@veltdev/sdk-staging 5.0.2-beta.59 → 5.0.2-beta.60
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/velt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var SNIPPYLY_VERSION = '5.0.2-beta.
|
|
1
|
+
var SNIPPYLY_VERSION = '5.0.2-beta.60';
|
|
2
2
|
Promise.allSettled||(Promise.allSettled=function(t){return Promise.all(t.map(function(r){return Promise.resolve(r).then(function(e){return{status:"fulfilled",value:e}}).catch(function(e){return{status:"rejected",reason:e}})}))});
|
|
3
3
|
|
|
4
4
|
var xOe=Object.create;var s6=Object.defineProperty,IOe=Object.defineProperties,EOe=Object.getOwnPropertyDescriptor,wOe=Object.getOwnPropertyDescriptors,TOe=Object.getOwnPropertyNames,c6=Object.getOwnPropertySymbols,une=Object.getPrototypeOf,wB=Object.prototype.hasOwnProperty,pne=Object.prototype.propertyIsEnumerable,DOe=Reflect.get;var gne=(n,o,r)=>o in n?s6(n,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[o]=r,h=(n,o)=>{for(var r in o||={})wB.call(o,r)&&gne(n,r,o[r]);if(c6)for(var r of c6(o))pne.call(o,r)&&gne(n,r,o[r]);return n},y=(n,o)=>IOe(n,wOe(o));var jh=(n,o)=>{var r={};for(var e in n)wB.call(n,e)&&o.indexOf(e)<0&&(r[e]=n[e]);if(n!=null&&c6)for(var e of c6(n))o.indexOf(e)<0&&pne.call(n,e)&&(r[e]=n[e]);return r};var OOe=(n,o)=>()=>(o||n((o={exports:{}}).exports,o),o.exports),d6=(n,o)=>{for(var r in o)s6(n,r,{get:o[r],enumerable:!0})},AOe=(n,o,r,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of TOe(o))!wB.call(n,t)&&t!==r&&s6(n,t,{get:()=>o[t],enumerable:!(e=EOe(o,t))||e.enumerable});return n};var hne=(n,o,r)=>(r=n!=null?xOe(une(n)):{},AOe(o||!n||!n.__esModule?s6(r,"default",{value:n,enumerable:!0}):r,n));var Ev=(n,o,r)=>DOe(une(n),r,o);var X=(n,o,r)=>new Promise((e,t)=>{var i=c=>{try{l(r.next(c))}catch(d){t(d)}},a=c=>{try{l(r.throw(c))}catch(d){t(d)}},l=c=>c.done?e(c.value):Promise.resolve(c.value).then(i,a);l((r=r.apply(n,o)).next())});var Pte=OOe((Axi,Mte)=>{"use strict";var Nt={};Nt.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};Nt.localCName=Nt.generateIdentifier();Nt.splitLines=function(n){return n.trim().split(`
|
|
@@ -405,7 +405,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
405
405
|
</radialGradient>
|
|
406
406
|
</defs>
|
|
407
407
|
</svg>
|
|
408
|
-
`},o.GIF_PATHS={CAT_JAM:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/emojis%2Fcatjam.gif?alt=media&token=9868b4ec-0031-4751-bb2e-47bf0f9d9583"},o.\u0275fac=function(t){return new(t||o)(K(Ue),K(k),K(Gd))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var vn=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u){this.analyticsService=e,this.authService=t,this.configService=i,this.coreActionsService=a,this.databaseService=l,this.docService=c,this.loggingService=d,this.commonDbService=m,this.usersService=u,this.db=null,this.internalUserContacts$=new Se([]),this.userGlobalContact$=new Se(!1),this.userGroupContact$=new Se(null),this.users$=new Se([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userAccessFields$=new Se({}),this.userOrganizationContacts$=new Se([]),this.userFolderContacts$=new Se([]),this.userDocumentContacts$=new Se([]),this.userOrganizationGroups$=new Se([]),this.onContactSelectedSubject$=new it,this.documentAccessType=null,this.atHereEnabled$=new Se(!1),this.atHereLabel$=new Se("here"),this.atHereDescription$=new Se(null),this.contactListScopeForOrganizationUsers$=new Se([ho.ALL]),this.customUserContacts$=new Se(null),this.customUserContactsConfig$=new Se({merge:!1}),this.currentOrganizationUserIAM$=new Se(null),this.userContacts$=new Se([]),this.userSnippylyIdContacts$=new Se(null),this.usersByOrganizationId$=new Se({}),this.temporaryUserIds$=new Se([]),this.usersByOrganizationIdAndDocumentId$=new Se({}),this.usersByOrganizationIdAndFolderId$=new Se({}),this.userById$=new Se({}),this.searchUsersSubject$=new it,this.searchUsersDebounceTime=300,this.pendingSearchPromises=new Map,this.authService.setContactService(this),this.usersService.setContactService(this),this.authService.getUser$().pipe(ye(_=>this.docService.getDocumentPaths$().pipe(ln(I=>{this.documentPaths=I}),ge(()=>_)))).subscribe(_=>X(this,null,function*(){if(this.user=_,_&&this.documentPaths)if(!_?.organizationId)this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(_),this.setLoggedInUser(_),yield this.moveGlobalContactUserFromEmailToUserIdPath(_),this.updateUserInGlobalContactsIfAvailable(_),_?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(_?.groupId)),this.checkToSetLoggedInUserInGroupContacts();else{let I=this.userPermissionService?.getCurrentUserPermissions(),A=this.documentPaths.folderId,M=!0;A&&I?.[_?.userId]?.folders?.[A]?.errorCode===Co.PERMISSION_DENIED&&(M=!1),this.getOrganizationContactsFromDb$(),M&&this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()}else this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0}),_=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",_)}),this.databaseService.getDb().pipe($e(_=>!!_),ut(1)).subscribe(_=>{_&&(this.db=_)},_=>{this.loggingService.catch("Error in ContactService constructor getDb: ",_)}),this.getOrganizationGroups$().subscribe(_=>{this.authService.setOrganizationUserGroups(_)}),Cn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([_,I,A])=>{I?A?.merge?this.userContacts$.next([..._||[],...I||[]]):this.userContacts$.next(I||[]):this.userContacts$.next(_||[])}),this.getUserContacts$().subscribe(_=>{try{_?.forEach(I=>{let A=I?.userSnippylyId||cd(this.configService.getApiKey(),I.userId);A&&this.userSnippylyIdContacts$.next(y(h({},this.userSnippylyIdContacts$.value),{[A]:I}))})}catch{}})}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in ContactService setCommentService: ",t)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in ContactService setUserPermissionService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.temporaryUserIds$.next([]),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.currentOrganizationUserIAM$.next(null)}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(t){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",t)}}checkIfUserGlobalContact(e){return X(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}return!1}catch(t){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",t),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(y(h({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(t){this.loggingService.catch("Error in ContactService setLoggedInUser: ",t)}}migrateLoggedInUserFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let t=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let i=t;if(i){if(i?.contacts){let a={};Object.keys(i?.contacts??{})?.forEach(l=>{let c=i.contacts[l];if(c?.userId){let d=It(c?.userId);a[d]=c}}),i.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}})}}}}catch(t){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",t)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}getUserAccessFields(){return JSON.parse(JSON.stringify(this.userAccessFields$.value))}getUserAccessFieldsByUserId(e){return this.getUserAccessFields()?.[e]}setUserAccessFields(e){try{let t=this.getUserAccessFields();e.forEach(a=>{t[a.user.userId]=a.accessFields||[]});let i=this.authService.getUser()?.userId;if(i&&t?.[i]?.length){let a=this.userPermissionService?.getCurrentUserPermissions();a&&(a[i]||(a[i]={}),a[i].context={accessFields:t[i]},this.userPermissionService?.setCurrentUserPermissions(a))}this.userAccessFields$.next(JSON.parse(JSON.stringify(t)))}catch(t){this.loggingService.catch("Error in ContactService setUserAccessFields: ",t)}}updateUserInGlobalContactsIfAvailable(e){return X(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let i=new ia;i.userId=e?.userId,i.userSnippylyId=e?.userSnippylyId,i.email=e?.email,i.name=e?.name,i.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))})}}catch(t){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",t)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let i=t;i&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}}))}}}catch(t){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",t)}})}setLoggedInUserPrivateContacts(e,t){try{if(e?.userId&&this.documentPaths?.logins){let i,a=t?.filter(c=>c?.visibility!=="group"),l=!1;this.authService.getUserOptions()&&(l=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(i={},a?.forEach(c=>{if(c?.userId){let d=It(c?.userId);i[d]=c}}),l?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))})):l&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0}})}}catch(i){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",i)}}migrateGroupContactsFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let t=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});t&&Object.keys(t??{}).forEach(i=>X(this,null,function*(){let a=t[i];a?.email&&a?.userId&&It(a?.email)===i&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:i,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:It(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(t){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",t)}})}checkToSetLoggedInUserInGroupContacts(){return X(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(ut(1)).subscribe(t=>X(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let i=!1,a=this.docService.getDocumentAccessType(t);if(!a||a===Hr.PUBLIC)i=!0;else if(a===Hr.RESTRICTED){let l=It(this.user?.userId);if(t?.users?.[l]&&(i=!0),this.user?.email){let c=It(this.user?.email);t?.users?.[c]&&(i=!0)}}if(i){let l=new Ms;l.email=this.user.email,l.visibility="group",l.name=this.user.name,l.photoUrl=this.user.photoUrl,l.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[l]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,t){try{let i=t?.filter(a=>a?.visibility==="group");i?.length&&i.forEach(a=>X(this,null,function*(){if(a?.userId&&e&&this.documentPaths?.groupContacts){if(this.configService?.getSF()&&(yield this.checkIfUserGlobalContact(a)))return;yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:It(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}),a?.email&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:It(a?.email),skipFirestore:!0}}))}}))}catch(i){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",i)}}removeGroupContacts(e){return X(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e)return this.commonDbService.deleteData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}})}catch(t){this.loggingService.catch("Error in ContactService removeGroupContacts: ",t)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let t={};e.forEach(i=>{i?.userId?(!i?.email||!t[i.email])&&(t[i.userId]=i):i?.email&&(!i?.userId||!t[i.userId])&&(t[i.email]=i)}),e=Object.values(t??{}),this.internalUserContacts$.next(e)}catch(e){this.loggingService.catch("Error in ContactService mergeUserContacts: ",e)}}getInternalUserContacts(){return this.internalUserContacts$.value}getInternalUserContacts$(){return this.internalUserContacts$.asObservable()}getUserContacts$(e){try{let{organizationId:t,documentId:i,veltFolderId:a}=e||{};return t&&i?Cn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(ge(([l,c,d,m,u,_,I,A])=>{let M={},B=!1;_&&!_?.merge&&(B=!0);let q=Ie=>I.some(Ce=>Ie.includes(Ce)),ae=q([ho.ALL,ho.ORGANIZATION])?Object.keys(l?.[t]||{}):[],_e=a?q([ho.ALL,ho.FOLDER])?Object.keys(c?.[t]?.[a]||{}):[]:[],re=q([ho.ALL,ho.DOCUMENT])?Object.keys(d?.[t]?.[i]||{}):[];if([...ae,..._e||[],...re,...A].forEach(Ie=>{let Ce=m?.[Ie];Ce&&(M[Ie]=Ce)}),u){let{merge:Ie,options:Ce}=_||{},{organizationId:Te,documentId:Oe,folderId:Me}=Ce||{},Be=Me?Nr(Me):void 0;(!Te||Te===t)&&(!Oe||Oe===i)&&(!Be||Be===a)&&(Ie||(M={}),u.forEach(We=>{We?.userId&&(M[We.userId]=We)}))}return Object.values(M??{})})):this.userContacts$.asObservable().pipe(ge(l=>l))}catch(t){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",t),ce([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getUserBySnippylyId(e){return this.userSnippylyIdContacts$.value?.[e]}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe($e(e=>!!e),ye(e=>this.docService.getDocumentPaths$().pipe($e(t=>!!t),ln(t=>{this.documentPaths=t}),ge(()=>e))),ye(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return ce();if(!this.documentPaths)return ce();let t=[];return t.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(i=>i?.data),ln(i=>{i?(this.userGlobalContacts=Object.values(i??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(ge(i=>i?.data),ln(i=>{i?(this.userGroupContacts=Object.values(i??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:It(e?.userId)}}).pipe(ge(i=>i?.data),ln(i=>{i?this.userPersonalContacts=Object.values(i??{}):this.userPersonalContacts=[]}))),No(...t).pipe(zo(this.authService.getUser$().pipe($e(i=>!i))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(t){this.loggingService.catch("Error in ContactService addUserContact: ",t)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable().pipe(_t(Kt))}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(ye(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(t=>t?.data),ln(t=>{t?this.users=Object.values(t??{}):this.users=[]})):(this.users=[],ce()):ce():ce())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(ye(e=>e?.organizationId?this.userById$.pipe(ge(t=>{let i={};return Object.values(t||{}).forEach(a=>{a?.userSnippylyId&&(i[a?.userSnippylyId]=a)}),i})):this.users$.pipe(ge(t=>{let i={};return t.forEach(a=>{i[a.userSnippylyId]=a}),i}))))}getUserByEmail$(e){return this.users$.pipe(ge(t=>t.find(i=>i.email===e)))}getUserByEmail(e){return this.users?.find(t=>t.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(t=>t.email===e)}getUserByUserId$(e){return this.users$.pipe(ge(t=>t.find(i=>i.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getTemporaryUsers(){try{let e=this.authService.getUser();this.docService.getOrganizationConfig$().pipe($e(t=>!!t),ge(t=>t?.organizationId)).subscribe(t=>X(this,null,function*(){if(t&&e){let i=((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ft("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(i?.length){let a=i.map(m=>m?.userId),l=at(),c=Os.GET_TEMPORARY_USERS;this.coreActionsService.triggerAction(tt.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:l,moduleName:c,methodName:gi.GET_TEMPORARY_USERS,source:"internal",payload:{userIds:a}});let d=yield this.usersService.resolveUsers({userIds:a,uniqueId:l,moduleName:c});if(d){let m={};Object.entries(d).forEach(([_,I])=>{m[_]=I}),this.userById$.next(h(h({},this.userById$.value),m));let u=new Set([...this.temporaryUserIds$.value,...Object.keys(m)]);this.temporaryUserIds$.next(Array.from(u))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}searchUsers(e){return X(this,null,function*(){try{if(!e||typeof e!="string"||!e.trim())return[];let t=e.trim();return this.searchUsersDebounced$||(this.searchUsersDebounced$=this.searchUsersSubject$.pipe(Qr(this.searchUsersDebounceTime),_t(),ye(i=>Eo(this.performSearch(i)).pipe(ge(a=>({searchText:i,results:a})),Jn(a=>(this.loggingService.catch("Error in ContactService performSearch: ",a),ce({searchText:i,results:[]})))))),this.searchUsersDebounced$.subscribe({next:({searchText:i,results:a})=>{Array.from(this.pendingSearchPromises.keys()).forEach(d=>{if(d!==i){let m=this.pendingSearchPromises.get(d);m&&(m.forEach(({resolve:u})=>u([])),this.pendingSearchPromises.delete(d))}});let c=this.pendingSearchPromises.get(i);c&&(c.forEach(({resolve:d})=>d(a)),this.pendingSearchPromises.delete(i))},error:i=>{this.pendingSearchPromises.forEach(a=>{a.forEach(({reject:l})=>l(i))}),this.pendingSearchPromises.clear()}})),new Promise((i,a)=>{this.pendingSearchPromises.has(t)||this.pendingSearchPromises.set(t,[]),this.pendingSearchPromises.get(t).push({resolve:i,reject:a}),this.searchUsersSubject$.next(t)})}catch(t){return this.loggingService.catch("Error in ContactService searchUsers: ",t),[]}})}performSearch(e){return X(this,null,function*(){try{let t=this.docService.getOrganizationConfig()?.organizationId;if(!t)return[];let i=this.documentPaths?.veltFolderId,a=this.docService.getDocumentIds().map(q=>q?.documentId),l=e.toLowerCase().trim(),c=l+"\uF8FF",d=[],m=a?.filter(q=>!!q)||[],u=m.length>0,_=!!i;if(u){let q=[];for(let _e=0;_e<m.length;_e+=20)q.push(m.slice(_e,_e+20));q.forEach(_e=>{let re=[ft("documentIds","array-contains-any",_e),ft("viewerDocumentIds","array-contains-any",_e)],be=[ft("organizationIds","array-contains-any",[t]),ft("viewerOrganizationIds","array-contains-any",[t]),...re];_&&be.push(ft("folderIds","array-contains-any",[i]),ft("viewerFolderIds","array-contains-any",[i])),d.push(this.commonDbService.queryData({feature:"allDocumentUsers",properties:{organizationId:t,isCollection:!0,useCollectionGroup:!1,useQuery:!0,firestoreQuery:[Sr(q0(...be),ft("user.name_lowercase",">=",l),ft("user.name_lowercase","<",c)),Cm(10)]}}).catch(()=>[])),d.push(this.commonDbService.queryData({feature:"allDocumentUsers",properties:{organizationId:t,isCollection:!0,useCollectionGroup:!1,useQuery:!0,firestoreQuery:[Sr(q0(...be),ft("user.email_lowercase",">=",l),ft("user.email_lowercase","<",c)),Cm(10)]}}).catch(()=>[]))})}let I=yield Promise.all(d),A=[];I.forEach(q=>{q&&Array.isArray(q)?q.forEach(ae=>{ae&&ae.user&&ae.user.userId&&A.push(ae)}):q&&typeof q=="object"&&Object.values(q).forEach(_e=>{_e&&_e.user&&_e.user.userId&&A.push(_e)})});let M=new Map;A.forEach(q=>{let ae=q.user?.userId;ae&&!M.has(ae)&&M.set(ae,q)});let B=Array.from(M.values());return this.setResolvedUsers(B,!0),B}catch(t){return this.loggingService.catch("Error in ContactService performSearch: ",t),[]}})}setResolvedUsers(e,t=!1){try{if(e?.length){let i=[],a=[],l=[],c=this.docService.getOrganizationConfig()?.organizationId,d=this.documentPaths?.veltFolderId,m=this.docService.getDocumentIds().map(I=>I?.documentId);e.forEach(I=>{this.userById$.value[I?.user?.userId]||(c&&I?.organizationIds?.includes(c)&&!i.find(A=>A?.user?.userId===I?.user?.userId)&&i.push(I),d&&I?.folderIds?.includes(d)&&!a.find(A=>A?.user?.userId===I?.user?.userId)&&a.push(I),m?.some(A=>I?.documentIds?.includes(A))&&!l.find(A=>A?.user?.userId===I?.user?.userId)&&l.push(I))}),i?.length&&this.setUserOrganizationContacts(i,c,t),a?.length&&this.setUserFolderContacts(a,t),l?.length&&this.setUserDocumentContacts(l,t);let _=[...i,...a,...l].filter((I,A,M)=>A===M.findIndex(B=>B.user.userId===I.user.userId));_?.length&&(this.setUserAccessFields(_),this.mergeOrganizationAndDocumentContacts())}}catch(i){this.loggingService.catch("Error in ContactService setResolvedUsers: ",i)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(ye(e=>e?.organizationId?ce(e).pipe(ye(t=>this.docService.getOrganizationConfig$().pipe($e(i=>!!i),ge(()=>t))),ye(t=>this.usersService.getResolveOrganizationUsers$().pipe($e(i=>i),ge(()=>t))),ye(t=>{let i=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],i),t?i?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:i,isCollection:!0,useQuery:!0,firestoreQuery:[Sr(q0(ft("organizationIds","array-contains-any",[i]),ft("viewerOrganizationIds","array-contains-any",[i]))),mo("id"),...this.commentService?.getPaginatedContactList()?[Cm(10)]:[]]}}).pipe(ge(a=>a?.data),ye(a=>this.commentService?.getPaginatedContactList()&&!Object.values(a??{}).find(l=>l?.user?.userId===this.authService.getUser()?.userId)?Eo(this.commonDbService.queryData({feature:"allOrganizationUsers",properties:{organizationId:i,isCollection:!0,useQuery:!0,firestoreQuery:[Sr(q0(ft("organizationIds","array-contains-any",[i]),ft("viewerOrganizationIds","array-contains-any",[i])),ft("user.userId","==",this.authService.getUser()?.userId))]}})).pipe(ge(l=>{if(l&&l.length>0){let c=l[0],d=c?.user?.userId||c?.id;if(d&&a){let m=It(d);return y(h({},a),{[m]:c})}}return a})):ce(a)),ge(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let l=Object.values(a??{});this.setUserAccessFields(l),this.setUserOrganizationContacts(l,i)}else this.setUserOrganizationContacts([],i)})):ce():ce()}),ye(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(ye(e=>e?ce(e).pipe(ye(t=>this.docService.getOrganizationConfig$().pipe($e(i=>!!i),ge(()=>t))),ye(t=>this.usersService.getResolveFolderUsers$().pipe($e(i=>i),ge(()=>t))),ye(t=>{let i=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!t)return ce();if(!this.commonDbService.shouldUseFirestore())return ce();if(!this.documentPaths?.veltFolderId)return ce();let a=ce([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:i,folderId:this.documentPaths?.veltFolderId,isCollection:!0,useQuery:!0,firestoreQuery:[Sr(q0(ft("folderIds","array-contains-any",[this.documentPaths?.veltFolderId]),ft("viewerFolderIds","array-contains-any",[this.documentPaths?.veltFolderId]))),mo("id"),...this.commentService?.getPaginatedContactList()?[Cm(10)]:[]]}}).pipe(ge(l=>l?.data)),a.pipe(ge(l=>{if(l){typeof l=="object"&&(l?.undefined&&delete l.undefined,l?.null&&delete l.null);let c=Object.values(l??{});this.setUserAccessFields(c),this.setUserFolderContacts(c)}else this.setUserFolderContacts([])}))}),ye(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(ye(e=>e?ce(e).pipe(ye(t=>this.docService.getDocumentPaths$().pipe($e(i=>!!i),ln(i=>{this.documentPaths=i}),ge(()=>t))),ye(t=>this.usersService.getResolveDocumentUsers$().pipe($e(i=>i),ge(()=>t))),ye(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(ye(i=>{let a=i?.length>0?i.map(m=>m.documentId):[this.documentPaths?.documentId??""];if(a.some(m=>!m)||!this.documentPaths)return ce();let l=ce([]),c={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(c.documentId=a?.length?a[0]:void 0,c.organizationId=this.documentPaths?.organizationId);let d=[];for(let m=0;m<a.length;m+=N.LISTENER_BATCH_SIZE)d.push(a.slice(m,m+N.LISTENER_BATCH_SIZE));return l=Cn(d.map(m=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:y(h({},c),{firestoreQuery:[Sr(q0(ft("documentIds","array-contains-any",m),ft("viewerDocumentIds","array-contains-any",m))),mo("id"),...this.commentService?.getPaginatedContactList()?[Cm(10)]:[]]})}).pipe(sa()))).pipe(ge(m=>Na(m)?.data)),l.pipe(ge(m=>{if(m){typeof m=="object"&&(m?.undefined&&delete m.undefined,m?.null&&delete m.null);let u=Object.values(m??{});this.setUserAccessFields(u),this.setUserDocumentContacts(u)}else this.setUserDocumentContacts([])}))})):ce():ce())),ye(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,t,i=!0){try{let a=e.find(c=>c.user.userId===this.user?.userId);a&&this.setCurrentOrganizationUserIAM(a);let l=e.map(c=>c.user)?.filter(c=>!this.userOrganizationContacts$.value.find(d=>d.userId===c.userId));if(this.userOrganizationContacts$.next([...this.userOrganizationContacts$.value,...l]),i&&this.usersService.setUserByIds(l),t){let c={};c[t]={};let d={};e.forEach(u=>{c[t][u.user.userId]=u,d[u.user.userId]=u.user}),this.userById$.next(h(h({},this.userById$.value),d));let m=this.usersByOrganizationId$.value?.[t];m&&(c[t]=h(h({},m),c[t])),this.usersByOrganizationId$.next(y(h({},this.usersByOrganizationId$.value),{[t]:c[t]}))}else this.usersByOrganizationId$.next({})}catch(a){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",a)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.ORGANIZATION])?this.userOrganizationContacts$.asObservable():ce([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e,t=!0){try{let i=e?.map(d=>d?.user)?.filter(d=>!this.userFolderContacts$.value.find(m=>m.userId===d.userId));this.userFolderContacts$.next([...this.userFolderContacts$.value,...i]),t&&this.usersService.setUserByIds(i);let a=this.usersByOrganizationIdAndFolderId$.value||{},l=h({},a),c={};e?.forEach(d=>{let{organizationId:m}=d?.metadata||{};m&&(l[m]||(l[m]={}),d.folderIds?.forEach(u=>{l[m][u]||(l[m][u]={}),l[m][u]=y(h({},l[m][u]),{[d.user.userId]:d}),c[d.user.userId]=d.user}))}),this.userById$.next(h(h({},this.userById$.value),c)),this.usersByOrganizationIdAndFolderId$.next(l)}catch(i){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",i)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.FOLDER])?this.userFolderContacts$.asObservable():ce([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e,t=!0){try{let i=e?.map(d=>d?.user)?.filter(d=>!this.userDocumentContacts$.value.find(m=>m.userId===d.userId));this.userDocumentContacts$.next([...this.userDocumentContacts$.value,...i]),t&&this.usersService.setUserByIds(i);let a=this.usersByOrganizationIdAndDocumentId$.value||{},l=h({},a),c={};e?.forEach(d=>{let{organizationId:m}=d?.metadata||{};m&&(l[m]||(l[m]={}),d.documentIds?.forEach(u=>{l[m][u]||(l[m][u]={}),l[m][u]=y(h({},l[m][u]),{[d.user.userId]:d}),c[d.user.userId]=d.user}))}),this.userById$.next(h(h({},this.userById$.value),c)),this.usersByOrganizationIdAndDocumentId$.next(l)}catch(i){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",i)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.DOCUMENT])?this.userDocumentContacts$.asObservable():ce([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.DOCUMENT])?this.userDocumentContacts$.value:[]}setCurrentOrganizationUserIAM(e){try{this.currentOrganizationUserIAM$.next(JSON.parse(JSON.stringify(e)))}catch(t){this.loggingService.catch("Error in ContactService setCurrentOrganizationUserIAM: ",t)}}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable().pipe(_t(Kt))}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{this.mergeContactsDebounceTimer&&clearTimeout(this.mergeContactsDebounceTimer),this.mergeContactsDebounceTimer=setTimeout(()=>{this.executeMergeContacts()},200)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}executeMergeContacts(){try{let e=this.getContactListScopeForOrganizationUsers(),t=[];e.includes(ho.ALL)?t=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:e.includes(ho.ORGANIZATION)?t=[...this.getUserOrganizationContacts()]:e.includes(ho.FOLDER)?t=[...this.getUserFolderContacts()]:e.includes(ho.DOCUMENT)&&(t=[...this.getUserDocumentContacts()]);let i=[...new Map(t.filter(a=>a?.userId).map(a=>[a.userId,a])).values()];this.internalUserContacts$.next(i)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(ye(e=>e?.organizationId?ce(e).pipe(ye(t=>this.docService.getOrganizationConfig$().pipe($e(i=>!!i),ge(()=>t))),ye(t=>{if(this.setUserOrganizationGroups([]),!t)return ce();let i=this.docService.getOrganizationConfig()?.organizationId;return i?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:i,isCollection:!0}}).pipe(ge(a=>a?.data),ge(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):ce()})):(this.setUserOrganizationGroups([]),ce()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",t)}}onContactSelected(e){try{if(e?.userId){let t=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),i=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case Hr.RESTRICTED:if(!t){let a={contact:e,isOrganizationContact:i,isDocumentContact:t,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let t={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(t)}}catch(t){this.loggingService.catch("Error in ContactService onContactSelected: ",t)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():ce([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:je.COMMENT,config:{atHereEnabled:!0}}),this.atHereEnabled$.value===!0)return;this.atHereEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ContactService enableAtHere: ",e)}}setAtHereLabel(e){try{this.analyticsService.setFeatureConfig({feature:je.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereLabel: ",t)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:je.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereDescription: ",t)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:je.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.DOCUMENT])?this.atHereEnabled$.asObservable():ce(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(t){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",t)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(t=>e.includes(t))}updateContactList(e,t){return X(this,null,function*(){try{this.analyticsService.trackEvent(Y.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService.setUserByIds(e),this.customUserContacts$.next(e),this.customUserContactsConfig$.next(t)}catch(i){this.loggingService.catch("Error in CommentService updateContactList: ",i)}})}convert(e){try{if(e?.options){let{documentId:t,organizationId:i}=this.docService.getServerId(e?.options);e.options=y(h({},e?.options),{documentId:t,organizationId:i})}return this}catch(t){return this.loggingService.catch("Error in ContactService convert: ",t),this}}getContactList$(){try{return this.authService.getUser$().pipe(ye(e=>e?Cn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(ge(([t,i,a,l,c])=>{let d={};d.organizationUsers=t?.map(u=>this.convertToClientUser(u)),d.folderUsers=i?.map(u=>this.convertToClientUser(u)),d.documentUsers=a?.map(u=>this.convertToClientUser(u)),d.updatedContactList=c?.map(u=>this.convertToClientUser(u));let m=[];return l?.forEach(u=>{let _=this.convertToClientUserGroup(u,d.organizationUsers||[]);_&&m.push(_)}),d.userGroups=m,d}),_t(Kt)):ce(null)),Jn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),ce(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),ce(null)}}convertToClientUserGroup(e,t){try{let i={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return t?.forEach(l=>{if(l?.userId){let c=It(l.userId);a[c]=l}}),Object.keys(e?.users??{}).forEach(l=>{a[l]&&i.users?.push(a[l])}),i}catch(i){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",i),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(t){return this.loggingService.catch("Error in ContactService convertToClientUser: ",t),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(qe),K(Ft),K(nr),K($n),K(st),K(k),K(yn),K(An))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Vn=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m){this.analyticsService=e,this.authService=t,this.contactService=i,this.databaseService=a,this.docService=l,this.configService=c,this.loggingService=d,this.commonDbService=m,this.documentIAM$=new Se(null),this.workspaceIAM$=new Se(null),this.roles$=new Se([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe($e(u=>!!u),ut(1)).subscribe(u=>{u&&(this.getUser(),this.getDocumentPaths())},u=>{this.loggingService.catch("Error in CommentService getDb subscription: ",u)}),this.getRole$().pipe(ut(1)).subscribe(u=>{this.authService?.getUser()&&!u&&this.analyticsService.trackEvent(Y.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(u=>{u?.accessType&&this.contactService.setDocumentAccessType(u.accessType)})}catch(u){this.loggingService.catch("Error in IamService constructor: ",u)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe($e(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe($e(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new AL;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(Jn(e=>ce(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(ge(e=>!!e),_t())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(ge(e=>e?.length?e:N.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(ge(e=>e?.features),ye(e=>this.getRole$().pipe(ge(t=>(t===Uo.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(ye(()=>this.documentIAM$.pipe($e(t=>!!t),ye(()=>this.workspaceIAM$.pipe(ge(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),ce(!1)}}getRole$(){try{return this.authService.getUser$().pipe(ye(()=>this.configService.getSF$()),ye(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():ce(null)),ye(()=>this.configService.getSF()?this.documentIAM$.pipe($e(e=>!!e),_t(Kt)):ce(null)),ye(()=>this.workspaceIAM$.pipe(_t(Kt))),ge(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),ce(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return Uo.ADMIN;if(!e)return this.user?.isAdmin?Uo.ADMIN:Uo.COMMENTER;let t=null,i;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?Hr.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||Hr.PUBLIC:null){case Hr.PUBLIC:i=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),i||(i=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=i?.role?.name||Uo.COMMENTER;break;case Hr.RESTRICTED:i=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),i||(i=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=i?.role?.name||null;break;default:break}return t}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(ge(e=>e===Uo.ADMIN),_t())}isUserAdmin(){try{return this.getRole()===Uo.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let i;return e&&(i=this.documentIAM$.value?.users?.[It(e)]),!i&&t&&(i=this.documentIAM$.value?.users?.[It(t)]),i}else return}catch(i){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",i)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let i;return e&&(i=this.workspaceIAM$.value?.users?.[It(e)]),!i&&t&&(i=this.workspaceIAM$.value?.users?.[It(t)]),i}else return}catch(i){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",i)}}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(qe),K(vn),K($n),K(st),K(Ft),K(k),K(yn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var tU="public",al=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_){this.authService=e,this.docService=t,this.loggingService=i,this.commonDbService=a,this.usersService=l,this.commentUtilsService=c,this.coreActionsService=d,this.functions=m,this.configService=u,this.contactService=_,this.currentUserPermissions$=new Se(null),this.permissionsCache$=new Se(null),this.permissionProvider$=new Se(null),this.REVOKE_DELAY_MS=3e3,this.pendingRevokeRequests=new Map,this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="";try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(I){this.loggingService.catch("Error in UserPermissionService constructor:",I)}}ngOnDestroy(){try{this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(e){this.loggingService.catch("Error in UserPermissionService ngOnDestroy:",e)}}collectRevokeRequest(e,t,i,a,l,c){try{return e.find(m=>m.resourceId===i&&m.type===a&&m.organizationId===l&&m.userId===c)?(t.push({userId:c,resourceId:i,organizationId:l,type:a,hasAccess:!1}),e.filter(m=>!(m.resourceId===i&&m.type===a&&m.organizationId===l&&m.userId===c))):e}catch(d){return this.loggingService.catch("Error in UsersPermissionService collectRevokeRequest:",d),e}}hasUserContextAccess({userId:e,accessFields:t}){try{if(!this.getIsContextEnabled()||t.includes(N.DEFAULT_VELT_CONTEXT))return!0;let i=this.contactService.getUserAccessFieldsByUserId(e);return i?t.every(a=>i.includes(a)):!0}catch(i){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",i),!1}}organizationDetails(e){return X(this,null,function*(){try{let t=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e}});return t&&t?.errorCode?{errorCode:Co.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:Co.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(t){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",t),{errorCode:Co.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(i){return X(this,arguments,function*({documentId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:t}});if(a&&a?.errorCode)return{errorCode:Co.PERMISSION_DENIED,error:!0};if(a&&!a?.metadata)return{errorCode:Co.DOES_NOT_EXIST,error:!0};let l=this.docService.getDocumentMetadata(e)??{};this.docService.setDocumentMetadata(e,h(h({},l),a?.metadata??{}));let c,d=a?.metadata?.veltFolderId;if(d)try{c=(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:d,organizationId:t}}))?.folderIamConfig?.accessType}catch(m){this.loggingService.catch("Error fetching folder accessType for document:",m)}return c||(c=a?.docIamConfig?.accessType),{error:!1,accessType:c}}catch(a){return this.loggingService.catch("Error in UserPermissionService documentDetails:",a),{errorCode:Co.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(i){return X(this,arguments,function*({folderId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:t}});return a&&a?.errorCode?{errorCode:Co.PERMISSION_DENIED,error:!0}:a&&!a?.metadata?{errorCode:Co.DOES_NOT_EXIST,error:!0}:{error:!1,accessType:a?.folderIamConfig?.accessType}}catch(a){return this.loggingService.catch("Error in UserPermissionService folderDetails:",a),{errorCode:Co.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let i=yield this.validateResources(t),[a,l]=yield this.fetchUserPermissionsFromDB(t),c=this.buildPermissionsResponse(t,i,a,l);return!e&&Object.keys(c).length>0&&this.setCurrentUserPermissions(c),c}catch(t){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",t),{}}})}extractResourceIds(e){let t=this.docService.getDocumentPaths(),i=this.docService.getDocumentIds();return{folderIds:e?.folderIds?.length?e.folderIds:t?.folderId?[t.folderId]:[],documentIds:e?.documentIds?.length?e.documentIds:i.map(a=>a.clientDocumentId),clientOrganizationId:e?.organizationId??t?.clientOrganizationId,organizationId:e?.organizationId??t?.clientOrganizationId?Ra(e?.organizationId??t?.clientOrganizationId??""):void 0}}validateResources(e){return X(this,null,function*(){let{folderIds:t,documentIds:i,organizationId:a,clientOrganizationId:l}=e,c=[],d=[];a&&(c.push(this.organizationDetails(a)),d.push({id:l??"",type:"organization"})),t.forEach(_=>{c.push(this.folderDetails({folderId:Nr(_),organizationId:a??""})),d.push({id:_,type:"folder"})}),i.forEach(_=>{c.push(this.documentDetails({documentId:vi(_),organizationId:a??""})),d.push({id:_,type:"document"})});let[m,u]=yield Promise.all([Promise.allSettled(c),this.getDefaultDocumentAccessType()]);return y(h({},this.processValidationResults(m,d)),{defaultDocumentAccessType:u})})}getDefaultDocumentAccessType(){return X(this,null,function*(){try{return(yield this.commonDbService?.getData({feature:"apiKeyMetadata",properties:{}}))?.defaultDocumentAccessType}catch(e){this.loggingService.catch("Error fetching defaultDocumentAccessType:",e);return}})}processValidationResults(e,t){let i=[],a=[],l,c={},d={};for(let m=0;m<e.length;m++){let u=e[m],_=t[m];if(u.status==="rejected"||u.status==="fulfilled"&&u.value.error){let A=u.status==="fulfilled"?u.value.errorCode??Co.SOMETHING_WENT_WRONG:Co.SOMETHING_WENT_WRONG,M={id:_.id,errorCode:A};switch(_.type){case"organization":if(l=M,A===Co.DOES_NOT_EXIST)throw new Error(`Organization with id '${_.id}' does not exist`);break;case"folder":i.push(M);break;case"document":a.push(M);break}}else if(u.status==="fulfilled")switch(_.type){case"folder":u.value.accessType&&(c[_.id]=u.value.accessType);break;case"document":u.value.accessType&&(d[_.id]=u.value.accessType);break}}return{failedFolderIds:i,failedDocumentIds:a,failedOrganizationId:l,folderAccessTypes:c,documentAccessTypes:d}}fetchUserPermissionsFromDB(e){return X(this,null,function*(){let{folderIds:t,documentIds:i,organizationId:a}=e,l=[this.authService.getUser()?.userId??""],c=[...t.map(u=>Nr(u)),...i.map(u=>vi(u)),a??""],[d,m]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:l,organizationId:a}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:l,organizationId:a,resourceIds:c})]);return[d.status==="fulfilled"?d.value:[],m.status==="fulfilled"?m.value:[]]})}buildPermissionsResponse(e,t,i,a){let{folderIds:l,documentIds:c,clientOrganizationId:d,organizationId:m}=e,{failedFolderIds:u,failedDocumentIds:_,failedOrganizationId:I}=t,A={};return this.processRegularUserPermissions(A,i,l,c,d??"",m??"",u,_,I,t.folderAccessTypes,t.documentAccessTypes,t.defaultDocumentAccessType),this.processTemporaryUserPermissions(A,a),this.processContextPermissions(A),A}processContextPermissions(e){try{let t=this.authService.getUser()?.userId;if(t){let i=this.contactService.getUserAccessFieldsByUserId(t);i?.length&&(e[t]||(e[t]={}),e[t].context={accessFields:i})}}catch(t){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",t);return}}processRegularUserPermissions(e,t,i,a,l,c,d,m,u,_,I,A){for(let M of t)for(let B of M)B?.user?.userId&&(e[B.user.userId]=y(h({},i.length&&{folders:this.buildFolderPermissions(i,B,d,_,A)}),{documents:this.buildDocumentPermissions(a,B,m,I,A),organization:{[l]:this.buildOrganizationPermission(c,B,u)}}))}getErrorMessage(e,t){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${t}`),e){case Co.DOES_NOT_EXIST:return`${t} does not exist`;case Co.PERMISSION_DENIED:return`User does not have access to ${t}`;case Co.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(i){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",i),"Something went wrong"}}buildFolderPermissions(e,t,i,a,l){return e.reduce((c,d)=>{let m=i.find(u=>u.id===d);return m?c[d]=h({error:this.getErrorMessage(m.errorCode,"folder"),errorCode:m.errorCode},m.errorCode===Co.PERMISSION_DENIED&&{accessType:a[d]??l??tU}):c[d]={accessRole:t.viewerFolderIds?.includes(Nr(d))?Zc.VIEWER:Zc.EDITOR,accessType:a[d]??l??tU},c},{})}buildDocumentPermissions(e,t,i,a,l){return e.reduce((c,d)=>{let m=i.find(u=>u.id===d);return m?c[d]=h({error:this.getErrorMessage(m.errorCode,"document"),errorCode:m.errorCode},m.errorCode===Co.PERMISSION_DENIED&&{accessType:a[d]??l??tU}):c[d]={accessRole:t.viewerDocumentIds?.includes(vi(d))?Zc.VIEWER:Zc.EDITOR,accessType:a[d]??l??tU},c},{})}buildOrganizationPermission(e,t,i){return i?{error:this.getErrorMessage(i.errorCode,"organization"),errorCode:i.errorCode}:{accessRole:t.viewerOrganizationIds?.includes(e)?Zc.VIEWER:Zc.EDITOR}}processTemporaryUserPermissions(e,t){for(let i of t)if(i?.userId)switch(this.ensureUserPermissionStructure(e,i.userId),i.type){case"folder":this.addTemporaryFolderPermission(e,i);break;case"document":this.addTemporaryDocumentPermission(e,i);break;case"organization":this.addTemporaryOrganizationPermission(e,i);break}}ensureUserPermissionStructure(e,t){e[t]||(e[t]={})}addTemporaryFolderPermission(e,t){let{userId:i,resourceId:a,role:l,expiresAt:c}=t;e[i].folders||(e[i].folders={}),e[i].folders[a]||(e[i].folders[a]={accessRole:l??Zc.EDITOR,expiresAt:c})}addTemporaryDocumentPermission(e,t){let{userId:i,resourceId:a,role:l,expiresAt:c}=t;e[i].documents||(e[i].documents={}),e[i].documents[a]={accessRole:l??Zc.EDITOR,expiresAt:c}}addTemporaryOrganizationPermission(e,t){let{userId:i,resourceId:a,role:l,expiresAt:c}=t;e[i].organization||(e[i].organization={}),e[i].organization[a]={accessRole:l??Zc.EDITOR,expiresAt:c}}hasEditAccess({organizationId:e,folderId:t,documentId:i}){try{let a=!0,l=this.getCurrentUserPermissionsWithServerIds(),c=this.authService.getUser()?.userId??"";return l&&(e&&typeof e=="string"&&l?.[c]?.organization?.[e]&&(l?.[c]?.organization?.[e]?.accessRole===Zc.VIEWER||l?.[c]?.organization?.[e]?.errorCode===Co.PERMISSION_DENIED)&&(a=!1),t&&typeof t=="string"&&l?.[c]?.folders?.[t]&&(l?.[c]?.folders?.[t]?.accessRole===Zc.VIEWER||l?.[c]?.folders?.[t]?.errorCode===Co.PERMISSION_DENIED)&&(a=!1),i&&typeof i=="string"&&l?.[c]?.documents?.[i]&&(l?.[c]?.documents?.[i]?.accessRole===Zc.VIEWER||l?.[c]?.documents?.[i]?.errorCode===Co.PERMISSION_DENIED)&&(a=!1)),a}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(_t(Kt))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let t=JSON.parse(JSON.stringify(e??{})),i=this.authService.getUser()?.userId??"";if(t?.[i]){let a=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(t?.[i]?.organization?.[a]){let l=Ra(a);t[i].organization&&(t[i].organization[l]=t[i].organization[a],delete t[i].organization[a])}t?.[i]?.folders&&(t[i].folders=Object.fromEntries(Object.entries(t?.[i]?.folders??{}).map(([l,c])=>[Nr(l),c]))),t?.[i]?.documents&&(t[i].documents=Object.fromEntries(Object.entries(t?.[i]?.documents??{}).map(([l,c])=>[vi(l),c])))}return t}catch(t){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",t),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(ge(e=>this.refactorPermissionsWithServerIds(e)),_t(Kt))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let t=null;e&&(t=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(t)}catch(t){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",t)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.permissionProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",t)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===gS.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===gS.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===gS.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===gS.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return X(this,null,function*(){let e=at();try{if(this.isRevokeAccessOnUserLogoutEnabled){let t=[],i=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(l=>{l.userId===i&&l.hasAccess&&(l.type===aa.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&t.push(y(h({},l),{hasAccess:!1})):t.push(y(h({},l),{hasAccess:!1})))}),t.length>0){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}}),this.setPermissionsCache([]),this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}});let l=yield this.revokeAccess({requests:t,userId:this.authService.getUser()?.userId??""});l.success?this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:l,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:l,success:!1,statusCode:500}}})}}}catch(t){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:t}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",t)}})}getRevokeKey(e){try{return`${e.userId}_${e.resourceId}_${e.type}_${e.organizationId}`}catch(t){return this.loggingService.catch("Error in UsersPermissionService getRevokeKey:",t),""}}cancelPendingRevokes(e){try{e.forEach(t=>{let i=this.getRevokeKey({userId:t.userId,resourceId:t.resource.id,type:t.resource.type,organizationId:t.resource.organizationId});this.pendingRevokeRequests.has(i)&&this.pendingRevokeRequests.delete(i)}),this.pendingRevokeRequests.size===0&&this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(t){this.loggingService.catch("Error in UsersPermissionService cancelPendingRevokes:",t)}}flushPendingRevokes(){return X(this,null,function*(){let e=this.pendingRevokeUniqueId,t=this.pendingRevokeUserId;try{let i=Array.from(this.pendingRevokeRequests.values());if(this.pendingRevokeRequests.clear(),this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="",i.length===0)return;let a=this.getPermissionsCache()??[];i.forEach(d=>{a=a.filter(m=>!(m.resourceId===d.resourceId&&m.type===d.type&&m.organizationId===d.organizationId&&m.userId===d.userId))}),this.setPermissionsCache(a);let l=this.docService.getDocContext(),c=yield this.revokeAccess({requests:i,userId:t,currentContext:l});c.success?this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:c,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:c,success:!1,statusCode:500}}})}catch(i){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:i}}),this.loggingService.catch("Error in UsersPermissionService flushPendingRevokes:",i)}})}revokeAccessOnDocumentUnset(a){return X(this,arguments,function*({documentIds:e,folderId:t,context:i}){let l=at();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let c=[],d=this.docService.getOrganizationConfig()?.clientOrganizationId??"",m=this.authService.getUser()?.userId??"",u=this.getPermissionsCache()??[];e.forEach(_=>{u=this.collectRevokeRequest(u,c,_.clientDocumentId,aa.DOCUMENT,d,m)}),t&&(u=this.collectRevokeRequest(u,c,t,aa.FOLDER,d,m)),d&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&(u=this.collectRevokeRequest(u,c,d,aa.ORGANIZATION,d,m)),i&&this.getIsContextEnabled()&&QN({input:i}).forEach(I=>{let A=JSON.stringify(I.access);u=this.collectRevokeRequest(u,c,A,aa.CONTEXT,d,m)}),this.setPermissionsCache(u),c.length>0&&(this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:l,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:c}}),this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:l,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:c}}),c.forEach(_=>{this.pendingRevokeRequests.set(this.getRevokeKey(_),_)}),this.pendingRevokeUniqueId=l,this.pendingRevokeUserId=m,this.pendingRevokeTimeoutId&&clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=setTimeout(()=>this.flushPendingRevokes(),this.REVOKE_DELAY_MS))}}catch(c){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:c}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",c)}})}getAccess(i){return X(this,arguments,function*({requests:e,userId:t}){let a=Yr(this.functions,Zr({url:On?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield wl({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}revokeAccess(a){return X(this,arguments,function*({requests:e,userId:t,currentContext:i}){let l=Yr(this.functions,Zr({url:On?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield wl({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:h({retryConfig:this.getPermissionProviderRetryConfig()},i?.access&&{currentContext:i})},getSdkProxy:l,userId:t})})}onResourceAccessRequired(c){return X(this,arguments,function*({requests:e,uniqueId:t,methodName:i,userId:a,fromCache:l=!0}){try{if(!e?.length)return;let d=[],m=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&l&&(e.forEach(u=>{let _=m?.find(I=>I.resourceId===u.resource.id&&I.type===u.resource.type&&I.userId===u.userId&&I.organizationId===u.resource.organizationId);_&&d.push(_)}),d.length>0&&(e=e.filter(u=>!d.find(_=>_.resourceId===u.resource.id&&_.type===u.resource.type&&_.userId===u.userId&&_.organizationId===u.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:i,source:"internal",payload:{requests:e,fromCache:l}});let u=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??a??""});return this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:t,methodName:i,source:"internal",payload:{result:u}}),u?.success&&u?.data?.length&&(this.setPermissionsCache([...m,...u.data]),u.data=[...d,...u.data]),u}else if(d.length>0)return this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:i,source:"internal",uniqueId:t,payload:{results:{data:d,success:!0,statusCode:200}}}),{data:d,success:!0,statusCode:200};return}catch(d){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",d),this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:i,source:"internal",uniqueId:t,payload:{error:d,requests:e,fromCache:l}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let t=new Map;e.forEach(a=>{let l=`${a.userId}_${a.resourceId}_${a.organizationId}_${a.type}`;t.set(l,a)});let i=JSON.parse(JSON.stringify(Array.from(t.values())));this.permissionsCache$.next(i)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",t)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(K(qe),K(st),K(k),K(yn),K(An),K(_m),K(nr),K(Oo),K(Ft),K(vn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zi=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A){this.afAuth=e,this.analyticsService=t,this.authService=i,this.configService=a,this.databaseService=l,this.commonDbService=c,this.docService=d,this.domService=m,this.emojiService=u,this.iamService=_,this.loggingService=I,this.userPermissionService=A,this.documentPaths=null,this.reactionAnnotationById$=new Se({}),this.customReactions$=new Se({}),this.commentService=null,this.darkMode$=new Se(null),this.loggingService.log("%c[WB] Creating CLASS: ReactionService","color: blue;"),this.analyticsService.setReactionService(this),this.authService.setReactionService(this),this.databaseService.getDb().pipe($e(M=>!!M),ut(1)).subscribe(M=>{M&&this.getAllReactionAnnotations(void 0,void 0,!0).subscribe()},M=>{this.loggingService.catch("Error in ReactionService getDb subscription: ",M)})}setCommentService(e){this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;");try{this.commentService=e}catch(t){this.loggingService.catch("Error in ReactionService setCommentService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ReactionService","color: green;");try{this.reactionAnnotationById$.next({}),this.customReactions$.next({}),this.documentPaths=null}catch(e){this.loggingService.catch("Error in ReactionService clearCache: ",e)}}getAllReactionAnnotations(e,t,i,a,l){this.loggingService.log("%c[WB] Calling FUNCTION: getAllReactionAnnotations","color: green;");let c,d;try{if(e&&(d=`${Qn(e)}`),t&&typeof t=="object"){let m=Oi(t);c=Qn(JSON.stringify(m))}}catch(m){this.loggingService.catch("Error in ReactionService getAllReactionAnnotations: ",m)}return br(this.afAuth).pipe($e(m=>!!m),ye(m=>this.isFeatureAllowed({firebaseUser:m,annotations:[],filteredAnnotations:[]})),ye(m=>m.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(u=>(m.featureAllowed=u,m))):ce(m)),ye(m=>m.featureAllowed?ce(m).pipe(ye(u=>this.docService.getDocumentPaths$().pipe(ge(_=>(this.documentPaths=_,u.documentPaths=_,u)))),ye(u=>d?this.getDataFromDocumentIds([d]).pipe(ge(_=>(u.annotations=_||[],h({},u)))):this.docService.getDocumentIds$().pipe(ye(_=>{let I=_?.length>0?_.map(A=>A.documentId):[this.documentPaths?.documentId??""];return this.getDataFromDocumentIds(I).pipe(ge(A=>(u.annotations=A||[],h({},u))))}))),ye(u=>this.docService.getLocation$().pipe(ge(_=>(u.location=_,u)))),ye(u=>this.docService.getLocations$().pipe(ge(_=>(u.customLocations=_,u)))),ge(u=>{if(u.filteredAnnotations=[],d&&!c)return u.filteredAnnotations=u.annotations?.slice(),u;{let _=[];return c?_.push(c):(_.push(u?.location?.locationId),_.push(...Object.values(u?.customLocations||[]).map(I=>I.locationId))),u.filteredAnnotations=this.filterAnnotationsByLocationIds(u?.annotations,_),u}}),ye(u=>i?ce(u):u?.annotations?.length?this.domService.onWindowResize$().pipe(ge(()=>u)):ce(u)),ye(u=>i?ce(u):ce(u)),ge(u=>u),ye(u=>u?.filteredAnnotations?ce(u?.filteredAnnotations||[]):ce([]))):ce([])),_t(Kt))}isFeatureAllowed(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>y(h({},t),{user:i})))),ye(t=>Mo(t.config,t.user,je.REACTION)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Reaction feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))),_t((t,i)=>t?.featureAllowed===i?.featureAllowed))}getDataFromDocumentIds(e,t){return this.getDataFromDocuments({documentIds:e,filters:t})}getDataFromDocuments(e){if(this.configService?.getApiKey()){let{documentIds:t,filters:i}=e;if(t?.some(d=>!d)||!this.documentPaths)return ce([]);let a=this.docService.getDocumentPaths()?.veltFolderId,l=ce([]),c={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(c.documentId=t?.length?t[0]:void 0,c.organizationId=this.documentPaths?.organizationId),this.userPermissionService?.getIsContextEnabled()){let d=[N.DEFAULT_VELT_CONTEXT,...this.docService.getProcessedDocContext()],m=[];for(let u=0;u<(d?.length??0);u+=N.LISTENER_CONTEXT_BATCH_SIZE)m.push(d?.slice(u,u+N.LISTENER_CONTEXT_BATCH_SIZE)??[]);l=Cn(m.map(u=>this.commonDbService.dbListener({feature:"allReactions",properties:y(h({},c),{firestoreQuery:[Sr(ft("metadata.apiKey","==",this.configService?.getApiKey()),ft("metadata.documentId","in",t),ft("metadata.organizationId","==",this.documentPaths?.organizationId),...a?[ft("metadata.veltFolderId","==",a)]:[],...u?.length?[ft("context.accessFields","array-contains-any",u)]:[])]})}).pipe(sa()))).pipe(ge(u=>Na(u)))}else{let d=[];for(let m=0;m<(t?.length??0);m+=N.LISTENER_BATCH_SIZE)d.push(t?.slice(m,m+N.LISTENER_BATCH_SIZE)??[]);l=Cn(d.map(m=>this.commonDbService.dbListener({feature:"allReactions",properties:y(h({},c),{firestoreQuery:[Sr(ft("metadata.apiKey","==",this.configService?.getApiKey()),ft("metadata.documentId","in",m),ft("metadata.organizationId","==",this.documentPaths?.organizationId),...a?[ft("metadata.veltFolderId","==",a)]:[])]})}).pipe(sa()))).pipe(ge(m=>Na(m)))}return l.pipe(ge(d=>({data:d?.data,operation:d?.operation})),ge(({data:d,operation:m})=>{let u=[];return d&&(u=Object.values(d??{}).filter(_=>typeof _=="object")),u?.forEach(_=>{this.sanitizeReactionAnnotation(_)}),{data:u,operation:m}}),ge(({data:d,operation:m})=>{if(!t)return{data:d,documentMap:{},operation:m};let u=d.reduce((_,I)=>{let A=I.metadata?.documentId;return A&&(_[A]||(_[A]=[]),_[A].push(I)),_},{});return{data:d,documentMap:u,operation:m}}),ge(({data:d,documentMap:m,operation:u})=>{if(!i)if(u?.type==="removed"){if(u?.ids?.length){let _=this.reactionAnnotationById$.value;u?.ids?.forEach(I=>{delete _?.[I]}),this.reactionAnnotationById$.next(_)}}else Object.entries(m??{}).forEach(([_,I])=>{this.setReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:_,annotations:I})});return d}),Jn(d=>(this.loggingService.catch("Error in ReactionService getDataFromDocumentId: ",d),ce([]))))}else return ce([])}setReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:t,annotations:i,queryHash:a}){try{if(t){e||(e=N.NO_ORGANIZATION_ID),a||(a=N.DEFAULT_QUERY_HASH);let l={};i?.forEach(d=>{d?.annotationId&&(l[d?.annotationId]=d)});let c=h(h({},this.reactionAnnotationById$.value),l);this.reactionAnnotationById$.next(c)}}catch(l){this.loggingService.catch("Error in ReactionService setReactionAnnotationsByOrganizationIdAndDocumentId:",l)}}getReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:t}){try{let i={};return Object.values(this.reactionAnnotationById$.value??{}).forEach(a=>{a?.metadata?.documentId==t&&a?.metadata?.organizationId==e&&(i[a?.annotationId]=a)}),Object.values(i)}catch(i){return this.loggingService.catch("Error in ReactionService getReactionAnnotationsByOrganizationIdAndDocumentId:",i),[]}}getLocations$(){return this.docService.getLocation$().pipe(ye(e=>this.docService.getLocations$().pipe(ge(t=>({location:e,locations:t})))),ge(e=>{let t=[];return t.push(e?.location?.locationId),t.push(...Object.values(e.locations||[]).map(i=>i.locationId)),t||[]}))}filterAnnotationsByLocationIds(e,t){try{return e.filter(i=>t.includes(i.locationId))}catch(i){return this.loggingService.catch("Error in ReactionService filterAnnotationsByLocations:",i),[]}}getAnnotationById(e,t){try{let i=this.reactionAnnotationById$.value?.[e];if(i){let{documentId:a,organizationId:l}=t||{};if(a&&i.metadata?.documentId!==a||l&&i.metadata?.organizationId!==l)return}return i}catch(i){this.loggingService.catch("Error in ReactionService getAnnotationById: ",i);return}}getBaseMetadataFromReactionAnnotationId(e){try{let t=this.reactionAnnotationById$.value?.[e];return t?t.metadata:void 0}catch(t){this.loggingService.catch("Error in ReactionService getBaseMetadataFromReactionAnnotationId: ",t);return}}getReactionAnnotationByAnnotationId(e,t){try{return this.reactionAnnotationById$.pipe(ge(()=>this.getAnnotationById(e,t)),ye(i=>i?ce(i):ce(i)))}catch(i){return this.loggingService.catch("Error in ReactionService getReactionAnnotationByAnnotationId: ",i),ce(void 0)}}getReactionAnnotationsBySectionId(e){try{return this.reactionAnnotationById$.pipe(ye(t=>this.docService.getDocumentPaths$().pipe(ge(i=>({documentPaths:i,sectionId:e,reactionAnnotationsMap:t})))),ye(t=>{let i=nl(e,["id","data-id"]);if(i){let a=this.docService.getAdditionLocationFromElement(i);if(a){let l=this.docService.genarateLocationId(a);return this.docService.getLocations$().pipe(ge(c=>{let m=Object.values(c||{}).find(u=>u.locationId===l||a?.id&&u.location.id===a.id);return y(h({},t),{additionalLocation:m,locationOnElement:!!a})}))}}return ce(y(h({},t),{additionalLocation:null,element:i}))}),ye(t=>t?.locationOnElement?ce(t):this.docService.getLocation$().pipe(ge(i=>y(h({},t),{location:i})))),ge(({documentPaths:t,location:i,additionalLocation:a,locationOnElement:l,element:c})=>{let d=null,m=this.docService.getAdditionalDocumentIdFromElement(c),u=m?this.docService.generateDocumentId(m):t?.documentId,_=t?.organizationId;if(u){let I=this.getReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:_,documentId:u});if(I){d=[];for(let A of I)A?.targetElementId===e&&(l?a&&_0({location:a?.location,locationId:a?.locationId},{location:A.location,locationId:A.locationId})&&d.push(A):i?_0({location:i?.location,locationId:i?.locationId},{location:A.location,locationId:A.locationId})&&d.push(A):A?.locationId||d.push(A))}}return d}))}catch(t){return this.loggingService.catch("Error in ReactionService getReactionAnnotationsBySectionId: ",t),ce(null)}}addOrUpdateReaction(e,t,i,a,l,c,d,m){return X(this,null,function*(){try{let u=t?.map(_=>this.getAnnotationById(_)).find(_=>_?.icon===e);if(u){if(!d||d==="delete")return yield this.updateUserInReaction(u)}else if(!d||d==="add")return yield this.addReaction(void 0,e,i,a,l,c,m)}catch(u){this.loggingService.catch("Error in ReactionService addOrUpdateReaction: ",u)}})}addReaction(e,t,i,a,l,c,d){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: addReaction","color: green;");try{let m=this.authService.getUser();if(m)if(m.isReadOnly||m.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add reactions.");else{let u=new wL;if(u.from=m,u.lastUpdated=this.timestamp,u.reactions=[],u.reactions.push({from:m,lastUpdated:this.timestamp}),a&&(u.targetElementId=a),l){u.commentAnnotationId=l;let _=this.commentService?.getAnnotationById(l);if(_?.context?.access&&_?.context?.accessFields){if(!this.userPermissionService?.hasUserContextAccess({userId:m.userId,accessFields:_.context.accessFields})){this.loggingService.catch("User does not have context access to add reaction annotation.",void 0,void 0,!0);return}u.context={access:_.context.access,accessFields:_.context.accessFields}}}if(this.setLocationToReactionAnnotation(u),u.pageInfo=no(),u.pageInfo&&(u.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),t)if(u.icon=t,c)u.iconUrl=c?.url,u.iconEmoji=c?.emoji;else{let _=this.customReactions$.value;if(_){let I=_[t];I?.url&&(u.iconUrl=I?.url),I?.emoji&&(u.iconEmoji=I?.emoji)}}return i&&(u.location={},u.location=h({},i),u.locationId=this.docService.genarateLocationId(u.location)),yield this.saveReactionToDb(u)}}catch(m){this.loggingService.catch("Error in ReactionService addReaction: ",m)}})}setLocationToReactionAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location);try{let i;e.targetElement?.xpath?i=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetElementId&&(i=nl(e.targetElementId,["id","data-id"]));let a=this.docService.getAdditionLocationFromElement(i);if(a){let l=this.docService.addLocation({location:a,source:"internal"});l?.[0]&&(e.locationId=l[0].locationId,e.location=l[0].location)}}catch{}}catch(t){this.loggingService.catch("Error in ReactionService setLocationToReactionAnnotation:",t)}}getElementForReactionAnnotation(e){try{let t;return e.targetElementId&&(t=nl(e.targetElementId,["id","data-id"])),t}catch(t){return this.loggingService.catch("Error in ReactionService getElementForReactionAnnotation: ",t),null}}saveReactionToDb(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: saveReactionToDb","color: green;");try{if(this.authService.getUser()){let t=yield this.docService.getDocumentPaths$().pipe($e(a=>!!a),ut(1)).toPromise();if(!t)throw new Error("Document paths not found.");if(this.documentPaths=t,this.loggingService.log(this.documentPaths),!(yield this.databaseService.getDb().pipe($e(a=>!!a),ut(1)).toPromise()))throw new Error("Database not found.");if(this.documentPaths?.reaction){if(e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo,!e?.metadata?.documentId){e?.metadata||(e.metadata={});let m=this.getElementForReactionAnnotation(e),u=this.docService.getBaseMetadata("reaction",{commentAnnotationId:e.commentAnnotationId,element:m});e.metadata=h(h({},e?.metadata),u)}let a=JSON.parse(JSON.stringify(e));a.position=null;let{documentId:l,organizationId:c}=this.getDocumentIdAndOrganizationIdFromReactionAnnotation(e),d=e.commentAnnotationId?void 0:{annotationData:a,actionType:"add",notificationSource:"reaction"};return yield this.commonDbService.setData({feature:"reaction",properties:{id:e.annotationId,documentId:l,organizationId:c},data:a,extraData:d}),a}else return}}catch(t){this.loggingService.catch("Error in ReactionService saveReactionToDb: ",t)}})}getDocumentIdAndOrganizationIdFromReactionAnnotation(e){try{return{documentId:e?.metadata?.documentId,organizationId:e?.metadata?.organizationId}}catch(t){return this.loggingService.catch("Error in ReactionService getDocumentIdAndOrganizationIdFromReactionAnnotation: ",t),{}}}updateUserInReaction(e){return X(this,null,function*(){try{let t=this.authService.getUser();if(t)return e?.reactions||(e.reactions=[]),e?.reactions?.find(a=>a?.from?.userId===t?.userId)?e.reactions=e?.reactions?.filter(a=>a?.from?.userId!==t?.userId):e.reactions.push({from:t,lastUpdated:this.timestamp}),e.reactions.length?yield this.updateReaction(e):yield this.deleteReactionPinAnnotation(e?.annotationId),e}catch(t){this.loggingService.catch("Error in ReactionService updateUserInReaction: ",t)}})}removeUserFromReaction(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeUserFromReaction","color: green;");try{let t=this.authService.getUser();t&&(e?.reactions||(e.reactions=[]),e.reactions=e?.reactions?.filter(i=>i?.from?.userId!==t?.userId),this.updateReaction(e))}catch(t){this.loggingService.catch("Error in ReactionService removeUserFromReaction: ",t)}}updateReaction(e,t,i){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateReaction","color: green;");try{if(this.authService.getUser()){if(e?.targetElement?.xpath){let d=this.domService.getXPath(e.targetElement.xpath);if(d){let m=d.iterateNext();m&&(Kr(m)||(e.targetElement=null))}}let a=JSON.parse(JSON.stringify(e));if(a.position=null,a.lastUpdated=this.timestamp,!a?.metadata?.documentId){a?.metadata||(a.metadata={});let d=this.docService.getBaseMetadata("reaction",{commentAnnotationId:e.commentAnnotationId});a.metadata=h(h({},a?.metadata),d)}let{documentId:l,organizationId:c}=a?.metadata||{};return i?yield this.commonDbService.updateData({feature:"reaction",properties:{id:e.annotationId,documentId:l,organizationId:c},data:JSON.parse(JSON.stringify(a))}):yield this.commonDbService.setData({feature:"reaction",properties:{id:e.annotationId,documentId:l,organizationId:c},data:JSON.parse(JSON.stringify(a))}),a}}catch(a){this.loggingService.catch("Error in ReactionService updateReaction: ",a)}})}deleteReactionPinAnnotation(e,t){return X(this,null,function*(){try{let i=this.getAnnotationById(e),{documentId:a,organizationId:l}=this.getDocumentIdAndOrganizationIdFromReactionAnnotation(i),c=i&&!i.commentAnnotationId?{annotationData:i,actionType:"delete",notificationSource:"reaction"}:void 0;yield this.commonDbService.deleteData({feature:"reaction",properties:{id:e,documentId:a,organizationId:l},extraData:c})}catch(i){this.loggingService.catch("Error in ReactionService deleteReactionPinAnnotation: ",i)}})}setCustomReactions(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomReactions","color: green;"),this.customReactions$.next(e),this.emojiService.setEmojiList(e)}catch(t){this.loggingService.catch("Error in ReactionService setCustomReactions: ",t)}}enableDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;"),this.darkMode$.value===!0)return;this.darkMode$.next(!0)}catch(e){this.loggingService.catch("Error in ReactionService enableDarkMode: ",e)}}disableDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;"),this.darkMode$.value===!1)return;this.darkMode$.next(!1)}catch(e){this.loggingService.catch("Error in ReactionService disableDarkMode: ",e)}}getDarkMode(){return this.darkMode$.value}getDarkMode$(){return this.darkMode$.asObservable()}sanitizeReactionAnnotation(e){try{e&&(e.iconUrl&&(e.iconUrl=this.domService.sanitizeHtml(e.iconUrl)),e.iconEmoji&&(e.iconEmoji=this.domService.sanitizeHtml(e.iconEmoji)),e.icon&&(e.icon=this.domService.sanitizeHtml(e.icon)))}catch(t){this.loggingService.catch("Error in ReactionService sanitizeReactionAnnotation: ",t)}}get timestamp(){return this.commonDbService.getServerTimestamp()}getReactionAnnotationForClient(e){try{let t=["isReactionResolverUsed","pageInfo","from","involvedUserIds","position"],i=JSON.parse(JSON.stringify(e)),a={};return Object.keys(i).forEach(l=>{t.includes(l)||(l==="reactions"?a.fromUsers=i[l]:a[l]=i[l])}),a}catch(t){return this.loggingService.catch("Error in ReactionService getReactionAnnotationForClient: ",t),e}}};o.\u0275fac=function(t){return new(t||o)(K(eo),K(ct),K(qe),K(Ft),K($n),K(yn),K(st),K(Ue),K(km),K(Vn),K(k),K(al))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Lg={user:"componentConfigSignal.appState.user",isUserAdmin:"componentConfigSignal.appState.isUserAdmin",isKnownUser:"componentConfigSignal.appState.isKnownUser",repliesUniqueUsers:"componentConfigSignal.appState.repliesUniqueUsers",annotation:"componentConfigSignal.data.annotation",annotations:"componentConfigSignal.data.annotations",allAnnotations:"componentConfigSignal.data.allAnnotations",ghostComment:"componentConfigSignal.data.ghostComment",selectedFiles:"parentLocalUIState.selectedFiles",invalidSelectedFiles:"parentLocalUIState.invalidSelectedFiles",selectedAttachments:"parentLocalUIState.selectedAttachments",editComment:"parentLocalUIState.editComment",editCommentIndex:"parentLocalUIState.editCommentIndex",assignTo:"componentConfigSignal.data.assignTo",selectedUserContacts:"componentConfigSignal.data.selectedUserContacts",localRecordedData:"parentLocalUIState.localRecordedData",customList:"componentConfigSignal.data.customList",toOrganizationUserGroup:"componentConfigSignal.data.toOrganizationUserGroup",taggedUserContacts:"componentConfigSignal.data.taggedUserContacts",taggedGroups:"componentConfigSignal.data.taggedGroups",attachmentsToDelete:"parentLocalUIState.attachmentsToDelete",customChipData:"componentConfigSignal.data.customChipData",selectedCustomChipSet:"componentConfigSignal.data.selectedCustomChipSet",currentDialogView:"componentConfigSignal.data.currentDialogView",sidebarMode:"parentLocalUIState.sidebarMode",inboxMode:"parentLocalUIState.inboxMode",dialogMode:"parentLocalUIState.dialogMode",inlineCommentMode:"parentLocalUIState.inlineCommentMode",inlineCommentSectionMode:"parentLocalUIState.inlineCommentSectionMode",focusedThreadMode:"parentLocalUIState.focusedThreadMode",isFocusedThreadEnabled:"parentLocalUIState.isFocusedThreadEnabled",pageModeComposer:"parentLocalUIState.pageModeComposer",darkMode:"parentLocalUIState.darkMode",variant:"parentLocalUIState.variant",disabled:"parentLocalUIState.disabled",commentPinSelected:"parentLocalUIState.commentPinSelected",fullExpanded:"parentLocalUIState.fullExpanded",commentDialogSelected:"parentLocalUIState.commentDialogSelected",readOnly:"parentLocalUIState.readOnly",dialogShadowDOM:"parentLocalUIState.dialogShadowDOM",locationVersion:"parentLocalUIState.locationVersion",composerPosition:"parentLocalUIState.composerPosition",dialogOpenedInSidebar:"parentLocalUIState.dialogOpenedInSidebar",expandOnSelection:"parentLocalUIState.expandOnSelection",selectedVisibility:"parentLocalUIState.selectedVisibility",selectedVisibilityUsers:"parentLocalUIState.selectedVisibilityUsers",containerComponentId:"componentConfigSignal.uiState.containerComponentId",isPrivateComment:"componentConfigSignal.uiState.isPrivateComment",assignToMenuOpened:"parentLocalUIState.assignToMenuOpened",showGhostCommentMessage:"componentConfigSignal.uiState.showGhostCommentMessage",showReplies:"componentConfigSignal.uiState.showReplies",collapsedComments:"componentConfigSignal.uiState.collapsedComments",showAllComments:"componentConfigSignal.uiState.showAllComments",composerContent:"parentLocalUIState.composerContent",composerContentHTML:"parentLocalUIState.composerContentHTML",composerInOpenState:"parentLocalUIState.composerInOpenState",composerMode:"componentConfigSignal.uiState.composerMode",multiThreadAnnotationId:"componentConfigSignal.uiState.multiThreadAnnotationId",maxReplyAvatars:"componentConfigSignal.uiState.maxReplyAvatars",showSuggestionModeActions:"componentConfigSignal.uiState.showSuggestionModeActions",uploadingAttachments:"componentConfigSignal.uiState.uploadingAttachments",playVideoInFullScreen:"componentConfigSignal.uiState.playVideoInFullScreen",commentDialogUniqueId:"componentConfigSignal.uiState.commentDialogUniqueId",recorderInitConfig:"componentConfigSignal.uiState.recorderInitConfig",isInputFocused:"componentConfigSignal.uiState.isInputFocused",showCommentButtons:"componentConfigSignal.uiState.showCommentButtons",isAutocompleteDropdownOpen:"componentConfigSignal.uiState.isAutocompleteDropdownOpen",bottomSheetMode:"componentConfigSignal.uiState.bottomSheetMode",commentComposerMode:"componentConfigSignal.uiState.commentComposerMode",shouldScrollToBottom:"componentConfigSignal.uiState.shouldScrollToBottom",deviceType:"componentConfigSignal.uiState.deviceType",showReplyComposer:"componentConfigSignal.uiState.showReplyComposer",reactionToolOpenIndex:"componentConfigSignal.uiState.reactionToolOpenIndex",openDropdownIndexValue:"componentConfigSignal.uiState.openDropdownIndexValue",hasReactionsByCommentId:"componentConfigSignal.uiState.hasReactionsByCommentId",newComment:"parentLocalUIState.composerContent",newCommentHTML:"parentLocalUIState.composerContentHTML",canResolveAnnotation:"componentConfigSignal.featureState.canResolveAnnotation",canUnresolveAnnotation:"componentConfigSignal.featureState.canUnresolveAnnotation",dialogSelectedByKnownUser:"componentConfigSignal.featureState.dialogSelectedByKnownUser",resolveStatusAccessAdminOnly:"componentConfigSignal.featureState.resolveStatusAccessAdminOnly",enableResolve:"componentConfigSignal.featureState.enableResolve",isPlanExpired:"componentConfigSignal.featureState.isPlanExpired",moderatorMode:"componentConfigSignal.featureState.moderatorMode",enableAutoCategorize:"componentConfigSignal.featureState.enableAutoCategorize",suggestionMode:"componentConfigSignal.featureState.suggestionMode",commentAcceptedStatus:"componentConfigSignal.featureState.commentAcceptedStatus",commentRejectedStatus:"componentConfigSignal.featureState.commentRejectedStatus",enableSignInButton:"componentConfigSignal.featureState.enableSignInButton",enableUpgradeButton:"componentConfigSignal.featureState.enableUpgradeButton",enableGhostCommentsMessage:"componentConfigSignal.featureState.enableGhostCommentsMessage",replyAvatars:"componentConfigSignal.featureState.replyAvatars",userMentions:"componentConfigSignal.featureState.userMentions",recordingSummaryEnabled:"componentConfigSignal.featureState.recordingSummaryEnabled",enableAttachment:"componentConfigSignal.featureState.enableAttachment",allowedFileTypes:"componentConfigSignal.featureState.allowedFileTypes",allowedRecordings:"componentConfigSignal.featureState.allowedRecordings",screenSharingSupported:"componentConfigSignal.featureState.screenSharingSupported",enterKeyToSubmit:"componentConfigSignal.featureState.enterKeyToSubmit",deleteOnBackspace:"componentConfigSignal.featureState.deleteOnBackspace",showScreenSizeInfo:"componentConfigSignal.uiState.showScreenSizeInfo",enableReactions:"componentConfigSignal.featureState.enableReactions",isInsidePdfViewer:"componentConfigSignal.featureState.isInsidePdfViewer",sidebarButtonOnCommentDialogVisible:"componentConfigSignal.uiState.sidebarButtonOnCommentDialogVisible",enableStatus:"componentConfigSignal.featureState.enableStatus",customStatusesShown:"componentConfigSignal.featureState.customStatusesShown",statusOptions:"componentConfigSignal.featureState.statusOptions",enablePriority:"componentConfigSignal.featureState.enablePriority",visibilityOptions:"componentConfigSignal.featureState.visibilityOptions",priorityOptions:"componentConfigSignal.featureState.priorityOptions",enableAssignment:"componentConfigSignal.featureState.enableAssignment",enableNotifications:"componentConfigSignal.featureState.enableNotifications",enableEdit:"componentConfigSignal.featureState.enableEdit",enableDelete:"componentConfigSignal.featureState.enableDelete",enablePrivateMode:"componentConfigSignal.featureState.enablePrivateMode",deleteThreadWithFirstComment:"componentConfigSignal.featureState.deleteThreadWithFirstComment",seenByUsers:"componentConfigSignal.featureState.seenByUsers",allowAssignment:"componentConfigSignal.featureState.enableAssignment",allowToggleNotification:"componentConfigSignal.featureState.enableNotifications",allowEdit:"componentConfigSignal.featureState.enableEdit",allowChangeCommentAccessMode:"componentConfigSignal.featureState.enablePrivateMode",notificationEnabled:"notificationEnabled",mainCommentId:"componentConfigSignal.data.annotation.comments.0.commentId",commentObj:"commentObj",commentIndex:"commentIndex",userContact:"selectorItem.contact",comment:"commentObj",commentAnnotation:"componentConfigSignal.data.annotation",commentAnnotations:"componentConfigSignal.data.annotations",context:"parentLocalUIState.context",focusedAnnotation:"focusedAnnotation",notification:"notification",notificationsPanel:"notificationsPanel",unreadNotificationsForYou:"componentConfigSignal.data.unreadNotificationsForYou",notificationsPanelVisible:"componentConfigSignal.uiState.notificationsPanelVisible",notificationsForYouInSession:"componentConfigSignal.data.notificationsForYouInSession",notificationsInSession:"componentConfigSignal.data.notificationsInSession",notificationsByUserMap:"componentConfigSignal.data.notificationsByUserMap",notificationsByDocumentId:"componentConfigSignal.data.notificationsByDocumentId",notificationsByDate:"componentConfigSignal.data.notificationsByDate",currentDocumentName:"componentConfigSignal.data.currentDocumentName",settingsConfig:"componentConfigSignal.data.settingsConfig",settingsSelectedOption:"componentConfigSignal.data.settingsSelectedOption",selectedTab:"componentConfigSignal.uiState.selectedTab",tabConfig:"componentConfigSignal.uiState.tabConfig",TABS:"componentConfigSignal.uiState.TABS",tabPage:"componentConfigSignal.uiState.tabPage",pageSize:"componentConfigSignal.uiState.pageSize",panelOpenMode:"componentConfigSignal.uiState.panelOpenMode",settingsOpen:"componentConfigSignal.uiState.settingsOpen",settingsAccordionExpanded:"componentConfigSignal.uiState.settingsAccordionExpanded",settingsMutedAll:"componentConfigSignal.uiState.settingsMutedAll",settingsItemRecentlyClosed:"componentConfigSignal.uiState.settingsItemRecentlyClosed",settingsLayout:"componentConfigSignal.uiState.settingsLayout",tabCount:"componentConfigSignal.uiState.tabCount",usersExpanded:"componentConfigSignal.uiState.usersExpanded",documentExpanded:"componentConfigSignal.uiState.documentExpanded",shadowDom:"componentConfigSignal.uiState.shadowDom",settingsEnabled:"componentConfigSignal.featureState.settingsEnabled",selectedMinimalFilterDropdownOption:"selectedMinimalFilterDropdownOption",appliedFiltersCount:"appliedFiltersCount",filteredCommentAnnotationsCount:"filteredCommentAnnotationsCount",unreadCommentAnnotationCount:"unreadCommentAnnotationCount"},Eqe=["user","annotation","annotations","allAnnotations","userContact","comment","commentAnnotation","commentAnnotations","recorderInitConfig","ghostComment","editComment","assignTo","customChipData","currentDialogView","context","focusedAnnotation","notification","notificationsPanel","selectedMinimalFilterDropdownOption","unreadNotificationsForYou","notificationsForYouInSession","notificationsInSession","notificationsByUserMap","notificationsByDocumentId","notificationsByDate","settingsConfig","settingsSelectedOption","settingsAccordionExpanded","tabConfig","tabPage","TABS"],T=(()=>{let _DynamicDataService=class _DynamicDataService{constructor(n,o,r,e,t,i){this.authService=n,this.commentService=o,this.loggingService=r,this.injector=e,this.docService=t,this.configService=i,this.subscriptions=[],this.commonData$=new Se({}),this.evaluateConditionTriggered=new Le,this.conditionRegex=/\{(.*?)\}/g,this.extractedProps={},this.condition="",this.dataComponentConfigSignal=De({});try{this.subscriptions.push(this.authService.getUser$().subscribe(a=>{this.commonData$.next(y(h({},this.commonData$.value),{user:a}))})),this.subscriptions.push(this.commentService.getUnreadCommentAnnotationCountOnCurrentDocument$().subscribe(a=>{this.commonData$.next(y(h({},this.commonData$.value),{unreadCommentAnnotationCount:a?.count||0}))})),this.subscriptions.push(this.commentService.getUnreadCommentCountOnCurrentDocument$().subscribe(a=>{this.commonData$.next(y(h({},this.commonData$.value),{unreadCommentCount:a?.count||0}))})),this.subscriptions.push(this.docService.getUIState$().subscribe(a=>{this.commonData$.next(h(h({},this.commonData$.value),a))})),this.subscriptions.push(this.getCommonData().subscribe(a=>{this.dataComponentConfigSignal.update(l=>(l=h(h({},l),a),l)),this.executeConditionalClasses()})),this.subscriptions.push(this.evaluateConditionTriggered.subscribe(a=>{this.extractedProps=a.extractedProps,this.evaluateCondition(a.className,a.elementRef,a.condition)}))}catch(a){this.loggingService.catch("Error in DynamicDataService constructor: ",a)}}ngOnDestroy(){try{this.subscriptions.forEach(n=>n.unsubscribe())}catch(n){this.loggingService.catch("Error in DynamicDataService ngOnDestroy: ",n)}}getCommonData(){return this.commonData$.asObservable()}getModifiedPathBasedOnCondition(n,o){try{return Object.keys(o).forEach(r=>{o[r].path=this.modifyPathBasedOnCondition(r,n)}),o}catch(r){this.loggingService.catch("Error in DynamicDataService getModifiedPathBasedOnCondition: ",r)}}getComputedValues(n,o,r,e,t,i){try{Object.keys(r).forEach(a=>{let l;if(co(n)?l=ie(()=>El(n(),r[a].path)):l=ie(()=>El(n,r[a].path)),co(l()))xn(()=>{try{let c=l()();r[a].value=c,this.evaluateConditionTriggered.emit({extractedProps:r,className:e,elementRef:t,condition:i})}catch{}},{injector:this.injector});else{let c=l();r[a].value=c,this.evaluateConditionTriggered.emit({extractedProps:r,className:e,elementRef:t,condition:i})}})}catch(a){this.loggingService.catch("Error in DynamicDataService getComputedValues: ",a)}}modifyPathBasedOnCondition(n,o){try{let r=n.match(/^([^\.\[]+)/),e=r?r[1]:n,t=n.slice(e.length);if(Lg[n])return Lg[n];if(["commentDialogOptionsDropdownConfigSignal","commentDialogStatusDropdownConfigSignal"].includes(e)&&t.startsWith(".")){let a=t.slice(1),l=a.match(/^([^\.\[]+)/),c=l?l[1]:a,d=a.slice(c.length);return Lg[c]?Lg[c]+d:"componentConfigSignal."+a}if(e&&o&&typeof o=="function"){let a=o();if(a&&e in a){let c=n.match(/\[(.*?)\]/);if(c&&c[1]){let d=c[1];if(d.includes(".")){let m=d.split(".")[0];if(Lg[m]){let u=d.replace(m,Lg[m]);return n.replace(`[${d}]`,`[${u}]`)}return m&&a&&m in a?n:n.replace(`[${d}]`,`[componentConfigSignal.${d}]`)}}return n}let l=a?.componentConfigSignal;if(l&&typeof l=="function"){let c=l();if(c&&e in c)return"componentConfigSignal."+n}}return Lg[e]?Eqe.includes(e)?Lg[e]+t:Lg[e]:"componentConfigSignal."+n}catch(r){return this.loggingService.catch("Error in DynamicDataService modifyPathBasedOnCondition: ",r),n}}applyConditionalClasses(n,o){try{this.elementRef=n,this.data=o}catch(r){this.loggingService.catch("Error in DynamicDataService applyConditionalClasses: ",r)}}executeConditionalClasses(){try{let n=this.getHostElementAttributes(this.elementRef),r=[...Object.keys(n).filter(e=>e.startsWith("velt-class-")).map(e=>({name:e,value:n[e]}))];if(n["velt-class"]){let e=n["velt-class"],t=/'([^']+)':\s*([^,]+)(?:,|$)/g,i=[],a=0,l=100,c;for(;(c=t.exec(e))!==null;){if(a++>l){this.loggingService.catch("Too many class definitions detected.");break}if(c.length<3)continue;let[,d,m]=c;!d||!m||d.split(" ").forEach(u=>{u.trim()&&i.push({name:`velt-class-${u.trim()}`,value:m.trim()})})}r=[...r,...i]}this.data&&typeof this.data=="object"&&Object.keys(this.data).forEach(e=>{this.updateDataComponentConfigSignal(e,this.data[e])}),r.forEach(e=>{let t=e.name.replace("velt-class-","");this.condition=e.value,this.condition&&(this.extractProps(),this.extractedProps=this.getModifiedPathBasedOnCondition(this.dataComponentConfigSignal,this.extractedProps),this.getComputedValues(this.dataComponentConfigSignal,this.evaluateCondition,this.extractedProps,t,this.elementRef,e.value))})}catch(n){this.loggingService.catch("Error in DynamicDataService applyConditionalClasses: ",n)}}updateDataComponentConfigSignal(n,o){try{n==="dataComponentConfigSignal"?this.dataComponentConfigSignal.set(o):this.dataComponentConfigSignal.update(r=>y(h({},r),{[n]:o}))}catch(r){this.loggingService.catch("Error in DataComponent updateDataComponentConfigSignal: ",r)}}extractProps(){try{this.extractedProps={},this.conditionRegex.lastIndex=0;let n;for(;(n=this.conditionRegex.exec(this.condition))!==null;){let o=n[1];this.extractedProps[o]={value:null,path:null,isDynamicPath:this.hasDynamicParts(o)}}}catch(n){this.loggingService.catch("Error in DynamicDataService extractProps: ",n)}}hasDynamicParts(n){try{let o=/\[[^\]'"]*[^\]'"]\]/.test(n),r=/\[[^[\]]*[\.\[][^[\]]*\]/.test(n);return o||r}catch(o){return this.loggingService.catch("Error checking for dynamic path: ",o),!1}}evaluateCondition(n,o,r){try{if(r){let e=this.extractedProps,t=r.replace(this.conditionRegex,(l,c)=>{let d=e[c];if(d&&d.value!==void 0){let m=d.value;return typeof m=="string"?`'${m}'`:typeof m=="boolean"||typeof m=="number"?String(m):m===null?"null":typeof m=="object"?m?"true":"false":String(m)}return"false"}),i=this.sanitizeCondition(t),a=this.safeEval(i);return n&&o&&(a?this.setHostElementClasses(o,n):this.removeHostElementClasses(o,n)),a}return!1}catch(e){return this.loggingService.catch("Error in IfComponent evaluateCondition: ",e),!1}}sanitizeCondition(n){try{return n.replace(/[^a-zA-Z0-9\s\+\-\*\/\%\(\)\!\=\<\>\|\&\.\[\]\{\},'"]/g,"")}catch(o){return this.loggingService.catch("Error in IfComponent sanitizeCondition: ",o),""}}safeEval(expression){try{if(this.configService.getSafeEval()){let n=this.tokenize(expression.trim());return this.evaluateTokens(n)}else return eval(expression)}catch(n){return this.loggingService.catch("safeEval error",n),!1}}tokenize(n){try{if(!n||n.trim()==="")return[];let o=[],r=0;for(;r<n.length;){let e=n[r];if(/\s/.test(e)){r++;continue}if(e==='"'||e==="'"){let t=e,i="";for(r++;r<n.length;)if(n[r]==="\\"&&r+1<n.length)i+=n[r+1],r+=2;else if(n[r]===t){r++;break}else i+=n[r],r++;o.push({type:"string",value:i});continue}if(e==="("){o.push({type:"lparen",value:"("}),r++;continue}if(e===")"){o.push({type:"rparen",value:")"}),r++;continue}if(r<n.length-2&&n.substring(r,r+3)==="==="){o.push({type:"operator",value:"===",precedence:4}),r+=3;continue}if(r<n.length-2&&n.substring(r,r+3)==="!=="){o.push({type:"operator",value:"!==",precedence:4}),r+=3;continue}if(r<n.length-1&&n.substring(r,r+2)==="&&"){o.push({type:"operator",value:"&&",precedence:2}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)==="||"){o.push({type:"operator",value:"||",precedence:1}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)==="<="){o.push({type:"operator",value:"<=",precedence:4}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)===">="){o.push({type:"operator",value:">=",precedence:4}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)==="=="){o.push({type:"operator",value:"==",precedence:4}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)==="!="){o.push({type:"operator",value:"!=",precedence:4}),r+=2;continue}if(e==="!"){o.push({type:"unary",value:"!",precedence:5}),r++;continue}if(e==="<"){o.push({type:"operator",value:"<",precedence:4}),r++;continue}if(e===">"){o.push({type:"operator",value:">",precedence:4}),r++;continue}if(/[a-zA-Z0-9._]/.test(e)){let t="";for(;r<n.length&&/[a-zA-Z0-9._]/.test(n[r]);)t+=n[r],r++;/^-?\d+(\.\d+)?$/.test(t)?o.push({type:"number",value:parseFloat(t)}):t==="true"||t==="false"?o.push({type:"boolean",value:t==="true"}):t==="null"?o.push({type:"null",value:null}):t==="undefined"?o.push({type:"undefined",value:void 0}):o.push({type:"identifier",value:t});continue}r++}return o}catch(o){return this.loggingService.catch("tokenize error",o),[]}}evaluateTokens(n){try{if(!n||n.length===0)return!1;let o=this.infixToPostfix(n);return this.evaluatePostfix(o)}catch(o){return this.loggingService.catch("evaluateTokens error",o),!1}}infixToPostfix(n){try{let o=[],r=[];for(let e of n)if(e.type==="string"||e.type==="number"||e.type==="boolean"||e.type==="null"||e.type==="undefined"||e.type==="identifier")o.push(e);else if(e.type==="unary")r.push(e);else if(e.type==="operator"){for(;r.length>0;){let t=r[r.length-1];if(t.type==="lparen"||t.precedence!==void 0&&t.precedence<e.precedence)break;o.push(r.pop())}r.push(e)}else if(e.type==="lparen")r.push(e);else if(e.type==="rparen"){for(;r.length>0&&r[r.length-1].type!=="lparen";)o.push(r.pop());r.length>0&&r.pop()}for(;r.length>0;){let e=r.pop();e.type!=="lparen"&&e.type!=="rparen"&&o.push(e)}return o}catch(o){return this.loggingService.catch("infixToPostfix error",o),[]}}evaluatePostfix(n){try{let o=[];for(let r of n)if(r.type==="string"||r.type==="number"||r.type==="boolean"||r.type==="null"||r.type==="undefined"||r.type==="identifier")o.push(r.value);else if(r.type==="unary"){if(o.length>=1){let e=o.pop();r.value==="!"&&o.push(!this.isTruthy(e))}}else if(r.type==="operator"&&o.length>=2){let e=o.pop(),t=o.pop();r.value==="&&"?o.push(this.isTruthy(t)&&this.isTruthy(e)):r.value==="||"?o.push(this.isTruthy(t)||this.isTruthy(e)):o.push(this.compare(t,e,r.value))}return o.length===1?this.isTruthy(o[0]):!1}catch(o){return this.loggingService.catch("evaluatePostfix error",o),!1}}parseValue(n){try{let o=n.trim();return o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'")?o.substring(1,o.length-1):/^-?\d+(\.\d+)?$/.test(o)?parseFloat(o):o==="true"?!0:o==="false"?!1:o==="null"?null:o==="undefined"?void 0:o}catch(o){return this.loggingService.catch("parseValue error",o),n}}compare(n,o,r){try{switch(r){case"===":return n===o;case"!==":return n!==o;case"==":return n==o;case"!=":return n!=o;case"<":return n<o;case">":return n>o;case"<=":return n<=o;case">=":return n>=o;default:return!1}}catch(e){return this.loggingService.catch("compare error",e),!1}}isTruthy(n){try{return n==null||n===""||n==="false"?!1:n==="true"?!0:typeof n=="number"?n!==0:!!n}catch(o){return this.loggingService.catch("isTruthy error",o),!1}}getHostElementAttributes(n){try{let o=n,r={};for(let e of o.attributes)r[e.name]=e.value;return r}catch{return{}}}setHostElementClasses(n,o){try{n.classList.add(o)}catch{}}removeHostElementClasses(n,o){try{n.classList.remove(o)}catch{}}};_DynamicDataService.\u0275fac=function(o){return new(o||_DynamicDataService)(K(qe),K(Re),K(k),K(Dt),K(st),K(Ft))},_DynamicDataService.\u0275prov=Ae({token:_DynamicDataService,factory:_DynamicDataService.\u0275fac,providedIn:"root"});let DynamicDataService=_DynamicDataService;return DynamicDataService})();var me=(()=>{let o=class o{set veltIf(e){try{e&&this.setIfCondition(e)}catch(t){this._loggingService.catch("Error in BaseComponent set veltIf:",t)}}constructor(e,t,i){this._elementRef=e,this._dynamicDataService=t,this._loggingService=i,this.componentConfigSignal=De({}),this.veltElement=!0,this.conditionSignal=De(null)}initializeComponentConfigSignal(e){try{this.componentConfigSignal.set(e)}catch(t){this._loggingService.catch("Error in BaseComponent initializeComponentConfigSignal:",t)}}ngOnInit(){try{this._dynamicDataService.applyConditionalClasses(this._elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal})}catch(e){this._loggingService.catch("Error in BaseComponent ngOnInit:",e)}}ngOnDestroy(){}setIfCondition(e){try{this.conditionSignal.set(e)}catch(t){this._loggingService.catch("Error in BaseComponent setIfCondition:",t)}}};o.\u0275fac=function(t){return new(t||o)(x(Q),x(T),x(k))},o.\u0275cmp=O({type:o,selectors:[["app-base"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{componentConfigSignal:"componentConfigSignal",template:"template",wireframe:"wireframe",veltIf:"veltIf"},standalone:!1,decls:0,vars:0,template:function(t,i){},encapsulation:2});let n=o;return n})();var yt=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.configService=t,this.darkMode$=new Se(!1)}setDarkMode(e){try{let t=document.documentElement;if(!t)return;e?t.setAttribute(N.ATTRIBUTES.VELT_THEME,"dark"):t.removeAttribute(N.ATTRIBUTES.VELT_THEME),this.darkMode$.next(e)}catch(t){this.loggingService.catch("Error in theme service setDarkMode: ",t)}}getDarkMode$(){return this.darkMode$.asObservable()}updateListenerOnConfigChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.usePrefersColorScheme){this.enablePrefersColorScheme();return}this.disablePrefersColorScheme()})}catch(e){this.loggingService.catch("Error in theme service updateListenerOnConfigChange: ",e)}}enablePrefersColorScheme(){try{if(this.disablePrefersColorScheme(),!window.matchMedia)return;this.darkModeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.setDarkMode(this.darkModeQuery.matches),this.darkModeQueryListener=e=>{this.setDarkMode(e.matches)},this.darkModeQuery.addEventListener("change",this.darkModeQueryListener)}catch(e){this.loggingService.catch("Error in theme service enablePrefersColorScheme: ",e)}}disablePrefersColorScheme(){try{this.darkModeQuery&&this.darkModeQueryListener&&this.darkModeQuery.removeEventListener("change",this.darkModeQueryListener)}catch(e){this.loggingService.catch("Error in theme service disablePrefersColorScheme: ",e)}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(Ft))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ot=(()=>{let o=class o extends me{onDarkModeChange(){return this.darkModeSubject$.asObservable()}constructor(e,t,i,a,l,c,d){super(e,c,d),this._elementRef=e,this._themeService=t,this._changeDetector=i,this._featureService=a,this._componentDarkModeObservable=l,this._componentDarkMode=null,this._globalDarkMode=!1,this._featureDarkMode=!1,this._themeSubscriptions=[],this._darkMode=!1,this.darkMode=!1,this.darkModeSubject$=new Se(!1);try{this._themeSubscriptions.push(this._themeService.getDarkMode$().subscribe(m=>{this._globalDarkMode=m,this.setDarkMode()})),this._featureService&&(this._featureService instanceof Re?this._themeSubscriptions.push(this._featureService.getCommentContainerDarkMode().subscribe(m=>{this._featureDarkMode=m,this.setDarkMode()})):this._featureService instanceof zi&&this._themeSubscriptions.push(this._featureService.getDarkMode$().subscribe(m=>{m!==null&&(this._featureDarkMode=m),this.setDarkMode()}))),this._componentDarkModeObservable&&this._componentDarkModeObservable instanceof Vt&&this._themeSubscriptions.push(this._componentDarkModeObservable.subscribe(m=>{this._componentDarkMode=m,this.setDarkMode()}))}catch{}}ngOnInit(){super.ngOnInit()}ngOnChanges(e){try{if(e._darkMode){let t=e._darkMode.currentValue;typeof t=="string"&&(t=t==="true"),this._componentDarkMode=t,this.setDarkMode()}}catch{}}setComponentDarkMode(e){try{this._componentDarkMode=e,this.setDarkMode()}catch{}}setDarkMode(){try{this._componentDarkMode===null?this._featureDarkMode?this.darkMode=!0:this.darkMode=!!this._globalDarkMode:this.darkMode=!!this._componentDarkMode,this.darkMode?this._elementRef.nativeElement.hasAttribute("dark")||this._elementRef.nativeElement.setAttribute("dark",""):this._elementRef.nativeElement.hasAttribute("dark")&&this._elementRef.nativeElement.removeAttribute("dark"),this.darkModeSubject$.next(this.darkMode),this._changeDetector&&this._changeDetector.markForCheck()}catch{}}ngOnDestroy(){try{super.ngOnDestroy(),this._themeSubscriptions.forEach(e=>{e.unsubscribe()})}catch{}}};o.\u0275fac=function(t){return new(t||o)(x(Q),x(yt),x(nn),x("FeatureService",8),x(Vt),x(T),x(k))},o.\u0275cmp=O({type:o,selectors:[["app-themed"]],inputs:{_darkMode:[0,"darkMode","_darkMode"]},standalone:!1,features:[P,Qe],decls:0,vars:0,template:function(t,i){},encapsulation:2,changeDetection:0});let n=o;return n})();var Xe=(()=>{let o=class o{constructor(e){this.loggingService=e,this.wireframeMap=new Se(new Map);try{this.loggingService.log("%c[WB] Creating CLASS: WireframeService","color: blue;")}catch(t){this.loggingService.catch("Error in WireframeService constructor: ",t)}}setWireframe(e,t){try{let i=this.wireframeMap.value,a=i.get(e),l=t.children.length>0||t.innerHTML?.trim()?.length>0,c=a&&(a.children.length>0||a.innerHTML?.trim()?.length>0);(!a||l&&!c)&&(i.set(e,t),this.wireframeMap.next(i))}catch(i){this.loggingService.catch("Error in WireframeService setWireframe: ",i)}}setWireframeMap(e){try{let t=this.wireframeMap.value;e.forEach((i,a)=>{let l=t.get(a),c=i.children.length>0||i.innerHTML?.trim()?.length>0,d=l&&(l.children.length>0||l.innerHTML?.trim()?.length>0);(!l||c&&!d)&&t.set(a,i)}),this.wireframeMap.next(t)}catch(t){this.loggingService.catch("Error in WireframeService setWireframeMap: ",t)}}getWireframe(e,t=!0){try{let i=this.wireframeMap.value,a=i.get(e);if(!a&&t){let l=e?.split("---")[0];l&&(a=i.get(l))}return a&&(a?.children?.length>0||a?.innerHTML?.trim()?.length>0)?a:void 0}catch(i){this.loggingService.catch("Error in WireframeService getWireframe: ",i);return}}getConditionElement(e,t=!0){try{let i=this.wireframeMap.value,a=i.get(e);if(!a&&t){let l=e?.split("---")[0];l&&(a=i.get(l))}return a}catch(i){this.loggingService.catch("Error in WireframeService getConditionElement: ",i);return}}getWireframe$(e,t=!0){return this.wireframeMap.asObservable().pipe(ge(i=>this.getWireframe(e,t)))}setChildren(e){try{this.wireframeMap.next(e)}catch(t){this.loggingService.catch("Error in WireframeService setChildren: ",t)}}getWireframeMap(){return this.wireframeMap.value}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var d_e=n=>({componentConfigSignal:n}),wqe=(n,o)=>({condition:n,data:o}),Tqe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-confirm-dialog-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Dqe(n,o){if(n&1&&(C(0),D(1,"app-confirm-dialog-title",5)(2,"app-confirm-dialog-message",5),f(3,"div",6),D(4,"app-confirm-dialog-reject",5)(5,"app-confirm-dialog-approve",5),S(),b()),n&2){let r=s(3);v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal),v(2),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal)}}function Oqe(n,o){if(n&1&&(C(0),p(1,Dqe,6,4,"ng-container",4),b()),n&2){let r=s().ngIf,e=s();v(),g("veltDynamicTemplate",j(3,Tqe,e.template,J(1,d_e,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function Aqe(n,o){if(n&1&&(C(0),p(1,Oqe,2,9,"ng-container",3),b()),n&2){let r=s();v(),g("veltIf",E(3,wqe,r.conditionSignal(),J(1,d_e,r.componentConfigSignal)))}}var ll=(()=>{let o=class o extends Ot{constructor(e,t,i,a,l,c,d){super(l,a,void 0,void 0,void 0,d,e),this.loggingService=e,this.dialogRef=t,this.wireframeService=i,this.themeService=a,this.elementRef=l,this.dynamicDataService=d,this.subscriptions=[],this.componentConfigSignal=De({title:"",message:"",yesButton:"",noButton:"",variant:"",type:"",closeDialog:this.closeDialog.bind(this)}),this.componentId="velt-confirm-dialog",this.veltElement=!0;try{c&&(this.componentConfigSignal.update(m=>(m=h(h({},m),c),m)),c?.darkMode&&[!0,!1].includes(c?.darkMode)&&super.setComponentDarkMode(c?.darkMode)),this.setZIndex()}catch(m){this.loggingService.catch("Error in ConfirmDialogComponent constructor: ",m)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-confirm-dialog-wireframe";super.ngOnInit(),this.componentConfigSignal()?.variant&&(e+=`---${this.componentConfigSignal()?.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let i=document.createElement(t.tagName);i.innerHTML=t.innerHTML,this.template=i}}))}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnInit: ",e)}}ngOnDestroy(){super.ngOnDestroy();try{this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnDestroy: ",e)}}setZIndex(){try{if(this.dialogRef){let e=this.dialogRef._overlayRef;e&&(e.backdropElement&&(e.backdropElement.style.zIndex="2147483647"),e.hostElement&&(e.hostElement.style.zIndex="2147483647"))}}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent setZIndex: ",e)}}closeDialog(e){try{this.dialogRef.close(e)}catch(t){this.loggingService.catch("Error in ConfirmDialogComponent closeDialog: ",t)}}get variantClass(){return Mqe(this.componentConfigSignal()?.type)}};o.\u0275fac=function(t){return new(t||o)(x(k),x(ji),x(Xe),x(yt),x(Q),x(rd,8),x(T))},o.\u0275cmp=O({type:o,selectors:[["snippyly-confirm-dialog"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},standalone:!1,features:[V([T]),P],decls:3,vars:6,consts:[["floatingConfirmationRef",""],[1,"velt-confirm-dialog",3,"ngClass","snippylyOverlay","snippylyOverlayZIndex","snippylyOverlayBackdropZIndex"],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],["mat-dialog-actions","",1,"velt-confirm-dialog-actions"]],template:function(t,i){if(t&1&&(f(0,"div",1,0),p(2,Aqe,2,6,"ng-container",2),S()),t&2){let a=Ee(1);g("ngClass",i.variantClass)("snippylyOverlay",a)("snippylyOverlayZIndex",1200)("snippylyOverlayBackdropZIndex",1100),w("data-testid",i.componentId),v(2),g("ngIf",i.componentConfigSignal())}},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%] *[_ngcontent-%COMP%]{outline:0}[_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-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)}[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-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-confirm-dialog[_ngcontent-%COMP%]{width:455px;padding:40px;display:block;box-sizing:border-box;background-color:var(--velt-background-0)}.velt-confirm-dialog-actions[_ngcontent-%COMP%]{justify-content:space-between;gap:var(--velt-spacing-md);min-height:auto} .velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface:has(snippyly-confirm-dialog){border-radius:var(--velt-border-radius-xl);padding:0}@media (max-width: 768px){.velt-confirm-dialog[_ngcontent-%COMP%]{width:auto;max-width:455px;padding:24px}}"],changeDetection:0});let n=o;return n})();function Mqe(n){return n?`velt-confirm-dialog--${n}`:""}var mn=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A,M,B,q,ae,_e,re,be){this.afAuth=e,this.analyticsService=t,this.authService=i,this.configService=a,this.commonDbService=l,this.commonDbUtilsService=c,this.commentUtilsService=d,this.commentAnnotationsResolverService=m,this.notificationResolverService=u,this.databaseService=_,this.docService=I,this.domService=A,this.iamService=M,this.loggingService=B,this.notificationUtilsService=q,this.usersService=ae,this.functions=_e,this.userPermissionService=re,this.coreActionsService=be,this.db=null,this.notificationsDb=null,this.documentPaths=null,this.notifications$=new Se([]),this.rawNotificationsByIdMap$=new Se(new Map),this.processedNotifications$=new Se([]),this.userNotificationsFromServer$=new Se(null),this.readNotificationsOnForYouTab$=new Se(!1),this.currentDocumentOnly$=new Se(!1),this.notificationViews$=new Se({}),this.notificationsByIdMap$=new Se(new Map),this.historyPanelVisible$=new Se(!1),this.notificationsForYou$=new Se(null),this.notificationsByDocumentIdMap$=new Se(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new Se(null),this.maxNotificationDays$=new Se(15),this.tabConfig$=new Se({people:{enable:!1}}),this.settingsConfig$=new Se(null),this.setSettingsConfigByOrganization$=new Se(!1),this.muteAllNotifications$=new Se(!1),this.enableSettings$=new Se(!1),this.selfNotifications$=new Se(!1),this.settingsInitialConfig$=new Se([{name:"Inbox",id:"inbox",default:"ALL",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]},{name:"Email",id:"email",default:"MINE",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]}]),this.settingsConfigGeneration=0,this.notificationsPanelVisible$=new Se(!1);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe($e(Ie=>!!Ie),ut(1)).subscribe(Ie=>{if(Ie){this.db=Ie;try{let Ce=this.configService.getProxyConfig(),Te=On.firebaseNotificationsDatabaseURL;Ce?.v1DbHost&&Te&&(Te=jN(Te,Ce.v1DbHost)),this.notificationsDb=N_(void 0,Te),Ce?.v1DbHost&&Te&&this.databaseService.lockDatabaseHost(this.notificationsDb)}catch(Ce){this.loggingService.catch("Error initializing notifications DB, using default: ",Ce),this.notificationsDb=Ie}this.getDocumentIds(),this.subscribeGetNotificationsForYou()}},Ie=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",Ie)}),this.authService.getUser$().subscribe(Ie=>{Ie?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Ce=>{this.notificationsByDocumentIdSubscription[Ce]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(Ie=>{if(Ie){let Ce=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(Ie||{}).forEach(Te=>{let Oe=Ce?.[Te]?.notifications;Oe?.length&&Oe.forEach(Me=>{this.notificationUtilsService.mergeLocationWithNotification({notification:Me},Ie)?.notification})}),this.notificationsByDocumentIdMap$.next(Ce)}})}catch(Ie){this.loggingService.catch("Error in NotificationService constructor: ",Ie)}}setDBConfigDataToInitialConfig(e){try{let t=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([i,a])=>{t[i]=a}),this.settingsConfig$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",t)}}getInitialConfigFromDB(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let t=++this.settingsConfigGeneration,i=It(this.authService.getUser()?.userId??""),a=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:this.getSettingsConfigByOrganization()?void 0:e?.documentId,organizationId:e?.organizationId??this.docService.getOrganizationConfig()?.organizationId,userId:i}});if(t!==this.settingsConfigGeneration)return;if(a?.notificationsConfig)this.setDBConfigDataToInitialConfig(a?.notificationsConfig);else{this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue());let l={};this.settingsInitialConfig$.getValue().forEach(d=>{if(d.enable){let m=d?.values?.find(u=>u.id===d.default);l[d.id]=m||d?.values?.[0]||{id:"NONE",name:"None"}}});let c={};Object.keys(l).forEach(d=>{c[d]=l[d].id}),yield this.updateSettingsConfigToDb(c)}}catch(t){this.loggingService.catch("Error in NotificationService getInitialConfigFromDB: ",t)}})}subscribeToUserSettings(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: subscribeToUserSettings","color: green;"),this.userSettingsSubscription&&this.userSettingsSubscription.unsubscribe();let e=It(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe($e(t=>t===!0),ye(()=>Cn([this.docService.getDocumentPaths$(),this.getSettingsConfigByOrganization$(),this.docService.getOrganizationConfig$()]).pipe($e(([t,i,a])=>(i||!!t)&&!!a?.organizationId),ye(([t,i,a])=>Eo(this.getInitialConfigFromDB(t)).pipe(ye(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:i?void 0:t?.documentId,organizationId:t?.organizationId??a?.organizationId,userId:e}}).pipe(ge(l=>{l?.data?.notificationsConfig&&!vr(l?.data?.notificationsConfig??{},this.settingsConfig$.getValue()??{})&&this.setDBConfigDataToInitialConfig(l?.data?.notificationsConfig)})))))))).subscribe()}catch(e){this.loggingService.catch("Error in NotificationService subscribeToUserSettings: ",e)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.setUserNotificationsFromServer(null),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.next(null)}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in NotificationService setCommentService: ",t)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.selfNotifications$.pipe(ye(()=>this.getCurrentDocumentOnly$().pipe(ye(e=>e?this.docService.getDocumentPaths$().pipe(ge(t=>{})):ce(void 0)))),ln(()=>{this.notificationsByDocumentIdMap$.next(null)}),ye(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Rr(),ge(([e,t])=>{let i=e?.map(m=>m.documentId),a=t?.map(m=>m.documentId),l=i?.filter(m=>!a?.includes(m)),c=a?.map(m=>({documentId:m,timestamp:t?.find(u=>u.documentId===m)?.timestamp})).filter(m=>!i?.includes(m.documentId)),d=a?.map(m=>{let u=t?.find(_=>_.documentId===m)?.timestamp;return{documentId:m,timestamp:u}}).filter(m=>{let u=e?.find(_=>_.documentId===m.documentId)?.timestamp;return u&&m.timestamp&&u!==m.timestamp});c?.length&&this.fetchNotificationsForDocumentIds(c),d?.length&&this.fetchNotificationsForDocumentIds(d,1),l?.forEach(m=>{this.removeNotificationsForDocumentId(m)}),t&&!t?.length&&!this.notificationsByDocumentIdMap$.getValue()&&(this.notificationsByDocumentIdMap$.next({}),this.setUserNotificationsFromServer([]))})))).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(ye(t=>this.docService.getOrganizationConfig$().pipe(ge(i=>{let a=null,l=this.configService.getApiKey(),c=i?.organizationId||t?.organizationId;return l&&c&&(a=new Sm({apiKey:l,organizationId:c})),{user:t,documentPaths:a}}))),ye(t=>{let{user:i,documentPaths:a}=t;if(this.getCurrentDocumentOnly()&&!this.docService?.getDocumentPaths()?.documentId)return ce(null);if(i&&a?.organizationNotificationsLastNotificationTimestamp){let l=new Date,c=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;l.setDate(l.getDate()-c);let d=l.getTime(),m=[Sr(ft("timestamp",">=",d),...this.getCurrentDocumentOnly()&&this.docService.getDocumentPaths()?.documentId?[ft("metadata.documentId","==",this.docService.getDocumentPaths()?.documentId)]:[])];return this.getCurrentDocumentOnly()||(m.push(mo("timestamp","desc")),m.push(Cm(e))),this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:m}}).pipe(ge(u=>u?.data),ge(u=>{let _=[];return Object.keys(u||{}).forEach(I=>{let A=this.commonDbService.shouldUseFirestore()?u[I]?.timestamp??0:u[I],M=this.commonDbService.shouldUseFirestore()?u[I]?.deletedNotification??!1:!1;if(M&&M.id&&M?.timestamp===A){let B=M.id,q=u[I]?.metadata?.documentId,ae=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),_e=ae?.[q]??{documentMetadata:null,notifications:[]},re=_e.notifications??[],be=re?.findIndex(Ie=>Ie.id===B);be!==-1&&(re.splice(be,1),this.notificationsByDocumentIdMap$.next(y(h({},ae),{[q]:y(h({},_e),{notifications:re})}))),this.notificationResolverService.notificationDataProviderAvailable()&&this.notificationResolverService.getNotificationById(B)&&this.notificationResolverService.deleteNotification(B,this.docService.getDocumentPaths()?.clientOrganizationId??"")}_.push({documentId:I,timestamp:A})}),_}),Jn(u=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",u),ce([]))))}return ce(null)}))}catch(t){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",t),ce([])}}resolveAndUpdateDocumentNotifications(e,t){try{Object.keys(e).forEach(i=>{let a=e[i]?.documentMetadata||{},l;if(t==="user")l=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:e[i]?.notifications||[]});else if(t==="notification"){let c=e[i]?.notifications?.reduce((m,u)=>(m[u.notificationId]=u,m),{}),d=this.commonDbUtilsService.mergeNotificationsWithResolvedData({feature:"allDocNotifications",data:c});l=Object.values(d??{})}else{let c=e[i]?.notifications?.reduce((m,u)=>(m[u.notificationId]=u,m),{}),d=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:c});l=Object.values(d??{})}l.forEach(c=>{c.notification=this.getClientNotificationObject(c)}),this.setNotificationForDocumentIdInCache(i,a,l)})}catch(i){this.loggingService.catch("Error in NotificationService resolveAndUpdateDocumentNotifications: ",i)}}resolveAndMergeUserNotifications(e,t,i=!1){try{let a=e;if(i&&t==="comment"){let u=this.getUserNotificationsFromServer()??[],_=new Set(e.map(I=>I.notificationId));a=u.filter(I=>_.has(I.notificationId)).concat(e.filter(I=>!u.some(A=>A.notificationId===I.notificationId)))}let l=a.reduce((u,_)=>(u[_.notificationId]=_,u),{}),c;if(t==="user"){let u=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:l});c=Object.values(u??{})}else if(t==="notification"){let u=this.commonDbUtilsService.mergeNotificationsWithResolvedData({feature:"allUserNotifications",data:l});c=Object.values(u??{})}else{let u=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:l});c=Object.values(u??{})}c.forEach(u=>{u.notification=this.getClientNotificationObject(u)});let d=this.getUserNotificationsFromServer()??[],m=new Map(d.map(u=>[u.notificationId,u]));c.forEach(u=>{m.set(u.notificationId,u)}),this.setUserNotificationsFromServer(Array.from(m.values()))}catch(a){this.loggingService.catch("Error in NotificationService resolveAndMergeUserNotifications: ",a)}}fetchNotificationsForDocumentIds(e,t=15){return X(this,null,function*(){try{if(e?.length){let i=Yr(this.functions,Zr({url:On.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"";if(!a)return[];let l=this.getStartAtTimestamp(),c={};if(e.forEach(re=>{if(re?.documentId){let be=this.getAllowedDocumentMetadataByDocumentId(re.documentId);be&&(c[re.documentId]=be)}}),this.userPermissionService?.isPermissionProviderAvailable())try{let re=[];if(e.forEach(Oe=>{this.docService.getDocumentMetadata(Oe.documentId)||re.push(Oe.documentId)}),re.length){let Oe=this.authService.getUser(),Me=Yr(this.functions,Zr({url:On?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));try{let Be=yield wl({methodName:"getDocumentMetadataFromIds",data:{type:"getDocumentMetadataFromIds",metadata:{organizationId:Oe?.clientOrganizationId,folderId:this.documentPaths?.folderId},documentIds:re},getSdkProxy:Me,userId:Oe?.userId??""});if(Be?.data?.length){let We={};Be.data.forEach(He=>{He?.documentId&&(We[He.documentId]=He)}),this.docService.setAllDocumentMetadata(h(h({},this.docService.getAllDocumentMetadataMap()),We))}}catch(Be){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",Be)}}let be=[],Ie=[];e.forEach(Oe=>{let Me=this.docService.getDocumentMetadata(Oe.documentId);Me?.clientDocumentId?be.push({userId:this.authService.getUser()?.userId??"",resource:{id:Me.clientDocumentId,type:aa.DOCUMENT,source:oo.GET_NOTIFICATIONS,organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??""}}):Ie.push(Oe.documentId)}),Ie.length&&(e=e.filter(Oe=>!Ie.includes(Oe.documentId)));let Ce=at();this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:Ce,methodName:oo.GET_NOTIFICATIONS,source:"internal",payload:{requests:be}});let Te=yield this.userPermissionService?.onResourceAccessRequired({requests:be,uniqueId:Ce,methodName:oo.GET_NOTIFICATIONS});Te?.success&&Te?.data?.length?Te.data.forEach(Oe=>{!Oe.hasAccess&&Oe.resourceId&&(e=e.filter(Me=>Me.documentId!==vi(Oe.resourceId)))}):e=[]}catch(re){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",re),e=[]}if(!e.length)return[];let d=this.userPermissionService?.getPermissionsCache()?.filter(re=>re.type===aa.CONTEXT),m={organizationId:a,documentIds:e.filter(re=>!!re.documentId&&!!re.timestamp).map(re=>({documentId:re.documentId,timestamp:re.timestamp??0})),timestamp:l,limitToLast:t,selfNotifications:this.selfNotifications$.value,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),getUserNotifications:!0,isContextEnabled:this.userPermissionService?.getIsContextEnabled(),cachedData:d,isSettingsConfigByOrganization:this.getSettingsConfigByOrganization(),retryConfig:this.userPermissionService?.getPermissionProviderRetryConfig()},u=yield this.notificationUtilsService.handleNotificationEncryption({data:m}),_=yield i({veltData:u}),I=_?.data?.data?.veltData||{},A=_?.data?.data?.veltAdditionalData||{},M="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),B=yield v1(I,M),{userNotifications:q=[],userNotificationIdsInDocNotifications:ae=[],permissionResults:_e=[]}=yield v1(A,M);if(this.userPermissionService?.getIsContextEnabled()){let re=[...this.userPermissionService?.getPermissionsCache()??[],..._e??[]];this.userPermissionService?.setPermissionsCache(re)}if(B&&typeof B=="object"){let re=this.usersService.userDataProviderAvailable(),be=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Ie=this.notificationResolverService.notificationDataProviderAvailable(),Ce=[],Te=[],Oe=[];Object.keys(B).forEach((We,He)=>{let $r=B[We].documentMetadata;if($r){let Et=this.allowedDocumentMetadataMap$.value||{};(!Et?.[We]||!vr(Et?.[We],$r))&&this.allowedDocumentMetadataMap$.next(y(h({},Et),{[We]:$r}))}let nt=B[We].notifications||[];nt.forEach(Et=>{ae.includes(Et.notificationId)&&!q.find(Je=>Je.notificationId===Et.notificationId)&&q.push(JSON.parse(JSON.stringify(Et))),Et.notification=this.getClientNotificationObject(Et)}),this.setNotificationForDocumentIdInCache(We,$r,nt),re&&(Ce.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:nt,shouldAwait:!0,forceResolve:!0})),Ce.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:q,shouldAwait:!0,forceResolve:!0}))),be&&(Te.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:nt,shouldCommentAnnotationsResolverAwait:!0})),Te.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:q,shouldCommentAnnotationsResolverAwait:!0}))),Ie&&(Oe.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:nt,shouldNotificationResolverAwait:!0})),Oe.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:q,shouldNotificationResolverAwait:!0})))});let Me=JSON.parse(JSON.stringify(q));this.setUserNotificationsFromServer([...this.getUserNotificationsFromServer()??[],...q]),(Ie||re||be)&&(()=>{let We=Promise.resolve();if(Ie&&(We=We.then(()=>Promise.allSettled(Oe)).then(()=>{this.resolveAndUpdateDocumentNotifications(B,"notification"),this.resolveAndMergeUserNotifications(Me,"notification")})),re&&(We=We.then(()=>Promise.allSettled(Ce)).then(()=>{this.resolveAndUpdateDocumentNotifications(B,"user"),this.resolveAndMergeUserNotifications(Me,"user")})),be){let He=Ie||re;We=We.then(()=>Promise.allSettled(Te)).then(()=>{this.resolveAndUpdateDocumentNotifications(B,"comment"),this.resolveAndMergeUserNotifications(Me,"comment",He)})}return We})().catch(We=>{this.loggingService.catch("Error in NotificationService resolveChain: ",We)})}}}catch(i){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",i),[]}})}getUserNotificationsFromServer$(){return this.userNotificationsFromServer$.asObservable()}setUserNotificationsFromServer(e){try{let t=JSON.parse(JSON.stringify(e));t=t?.filter((i,a,l)=>a===l.findIndex(c=>c.notificationId===i.notificationId)),this.userNotificationsFromServer$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setUserNotificationsFromServer: ",t)}}getUserNotificationsFromServer(){return this.userNotificationsFromServer$.getValue()}setNotificationForDocumentIdInCache(e,t,i,a){try{let l=this.docService.getOrganizationConfig()?.organizationId??"",c=this.docService.getOrganizationMetadata(l);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),c||(c=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(l)||{})));let d=this.notificationsByDocumentIdMap$.getValue(),m=d?.[e]?.notifications||[],u=this.docService.getLocationMetadatas(),_=i?.map(M=>{let B=M?.notification;return B?(B.metadata&&(B.metadata.documentName=t?.documentName||B.metadata.documentName,B.metadata.organizationMetadata=c||B.metadata.organizationMetadata,B.metadata.documentMetadata=t||B.metadata.documentMetadata),u&&(B=this.notificationUtilsService.mergeLocationWithNotification({notification:B},u)?.notification),B):null})?.filter(M=>!!M)||[],I=new Map(m.map(M=>[M.id,M]));_.forEach(M=>{I.set(M.id,M)});let A=Array.from(I.values()).sort((M,B)=>(B.timestamp||0)-(M.timestamp||0));this.notificationsByDocumentIdMap$.next(y(h({},d),{[e]:{notifications:A,documentMetadata:t}}))}catch(l){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",l)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let t=this.notificationsByDocumentIdMap$.getValue();delete t?.[e],this.notificationsByDocumentIdMap$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",t)}}getStartAtTimestamp(){try{let e=new Date,t=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-t),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.getUserNotificationsFromServer$().pipe(ye(e=>ce(e).pipe($e(t=>!!t),ge(t=>{let i=this.usersService.userDataProviderAvailable(),a=this.commentAnnotationsResolverService?.commentAnnotationDataProviderAvailable(),l=this.notificationResolverService?.notificationDataProviderAvailable();if(l||i||a){let d=t?.reduce((m,u)=>(m[u.notificationId]=u,m),{});l&&(d=this.commonDbUtilsService.mergeNotificationsWithResolvedData({feature:"allUserNotifications",data:d||[]})),i&&(d=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:d||[]})),a&&(d=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:d||[]})),t=Object.values(d??{})}return t.forEach(d=>{d.notification=this.getClientNotificationObject(d)}),t.sort((d,m)=>m.timestamp-d.timestamp),t.map(d=>d.notification).filter(d=>!!d)}),ye(t=>{let i={data:t?.reduce((a,l)=>(a[l.id]={notification:l},a),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:i,feature:"allUserNotifications"}).pipe(ge(a=>Object.values(a?.data||{}).map(l=>l?.notification)))}))),ye(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(ge(()=>e))}),ye(e=>this.allowedDocumentMetadataMap$.pipe(ge(()=>e))),ge(e=>(e?.length&&(e=e.map(t=>{if(t?.metadata){let i=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(t.metadata.documentId),l=this.docService.getOrganizationMetadata(i);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),l||(l=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(i)||{}))),t.metadata.documentName=a?.documentName||t.metadata.documentName,t.metadata.organizationMetadata=l||t.metadata.organizationMetadata,t.metadata.documentMetadata=a||t.metadata.documentMetadata}return t})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(JSON.parse(JSON.stringify(e))):this.notificationsForYou$.next([]),ce(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),ce({})}}subscribeNotificationsData(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let i,a;try{if(e&&(a=Qn(e)),t&&typeof t=="object"){let l=Oi(t);i=Qn(JSON.stringify(l))}}catch(l){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",l)}return br(this.afAuth).pipe($e(l=>!!l),ye(l=>this.isFeatureAllowed({firebaseUser:l})),ye(l=>l.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(c=>(l.featureAllowed=c,l))):ce(l)),ye(l=>!l.featureAllowed||l?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),ce([])):ce(l).pipe(ye(c=>this.docService.getDocumentPaths$().pipe(ge(d=>(this.documentPaths=d,c.documentPaths=d,c)))),ye(c=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>y(h({},t),{user:i})))),ye(t=>Mo(t.config,t.user,je.NOTIFICATION)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe($e(t=>!!t),ye(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let i=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(i+=`/${N.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=Vr(this.db,`${e?i+"/"+N.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+N.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return R8(a).pipe(Jn(l=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",l),ce(null))),ge(l=>{let c=[],d=new Map;l?.raw&&(Object.keys(l?.raw||{}).forEach(u=>{let _=l?.raw[u];_?.id&&c.push(_)}),c.forEach(u=>{u.id&&d.set(u.id,u)})),this.notifications$.next(c),this.rawNotificationsByIdMap$.next(d);let m=[];l?.processed&&Object.keys(l?.processed||{}).forEach(u=>{let _=l?.processed[u];_?.id&&m.push(_)}),this.processedNotifications$.next(m),this.setNotificationsByIdMap()}))}else return ce(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),i;e?.email&&(i=It(e?.email));let a;e?.userId&&(a=It(e?.userId));let l=new Map;this.processedNotifications$.getValue().forEach(d=>{if(d.id&&d?.displayHeadlineMessageTemplate){let m=!1;(i&&d.notifyUsers?.[i]||a&&d.notifyUsers?.[a])&&(m=!0);let u={id:d.id,notificationSource:d.notificationSource,actionType:d.actionType,actionUser:d.actionUser,timestamp:d.timestamp,targetAnnotationId:d.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(d),displayBodyMessage:this.getNotificationBodyMessage(d),forYou:m,notificationSourceData:d.notificationSourceData},_=this.getRawNotificationById(u.id);if(_?.metadata&&(u.metadata={apiKey:_.metadata.apiKey,organizationId:_.metadata.organizationId,clientOrganizationId:_.metadata.clientOrganizationId,documentId:_.metadata.documentId,clientDocumentId:_.metadata.clientDocumentId,location:_?.location,locationId:_?.locationId}),u?.notificationSource==="comment"&&u?.targetAnnotationId){let I=this.commentService?.getAnnotationById(u.targetAnnotationId);I||_?.annotationData&&(I=_.annotationData),I&&(u.notificationSourceData=this.commentService?.getCommentAnnotationForClient(I))}l.set(d.id,u)}}),l.forEach((d,m)=>{d.isUnread=d?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[m]?.views?.[e?.userSnippylyId],l.set(m,d)}),this.notificationsByIdMap$.next(l)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:t,metadata:i,views:a,notification:l}){try{let c=this.authService.getUser(),d=l||e;if(d.id&&d?.displayHeadlineMessageTemplate&&c){let m=null;c?.email&&(m=It(c?.email));let u=null;c?.userId&&(u=It(c?.userId));let _=!1,I=!0;(m&&d.notifyUsers?.[m]||u&&d.notifyUsersByUserId?.[u])&&(_=!0),u&&a?.[u]&&(I=!1);let A={id:d.id};if(l?A=y(h(h({},A),l),{displayHeadlineMessage:this.getNotificationHeadlineMessage(l),displayBodyMessage:this.getNotificationBodyMessage(l),forYou:_,isUnread:I}):A={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:_,isUnread:I,metadata:i},A?.notificationSource==="comment"&&A?.targetAnnotationId){let M=this.commentService?.getAnnotationById(A.targetAnnotationId);M||l?.notificationSourceData&&(M=l?.notificationSourceData),M||t?.annotationData&&(M=t.annotationData),M&&(A.notificationSourceData=this.commentService?.getCommentAnnotationForClient(M))}return t?.targetAnnotationData?.isCommentResolverUsed&&(A.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),l?.isNotificationResolverUsed&&(A.isNotificationResolverUsed=l.isNotificationResolverUsed),A}return}catch(c){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",c);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(ge(e=>e?Object.keys(e??{}).map(t=>{let i=e[t].notifications||[],a=i.filter(c=>c.isUnread).length,l=i.length>0&&i[0]?.timestamp||0;return{documentId:t,notifications:e[t]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:l,documentMetadata:e[t]?.documentMetadata}}).filter(t=>t.notifications?.length>0).sort((t,i)=>i.latestNotificationTimestamp-t.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(ge(e=>{let t=null;return e?(t=[],e.forEach(i=>{i.notifications.forEach(a=>{t?.push(a)})}),t?.sort((i,a)=>a.timestamp-i.timestamp)):null}))}processNotificationData(e){try{let t=e?.annotationData?.metadata,i=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.documentId)||{})),e.metadata||(e.metadata={},this.loggingService.catch("Warning in NotificationService updateNotificationDatabase: ","Document metadata not found")),delete e.metadata.locations,e.metadata.documentMetadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.documentId)||{})),e?.metadata?.documentMetadata?.clientDocumentId&&e?.metadata?.documentMetadata?.documentId&&(e.metadata.documentMetadata.documentId=e?.metadata?.documentMetadata?.clientDocumentId),delete e.metadata.documentMetadata.locations,e.metadata.organizationMetadata=JSON.parse(JSON.stringify(i?this.docService.getOrganizationMetadata(i)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let l=t?.documentId?new Sm({apiKey:a,documentId:t.documentId,organizationId:t?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=l?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=l?.clientOrganizationId||e.actionUser.clientOrganizationId);let c=this.docService.getLocation();c&&(e.location=c?.location,e.locationId=c?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let d=this.commonDbService.getServerTimestamp(),m=this.notificationUtilsService.formatNotification(e,d);return JSON.parse(JSON.stringify(m))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{if(!this.notificationsDb)return;let t=Vr(this.notificationsDb),i=this.processNotificationData(e);I8(t,JSON.parse(JSON.stringify(i)))}catch(t){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",t)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(e){return this.authService.getUser$().pipe(ye(t=>t?t.organizationId?this.getAllNotifications$().pipe(ye(i=>this.notificationsForYou$.pipe(ge(a=>{if(i||a){let l=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(i||[]).forEach(c=>{c.id&&l.set(c.id,c)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(c=>{c.id&&!l.has(c.id)&&l.set(c.id,c)}),Array.from(l.values()).sort((c,d)=>(d.timestamp||0)-(c.timestamp||0))}else return null})))):this.notificationsByIdMap$.asObservable().pipe(ge(i=>Array.from(i.values())),ge(i=>i.sort((a,l)=>l.timestamp-a.timestamp)),Xh()):ce(null)),_t(Kt))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(t){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",t);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(t){this.loggingService.catch("Error in NotificationService setNotificationViews: ",t)}}getNotificationHeadlineMessage(e){try{let t=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let i=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,l=/\{(\w+)\}/g,c=i.replace(l,(d,m)=>(m==="actionUser"||m==="recipientUser")&&a[m]?t?.email&&a[m].email===t?.email||t?.userId&&a[m]?.userId===t?.userId?"You":a[m].name||a[m].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[m]?a[m]:d);return this.domService.sanitizeHtml(c)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",t),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let t=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(i=>{if(i?.userId){let a=this.usersService.getUserById(i?.userId);t=t?.replaceAll(`{{${i.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>'),t=t?.replaceAll(`@User ${i.userId}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(t)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",t),""}}setHistoryPanelVisibility(e,t=!1,i=!1){try{e?document.querySelector(N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,t=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return X(this,null,function*(){try{let t=JSON.parse(JSON.stringify(this.getUserNotificationsFromServer()??[]));if(e?.length){for(let c=0;c<e.length;c+=50){let m=e.slice(c,c+50).filter(I=>I?.id),u=m.map(I=>this.setNotificationAsRead({notification:I,userNotifications:JSON.parse(JSON.stringify(t))})),_=yield Promise.all(u);m.forEach((I,A)=>{let M=_[A];if(!M.some(q=>q.notificationId===I.id))t=t.filter(q=>q.notificationId!==I.id);else{let q=t.find(_e=>_e.notificationId===I.id),ae=M.find(_e=>_e.notificationId===I.id);q&&ae?.views&&(q.views=ae.views)}})}let a=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(c=>{let d=c.metadata?.documentId;if(d&&a?.[d]){let m=a?.[d]?.notifications||[],u=m.find(_=>_.id===c.id);u&&(u.isUnread=!1),a[d].notifications=m}}),this.notificationsByDocumentIdMap$.next(a),!vr(t,this.getUserNotificationsFromServer())&&this.setUserNotificationsFromServer(t)}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",t)}})}setAllNotificationsAsRead(e){return X(this,null,function*(){try{if(e?.tabId==="for-you"){let t=this.notificationsForYou$.value||[];this.setNotificationsAsRead(t)}else this.getNotifications$().pipe(ut(1)).subscribe(t=>{t&&this.setNotificationsAsRead(t)})}catch(t){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",t)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(ge(e=>e?.filter(i=>i?.isUnread)?.length??null),ye(e=>this.getNotifications$().pipe(ge(t=>{let i=t?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:i}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),ce({forYou:null,all:null})}}setNotificationAsRead(i){return X(this,arguments,function*({notification:e,userNotifications:t}){try{let a=this.authService.getUser();if(a&&e?.id){let l=It(a?.userId),{metadata:c}=e;if(c){let{apiKey:d,organizationId:m,documentId:u}=c;if(d&&m&&u&&l){let _=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:m,documentId:u,apiKey:d}});_?.notificationId&&(_?.views?.[l]||(_.views||(_.views={}),_.views[l]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:m,documentId:u,apiKey:d},data:_})));let I=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:l,documentId:u,organizationId:m}});if(I?.notificationId){if(!this.getReadNotificationsOnForYouTab())yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:l,documentId:u,organizationId:m}}),t=t.filter(A=>A.notificationId!==e.id);else if(!I?.views?.[l]){I.views||(I.views={}),I.views[l]={timestamp:Date.now()};let A=t.find(M=>M.notificationId===e.id);A&&(A.views=I.views),this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:l,documentId:u,organizationId:m},data:I})}}}}}return t}catch(a){return this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",a),t}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(t){this.loggingService.catch("Error in NotificationService setMaxDays: ",t)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setTabConfig: ",t)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}enableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!0)return;this.currentDocumentOnly$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableCurrentDocumentOnly: ",e)}}disableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!1)return;this.currentDocumentOnly$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableCurrentDocumentOnly: ",e)}}getCurrentDocumentOnly$(){return this.currentDocumentOnly$.asObservable()}getCurrentDocumentOnly(){return this.currentDocumentOnly$.value}markNotificationAsReadById(e){return X(this,null,function*(){try{this.getNotifications$().pipe(ut(1)).subscribe(t=>{if(t){let i=t.filter(a=>a.id===e);this.setNotificationsAsRead(i)}})}catch(t){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",t)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(t){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",t),null}}setSettingsConfig(e){try{this.enableSettings$.value&&this.settingsConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfig: ",t)}}setSettingsConfigWithDB(e){try{this.enableSettings$.value&&(this.settingsConfig$.next(e),this.updateSettingsConfigToDb())}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfigWithDB: ",t)}}getSettingsConfig$(){return this.settingsConfig$.asObservable()}getSettingsConfig(){return this.settingsConfig$.value}setMuteAllNotifications(){try{this.muteAllNotifications$.value!==!0&&this.muteAllNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService setSettingsMuteAll: ",e)}}getMuteAllNotifications$(){return this.muteAllNotifications$.asObservable()}getMuteAllNotifications(){return this.muteAllNotifications$.value}enableSettings(){try{this.enableSettings$.value!==!0&&this.enableSettings$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettings: ",e)}}enableSettingsConfigByOrganization(){try{this.getSettingsConfigByOrganization()!==!0&&this.setSettingsConfigByOrganization$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettingsConfigByOrganization: ",e)}}disableSettingsConfigByOrganization(){try{this.getSettingsConfigByOrganization()!==!1&&this.setSettingsConfigByOrganization$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettingsConfigByOrganization: ",e)}}getSettingsConfigByOrganization$(){return this.setSettingsConfigByOrganization$.asObservable()}getSettingsConfigByOrganization(){return this.setSettingsConfigByOrganization$.value}enableSelfNotifications(){try{this.selfNotifications$.value!==!0&&this.selfNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSelfNotifications: ",e)}}disableSelfNotifications(){try{this.selfNotifications$.value!==!1&&this.selfNotifications$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSelfNotifications: ",e)}}disableSettings(){try{this.enableSettings$.value!==!1&&this.enableSettings$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettings: ",e)}}getEnableSettings$(){return this.enableSettings$.asObservable()}getEnableSettings(){return this.enableSettings$.value}setSettingsInitialConfig(e){try{let t=!1;if(e.forEach(i=>{["email","inbox"].includes(i.id)&&(t=!i.values?.every(a=>["ALL","NONE","MINE"].includes(a.id)))}),t){this.loggingService.catch("Invalid config values for email or inbox, It should have only ALL, NONE, MINE values");return}this.settingsInitialConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsInitialConfig: ",t)}}getSettingsInitialConfig$(){return this.settingsInitialConfig$.asObservable()}getSettingsInitialConfig(){return this.settingsInitialConfig$.value}updateSettingsConfigToDb(e){return X(this,null,function*(){try{let t=this.authService.getUser(),i=It(t?.userId??""),a=this.docService.getDocumentPaths(),l=this.docService.getOrganizationConfig(),c=a?.organizationId??l?.organizationId,d=a?.clientOrganizationId??l?.clientOrganizationId,m={apiKey:this.configService.getApiKey(),organizationId:c,documentId:a?.documentId,clientOrganizationId:d,clientDocumentId:a?.clientDocumentId,userId:i,clientUserId:this.authService.getUser()?.userId};i&&this.getEnableSettings()&&this.enableSettings$.value&&(this.getSettingsConfigByOrganization()?this.docService.addUserInfoToOrganization({organizationId:d??t?.clientOrganizationId??"",user:{userId:t?.userId??""},notificationsConfig:e||this.settingsConfig$.getValue()}):a?.documentId&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:a?.documentId,userId:i},data:{id:a?.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:m}})))}catch(t){this.loggingService.catch("Error in NotificationService updateSettingsConfigToDb: ",t)}})}openNotificationsPanel(){try{this.notificationsPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService openNotificationsPanel: ",e)}}closeNotificationsPanel(){try{this.notificationsPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService closeNotificationsPanel: ",e)}}getNotificationsPanelVisible$(){return this.notificationsPanelVisible$.asObservable()}getNotificationsPanelVisible(){return this.notificationsPanelVisible$.value}};o.\u0275fac=function(t){return new(t||o)(K(eo),K(ct),K(qe),K(Ft),K(yn),K(md),K(_m),K(ol),K(ym),K($n),K(st),K(Ue),K(Vn),K(k),K(eU),K(An),K(Oo),K(al),K(nr))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var pv=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A,M){this.analyticsService=e,this.configService=t,this.docService=i,this.databaseService=a,this.commonDbService=l,this.authService=c,this.domService=d,this.afAuth=m,this.iamService=u,this.dialog=_,this.loggingService=I,this.notificationService=A,this.userPermissionService=M,this.areaAnnotationById$=new Se({}),this.documentPaths=null,this.areaEnabled$=new Se(!0),this.allowedElementIds$=new Se([]),this.addAreaMode$=new Se(!1),this.loggingService.log("%c[WB] Creating CLASS: AreaService","color: blue;"),this.analyticsService.setAreaService(this),this.authService.setAreaService(this),this.databaseService.getDb().pipe($e(B=>!!B),ut(1)).subscribe(B=>{B&&this.getDocumentPaths()},B=>{this.loggingService.catch("Error in AreaService getDb subscription: ",B)}),this.domService.onWindowPointerMove$().subscribe(B=>{if(this.addAreaMode$.value){this.highlightElement&&this.domService.removeHighlightFromElement(this.highlightElement);let q=this.domService.getBackgroundElement(B.clientX,B.clientY);q&&(this.isElementInsideAllowedElements(q)?zN(B.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.highlightElement=q,this.domService.highlightElement(this.highlightElement,N.CURSOR.AREA_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},B=>{this.loggingService.catch("Error in AreaService onWindowPointerMove$ subscription: ",B)}),this.domService.onWindowKeyupEsc$().subscribe(B=>{this.addAreaMode$.value&&this.disableAddAreaMode()},B=>{this.loggingService.catch("Error in AreaService onWindowKeyupEsc$ subscription: ",B)}),this.domService.onDocumentClick$().subscribe(B=>{if(B&&this.addAreaMode$.value){if(B.preventDefault(),B.stopPropagation(),!zN(B.target)){let q=this.domService.getBackgroundElement(B.clientX,B.clientY);q&&this.isElementInsideAllowedElements(q)&&this.addArea(B)}this.disableAddAreaMode()}},B=>{this.loggingService.catch("Error in AreaService onDocumentClick$ subscription: ",B)}),this.addAreaMode$.subscribe(B=>{this.highlightElement&&this.domService.removeHighlightFromElement(this.highlightElement),B?this.domService.addClassToElement(document.body,"snippyly-add-area-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-area-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},B=>{this.loggingService.catch("Error in AreaService addAreaMode$ subscription: ",B)}),this.domService.onWindowKeyupBackspace$().subscribe(B=>{this.deleteAreaPinAnnotations("keyupBackspace")},B=>{this.loggingService.catch("Error in AreaService onWindowKeyupBackspace$ subscription: ",B)}),this.domService.onWindowKeyupDelete$().subscribe(B=>{this.deleteAreaPinAnnotations("keyupDelete")},B=>{this.loggingService.catch("Error in AreaService onWindowKeyupDelete$ subscription: ",B)})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in AreaService","color: green;");try{this.areaAnnotationById$.next({}),this.areaEnabled$.next(!0),this.allowedElementIds$.next([]),this.addAreaMode$.next(!1),this.highlightElement=null}catch(e){this.loggingService.catch("Error in AreaService clearCache: ",e)}}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$()}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllAreaAnnotations(e,t,i){this.loggingService.log("%c[WB] Calling FUNCTION: getAllAreaAnnotations","color: green;");let a,l;try{if(e&&(l=Qn(e)),t&&typeof t=="object"){let c=Oi(t);a=Qn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in AreaService getAllAreaAnnotations: ",c)}return br(this.afAuth).pipe($e(c=>!!c),ye(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),ye(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(d=>(c.featureAllowed=d,c))):ce(c)),ye(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(ge(d=>(c.featureAllowed=!d,c))):ce(c)),ye(c=>c.featureAllowed?ce(c).pipe(ye(d=>this.docService.getDocumentPaths$().pipe(ge(m=>(this.documentPaths=m,d.documentPaths=m,d)))),ye(d=>l?this.getDataFromDocumentIds([l]).pipe(ge(m=>(d.annotations=m||[],h({},d)))):this.docService.getDocumentIds$().pipe(ye(m=>{let u=m?.length>0?m.map(_=>_.documentId):[this.documentPaths?.documentId??""];return this.getDataFromDocumentIds(u).pipe(ge(_=>(d.annotations=_||[],h({},d))))}))),ye(d=>this.docService.getLocation$().pipe(ge(m=>(d.location=m,d)))),ye(d=>this.docService.getLocations$().pipe(ge(m=>(d.customLocations=m,d)))),ge(d=>{if(d.filteredAnnotations=[],l&&!a)return d.filteredAnnotations=d.annotations?.slice(),d;{let m=[],u=[];return a?m.push(a):(m.push(d?.location?.locationId),m.push(...Object.values(d?.customLocations||[]).map(_=>_.locationId)),d?.location?.location?.id&&u.push(d?.location?.location?.id)),d.filteredAnnotations=this.filterAnnotationsByLocationIds(d?.annotations,m,u),d}}),ye(d=>i?ce(d):d?.annotations?.length?this.domService.onWindowResize$().pipe(ge(()=>d)):ce(d)),ye(d=>i?ce(d):d?.annotations?.length?this.domService.onDomChange$("AreaService getAllAreaAnnotations").pipe(ge(()=>d)):ce(d)),ge(d=>(d.filteredAnnotations=d.filteredAnnotations?.map(m=>{let u=Object.assign({},m);return u.areaProperties=this.calculateAreaAnnotationPosition(u),u}),d)),ye(d=>d?.filteredAnnotations?ce(d?.filteredAnnotations||[]):ce([])),ye(d=>{if(this.authService.isFeatureAllowed(je.COMMENT))return ce(d);{let m=d?.filter(u=>!u?.targetAnnotations?.filter(_=>_?.type===je.COMMENT)?.length);return ce(m)}})):ce([])),_t(Kt))}isFeatureAllowed(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>y(h({},t),{user:i})))),ye(t=>Mo(t.config,t.user,je.AREA)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Area feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))),_t((t,i)=>t?.featureAllowed===i?.featureAllowed))}getDataFromDocumentIds(e,t){return this.getDataFromDocuments({documentIds:e,filters:t})}getDataFromDocuments(e){if(this.configService.getApiKey()){let{documentIds:t,filters:i}=e;if(t?.some(d=>!d)||!this.documentPaths)return ce([]);let a=this.docService.getDocumentPaths()?.veltFolderId,l=ce([]),c={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(c.documentId=t?.length?t[0]:void 0,c.organizationId=this.documentPaths?.organizationId),this.userPermissionService?.getIsContextEnabled()){let d=[N.DEFAULT_VELT_CONTEXT,...this.docService.getProcessedDocContext()],m=[];for(let u=0;u<(d?.length??0);u+=N.LISTENER_CONTEXT_BATCH_SIZE)m.push(d?.slice(u,u+N.LISTENER_CONTEXT_BATCH_SIZE)??[]);l=Cn(m.map(u=>this.commonDbService.dbListener({feature:"allAreas",properties:y(h({},c),{firestoreQuery:[Sr(ft("metadata.apiKey","==",this.configService?.getApiKey()),ft("metadata.documentId","in",t),ft("metadata.organizationId","==",this.documentPaths?.organizationId),...a?[ft("metadata.veltFolderId","==",a)]:[],...u?.length?[ft("context.accessFields","array-contains-any",u)]:[])]})}).pipe(sa()))).pipe(ge(u=>Na(u)))}else{let d=[];for(let m=0;m<(t?.length??0);m+=N.LISTENER_BATCH_SIZE)d.push(t?.slice(m,m+N.LISTENER_BATCH_SIZE)??[]);l=Cn(d.map(m=>this.commonDbService.dbListener({feature:"allAreas",properties:y(h({},c),{firestoreQuery:[Sr(ft("metadata.apiKey","==",this.configService?.getApiKey()),ft("metadata.documentId","in",m),ft("metadata.organizationId","==",this.documentPaths?.organizationId),...a?[ft("metadata.veltFolderId","==",a)]:[])]})}).pipe(sa()))).pipe(ge(m=>Na(m)))}return l.pipe(ge(({data:d,operation:m})=>{let u=[];return d&&(u=Object.values(d??{}).filter(_=>typeof _=="object")),{data:u,operation:m}}),ge(({data:d,operation:m})=>{if(!t)return{data:d,documentMap:{},operation:m};let u=d.reduce((_,I)=>{let A=I.metadata?.documentId;return A&&(_[A]||(_[A]=[]),_[A].push(I)),_},{});return{data:d,documentMap:u,operation:m}}),ge(({data:d,documentMap:m,operation:u})=>{if(!i)if(u?.type==="removed"){if(u?.ids?.length){let _=this.areaAnnotationById$.value;u?.ids?.forEach(I=>{delete _?.[I]}),this.areaAnnotationById$.next(_)}}else Object.entries(m??{}).forEach(([_,I])=>{this.setAreaAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:_,annotations:I})});return d}))}else return ce([])}setAreaAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:t,annotations:i,queryHash:a}){try{if(t){e||(e=N.NO_ORGANIZATION_ID),a||(a=N.DEFAULT_QUERY_HASH);let l={};i?.forEach(d=>{d?.annotationId&&(l[d?.annotationId]=d)});let c=h(h({},this.areaAnnotationById$.value),l);this.areaAnnotationById$.next(c)}}catch(l){this.loggingService.catch("Error in AreaService setAreaAnnotationsByOrganizationIdAndDocumentId:",l)}}getAnnotationById(e){try{return this.areaAnnotationById$.value?.[e]?this.areaAnnotationById$.value?.[e]:void 0}catch(t){this.loggingService.catch("Error in AreaService getAnnotationById: ",t);return}}filterAnnotationsByLocationIds(e,t,i){try{return e.filter(a=>t.includes(a.locationId)||i?.includes(a?.location?.id)||t?.find(l=>l==a?.location?.id)||i?.find(l=>l==a?.locationId+""))}catch(a){return this.loggingService.catch("Error in AreaService filterAnnotationsByLocations:",a),[]}}calculateAreaAnnotationPosition(e,t=!1){try{if(e.targetElements?.length){let i=e.targetElements[0],a=e.targetElements[1];if(i?.xpath&&a?.xpath||i?.anchor&&a?.anchor){let l=null,c=null;if(i?.anchor){let d=this.domService.resolveAnchorRecord(i.anchor);d?.element&&d?.element instanceof HTMLElement&&!fo(d.element)&&this.domService.isElementVisible(d.element)&&Kr(d.element)&&(l=d.element)}else i?.xpath&&(l=this.domService.getElementFromXPath(i.xpath),l&&fo(l)&&(l=null),this.domService.isXpathWithId(i.xpath)||(!l&&i.cfXpath&&(l=this.domService.getElementFromXPath(i.cfXpath),l&&fo(l)&&(l=null)),!l&&i.fXpath&&(l=this.domService.getElementFromXPath(i.fXpath),l&&fo(l)&&(l=null))));if(a?.anchor){let d=this.domService.resolveAnchorRecord(a.anchor);d?.element&&d?.element instanceof HTMLElement&&!fo(d.element)&&this.domService.isElementVisible(d.element)&&Kr(d.element)&&(c=d.element)}else a?.xpath&&(c=this.domService.getElementFromXPath(a.xpath),c&&fo(c)&&(c=null),this.domService.isXpathWithId(a.xpath)||(!c&&a.cfXpath&&(c=this.domService.getElementFromXPath(a.cfXpath),c&&fo(c)&&(c=null)),!c&&a.fXpath&&(c=this.domService.getElementFromXPath(a.fXpath),c&&fo(c)&&(c=null))));if(l&&c){let d=hZ(l,c);if(d){let m=l,u=c,_=m.getBoundingClientRect(),I=u.getBoundingClientRect(),A=t?_.width:m.offsetWidth||_.width,M=t?_.height:m.offsetHeight||_.height,B=t?I.width:u.offsetWidth||I.width,q=t?I.height:u.offsetHeight||I.height,ae={};A&&M&&(ae={top:M*i.topPercentage/100,left:A*i.leftPercentage/100});let _e={};B&&q&&(_e={top:q*a.topPercentage/100,left:B*a.leftPercentage/100});let re=!t,be=fZ(ae.left,ae.top,l,d,re),Ie=fZ(_e.left,_e.top,c,d,re),Ce,Te,Oe,Me,Be={};be.x>Ie.x?be.y>Ie.y?(Me={x:be.x,y:be.y},Ce={x:Ie.x,y:Ie.y},Be.handle1=Me,Be.handle2=Ce):(Te={x:be.x,y:be.y},Oe={x:Ie.x,y:Ie.y},Be.handle1=Te,Be.handle2=Oe):be.y>Ie.y?(Oe={x:be.x,y:be.y},Te={x:Ie.x,y:Ie.y},Be.handle1=Oe,Be.handle2=Te):(Ce={x:be.x,y:be.y},Me={x:Ie.x,y:Ie.y},Be.handle1=Ce,Be.handle2=Me);let We={topLeft:Ce||{x:Oe?.x,y:Te?.y},bottomRight:Me||{x:Te?.x,y:Oe?.y},topRight:Te||{x:Me?.x,y:Ce?.y},bottomLeft:Oe||{x:Ce?.x,y:Me?.y}};return Be.coordinates=We,Be.targetElement=this.domService.getXPath(d),Be}}}}return}catch(i){this.loggingService.catch("Error in AreaService calculateAreaAnnotationPosition:",i);return}}addArea(e,t=[],i,a,l,c){this.loggingService.log("%c[WB] Calling FUNCTION: addArea","color: green;");try{let d=this.authService.getUser();if(d)if(d.isReadOnly||d.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add areas.");else{let m=new TL;a&&(m.annotationId=a),m.from=d,m.color=N.DEFAULT_ANNOTATION_COLOR,m.lastUpdated=this.timestamp,i&&(m.targetAnnotations=[i]),m.props=new dd;let u=this.domService.getCurrentWindowSizeValue();if(m.props.screenWidth=u.screenWidth,m.props.screenHeight=u.screenHeight,m.props.screenScrollHeight=u.screenScrollHeight,m.props.viewportWidth=window.innerWidth,m.props.viewportHeight=window.innerHeight,e||t?.length>0){let A=e?this.getPointsForAreaPinAnnotation(e):t;m.targetElements=[],A.forEach(M=>{m.targetElements.push(this.domService.getTargetElementForCursorPosition(e,void 0,void 0,void 0,void 0,!0,{clientX:M.x,clientY:M.y}))})}this.setLocationToAreaAnnotation(m),l&&(m.locationId=l.locationId,m.location=l.location),m.pageInfo=no(),m.pageInfo&&(m.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth);let _=this.getElementForAreaAnnotation(m),I=this.docService.getBaseMetadata("area",{element:_});if(m?.metadata||(m.metadata={}),m.metadata=h(h({},m.metadata),I),c?.access&&c?.accessFields){if(!this.userPermissionService?.hasUserContextAccess({userId:d.userId,accessFields:c.accessFields})){this.loggingService.catch("User does not have context access to add area annotation.",void 0,void 0,!0);return}m.context={access:c.access,accessFields:c.accessFields}}return this.saveAreaToDb(m),m}return}catch(d){this.loggingService.catch("Error in AreaService addArea: ",d);return}}setLocationToAreaAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location)}catch(t){this.loggingService.catch("Error in AreaService setLocationToAreaAnnotation:",t)}}getElementForAreaAnnotation(e){try{let t,i,a;if(e.targetElements?.length){if(e.targetElements[0]?.anchor){let l=this.domService.resolveAnchorRecord(e.targetElements[0].anchor);l?.element&&this.domService.isElementVisible(l.element)&&Kr(l.element)&&(i=l.element)}else e.targetElements[0]?.xpath&&(i=this.domService.getElementFromXPath(e.targetElements[0].xpath));if(e.targetElements[1]?.anchor){let l=this.domService.resolveAnchorRecord(e.targetElements[1].anchor);l?.element&&this.domService.isElementVisible(l.element)&&Kr(l.element)&&(a=l.element)}else e.targetElements[1]?.xpath&&(a=this.domService.getElementFromXPath(e.targetElements[1].xpath))}return i&&a&&(t=hZ(i,a)),t}catch(t){return this.loggingService.catch("Error in AreaService getElementForAreaAnnotation: ",t),null}}saveAreaToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveAreaToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(je.AREA)&&Cn([this.docService.getDocumentPaths$(),this.databaseService.getDb()]).pipe($e(([t,i])=>!!t&&!!i),ut(1),ye(([t,i])=>{if(this.documentPaths=t,this.documentPaths?.area){e.annotationId||(e.annotationId=this.commonDbService.generateDocumentId()),e.pageInfo&&(e.pageInfo.areaUrl=this.generateAreaUrl(e));let a=JSON.parse(JSON.stringify(e));if(a.position=null,!a?.metadata?.documentId){a?.metadata||(a.metadata={});let d=this.docService.getBaseMetadata("area");a.metadata=h(h({},a?.metadata),d)}this.domService.toggleAnnotationSelection(a),this.analyticsService.trackEvent(Y.Events.Area.AREA_ADDED,{annotationId:e.annotationId});let{documentId:l,organizationId:c}=this.getDocumentIdAndOrganizationIdFromAreaAnnotation(e);return this.commonDbService.setData({feature:"area",properties:{id:e.annotationId,documentId:l,organizationId:c},data:JSON.parse(JSON.stringify(a))})}else return ce(null)})).subscribe(()=>{},t=>{this.loggingService.catch("Error in AreaService saveAreaToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in AreaService saveAreaToDb: ",t)}}getDocumentIdAndOrganizationIdFromAreaAnnotation(e){try{return{documentId:e?.metadata?.documentId,organizationId:e?.metadata?.organizationId}}catch(t){return this.loggingService.catch("Error in AreaService getDocumentIdAndOrganizationIdFromAreaAnnotation: ",t),{}}}updateArea(e,t=!1,i){try{i&&this.setLocationToAreaAnnotation(e),t&&this.updateNotificationsDatabase(e,FN.UPDATED),this.updateAreaToDb(e)}catch(a){this.loggingService.catch("Error in AreaService updateArea: ",a)}}updateAreaToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateAreaToDb","color: green;");try{if(this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(je.AREA)){let t=JSON.parse(JSON.stringify(e));if(t.position=null,!t?.metadata?.documentId){t?.metadata||(t.metadata={});let l=this.docService.getBaseMetadata("area");t.metadata=h(h({},t?.metadata),l)}let{documentId:i,organizationId:a}=this.getDocumentIdAndOrganizationIdFromAreaAnnotation(e);this.commonDbService.setData({feature:"area",properties:{id:e.annotationId,documentId:i,organizationId:a},data:JSON.parse(JSON.stringify(t))})}}catch(t){this.loggingService.catch("Error in AreaService updateAreaToDb: ",t)}}deleteAreaPinAnnotations(e){try{let t=this.domService.getSelectedAnnotationsMap(),i=this.authService.getUser(),a=[];Object.keys(t??{}).forEach(l=>X(this,null,function*(){let c=t[l];c.type==="area"&&i&&c.from&&(i?.isAdmin||c.from.userId===i.userId)&&a.push(c)})),a?.length&&(this.analyticsService.trackEvent(Y.Events.Area.AREA_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(l=>l.annotationId).join()}),this.dialog.open(ll,{panelClass:"velt-mat-dialog-container",data:{title:"Delete area?",message:"This selected area will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"area"}}).afterClosed().pipe(ut(1)).subscribe(l=>{l&&(a.forEach(c=>X(this,null,function*(){yield this.deleteAreaPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${N.SNIPPYLY_HIGHLIGHT}]`).forEach(d=>{this.domService.removeHighlightFromElement(d)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"area")}catch(t){this.loggingService.catch("Error in AreaService deleteAreaPinAnnotations: ",t)}}getAreaAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:t}){try{let i={};return Object.values(this.areaAnnotationById$.value??{}).forEach(a=>{a?.metadata?.documentId==t&&a?.metadata?.organizationId==e&&(i[a?.annotationId]=a)}),Object.values(i??{})}catch(i){return this.loggingService.catch("Error in AreaService getAreaAnnotationsByOrganizationIdAndDocumentId:",i),[]}}onDeleteTargetAnnotation(e,t){try{if(this.docService.getDocumentId()&&this.areaAnnotationById$.value){let a=Object.values(this.areaAnnotationById$.value||{}),l;t?l=a.find(c=>c?.annotationId===t):l=a.find(c=>c?.targetAnnotations?.find(d=>d?.annotationId===e)),l&&(l.targetAnnotations=l.targetAnnotations?.filter(c=>c?.annotationId!==e),l.targetAnnotations?.length?this.updateAreaToDb(l):this.deleteAreaPinAnnotation(l))}}catch(i){this.loggingService.catch("Error in AreaService onDeleteTargetAnnotation: ",i)}}deleteAreaPinAnnotation(e){if(this.authService.isFeatureAllowed(je.AREA)&&this.documentPaths?.area&&e?.annotationId){this.updateNotificationsDatabase(e,FN.DELETED),this.analyticsService.trackEvent(Y.Events.Area.AREA_DELETED,{annotationId:e.annotationId});let{documentId:t,organizationId:i}=this.getDocumentIdAndOrganizationIdFromAreaAnnotation(e);return this.commonDbService.deleteData({feature:"area",properties:{id:e.annotationId,documentId:t,organizationId:i}})}else return Promise.resolve()}enableArea(){try{this.areaEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in AreaService enableArea: ",e)}}disableArea(){try{this.areaEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in AreaService disableArea: ",e)}}getAreaEnabled$(){try{return this.areaEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in AreaService getAreaEnabled$: ",e),ce(!1)}}getAreaEnabled(){try{return this.areaEnabled$.value}catch(e){return this.loggingService.catch("Error in AreaService getAreaEnabled: ",e),!1}}enableAddAreaMode(){this.authService.isFeatureAllowed(je.AREA)?(this.analyticsService.trackEvent(Y.Events.Area.AREA_ADD_MODE_ENABLED),this.addAreaMode$.next(!0)):this.loggingService.catch("Error in AreaService enableAddAreaMode: ","Area feature is not enabled.")}disableAddAreaMode(){this.analyticsService.trackEvent(Y.Events.Area.AREA_ADD_MODE_DISABLED),this.addAreaMode$.next(!1)}addAreaModeChange(){return this.addAreaMode$.asObservable()}getPointsForAreaPinAnnotation(e){let t=[],i=e,a=i?.touches?.length?i.touches[0]?.clientX:i.clientX,l=i?.touches?.length?i.touches[0]?.clientY:i.clientY;return t.push({x:a,y:l}),t.push({x:a+100,y:l+100}),t}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in AreaService isElementInsideAllowedElements: ",t),!1}}updateNotificationsDatabase(e,t){try{let i={annotationData:e,actionType:t,notificationSource:"area"};this.notificationService.updateNotificationDatabase(i)}catch(i){this.loggingService.catch("Error in AreaService updateNotificationsDatabase: ",i)}}getAreaUrl(e){try{return e?.pageInfo?.areaUrl?e.pageInfo.areaUrl:(e?.pageInfo||(e.pageInfo=no(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.areaUrl=this.generateAreaUrl(e),this.updateArea(e),e.pageInfo?.areaUrl)}catch(t){this.loggingService.catch("Error in AreaService getAreaUrl: ",t);return}}generateAreaUrl(e){let t=new URL(window.location.href);return t.searchParams.delete(N.URL_PARAMS.TAG_ID),t.searchParams.append(N.URL_PARAMS.TAG_ID,e.annotationId),t.href}generateAreaAnnotationId(){return X(this,null,function*(){try{if(this.docService.getDocumentPaths()?.area){let t=this.commonDbService.generateDocumentId();return yield rp(10),t||""}else return""}catch(e){return this.loggingService.catch("Error in AreaService generateAreaAnnotationId: ",e),""}})}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(Ft),K(st),K($n),K(yn),K(qe),K(Ue),K(eo),K(Vn),K(Lo),K(k),K(mn),K(al))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var v_e=n=>{try{let o={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return CS.sanitize(n,o)}catch(o){return lt.catch("Error in File utils sanitizeSvg: ",o),""}},m_e=n=>{try{return n.name.split(".").slice(0,-1).join(".")}catch(o){lt.catch("Error in File utils getFileName: ",o);return}},GQ=n=>{try{return/(?:\.([^.]+))?$/.exec(n?.name)[1]}catch(o){lt.catch("Error in File utils getFileExtension: ",o);return}},g_e=(n,o)=>{try{let r=n.slice(0,-1,n.type);return new File([r],o+"."+GQ(n),{type:n.type})}catch(r){lt.catch("Error in File utils updateFile: ",r);return}};var HQ={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var Fp=(()=>{let o=class o{constructor(e,t,i,a,l){this.authService=e,this.configService=t,this.coreActionsService=i,this.loggingService=a,this.attachmentResolverService=l,this.storage=GD();try{this.configService.getApiKey$().subscribe(c=>{this.apiKey=c}),this.authService.getFirebaseConfig$().subscribe(c=>{if(c&&c.firebaseOptions?.storageBucket){this.storage=GD(void 0,c?.firebaseOptions?.storageBucket);let d=this.configService.getProxyConfig();d?.storageHost&&(this.storage.host=d.storageHost)}},c=>{this.loggingService.catch("Error in StorageService constructor: ",c)})}catch(c){this.loggingService.catch("Error in StorageService constructor:",c)}}createAttachment({path:e,file:t}){try{let i=new cS;i.name=t.name;let a=g_e(t,`${i.attachmentId}_${m_e(t)}`),l=`${this.apiKey}/${e}/${a?.name}`;return i.bucketPath=l,i.size=t.size,i.type=GQ(t),i?.type&&(i.mimeType=HQ[i?.type]),i}catch(i){return this.loggingService.catch("Error in StorageService createAttachment: ",i),null}}sanitizeSvgFile(e){return X(this,null,function*(){if(e.type===HQ.svg)try{let t=yield e.text(),i=v_e(t);return new File([i],e.name,{type:e.type})}catch(t){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",t),e}return e})}uploadAttachmentToStorage(l){return X(this,arguments,function*({attachment:e,file:t,resolve:i,reject:a}){try{let c=HD(this.storage,e.bucketPath),d=HY(c,t,{cacheControl:"public,max-age=3600"});d.on("state_changed",m=>{let u=m.bytesTransferred/m.totalBytes*100},m=>{a(m)},()=>{GY(d.snapshot.ref).then(m=>{e.url=m,i(e)})})}catch(c){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",c),a(c)}})}uploadToResolver(d){return X(this,arguments,function*({file:e,attachment:t,metadata:i,resolve:a,reject:l,scope:c}){try{i.attachmentId=t.attachmentId;let m={attachmentId:t.attachmentId,name:t.name,file:e,metadata:i,mimeType:t.mimeType},u=at();this.coreActionsService.triggerAction(tt.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:u,methodName:As.UPLOAD_TO_RESOLVER,source:"internal",payload:{attachment:m,eventType:xo.ATTACHMENT_ADD}});let _=yield this.attachmentResolverService.saveAttachment({attachment:m,eventType:xo.ATTACHMENT_ADD},u,c);_&&_.data?.url?(t.url=_.data?.url,a(t)):l(new Error("Failed to upload attachment to resolver"))}catch(m){this.loggingService.catch("Error in StorageService uploadToResolver: ",m),l(m)}})}uploadFile({path:e,file:t,useAttachmentResolver:i,metadata:a,attachmentScope:l}){return new Promise((c,d)=>X(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let m=yield this.sanitizeSvgFile(t),u=this.createAttachment({path:e,file:m});if(!u)throw new Error("Attachment not created");i?this.uploadToResolver({file:m,attachment:u,metadata:a,resolve:c,reject:d,scope:l}):this.uploadAttachmentToStorage({attachment:u,file:m,resolve:c,reject:d})}catch(m){this.loggingService.catch("Error in StorageService uploadFile:",m),d(m)}}))}uploadChunk(e,t,i,a){return new Promise((l,c)=>{try{if(a?.useAttachmentResolver){let d=this.createAttachment({path:e,file:t});if(!d){c(new Error("Attachment not created for chunk upload"));return}this.uploadToResolver({file:t,attachment:d,metadata:a.metadata,resolve:m=>l(m.url),reject:c,scope:a.attachmentScope});return}if(this.apiKey){let d=`${this.apiKey}/${e}/${t.name}`,m=HD(this.storage,d),u=HY(m,t,{cacheControl:"public,max-age=3600"});u.on("state_changed",_=>{let I=_.bytesTransferred/_.totalBytes*100},_=>{c(_)},()=>{GY(u.snapshot.ref).then(_=>{l(_)}).catch(_=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${i}:`,_),c(_)})})}else{let d=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",d),c(d)}}catch(d){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${i}: `,d),c(d)}})}downloadAttachment(e){try{if(e.url){let t=new XMLHttpRequest;t.responseType="blob",t.onload=()=>{let i=t.response,a=document.createElement("a"),l=window.URL.createObjectURL(i);a.setAttribute("type","hidden"),a.setAttribute(N.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=l,e?.name&&(a.download=e?.name),document.body.appendChild(a);let c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(c),window.URL.revokeObjectURL(l),a.remove()},t.onerror=()=>{window.open(e.url,"_blank")},t.open("GET",e.url),t.send()}}catch(t){this.loggingService.catch("Error in StorageService downloadAttachment: ",t)}}deleteAttachment({attachment:e,metadata:t,useAttachmentResolver:i,attachmentScope:a}){return new Promise((l,c)=>{if(i){let d=at();this.coreActionsService.triggerAction(tt.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:As.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e.attachmentId,metadata:t}}),this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t},d,a).then(()=>{l(null)}).catch(m=>{c(m)})}else{let d=HD(this.storage,e.bucketPath);$Y(d).then(()=>{l(null)}).catch(m=>{l(null)})}})}deleteFileFromPath(e){return new Promise((t,i)=>{let a=HD(this.storage,e);$Y(a).then(()=>{t(null)}).catch(l=>{i(l)})})}};o.\u0275fac=function(t){return new(t||o)(K(qe),K(Ft),K(nr),K(k),K(Xc))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var go=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new Se(N.CommentAnnotationStatusMap),this._customPriorityMap=new Se(N.CommentAnnotationPriorityMap),this._customCategoryMap=new Se(N.CommentCategoryMap);try{let t=sessionStorage.getItem(N.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let i=sessionStorage.getItem(N.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);i&&this._customStatusMap.next(JSON.parse(i));let a=sessionStorage.getItem(N.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(t){this.loggingService.catch("Error in CustomFilterService constructor: ",t)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(N.CommentAnnotationStatusMap),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(N.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let t={};e.forEach(i=>{t[i.id]=i,i.type||(i.type="ongoing")}),this._customStatusMap.next(t),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",t)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(N.CommentAnnotationPriorityMap),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(N.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let t={};e.forEach(i=>{t[i.id]=i}),this._customPriorityMap.next(t),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",t)}}setCustomCategories(e){try{let t={};e.forEach(i=>{t[i.id]=i}),this._customCategoryMap.next(t),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",t)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([i,a])=>a.type==="default");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return N.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([i,a])=>a.type==="terminal");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return N.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let t=Object.entries(this._customStatusMap.value).filter(([i,a])=>a.type==="ongoing");if(t)return t.map(i=>i[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[N.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let t=Object.entries(this._customStatusMap.value),i=t.find(([a,l])=>l.type==="default");switch(e.status){case"open":i&&(e.status=i[1]);break;case"inProgress":let a=t.find(([c,d])=>d.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let l=t.find(([c,d])=>d.type==="terminal");l&&(e.status=l[1]);break;default:i&&(e.status=i[1]);break}}return e}catch(t){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",t),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=N.CommentAnnotationPriorityMap[e.priority])}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",t)}return e}convertLegacyCategory(e){try{if(e.commentCategories===void 0||e.commentCategories===null||!Array.isArray(e.commentCategories)||e.commentCategories.length===0)return e;typeof e.commentCategories[0]=="string"&&(e.commentCategories=e.commentCategories.map(t=>N.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var u_e=(()=>{let o=class o{constructor(e,t){this.domService=e,this.loggingService=t,this.keyEventSubject$=new it;try{this.loggingService.log("%c[WB] Creating CLASS: HotkeyService","color: blue;"),this.keyEvent$=this.keyEventSubject$.asObservable().pipe(Xh()),this.domService.onWindowKeydown$().subscribe(i=>{this.keyEventSubject$.next(i)})}catch(i){this.loggingService.catch("Error in HotkeyService constructor: ",i)}}getKeyPressEvent(e,t={}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getKeyPressEvent","color: green;"),this.keyEvent$.pipe($e(i=>i?.key===e),$e(i=>!(!!t?.includeCtrl!==i.ctrlKey||!!t?.includeAlt!==i.altKey||!!t?.includeShift!==i.shiftKey||!!t?.includeMeta!==i.metaKey)),$e(()=>this.isNoInputFocused()))}catch(i){return this.loggingService.catch("Error in HotkeyService getKeyPressEvent: ",i),new Vt}}isNoInputFocused(){try{let e=document.activeElement;for(;e&&e?.tagName!=="BODY";){if(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e?.isContentEditable)return!1;e=e?.parentElement}return!0}catch(e){return this.loggingService.catch("Error in HotkeyService isNoInputFocused: ",e),!1}}};o.\u0275fac=function(t){return new(t||o)(K(Ue),K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();function Rqe(n,o){n&1&&(se(),f(0,"svg",16),D(1,"rect",17)(2,"path",18)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function Nqe(n,o){n&1&&(se(),f(0,"svg",16),D(1,"rect",22)(2,"path",23)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function Fqe(n,o){if(n&1&&(C(0),f(1,"div",6)(2,"div",7),p(3,Rqe,6,0,"svg",8)(4,Nqe,6,0,"ng-template",null,1,Ve),S(),f(6,"div",9),oe(7),R(8,"translate"),D(9,"br"),oe(10),R(11,"translate"),S(),f(12,"div",10)(13,"p"),oe(14),R(15,"translate"),se(),f(16,"svg",11),D(17,"path",12)(18,"path",13)(19,"path",14)(20,"path",15),S(),oe(21),R(22,"translate"),S(),St(),f(23,"p"),oe(24),R(25,"translate"),S()()(),b()),n&2){let r=Ee(5),e=s();v(3),g("ngIf",e.darkMode)("ngIfElse",r),v(4),we(" ",F(8,7,"Allow mic permission to")),v(3),we("",F(11,9,"enable your audio")," "),v(4),we(" ",F(15,11,"1. Click the")," "),v(7),we(" ",F(22,13,"page info icon in your browser\u2019s address bar")," "),v(3),we(" ",F(25,15,"2. Turn on Microphone")," ")}}function Lqe(n,o){n&1&&(se(),f(0,"svg",16),D(1,"rect",17)(2,"path",24)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function Uqe(n,o){n&1&&(se(),f(0,"svg",16),D(1,"rect",22)(2,"path",25)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function Vqe(n,o){if(n&1&&(C(0),f(1,"div",6)(2,"div",7),p(3,Lqe,6,0,"svg",8)(4,Uqe,6,0,"ng-template",null,2,Ve),S(),f(6,"div",9),oe(7),R(8,"translate"),D(9,"br"),oe(10),R(11,"translate"),S(),f(12,"div",10)(13,"p"),oe(14),R(15,"translate"),se(),f(16,"svg",11),D(17,"path",12)(18,"path",13)(19,"path",14)(20,"path",15),S(),oe(21),R(22,"translate"),S(),St(),f(23,"p"),oe(24),R(25,"translate"),S()()(),b()),n&2){let r=Ee(5),e=s();v(3),g("ngIf",e.darkMode)("ngIfElse",r),v(4),we(" ",F(8,7,"Allow camera permission")),v(3),we("",F(11,9,"to enable your video")," "),v(4),we(" ",F(15,11,"1. Click the")," "),v(7),we(" ",F(22,13,"page info icon in your browser\u2019s address bar")," "),v(3),we(" ",F(25,15,"2. Turn on Camera")," ")}}var oU=(()=>{let o=class o{constructor(e,t,i,a,l){this.loggingService=e,this.themeService=t,this.elementRef=i,this.matDialogRef=a,this.data=l,this.veltElement=!0,this.darkMode=!0;try{this.loggingService.log("%c[WB] Creating CLASS: DevicePermissionDeniedDialogComponent","color: blue;"),this.type=this.data?.type,[!0,!1].includes(this.data?.darkMode)&&(this.darkMode=this.data?.darkMode)}catch(c){this.loggingService.catch("Error in DevicePermissionDeniedDialogComponent constructor: ",c)}}ngOnDestroy(){}};o.\u0275fac=function(t){return new(t||o)(x(k),x(yt),x(Q),x(ji,8),x(rd,8))},o.\u0275cmp=O({type:o,selectors:[["velt-device-permission-denied-dialog-internal"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{type:"type"},standalone:!1,decls:5,vars:5,consts:[["devicePermissionDialogRef",""],["defaultAudioIcon",""],["defaultVideoIcon",""],[1,"velt-device-permission-denied-dialog--container",3,"snippylyOverlay","snippylyOverlayZIndex"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"velt-device-permission-denied-dialog"],[1,"velt-device-permission-denied-dialog--icon"],["width","61","height","60","viewBox","0 0 61 60","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf","ngIfElse"],[1,"velt-device-permission-denied-dialog--header"],[1,"velt-device-permission-denied-dialog--content"],["width","13","height","12","viewBox","0 0 13 12","fill","none","xmlns","http://www.w3.org/2000/svg",1,"velt-device-permission-denied-dialog--page-info-icon"],["d","M4.375 2.5C4.375 3.53553 3.53553 4.375 2.5 4.375C1.46447 4.375 0.625 3.53553 0.625 2.5C0.625 1.46447 1.46447 0.625 2.5 0.625C3.53553 0.625 4.375 1.46447 4.375 2.5Z","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["d","M5 2.5H12.5","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["d","M0 8.75H7.5","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["d","M11.875 8.75C11.875 9.78553 11.0355 10.625 10 10.625C8.96447 10.625 8.125 9.78553 8.125 8.75C8.125 7.71447 8.96447 6.875 10 6.875C11.0355 6.875 11.875 7.71447 11.875 8.75Z","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["width","61","height","60","viewBox","0 0 61 60","fill","none","xmlns","http://www.w3.org/2000/svg"],["x","0.5","y","4","width","56","height","56","rx","28","fill","white","fill-opacity","0.04"],["d","M23.5026 20.333C23.5026 19.0069 24.0294 17.7352 24.9671 16.7975C25.9048 15.8598 27.1765 15.333 28.5026 15.333C29.8287 15.333 31.1005 15.8598 32.0381 16.7975C32.9758 17.7352 33.5026 19.0069 33.5026 20.333V28.6663C33.5027 29.1599 33.4297 29.6508 33.2859 30.123M29.9526 33.4563C29.2054 33.6828 28.4155 33.7311 27.6463 33.5973C26.8771 33.4636 26.1499 33.1516 25.5229 32.6863C24.8959 32.2211 24.3866 31.6154 24.0358 30.9179C23.685 30.2204 23.5024 29.4504 23.5026 28.6697V27.003M16.8359 28.6663C16.8356 30.7719 17.405 32.8383 18.484 34.6465C19.5629 36.4546 21.111 37.9371 22.9642 38.9366C24.8174 39.9362 26.9066 40.4156 29.0102 40.324C31.1137 40.2324 33.1533 39.5732 34.9126 38.4163M38.2459 35.083C39.5023 33.1791 40.1701 30.9474 40.1659 28.6663M21.8359 46.9997H35.1693M28.5026 40.333V46.9997","stroke","white","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["d","M13.5 17L43.5 47","stroke","currentColor","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["x","36.5","width","24","height","24","rx","12","fill","currentColor"],["d","M48.5 18.99V19M48.5 14V5","stroke","white","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["x","0.5","y","4","width","56","height","56","rx","28","fill","black","fill-opacity","0.04"],["d","M23.5026 20.333C23.5026 19.0069 24.0294 17.7352 24.9671 16.7975C25.9048 15.8598 27.1765 15.333 28.5026 15.333C29.8287 15.333 31.1005 15.8598 32.0381 16.7975C32.9758 17.7352 33.5026 19.0069 33.5026 20.333V28.6663C33.5027 29.1599 33.4297 29.6508 33.2859 30.123M29.9526 33.4563C29.2054 33.6828 28.4155 33.7311 27.6463 33.5973C26.8771 33.4636 26.1499 33.1516 25.5229 32.6863C24.8959 32.2211 24.3866 31.6154 24.0358 30.9179C23.685 30.2204 23.5024 29.4504 23.5026 28.6697V27.003M16.8359 28.6663C16.8356 30.7719 17.405 32.8383 18.484 34.6465C19.5629 36.4546 21.111 37.9371 22.9642 38.9366C24.8174 39.9362 26.9066 40.4156 29.0102 40.324C31.1137 40.2324 33.1533 39.5732 34.9126 38.4163M38.2459 35.083C39.5023 33.1791 40.1701 30.9474 40.1659 28.6663M21.8359 46.9997H35.1693M28.5026 40.333V46.9997","stroke","black","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["d","M42.375 39.2135C42.7034 39.1007 42.9883 38.8881 43.19 38.6054C43.3917 38.3227 43.5001 37.9841 43.5 37.6369V26.3635C43.4998 26.0795 43.4271 25.8003 43.2888 25.5523C43.1504 25.3043 42.9509 25.0958 42.7093 24.9465C42.4677 24.7973 42.192 24.7122 41.9083 24.6994C41.6246 24.6867 41.3424 24.7466 41.0883 24.8735L33.5 28.6669V30.3335V25.3333C33.5 24.4493 33.1488 23.6014 32.5237 22.9763C31.8986 22.3512 31.0507 22 30.1667 22H25.1667M33.5 37V38.6667C33.5 39.5507 33.1488 40.3986 32.5237 41.0237C31.8986 41.6488 31.0507 42 30.1667 42H16.8333C15.9493 42 15.1014 41.6488 14.4763 41.0237C13.8512 40.3986 13.5 39.5507 13.5 38.6667V25.3333C13.5 24.4493 13.8512 23.6014 14.4763 22.9763C15.1014 22.3512 15.9493 22 16.8333 22H18.5","stroke","white","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["d","M42.375 39.2135C42.7034 39.1007 42.9883 38.8881 43.19 38.6054C43.3917 38.3227 43.5001 37.9841 43.5 37.6369V26.3635C43.4998 26.0795 43.4271 25.8003 43.2888 25.5523C43.1504 25.3043 42.9509 25.0958 42.7093 24.9465C42.4677 24.7973 42.192 24.7122 41.9083 24.6994C41.6246 24.6867 41.3424 24.7466 41.0883 24.8735L33.5 28.6669V30.3335V25.3333C33.5 24.4493 33.1488 23.6014 32.5237 22.9763C31.8986 22.3512 31.0507 22 30.1667 22H25.1667M33.5 37V38.6667C33.5 39.5507 33.1488 40.3986 32.5237 41.0237C31.8986 41.6488 31.0507 42 30.1667 42H16.8333C15.9493 42 15.1014 41.6488 14.4763 41.0237C13.8512 40.3986 13.5 39.5507 13.5 38.6667V25.3333C13.5 24.4493 13.8512 23.6014 14.4763 22.9763C15.1014 22.3512 15.9493 22 16.8333 22H18.5","stroke","currentColor","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){if(t&1&&(f(0,"div",3,0),C(2,4),p(3,Fqe,26,17,"ng-container",5)(4,Vqe,26,17,"ng-container",5),b(),S()),t&2){let a=Ee(1);g("snippylyOverlay",a)("snippylyOverlayZIndex",3e3),v(2),g("ngSwitch",i.type),v(),g("ngSwitchCase","audio"),v(),g("ngSwitchCase","video")}},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-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)}[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-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-mat-dialog-container.velt-device-permission-denied-dialog--panel mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{padding:0;background-color:transparent;box-shadow:none;overflow:unset}.velt-device-permission-denied-dialog[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-lg);align-items:center;justify-content:center;padding:4rem;box-sizing:border-box;word-break:break-word;max-width:600px;max-height:400px;text-align:center;background-color:var(--velt-background-0);border-radius:var(--velt-border-radius-2xl);box-shadow:0 calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((-3rem + 0px) * var(--velt-base-rem-unit)) #1f2f461f}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--icon[_ngcontent-%COMP%]{color:var(--velt-error)}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--header[_ngcontent-%COMP%]{font-size:var(--velt-font-size-lg);font-weight:600;line-height:36px;letter-spacing:-.02em;text-align:center;color:var(--velt-text-0)}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--content[_ngcontent-%COMP%]{font-size:var(--velt-font-size-sm);font-weight:400;line-height:21px;text-align:center;color:var(--velt-text-0)}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--content[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--page-info-icon[_ngcontent-%COMP%]{margin-left:var(--velt-spacing-sm);margin-right:var(--velt-spacing-sm);color:var(--velt-error)}"],changeDetection:0});let n=o;return n})();var xm=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.matDialog=t,this.audioPermissionState$=new Se(null),this.videoPermissionState$=new Se(null);try{this.loggingService.log("%c[WB] Creating CLASS: DevicePermissionService","color: blue;"),this.checkPermissions()}catch(i){this.loggingService.catch("Error in DevicePermissionService constructor: ",i)}}checkPermissions(){try{this.loggingService.log("%c[WB] Calling DevicePermissionService FUNCTION: checkPermissions","color: green;"),new pr().browserName!=="Firefox"&&(navigator.permissions.query({name:"microphone"}).then(t=>{this.audioPermissionState$.next(t.state),t.onchange=()=>{this.audioPermissionState$.next(t.state)}}).catch(t=>{}),navigator.permissions.query({name:"camera"}).then(t=>{this.videoPermissionState$.next(t.state),t.onchange=()=>{this.videoPermissionState$.next(t.state)}}).catch(t=>{}))}catch(e){this.loggingService.catch("Error in DevicePermissionService checkPermissions: ",e)}}getPermissionState$(e){try{switch(this.loggingService.log("%c[WB] Calling DevicePermissionService FUNCTION: getPermissionState$","color: green;"),e){case"audio":return this.getAudioPermissionState$();case"video":return this.getVideoPermissionState$();default:return ce(null)}}catch(t){return this.loggingService.catch("Error in DevicePermissionService getPermissionState$: ",t),ce(null)}}getAudioPermissionState$(){return this.audioPermissionState$.asObservable()}getVideoPermissionState$(){return this.videoPermissionState$.asObservable()}openDevicePermissionDeniedDialog(e,t){try{this.loggingService.log("%c[WB] Calling DevicePermissionService FUNCTION: openDevicePermissionDeniedDialog","color: green;"),this.matDialog.open(oU,{panelClass:["velt-device-permission-denied-dialog--panel","velt-mat-dialog-container"],backdropClass:["velt-device-permission-denied-dialog--backdrop","s-background-blur-1"],data:h({type:e},t||{})})}catch(i){this.loggingService.catch("Error in DevicePermissionService openDevicePermissionDeniedDialog: ",i)}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(Lo))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Bqe=()=>["video","screen"];function jqe(n,o){if(n&1&&D(0,"app-recording-preview-steps-dialog-video",4),n&2){let r=s(2);g("componentConfigSignal",r.componentConfigSignal)}}function $qe(n,o){if(n&1&&D(0,"app-recording-preview-steps-dialog-audio",4),n&2){let r=s(2);g("componentConfigSignal",r.componentConfigSignal)}}function Gqe(n,o){if(n&1&&(C(0),f(1,"div",2,0),p(3,jqe,1,1,"app-recording-preview-steps-dialog-video",3)(4,$qe,1,1,"app-recording-preview-steps-dialog-audio",3),S(),b()),n&2){let r=o.ngIf,e=Ee(2),t=s();v(),g("snippylyOverlay",e)("snippylyOverlayZIndex",2e3),w("aria-label","Recording preview - "+r.type+" mode")("data-testid",t.componentId),v(2),g("ngIf",xt(6,Bqe).includes(r.type)),v(),g("ngIf",r.type==="audio")}}var iU=(()=>{let o=class o{constructor(e,t,i,a,l,c,d){this.loggingService=e,this.recorderService=t,this.dialog=i,this.devicePermissionService=a,this.dialogRef=l,this.elementRef=c,this.data=d,this.darkMode=!1,this.shadowDom=!0,this.startCountdownFrom=3,this.defaultMediaSourceOptions=cv(),this.recordingCountdownEnabled=!1,this.subscriptions=[],this.veltElement=!0,this.componentId="velt-recording-preview-steps-dialog",this.componentConfigSignal=De({closeDialog:this.closeDialog.bind(this),startCountdown:this.startCountdown.bind(this),toggleAudio:this.toggleAudio.bind(this),toggleVideo:this.toggleVideo.bind(this),toggleSettings:this.toggleSettings.bind(this),cancelCountdown:this.cancelCountdown.bind(this),updateMediaConfig:this.updateMediaConfig.bind(this),handleOverlayClick:this.handleOverlayClick.bind(this),countdownStarted:!1,mediaConfig:{audio:{enabled:!1},video:{enabled:!1}},mediaState:{audio:{enabled:!1},video:{enabled:!1}},type:"video",countdown:this.startCountdownFrom,mediaStream:void 0,isSettingsOpen:!1,darkMode:this.darkMode,shadowDom:this.shadowDom,isExplicitShadowDom:!1});try{this.devicePermissionService.getPermissionState$("video").subscribe(m=>{this.componentConfigSignal.update(u=>(u=y(h({},u),{mediaState:y(h({},u.mediaState),{video:{enabled:m!=="denied"}})}),u))}),this.devicePermissionService.getPermissionState$("audio").subscribe(m=>{this.componentConfigSignal.update(u=>(u=y(h({},u),{mediaState:y(h({},u.mediaState),{audio:{enabled:m!=="denied"}})}),u))}),this.subscriptions.push(this.recorderService.getRecordingCountdownEnabled$().subscribe(m=>{this.recordingCountdownEnabled=m})),this.subscriptions.push(this.recorderService.getRecordingMicEnabled$().subscribe(m=>{m!==null&&(m?this.toggleAudioOn():this.toggleAudioOff())})),d&&(d.type&&this.componentConfigSignal.update(m=>(m=y(h({},m),{type:d.type}),m)),d.recordingCountdown!==void 0&&(this.recordingCountdownEnabled=!!d.recordingCountdown),d.mediaConfig&&(d.mediaConfig?.audio?.enabled&&!d.mediaConfig?.audio?.deviceId&&(d.mediaConfig.audio.deviceId=this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId),d.mediaConfig?.video?.enabled&&!d.mediaConfig?.video?.deviceId&&(d.mediaConfig.video.deviceId=this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId),d?.darkMode?this.elementRef.nativeElement.setAttribute("dark",""):this.elementRef.nativeElement.removeAttribute("dark"),this.componentConfigSignal.update(m=>(m=y(h({},m),{shadowDom:d?.shadowDom!==!1,isExplicitShadowDom:!!d?.isExplicitShadowDom,darkMode:d.darkMode||!1}),m)),this.updateMediaConfig(d.mediaConfig)))}catch(m){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent constructor: ",m)}}ngOnInit(){try{this.setupA11yAttributes(),this.componentConfigSignal().type==="screen"&&this.subscriptions.push(this.recorderService.getScreenStream$().subscribe(e=>{e&&e.active&&e.getVideoTracks().some(t=>t.readyState==="live")&&this.componentConfigSignal.update(t=>(t=h({},t),t.mediaConfig.screen={enabled:!0,stream:e},t))}))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Recording preview steps dialog")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=y(h({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngOnChanges: ",t)}}ngAfterViewInit(){try{this.dialogRef.addPanelClass("snippyly-recording-preview-steps-dialog"),this.dialogRef.disableClose=!0}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngAfterViewInit: ",e)}}toggleSettings(e){try{e.stopPropagation(),this.componentConfigSignal.update(t=>(t=y(h({},t),{isSettingsOpen:!t.isSettingsOpen}),t))}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleSettings: ",t)}}toggleAudio(){try{this.componentConfigSignal().mediaConfig.audio||this.componentConfigSignal.update(i=>(i=y(h({},i),{mediaConfig:y(h({},i.mediaConfig),{audio:{enabled:!0}})}),i));let e=!this.componentConfigSignal().mediaConfig.audio?.enabled;this.componentConfigSignal.update(i=>(i=y(h({},i),{mediaConfig:y(h({},i.mediaConfig),{audio:{enabled:e}})}),i));let t=this.componentConfigSignal().mediaStream?.getAudioTracks()[0];t?t.enabled=e:e&&(this.componentConfigSignal.update(i=>(i=y(h({},i),{mediaConfig:y(h({},i.mediaConfig),{audio:y(h({},i.mediaConfig.audio),{deviceId:this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId})})}),i)),this.updateMediaConfig(this.componentConfigSignal().mediaConfig))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleAudio: ",e)}}toggleAudioOn(){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{mediaConfig:y(h({},t.mediaConfig),{audio:{enabled:!0}})}),t));let e=this.componentConfigSignal().mediaStream?.getAudioTracks()[0];e?e.enabled=!0:(this.componentConfigSignal.update(t=>(t=y(h({},t),{mediaConfig:y(h({},t.mediaConfig),{audio:y(h({},t.mediaConfig.audio),{deviceId:this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId})})}),t)),this.updateMediaConfig(this.componentConfigSignal().mediaConfig))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleAudioOn: ",e)}}toggleAudioOff(){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{mediaConfig:y(h({},t.mediaConfig),{audio:{enabled:!1}})}),t));let e=this.componentConfigSignal().mediaStream?.getAudioTracks()[0];e&&(e.enabled=!1)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleAudioOn: ",e)}}toggleVideo(){try{this.componentConfigSignal.update(e=>(e=h({},e),e.mediaConfig.video||(e.mediaConfig.video={enabled:!0}),e.mediaConfig.video.enabled=!e.mediaConfig.video.enabled,e.mediaConfig.video.deviceId=this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId,e)),this.updateMediaConfig(this.componentConfigSignal().mediaConfig)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleVideo: ",e)}}updateMediaConfig(e){try{this.stopMediaStream(),this.getMediaStream(e)}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent updateMediaConfig: ",t)}}getMediaStream(e){try{if(!navigator.mediaDevices){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream: ","No media devices");return}if(!navigator.mediaDevices.getUserMedia){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream: ","No getUserMedia");return}if(e.audio?.enabled||e.video?.enabled){let t=p_e(e);navigator.mediaDevices.getUserMedia(t).then(i=>{this.componentConfigSignal.update(a=>(a=y(h({},a),{mediaConfig:e,mediaStream:i}),a))}).catch(i=>{this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream catch: ",i)})}else this.componentConfigSignal.update(t=>(t=y(h({},t),{mediaStream:void 0,mediaConfig:e}),t))}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream: ",t)}}stopMediaStream(){try{this.componentConfigSignal.update(e=>(e=h({},e),e.mediaStream?.getTracks().forEach(t=>{t.stop()}),e.mediaStream=void 0,e))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent stopMediaStream: ",e)}}startCountdown(){return X(this,null,function*(){try{let t=new pr().getBrowserName()==="Firefox",i=null;if(t&&this.componentConfigSignal().type==="screen")try{let a=this.componentConfigSignal().mediaConfig,l=p_e(a);Object.keys(l).length>0&&(i=yield navigator.mediaDevices.getUserMedia(l))}catch(a){this.loggingService.catch("Error getting Firefox user media stream:",a),i=null}if(this.componentConfigSignal().type==="screen"){if(!this.componentConfigSignal().mediaConfig.screen?.stream)try{let l=yield navigator.mediaDevices.getDisplayMedia({video:!0,audio:!0});this.componentConfigSignal.update(c=>(c=h({},c),c.mediaConfig.screen={enabled:!0,stream:l},c))}catch(l){this.loggingService.catch("Error getting screen media stream:",l),this.cancelCountdown();return}this.componentConfigSignal.update(l=>(l=h({},l),i&&(l.mediaConfig.audio?.enabled&&(l.mediaConfig.audio.stream=i),l.mediaConfig.video?.enabled&&(l.mediaConfig.video.stream=i)),l)),this.componentConfigSignal().mediaConfig.screen?.stream?.getTracks().forEach(l=>{l&&(l.onended=()=>{this.cancelCountdown()})})}this.recordingCountdownEnabled?(this.componentConfigSignal.update(a=>(a=y(h({},a),{countdownStarted:!0}),a)),this.countdownInterval=setInterval(()=>{this.componentConfigSignal().countdown>1?this.componentConfigSignal.update(a=>(a=y(h({},a),{countdown:a.countdown-1}),a)):this.closeDialog(this.componentConfigSignal().mediaConfig)},1e3)):this.closeDialog(this.componentConfigSignal().mediaConfig)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent startCountdown: ",e)}})}cancelCountdown(){try{if(this.componentConfigSignal.update(e=>(e=y(h({},e),{countdownStarted:!1,countdown:this.startCountdownFrom}),e)),this.clearInterval(),this.componentConfigSignal().type==="screen"){let e=this.componentConfigSignal().mediaConfig.screen?.stream;e&&e.getTracks().forEach(t=>{t.stop()}),this.componentConfigSignal.update(t=>(t=h({},t),t.mediaConfig.screen=void 0,t))}}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent cancelCountdown: ",e)}}closeDialog(e){return X(this,null,function*(){try{this.clearInterval(),e||(this.stopMediaStream(),this.componentConfigSignal.update(t=>(t=h({},t),t.mediaConfig&&(t.mediaConfig.screen?.stream&&(t.mediaConfig.screen.stream.getTracks().forEach(i=>i.stop()),t.mediaConfig.screen.stream=void 0),t.mediaConfig.audio?.stream&&(t.mediaConfig.audio.stream.getTracks().forEach(i=>i.stop()),t.mediaConfig.audio.stream=void 0),t.mediaConfig.video?.stream&&(t.mediaConfig.video.stream.getTracks().forEach(i=>i.stop()),t.mediaConfig.video.stream=void 0)),t))),this.dialogRef.close(e)}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent closeDialog: ",t)}})}handleOverlayClick(e){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{isSettingsOpen:!1}),t)),e.stopPropagation()}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent handleOverlayClick: ",t)}}clearInterval(){try{this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=void 0)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent clearInterval: ",e)}}ngOnDestroy(){try{this.clearInterval(),this.stopMediaStream(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Un),x(Lo),x(xm),x(ji),x(Q),x(rd,8))},o.\u0275cmp=O({type:o,selectors:[["snippyly-recording-preview-steps-dialog"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{darkMode:"darkMode",shadowDom:"shadowDom"},standalone:!1,features:[Qe],decls:1,vars:1,consts:[["recordingPreviewDialogRef",""],[4,"ngIf"],["role","dialog","aria-modal","true",3,"snippylyOverlay","snippylyOverlayZIndex"],[3,"componentConfigSignal",4,"ngIf"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&p(0,Gqe,5,7,"ng-container",1),t&2&&g("ngIf",i.componentConfigSignal())},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-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)}[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-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-mat-dialog-container.snippyly-recording-preview-steps-dialog{max-width:none} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background:transparent;padding:0;margin:0;border-radius:var(--velt-border-radius-lg)}"],changeDetection:0});let n=o;return n})();function p_e(n){try{let o={};return n.audio?.enabled&&(o.audio={deviceId:n.audio.deviceId?{exact:n.audio.deviceId}:void 0}),n.video?.enabled&&(o.video={deviceId:n.video.deviceId?{exact:n.video.deviceId}:void 0}),o}catch{return{}}}var rc=(()=>{let o=class o{constructor(e){this.loggingService=e,this.isPipActive$=new Se(!1),this.pipStopRecordingTriggered$=new Se(!1),this.pipPauseRecordingTriggered$=new Se(!1),this.pictureInPicture$=new Se(!1),this.pipClearRecordingTriggered$=new Se(!1)}getPipClearRecordingTriggered$(){return this.pipClearRecordingTriggered$.asObservable()}resetPipClearRecordingTriggered(){this.pipClearRecordingTriggered$.next(!1)}openPictureInPicture(e,t){return X(this,null,function*(){try{if(!this.isPictureInPictureEnabled()||!e||document.pictureInPictureElement||window.documentPictureInPicture?.window)return;if("documentPictureInPicture"in window){yield this.createDocumentPip(e,t);return}if(document.pictureInPictureEnabled){let i=yield this.findVideoElement();if(!i){this.loggingService.warn("No video element found for Picture-in-Picture");return}yield i.requestPictureInPicture(),this.isPipActive$.next(!0);return}}catch(i){this.loggingService.catch("Error in PipService openPictureInPicture:",i)}})}createDocumentPip(e,t){return X(this,null,function*(){try{let i=window.documentPictureInPicture;this.pipWindow=yield i.requestWindow({width:320,height:288}),yield this.addStylesToPip(),yield this.createControlPanelInPip(e,t),this.pipWindow?.addEventListener("unload",()=>{try{this.isPipActive$.next(!1),this.pipWindow=void 0}catch(a){this.loggingService.catch("Error in PipService createDocumentPip unload:",a)}}),this.isPipActive$.next(!0)}catch{this.isPipActive$.next(!1),this.pipWindow=void 0}})}addStylesToPip(){return X(this,null,function*(){try{if(!this.pipWindow)return;this.pipWindow.document.body.style.margin="0",this.pipWindow.document.body.style.padding="0",this.pipWindow.document.body.style.backgroundColor="#000",this.pipWindow.document.body.style.display="flex",this.pipWindow.document.body.style.alignItems="center",this.pipWindow.document.body.style.justifyContent="center"}catch(e){this.loggingService.catch("Error in PipService copyStylesToPip:",e)}})}createControlPanelInPip(e,t){return X(this,null,function*(){if(this.pipWindow)try{let i=this.pipWindow.document.createElement("div");i.style.cssText=`
|
|
408
|
+
`},o.GIF_PATHS={CAT_JAM:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/emojis%2Fcatjam.gif?alt=media&token=9868b4ec-0031-4751-bb2e-47bf0f9d9583"},o.\u0275fac=function(t){return new(t||o)(K(Ue),K(k),K(Gd))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var vn=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u){this.analyticsService=e,this.authService=t,this.configService=i,this.coreActionsService=a,this.databaseService=l,this.docService=c,this.loggingService=d,this.commonDbService=m,this.usersService=u,this.db=null,this.internalUserContacts$=new Se([]),this.userGlobalContact$=new Se(!1),this.userGroupContact$=new Se(null),this.users$=new Se([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userAccessFields$=new Se({}),this.userOrganizationContacts$=new Se([]),this.userFolderContacts$=new Se([]),this.userDocumentContacts$=new Se([]),this.userOrganizationGroups$=new Se([]),this.onContactSelectedSubject$=new it,this.documentAccessType=null,this.atHereEnabled$=new Se(!1),this.atHereLabel$=new Se("here"),this.atHereDescription$=new Se(null),this.contactListScopeForOrganizationUsers$=new Se([ho.ALL]),this.customUserContacts$=new Se(null),this.customUserContactsConfig$=new Se({merge:!1}),this.currentOrganizationUserIAM$=new Se(null),this.userContacts$=new Se([]),this.userSnippylyIdContacts$=new Se(null),this.usersByOrganizationId$=new Se({}),this.temporaryUserIds$=new Se([]),this.usersByOrganizationIdAndDocumentId$=new Se({}),this.usersByOrganizationIdAndFolderId$=new Se({}),this.userById$=new Se({}),this.searchUsersSubject$=new it,this.searchUsersDebounceTime=300,this.pendingSearchPromises=new Map,this.authService.setContactService(this),this.usersService.setContactService(this),this.authService.getUser$().pipe(ye(_=>this.docService.getDocumentPaths$().pipe(ln(I=>{this.documentPaths=I}),ge(()=>_)))).subscribe(_=>X(this,null,function*(){if(this.user=_,_&&this.documentPaths)if(!_?.organizationId)this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(_),this.setLoggedInUser(_),yield this.moveGlobalContactUserFromEmailToUserIdPath(_),this.updateUserInGlobalContactsIfAvailable(_),_?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(_?.groupId)),this.checkToSetLoggedInUserInGroupContacts();else{let I=this.userPermissionService?.getCurrentUserPermissions(),A=this.documentPaths.folderId,M=!0;A&&I?.[_?.userId]?.folders?.[A]?.errorCode===Co.PERMISSION_DENIED&&(M=!1),this.getOrganizationContactsFromDb$(),M&&this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()}else this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0}),_=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",_)}),this.databaseService.getDb().pipe($e(_=>!!_),ut(1)).subscribe(_=>{_&&(this.db=_)},_=>{this.loggingService.catch("Error in ContactService constructor getDb: ",_)}),this.getOrganizationGroups$().subscribe(_=>{this.authService.setOrganizationUserGroups(_)}),Cn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([_,I,A])=>{I?A?.merge?this.userContacts$.next([..._||[],...I||[]]):this.userContacts$.next(I||[]):this.userContacts$.next(_||[])}),this.getUserContacts$().subscribe(_=>{try{_?.forEach(I=>{let A=I?.userSnippylyId||cd(this.configService.getApiKey(),I.userId);A&&this.userSnippylyIdContacts$.next(y(h({},this.userSnippylyIdContacts$.value),{[A]:I}))})}catch{}})}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in ContactService setCommentService: ",t)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in ContactService setUserPermissionService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.temporaryUserIds$.next([]),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.currentOrganizationUserIAM$.next(null)}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(t){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",t)}}checkIfUserGlobalContact(e){return X(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}return!1}catch(t){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",t),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(y(h({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(t){this.loggingService.catch("Error in ContactService setLoggedInUser: ",t)}}migrateLoggedInUserFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let t=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let i=t;if(i){if(i?.contacts){let a={};Object.keys(i?.contacts??{})?.forEach(l=>{let c=i.contacts[l];if(c?.userId){let d=It(c?.userId);a[d]=c}}),i.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}})}}}}catch(t){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",t)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}getUserAccessFields(){return JSON.parse(JSON.stringify(this.userAccessFields$.value))}getUserAccessFieldsByUserId(e){return this.getUserAccessFields()?.[e]}setUserAccessFields(e){try{let t=this.getUserAccessFields();e.forEach(a=>{t[a.user.userId]=a.accessFields||[]});let i=this.authService.getUser()?.userId;if(i&&t?.[i]?.length){let a=this.userPermissionService?.getCurrentUserPermissions();a&&(a[i]||(a[i]={}),a[i].context={accessFields:t[i]},this.userPermissionService?.setCurrentUserPermissions(a))}this.userAccessFields$.next(JSON.parse(JSON.stringify(t)))}catch(t){this.loggingService.catch("Error in ContactService setUserAccessFields: ",t)}}updateUserInGlobalContactsIfAvailable(e){return X(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let i=new ia;i.userId=e?.userId,i.userSnippylyId=e?.userSnippylyId,i.email=e?.email,i.name=e?.name,i.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))})}}catch(t){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",t)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let i=t;i&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.email),skipFirestore:!0}}))}}}catch(t){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",t)}})}setLoggedInUserPrivateContacts(e,t){try{if(e?.userId&&this.documentPaths?.logins){let i,a=t?.filter(c=>c?.visibility!=="group"),l=!1;this.authService.getUserOptions()&&(l=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(i={},a?.forEach(c=>{if(c?.userId){let d=It(c?.userId);i[d]=c}}),l?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(i))})):l&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:It(e?.userId),skipFirestore:!0}})}}catch(i){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",i)}}migrateGroupContactsFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let t=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});t&&Object.keys(t??{}).forEach(i=>X(this,null,function*(){let a=t[i];a?.email&&a?.userId&&It(a?.email)===i&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:i,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:It(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(t){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",t)}})}checkToSetLoggedInUserInGroupContacts(){return X(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(ut(1)).subscribe(t=>X(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let i=!1,a=this.docService.getDocumentAccessType(t);if(!a||a===Hr.PUBLIC)i=!0;else if(a===Hr.RESTRICTED){let l=It(this.user?.userId);if(t?.users?.[l]&&(i=!0),this.user?.email){let c=It(this.user?.email);t?.users?.[c]&&(i=!0)}}if(i){let l=new Ms;l.email=this.user.email,l.visibility="group",l.name=this.user.name,l.photoUrl=this.user.photoUrl,l.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[l]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,t){try{let i=t?.filter(a=>a?.visibility==="group");i?.length&&i.forEach(a=>X(this,null,function*(){if(a?.userId&&e&&this.documentPaths?.groupContacts){if(this.configService?.getSF()&&(yield this.checkIfUserGlobalContact(a)))return;yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:It(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}),a?.email&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:It(a?.email),skipFirestore:!0}}))}}))}catch(i){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",i)}}removeGroupContacts(e){return X(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e)return this.commonDbService.deleteData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}})}catch(t){this.loggingService.catch("Error in ContactService removeGroupContacts: ",t)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let t={};e.forEach(i=>{i?.userId?(!i?.email||!t[i.email])&&(t[i.userId]=i):i?.email&&(!i?.userId||!t[i.userId])&&(t[i.email]=i)}),e=Object.values(t??{}),this.internalUserContacts$.next(e)}catch(e){this.loggingService.catch("Error in ContactService mergeUserContacts: ",e)}}getInternalUserContacts(){return this.internalUserContacts$.value}getInternalUserContacts$(){return this.internalUserContacts$.asObservable()}getUserContacts$(e){try{let{organizationId:t,documentId:i,veltFolderId:a}=e||{};return t&&i?Cn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(ge(([l,c,d,m,u,_,I,A])=>{let M={},B=!1;_&&!_?.merge&&(B=!0);let q=Ie=>I.some(Ce=>Ie.includes(Ce)),ae=q([ho.ALL,ho.ORGANIZATION])?Object.keys(l?.[t]||{}):[],_e=a?q([ho.ALL,ho.FOLDER])?Object.keys(c?.[t]?.[a]||{}):[]:[],re=q([ho.ALL,ho.DOCUMENT])?Object.keys(d?.[t]?.[i]||{}):[];if([...ae,..._e||[],...re,...A].forEach(Ie=>{let Ce=m?.[Ie];Ce&&(M[Ie]=Ce)}),u){let{merge:Ie,options:Ce}=_||{},{organizationId:Te,documentId:Oe,folderId:Me}=Ce||{},Be=Me?Nr(Me):void 0;(!Te||Te===t)&&(!Oe||Oe===i)&&(!Be||Be===a)&&(Ie||(M={}),u.forEach(We=>{We?.userId&&(M[We.userId]=We)}))}return Object.values(M??{})})):this.userContacts$.asObservable().pipe(ge(l=>l))}catch(t){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",t),ce([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getUserBySnippylyId(e){return this.userSnippylyIdContacts$.value?.[e]}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe($e(e=>!!e),ye(e=>this.docService.getDocumentPaths$().pipe($e(t=>!!t),ln(t=>{this.documentPaths=t}),ge(()=>e))),ye(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return ce();if(!this.documentPaths)return ce();let t=[];return t.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(i=>i?.data),ln(i=>{i?(this.userGlobalContacts=Object.values(i??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(ge(i=>i?.data),ln(i=>{i?(this.userGroupContacts=Object.values(i??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:It(e?.userId)}}).pipe(ge(i=>i?.data),ln(i=>{i?this.userPersonalContacts=Object.values(i??{}):this.userPersonalContacts=[]}))),No(...t).pipe(zo(this.authService.getUser$().pipe($e(i=>!i))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(t){this.loggingService.catch("Error in ContactService addUserContact: ",t)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable().pipe(_t(Kt))}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(ye(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(t=>t?.data),ln(t=>{t?this.users=Object.values(t??{}):this.users=[]})):(this.users=[],ce()):ce():ce())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(ye(e=>e?.organizationId?this.userById$.pipe(ge(t=>{let i={};return Object.values(t||{}).forEach(a=>{a?.userSnippylyId&&(i[a?.userSnippylyId]=a)}),i})):this.users$.pipe(ge(t=>{let i={};return t.forEach(a=>{i[a.userSnippylyId]=a}),i}))))}getUserByEmail$(e){return this.users$.pipe(ge(t=>t.find(i=>i.email===e)))}getUserByEmail(e){return this.users?.find(t=>t.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(t=>t.email===e)}getUserByUserId$(e){return this.users$.pipe(ge(t=>t.find(i=>i.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getTemporaryUsers(){try{let e=this.authService.getUser();this.docService.getOrganizationConfig$().pipe($e(t=>!!t),ge(t=>t?.organizationId)).subscribe(t=>X(this,null,function*(){if(t&&e){let i=((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ft("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(i?.length){let a=i.map(m=>m?.userId),l=at(),c=Os.GET_TEMPORARY_USERS;this.coreActionsService.triggerAction(tt.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:l,moduleName:c,methodName:gi.GET_TEMPORARY_USERS,source:"internal",payload:{userIds:a}});let d=yield this.usersService.resolveUsers({userIds:a,uniqueId:l,moduleName:c});if(d){let m={};Object.entries(d).forEach(([_,I])=>{m[_]=I}),this.userById$.next(h(h({},this.userById$.value),m));let u=new Set([...this.temporaryUserIds$.value,...Object.keys(m)]);this.temporaryUserIds$.next(Array.from(u))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}searchUsers(e){return X(this,null,function*(){try{if(!e||typeof e!="string"||!e.trim())return[];let t=e.trim();return this.searchUsersDebounced$||(this.searchUsersDebounced$=this.searchUsersSubject$.pipe(Qr(this.searchUsersDebounceTime),_t(),ye(i=>Eo(this.performSearch(i)).pipe(ge(a=>({searchText:i,results:a})),Jn(a=>(this.loggingService.catch("Error in ContactService performSearch: ",a),ce({searchText:i,results:[]})))))),this.searchUsersDebounced$.subscribe({next:({searchText:i,results:a})=>{Array.from(this.pendingSearchPromises.keys()).forEach(d=>{if(d!==i){let m=this.pendingSearchPromises.get(d);m&&(m.forEach(({resolve:u})=>u([])),this.pendingSearchPromises.delete(d))}});let c=this.pendingSearchPromises.get(i);c&&(c.forEach(({resolve:d})=>d(a)),this.pendingSearchPromises.delete(i))},error:i=>{this.pendingSearchPromises.forEach(a=>{a.forEach(({reject:l})=>l(i))}),this.pendingSearchPromises.clear()}})),new Promise((i,a)=>{this.pendingSearchPromises.has(t)||this.pendingSearchPromises.set(t,[]),this.pendingSearchPromises.get(t).push({resolve:i,reject:a}),this.searchUsersSubject$.next(t)})}catch(t){return this.loggingService.catch("Error in ContactService searchUsers: ",t),[]}})}performSearch(e){return X(this,null,function*(){try{let t=this.docService.getOrganizationConfig()?.organizationId;if(!t)return[];let i=this.documentPaths?.veltFolderId,a=this.docService.getDocumentIds().map(q=>q?.documentId),l=e.toLowerCase().trim(),c=l+"\uF8FF",d=[],m=a?.filter(q=>!!q)||[],u=m.length>0,_=!!i;if(u){let q=[];for(let _e=0;_e<m.length;_e+=20)q.push(m.slice(_e,_e+20));q.forEach(_e=>{let re=[ft("documentIds","array-contains-any",_e),ft("viewerDocumentIds","array-contains-any",_e)],be=[ft("organizationIds","array-contains-any",[t]),ft("viewerOrganizationIds","array-contains-any",[t]),...re];_&&be.push(ft("folderIds","array-contains-any",[i]),ft("viewerFolderIds","array-contains-any",[i])),d.push(this.commonDbService.queryData({feature:"allDocumentUsers",properties:{organizationId:t,isCollection:!0,useCollectionGroup:!1,useQuery:!0,firestoreQuery:[Sr(q0(...be),ft("user.name_lowercase",">=",l),ft("user.name_lowercase","<",c)),Cm(10)]}}).catch(()=>[])),d.push(this.commonDbService.queryData({feature:"allDocumentUsers",properties:{organizationId:t,isCollection:!0,useCollectionGroup:!1,useQuery:!0,firestoreQuery:[Sr(q0(...be),ft("user.email_lowercase",">=",l),ft("user.email_lowercase","<",c)),Cm(10)]}}).catch(()=>[]))})}let I=yield Promise.all(d),A=[];I.forEach(q=>{q&&Array.isArray(q)?q.forEach(ae=>{ae&&ae.user&&ae.user.userId&&A.push(ae)}):q&&typeof q=="object"&&Object.values(q).forEach(_e=>{_e&&_e.user&&_e.user.userId&&A.push(_e)})});let M=new Map;A.forEach(q=>{let ae=q.user?.userId;ae&&!M.has(ae)&&M.set(ae,q)});let B=Array.from(M.values());return this.setResolvedUsers(B,!0),B}catch(t){return this.loggingService.catch("Error in ContactService performSearch: ",t),[]}})}setResolvedUsers(e,t=!1){try{if(e?.length){let i=[],a=[],l=[],c=this.docService.getOrganizationConfig()?.organizationId,d=this.documentPaths?.veltFolderId,m=this.docService.getDocumentIds().map(I=>I?.documentId);e.forEach(I=>{this.userById$.value[I?.user?.userId]||(c&&I?.organizationIds?.includes(c)&&!i.find(A=>A?.user?.userId===I?.user?.userId)&&i.push(I),d&&I?.folderIds?.includes(d)&&!a.find(A=>A?.user?.userId===I?.user?.userId)&&a.push(I),m?.some(A=>I?.documentIds?.includes(A))&&!l.find(A=>A?.user?.userId===I?.user?.userId)&&l.push(I))}),i?.length&&this.setUserOrganizationContacts(i,c,t),a?.length&&this.setUserFolderContacts(a,t),l?.length&&this.setUserDocumentContacts(l,t);let _=[...i,...a,...l].filter((I,A,M)=>A===M.findIndex(B=>B.user.userId===I.user.userId));_?.length&&(this.setUserAccessFields(_),this.mergeOrganizationAndDocumentContacts())}}catch(i){this.loggingService.catch("Error in ContactService setResolvedUsers: ",i)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(ye(e=>e?.organizationId?ce(e).pipe(ye(t=>this.docService.getOrganizationConfig$().pipe($e(i=>!!i),ge(()=>t))),ye(t=>this.usersService.getResolveOrganizationUsers$().pipe($e(i=>i),ge(()=>t))),ye(t=>{let i=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],i),t?i?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:i,isCollection:!0,useQuery:!0,firestoreQuery:[Sr(q0(ft("organizationIds","array-contains-any",[i]),ft("viewerOrganizationIds","array-contains-any",[i]))),mo("id"),...this.commentService?.getPaginatedContactList()?[Cm(10)]:[]]}}).pipe(ge(a=>a?.data),ye(a=>this.commentService?.getPaginatedContactList()&&!Object.values(a??{}).find(l=>l?.user?.userId===this.authService.getUser()?.userId)?Eo(this.commonDbService.queryData({feature:"allOrganizationUsers",properties:{organizationId:i,isCollection:!0,useQuery:!0,firestoreQuery:[Sr(q0(ft("organizationIds","array-contains-any",[i]),ft("viewerOrganizationIds","array-contains-any",[i])),ft("user.userId","==",this.authService.getUser()?.userId))]}})).pipe(ge(l=>{if(l&&l.length>0){let c=l[0],d=c?.user?.userId||c?.id;if(d&&a){let m=It(d);return y(h({},a),{[m]:c})}}return a})):ce(a)),ge(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let l=Object.values(a??{});this.setUserAccessFields(l),this.setUserOrganizationContacts(l,i)}else this.setUserOrganizationContacts([],i)})):ce():ce()}),ye(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(ye(e=>e?ce(e).pipe(ye(t=>this.docService.getOrganizationConfig$().pipe($e(i=>!!i),ge(()=>t))),ye(t=>this.usersService.getResolveFolderUsers$().pipe($e(i=>i),ge(()=>t))),ye(t=>{let i=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!t)return ce();if(!this.commonDbService.shouldUseFirestore())return ce();if(!this.documentPaths?.veltFolderId)return ce();let a=ce([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:i,folderId:this.documentPaths?.veltFolderId,isCollection:!0,useQuery:!0,firestoreQuery:[Sr(q0(ft("folderIds","array-contains-any",[this.documentPaths?.veltFolderId]),ft("viewerFolderIds","array-contains-any",[this.documentPaths?.veltFolderId]))),mo("id"),...this.commentService?.getPaginatedContactList()?[Cm(10)]:[]]}}).pipe(ge(l=>l?.data)),a.pipe(ge(l=>{if(l){typeof l=="object"&&(l?.undefined&&delete l.undefined,l?.null&&delete l.null);let c=Object.values(l??{});this.setUserAccessFields(c),this.setUserFolderContacts(c)}else this.setUserFolderContacts([])}))}),ye(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(ye(e=>e?ce(e).pipe(ye(t=>this.docService.getDocumentPaths$().pipe($e(i=>!!i),ln(i=>{this.documentPaths=i}),ge(()=>t))),ye(t=>this.usersService.getResolveDocumentUsers$().pipe($e(i=>i),ge(()=>t))),ye(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(ye(i=>{let a=i?.length>0?i.map(m=>m.documentId):[this.documentPaths?.documentId??""];if(a.some(m=>!m)||!this.documentPaths)return ce();let l=ce([]),c={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(c.documentId=a?.length?a[0]:void 0,c.organizationId=this.documentPaths?.organizationId);let d=[];for(let m=0;m<a.length;m+=N.LISTENER_BATCH_SIZE)d.push(a.slice(m,m+N.LISTENER_BATCH_SIZE));return l=Cn(d.map(m=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:y(h({},c),{firestoreQuery:[Sr(q0(ft("documentIds","array-contains-any",m),ft("viewerDocumentIds","array-contains-any",m))),mo("id"),...this.commentService?.getPaginatedContactList()?[Cm(10)]:[]]})}).pipe(sa()))).pipe(ge(m=>Na(m)?.data)),l.pipe(ge(m=>{if(m){typeof m=="object"&&(m?.undefined&&delete m.undefined,m?.null&&delete m.null);let u=Object.values(m??{});this.setUserAccessFields(u),this.setUserDocumentContacts(u)}else this.setUserDocumentContacts([])}))})):ce():ce())),ye(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,t,i=!0){try{let a=e.find(c=>c.user.userId===this.user?.userId);a&&this.setCurrentOrganizationUserIAM(a);let l=e.map(c=>c.user)?.filter(c=>!this.userOrganizationContacts$.value.find(d=>d.userId===c.userId));if(this.userOrganizationContacts$.next([...this.userOrganizationContacts$.value,...l]),i&&this.usersService.setUserByIds(l),t){let c={};c[t]={};let d={};e.forEach(u=>{c[t][u.user.userId]=u,d[u.user.userId]=u.user}),this.userById$.next(h(h({},this.userById$.value),d));let m=this.usersByOrganizationId$.value?.[t];m&&(c[t]=h(h({},m),c[t])),this.usersByOrganizationId$.next(y(h({},this.usersByOrganizationId$.value),{[t]:c[t]}))}else this.usersByOrganizationId$.next({})}catch(a){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",a)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.ORGANIZATION])?this.userOrganizationContacts$.asObservable():ce([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e,t=!0){try{let i=e?.map(d=>d?.user)?.filter(d=>!this.userFolderContacts$.value.find(m=>m.userId===d.userId));this.userFolderContacts$.next([...this.userFolderContacts$.value,...i]),t&&this.usersService.setUserByIds(i);let a=this.usersByOrganizationIdAndFolderId$.value||{},l=h({},a),c={};e?.forEach(d=>{let{organizationId:m}=d?.metadata||{};m&&(l[m]||(l[m]={}),d.folderIds?.forEach(u=>{l[m][u]||(l[m][u]={}),l[m][u]=y(h({},l[m][u]),{[d.user.userId]:d}),c[d.user.userId]=d.user}))}),this.userById$.next(h(h({},this.userById$.value),c)),this.usersByOrganizationIdAndFolderId$.next(l)}catch(i){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",i)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.FOLDER])?this.userFolderContacts$.asObservable():ce([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e,t=!0){try{let i=e?.map(d=>d?.user)?.filter(d=>!this.userDocumentContacts$.value.find(m=>m.userId===d.userId));this.userDocumentContacts$.next([...this.userDocumentContacts$.value,...i]),t&&this.usersService.setUserByIds(i);let a=this.usersByOrganizationIdAndDocumentId$.value||{},l=h({},a),c={};e?.forEach(d=>{let{organizationId:m}=d?.metadata||{};m&&(l[m]||(l[m]={}),d.documentIds?.forEach(u=>{l[m][u]||(l[m][u]={}),l[m][u]=y(h({},l[m][u]),{[d.user.userId]:d}),c[d.user.userId]=d.user}))}),this.userById$.next(h(h({},this.userById$.value),c)),this.usersByOrganizationIdAndDocumentId$.next(l)}catch(i){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",i)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.DOCUMENT])?this.userDocumentContacts$.asObservable():ce([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.DOCUMENT])?this.userDocumentContacts$.value:[]}setCurrentOrganizationUserIAM(e){try{this.currentOrganizationUserIAM$.next(JSON.parse(JSON.stringify(e)))}catch(t){this.loggingService.catch("Error in ContactService setCurrentOrganizationUserIAM: ",t)}}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable().pipe(_t(Kt))}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{this.mergeContactsDebounceTimer&&clearTimeout(this.mergeContactsDebounceTimer),this.mergeContactsDebounceTimer=setTimeout(()=>{this.executeMergeContacts()},200)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}executeMergeContacts(){try{let e=this.getContactListScopeForOrganizationUsers(),t=[];e.includes(ho.ALL)?t=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:e.includes(ho.ORGANIZATION)?t=[...this.getUserOrganizationContacts()]:e.includes(ho.FOLDER)?t=[...this.getUserFolderContacts()]:e.includes(ho.DOCUMENT)&&(t=[...this.getUserDocumentContacts()]);let i=[...new Map(t.filter(a=>a?.userId).map(a=>[a.userId,a])).values()];this.internalUserContacts$.next(i)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(ye(e=>e?.organizationId?ce(e).pipe(ye(t=>this.docService.getOrganizationConfig$().pipe($e(i=>!!i),ge(()=>t))),ye(t=>{if(this.setUserOrganizationGroups([]),!t)return ce();let i=this.docService.getOrganizationConfig()?.organizationId;return i?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:i,isCollection:!0}}).pipe(ge(a=>a?.data),ge(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):ce()})):(this.setUserOrganizationGroups([]),ce()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",t)}}onContactSelected(e){try{if(e?.userId){let t=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),i=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case Hr.RESTRICTED:if(!t){let a={contact:e,isOrganizationContact:i,isDocumentContact:t,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let t={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(t)}}catch(t){this.loggingService.catch("Error in ContactService onContactSelected: ",t)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():ce([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:je.COMMENT,config:{atHereEnabled:!0}}),this.atHereEnabled$.value===!0)return;this.atHereEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ContactService enableAtHere: ",e)}}setAtHereLabel(e){try{this.analyticsService.setFeatureConfig({feature:je.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereLabel: ",t)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:je.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereDescription: ",t)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:je.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(ye(()=>this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.DOCUMENT])?this.atHereEnabled$.asObservable():ce(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([ho.ALL,ho.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(t){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",t)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(t=>e.includes(t))}updateContactList(e,t){return X(this,null,function*(){try{this.analyticsService.trackEvent(Y.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService.setUserByIds(e),this.customUserContacts$.next(e),this.customUserContactsConfig$.next(t)}catch(i){this.loggingService.catch("Error in CommentService updateContactList: ",i)}})}convert(e){try{if(e?.options){let{documentId:t,organizationId:i}=this.docService.getServerId(e?.options);e.options=y(h({},e?.options),{documentId:t,organizationId:i})}return this}catch(t){return this.loggingService.catch("Error in ContactService convert: ",t),this}}getContactList$(){try{return this.authService.getUser$().pipe(ye(e=>e?Cn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(ge(([t,i,a,l,c])=>{let d={};d.organizationUsers=t?.map(u=>this.convertToClientUser(u)),d.folderUsers=i?.map(u=>this.convertToClientUser(u)),d.documentUsers=a?.map(u=>this.convertToClientUser(u)),d.updatedContactList=c?.map(u=>this.convertToClientUser(u));let m=[];return l?.forEach(u=>{let _=this.convertToClientUserGroup(u,d.organizationUsers||[]);_&&m.push(_)}),d.userGroups=m,d}),_t(Kt)):ce(null)),Jn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),ce(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),ce(null)}}convertToClientUserGroup(e,t){try{let i={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return t?.forEach(l=>{if(l?.userId){let c=It(l.userId);a[c]=l}}),Object.keys(e?.users??{}).forEach(l=>{a[l]&&i.users?.push(a[l])}),i}catch(i){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",i),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(t){return this.loggingService.catch("Error in ContactService convertToClientUser: ",t),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(qe),K(Ft),K(nr),K($n),K(st),K(k),K(yn),K(An))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Vn=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m){this.analyticsService=e,this.authService=t,this.contactService=i,this.databaseService=a,this.docService=l,this.configService=c,this.loggingService=d,this.commonDbService=m,this.documentIAM$=new Se(null),this.workspaceIAM$=new Se(null),this.roles$=new Se([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe($e(u=>!!u),ut(1)).subscribe(u=>{u&&(this.getUser(),this.getDocumentPaths())},u=>{this.loggingService.catch("Error in CommentService getDb subscription: ",u)}),this.getRole$().pipe(ut(1)).subscribe(u=>{this.authService?.getUser()&&!u&&this.analyticsService.trackEvent(Y.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(u=>{u?.accessType&&this.contactService.setDocumentAccessType(u.accessType)})}catch(u){this.loggingService.catch("Error in IamService constructor: ",u)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe($e(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe($e(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new AL;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(Jn(e=>ce(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(ge(e=>!!e),_t())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(ge(e=>e?.length?e:N.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(ge(e=>e?.features),ye(e=>this.getRole$().pipe(ge(t=>(t===Uo.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(ye(()=>this.documentIAM$.pipe($e(t=>!!t),ye(()=>this.workspaceIAM$.pipe(ge(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),ce(!1)}}getRole$(){try{return this.authService.getUser$().pipe(ye(()=>this.configService.getSF$()),ye(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():ce(null)),ye(()=>this.configService.getSF()?this.documentIAM$.pipe($e(e=>!!e),_t(Kt)):ce(null)),ye(()=>this.workspaceIAM$.pipe(_t(Kt))),ge(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),ce(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return Uo.ADMIN;if(!e)return this.user?.isAdmin?Uo.ADMIN:Uo.COMMENTER;let t=null,i;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?Hr.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||Hr.PUBLIC:null){case Hr.PUBLIC:i=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),i||(i=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=i?.role?.name||Uo.COMMENTER;break;case Hr.RESTRICTED:i=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),i||(i=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=i?.role?.name||null;break;default:break}return t}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(ge(e=>e===Uo.ADMIN),_t())}isUserAdmin(){try{return this.getRole()===Uo.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let i;return e&&(i=this.documentIAM$.value?.users?.[It(e)]),!i&&t&&(i=this.documentIAM$.value?.users?.[It(t)]),i}else return}catch(i){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",i)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let i;return e&&(i=this.workspaceIAM$.value?.users?.[It(e)]),!i&&t&&(i=this.workspaceIAM$.value?.users?.[It(t)]),i}else return}catch(i){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",i)}}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(qe),K(vn),K($n),K(st),K(Ft),K(k),K(yn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var tU="public",al=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_){this.authService=e,this.docService=t,this.loggingService=i,this.commonDbService=a,this.usersService=l,this.commentUtilsService=c,this.coreActionsService=d,this.functions=m,this.configService=u,this.contactService=_,this.currentUserPermissions$=new Se(null),this.permissionsCache$=new Se(null),this.permissionProvider$=new Se(null),this.REVOKE_DELAY_MS=3e3,this.pendingRevokeRequests=new Map,this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="";try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(I){this.loggingService.catch("Error in UserPermissionService constructor:",I)}}ngOnDestroy(){try{this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(e){this.loggingService.catch("Error in UserPermissionService ngOnDestroy:",e)}}collectRevokeRequest(e,t,i,a,l,c){try{return e.find(m=>m.resourceId===i&&m.type===a&&m.organizationId===l&&m.userId===c)?(t.push({userId:c,resourceId:i,organizationId:l,type:a,hasAccess:!1}),e.filter(m=>!(m.resourceId===i&&m.type===a&&m.organizationId===l&&m.userId===c))):e}catch(d){return this.loggingService.catch("Error in UsersPermissionService collectRevokeRequest:",d),e}}hasUserContextAccess({userId:e,accessFields:t}){try{if(!this.getIsContextEnabled()||t.includes(N.DEFAULT_VELT_CONTEXT))return!0;let i=this.contactService.getUserAccessFieldsByUserId(e);return i?t.every(a=>i.includes(a)):!0}catch(i){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",i),!1}}organizationDetails(e){return X(this,null,function*(){try{let t=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e}});return t&&t?.errorCode?{errorCode:Co.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:Co.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(t){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",t),{errorCode:Co.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(i){return X(this,arguments,function*({documentId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:t}});if(a&&a?.errorCode)return{errorCode:Co.PERMISSION_DENIED,error:!0};if(a&&!a?.metadata)return{errorCode:Co.DOES_NOT_EXIST,error:!0};let l=this.docService.getDocumentMetadata(e)??{};this.docService.setDocumentMetadata(e,h(h({},l),a?.metadata??{}));let c,d=a?.metadata?.veltFolderId;if(d)try{c=(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:d,organizationId:t}}))?.folderIamConfig?.accessType}catch(m){this.loggingService.catch("Error fetching folder accessType for document:",m)}return c||(c=a?.docIamConfig?.accessType),{error:!1,accessType:c}}catch(a){return this.loggingService.catch("Error in UserPermissionService documentDetails:",a),{errorCode:Co.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(i){return X(this,arguments,function*({folderId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:t}});return a&&a?.errorCode?{errorCode:Co.PERMISSION_DENIED,error:!0}:a&&!a?.metadata?{errorCode:Co.DOES_NOT_EXIST,error:!0}:{error:!1,accessType:a?.folderIamConfig?.accessType}}catch(a){return this.loggingService.catch("Error in UserPermissionService folderDetails:",a),{errorCode:Co.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let i=yield this.validateResources(t),[a,l]=yield this.fetchUserPermissionsFromDB(t),c=this.buildPermissionsResponse(t,i,a,l);return!e&&Object.keys(c).length>0&&this.setCurrentUserPermissions(c),c}catch(t){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",t),{}}})}extractResourceIds(e){let t=this.docService.getDocumentPaths(),i=this.docService.getDocumentIds();return{folderIds:e?.folderIds?.length?e.folderIds:t?.folderId?[t.folderId]:[],documentIds:e?.documentIds?.length?e.documentIds:i.map(a=>a.clientDocumentId),clientOrganizationId:e?.organizationId??t?.clientOrganizationId,organizationId:e?.organizationId??t?.clientOrganizationId?Ra(e?.organizationId??t?.clientOrganizationId??""):void 0}}validateResources(e){return X(this,null,function*(){let{folderIds:t,documentIds:i,organizationId:a,clientOrganizationId:l}=e,c=[],d=[];a&&(c.push(this.organizationDetails(a)),d.push({id:l??"",type:"organization"})),t.forEach(_=>{c.push(this.folderDetails({folderId:Nr(_),organizationId:a??""})),d.push({id:_,type:"folder"})}),i.forEach(_=>{c.push(this.documentDetails({documentId:vi(_),organizationId:a??""})),d.push({id:_,type:"document"})});let[m,u]=yield Promise.all([Promise.allSettled(c),this.getDefaultDocumentAccessType()]);return y(h({},this.processValidationResults(m,d)),{defaultDocumentAccessType:u})})}getDefaultDocumentAccessType(){return X(this,null,function*(){try{return(yield this.commonDbService?.getData({feature:"apiKeyMetadata",properties:{}}))?.defaultDocumentAccessType}catch(e){this.loggingService.catch("Error fetching defaultDocumentAccessType:",e);return}})}processValidationResults(e,t){let i=[],a=[],l,c={},d={};for(let m=0;m<e.length;m++){let u=e[m],_=t[m];if(u.status==="rejected"||u.status==="fulfilled"&&u.value.error){let A=u.status==="fulfilled"?u.value.errorCode??Co.SOMETHING_WENT_WRONG:Co.SOMETHING_WENT_WRONG,M={id:_.id,errorCode:A};switch(_.type){case"organization":if(l=M,A===Co.DOES_NOT_EXIST)throw new Error(`Organization with id '${_.id}' does not exist`);break;case"folder":i.push(M);break;case"document":a.push(M);break}}else if(u.status==="fulfilled")switch(_.type){case"folder":u.value.accessType&&(c[_.id]=u.value.accessType);break;case"document":u.value.accessType&&(d[_.id]=u.value.accessType);break}}return{failedFolderIds:i,failedDocumentIds:a,failedOrganizationId:l,folderAccessTypes:c,documentAccessTypes:d}}fetchUserPermissionsFromDB(e){return X(this,null,function*(){let{folderIds:t,documentIds:i,organizationId:a}=e,l=[this.authService.getUser()?.userId??""],c=[...t.map(u=>Nr(u)),...i.map(u=>vi(u)),a??""],[d,m]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:l,organizationId:a}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:l,organizationId:a,resourceIds:c})]);return[d.status==="fulfilled"?d.value:[],m.status==="fulfilled"?m.value:[]]})}buildPermissionsResponse(e,t,i,a){let{folderIds:l,documentIds:c,clientOrganizationId:d,organizationId:m}=e,{failedFolderIds:u,failedDocumentIds:_,failedOrganizationId:I}=t,A={};return this.processRegularUserPermissions(A,i,l,c,d??"",m??"",u,_,I,t.folderAccessTypes,t.documentAccessTypes,t.defaultDocumentAccessType),this.processTemporaryUserPermissions(A,a),this.processContextPermissions(A),A}processContextPermissions(e){try{let t=this.authService.getUser()?.userId;if(t){let i=this.contactService.getUserAccessFieldsByUserId(t);i?.length&&(e[t]||(e[t]={}),e[t].context={accessFields:i})}}catch(t){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",t);return}}processRegularUserPermissions(e,t,i,a,l,c,d,m,u,_,I,A){for(let M of t)for(let B of M)B?.user?.userId&&(e[B.user.userId]=y(h({},i.length&&{folders:this.buildFolderPermissions(i,B,d,_,A)}),{documents:this.buildDocumentPermissions(a,B,m,I,A),organization:{[l]:this.buildOrganizationPermission(c,B,u)}}))}getErrorMessage(e,t){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${t}`),e){case Co.DOES_NOT_EXIST:return`${t} does not exist`;case Co.PERMISSION_DENIED:return`User does not have access to ${t}`;case Co.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(i){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",i),"Something went wrong"}}buildFolderPermissions(e,t,i,a,l){return e.reduce((c,d)=>{let m=i.find(u=>u.id===d);return m?c[d]=h({error:this.getErrorMessage(m.errorCode,"folder"),errorCode:m.errorCode},m.errorCode===Co.PERMISSION_DENIED&&{accessType:a[d]??l??tU}):c[d]={accessRole:t.viewerFolderIds?.includes(Nr(d))?Zc.VIEWER:Zc.EDITOR,accessType:a[d]??l??tU},c},{})}buildDocumentPermissions(e,t,i,a,l){return e.reduce((c,d)=>{let m=i.find(u=>u.id===d);return m?c[d]=h({error:this.getErrorMessage(m.errorCode,"document"),errorCode:m.errorCode},m.errorCode===Co.PERMISSION_DENIED&&{accessType:a[d]??l??tU}):c[d]={accessRole:t.viewerDocumentIds?.includes(vi(d))?Zc.VIEWER:Zc.EDITOR,accessType:a[d]??l??tU},c},{})}buildOrganizationPermission(e,t,i){return i?{error:this.getErrorMessage(i.errorCode,"organization"),errorCode:i.errorCode}:{accessRole:t.viewerOrganizationIds?.includes(e)?Zc.VIEWER:Zc.EDITOR}}processTemporaryUserPermissions(e,t){for(let i of t)if(i?.userId)switch(this.ensureUserPermissionStructure(e,i.userId),i.type){case"folder":this.addTemporaryFolderPermission(e,i);break;case"document":this.addTemporaryDocumentPermission(e,i);break;case"organization":this.addTemporaryOrganizationPermission(e,i);break}}ensureUserPermissionStructure(e,t){e[t]||(e[t]={})}addTemporaryFolderPermission(e,t){let{userId:i,resourceId:a,role:l,expiresAt:c}=t;e[i].folders||(e[i].folders={}),e[i].folders[a]||(e[i].folders[a]={accessRole:l??Zc.EDITOR,expiresAt:c})}addTemporaryDocumentPermission(e,t){let{userId:i,resourceId:a,role:l,expiresAt:c}=t;e[i].documents||(e[i].documents={}),e[i].documents[a]={accessRole:l??Zc.EDITOR,expiresAt:c}}addTemporaryOrganizationPermission(e,t){let{userId:i,resourceId:a,role:l,expiresAt:c}=t;e[i].organization||(e[i].organization={}),e[i].organization[a]={accessRole:l??Zc.EDITOR,expiresAt:c}}hasEditAccess({organizationId:e,folderId:t,documentId:i}){try{let a=!0,l=this.getCurrentUserPermissionsWithServerIds(),c=this.authService.getUser()?.userId??"";return l&&(e&&typeof e=="string"&&l?.[c]?.organization?.[e]&&(l?.[c]?.organization?.[e]?.accessRole===Zc.VIEWER||l?.[c]?.organization?.[e]?.errorCode===Co.PERMISSION_DENIED)&&(a=!1),t&&typeof t=="string"&&l?.[c]?.folders?.[t]&&(l?.[c]?.folders?.[t]?.accessRole===Zc.VIEWER||l?.[c]?.folders?.[t]?.errorCode===Co.PERMISSION_DENIED)&&(a=!1),i&&typeof i=="string"&&l?.[c]?.documents?.[i]&&(l?.[c]?.documents?.[i]?.accessRole===Zc.VIEWER||l?.[c]?.documents?.[i]?.errorCode===Co.PERMISSION_DENIED)&&(a=!1)),a}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(_t(Kt))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let t=JSON.parse(JSON.stringify(e??{})),i=this.authService.getUser()?.userId??"";if(t?.[i]){let a=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(t?.[i]?.organization?.[a]){let l=Ra(a);t[i].organization&&(t[i].organization[l]=t[i].organization[a],delete t[i].organization[a])}t?.[i]?.folders&&(t[i].folders=Object.fromEntries(Object.entries(t?.[i]?.folders??{}).map(([l,c])=>[Nr(l),c]))),t?.[i]?.documents&&(t[i].documents=Object.fromEntries(Object.entries(t?.[i]?.documents??{}).map(([l,c])=>[vi(l),c])))}return t}catch(t){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",t),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(ge(e=>this.refactorPermissionsWithServerIds(e)),_t(Kt))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let t=null;e&&(t=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(t)}catch(t){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",t)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.permissionProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",t)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===gS.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===gS.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===gS.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===gS.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return X(this,null,function*(){let e=at();try{if(this.isRevokeAccessOnUserLogoutEnabled){let t=[],i=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(l=>{l.userId===i&&l.hasAccess&&(l.type===aa.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&t.push(y(h({},l),{hasAccess:!1})):t.push(y(h({},l),{hasAccess:!1})))}),t.length>0){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}}),this.setPermissionsCache([]),this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}});let l=yield this.revokeAccess({requests:t,userId:this.authService.getUser()?.userId??""});l.success?this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:l,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:l,success:!1,statusCode:500}}})}}}catch(t){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:t}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",t)}})}getRevokeKey(e){try{return`${e.userId}_${e.resourceId}_${e.type}_${e.organizationId}`}catch(t){return this.loggingService.catch("Error in UsersPermissionService getRevokeKey:",t),""}}cancelPendingRevokes(e){try{e.forEach(t=>{let i=this.getRevokeKey({userId:t.userId,resourceId:t.resource.id,type:t.resource.type,organizationId:t.resource.organizationId});this.pendingRevokeRequests.has(i)&&this.pendingRevokeRequests.delete(i)}),this.pendingRevokeRequests.size===0&&this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(t){this.loggingService.catch("Error in UsersPermissionService cancelPendingRevokes:",t)}}flushPendingRevokes(){return X(this,null,function*(){let e=this.pendingRevokeUniqueId,t=this.pendingRevokeUserId;try{let i=Array.from(this.pendingRevokeRequests.values());if(this.pendingRevokeRequests.clear(),this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="",i.length===0)return;let a=this.getPermissionsCache()??[];i.forEach(d=>{a=a.filter(m=>!(m.resourceId===d.resourceId&&m.type===d.type&&m.organizationId===d.organizationId&&m.userId===d.userId))}),this.setPermissionsCache(a);let l=this.docService.getDocContext(),c=yield this.revokeAccess({requests:i,userId:t,currentContext:l});c.success?this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:c,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:c,success:!1,statusCode:500}}})}catch(i){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:i}}),this.loggingService.catch("Error in UsersPermissionService flushPendingRevokes:",i)}})}revokeAccessOnDocumentUnset(a){return X(this,arguments,function*({documentIds:e,folderId:t,context:i}){let l=at();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let c=[],d=this.docService.getOrganizationConfig()?.clientOrganizationId??"",m=this.authService.getUser()?.userId??"",u=this.getPermissionsCache()??[];e.forEach(_=>{u=this.collectRevokeRequest(u,c,_.clientDocumentId,aa.DOCUMENT,d,m)}),t&&(u=this.collectRevokeRequest(u,c,t,aa.FOLDER,d,m)),d&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&(u=this.collectRevokeRequest(u,c,d,aa.ORGANIZATION,d,m)),i&&this.getIsContextEnabled()&&QN({input:i}).forEach(I=>{let A=JSON.stringify(I.access);u=this.collectRevokeRequest(u,c,A,aa.CONTEXT,d,m)}),this.setPermissionsCache(u),c.length>0&&(this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:l,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:c}}),this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:l,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:c}}),c.forEach(_=>{this.pendingRevokeRequests.set(this.getRevokeKey(_),_)}),this.pendingRevokeUniqueId=l,this.pendingRevokeUserId=m,this.pendingRevokeTimeoutId&&clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=setTimeout(()=>this.flushPendingRevokes(),this.REVOKE_DELAY_MS))}}catch(c){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:oo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:c}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",c)}})}getAccess(i){return X(this,arguments,function*({requests:e,userId:t}){let a=Yr(this.functions,Zr({url:On?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield wl({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}revokeAccess(a){return X(this,arguments,function*({requests:e,userId:t,currentContext:i}){let l=Yr(this.functions,Zr({url:On?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield wl({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:h({retryConfig:this.getPermissionProviderRetryConfig()},i?.access&&{currentContext:i})},getSdkProxy:l,userId:t})})}onResourceAccessRequired(c){return X(this,arguments,function*({requests:e,uniqueId:t,methodName:i,userId:a,fromCache:l=!0}){try{if(!e?.length)return;let d=[],m=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&l&&(e.forEach(u=>{let _=m?.find(I=>I.resourceId===u.resource.id&&I.type===u.resource.type&&I.userId===u.userId&&I.organizationId===u.resource.organizationId);_&&d.push(_)}),d.length>0&&(e=e.filter(u=>!d.find(_=>_.resourceId===u.resource.id&&_.type===u.resource.type&&_.userId===u.userId&&_.organizationId===u.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:i,source:"internal",payload:{requests:e,fromCache:l}});let u=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??a??""});return this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:t,methodName:i,source:"internal",payload:{result:u}}),u?.success&&u?.data?.length&&(this.setPermissionsCache([...m,...u.data]),u.data=[...d,...u.data]),u}else if(d.length>0)return this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:i,source:"internal",uniqueId:t,payload:{results:{data:d,success:!0,statusCode:200}}}),{data:d,success:!0,statusCode:200};return}catch(d){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",d),this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:i,source:"internal",uniqueId:t,payload:{error:d,requests:e,fromCache:l}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let t=new Map;e.forEach(a=>{let l=`${a.userId}_${a.resourceId}_${a.organizationId}_${a.type}`;t.set(l,a)});let i=JSON.parse(JSON.stringify(Array.from(t.values())));this.permissionsCache$.next(i)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",t)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(K(qe),K(st),K(k),K(yn),K(An),K(_m),K(nr),K(Oo),K(Ft),K(vn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zi=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A){this.afAuth=e,this.analyticsService=t,this.authService=i,this.configService=a,this.databaseService=l,this.commonDbService=c,this.docService=d,this.domService=m,this.emojiService=u,this.iamService=_,this.loggingService=I,this.userPermissionService=A,this.documentPaths=null,this.reactionAnnotationById$=new Se({}),this.customReactions$=new Se({}),this.commentService=null,this.darkMode$=new Se(null),this.loggingService.log("%c[WB] Creating CLASS: ReactionService","color: blue;"),this.analyticsService.setReactionService(this),this.authService.setReactionService(this),this.databaseService.getDb().pipe($e(M=>!!M),ut(1)).subscribe(M=>{M&&this.getAllReactionAnnotations(void 0,void 0,!0).subscribe()},M=>{this.loggingService.catch("Error in ReactionService getDb subscription: ",M)})}setCommentService(e){this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;");try{this.commentService=e}catch(t){this.loggingService.catch("Error in ReactionService setCommentService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ReactionService","color: green;");try{this.reactionAnnotationById$.next({}),this.customReactions$.next({}),this.documentPaths=null}catch(e){this.loggingService.catch("Error in ReactionService clearCache: ",e)}}getAllReactionAnnotations(e,t,i,a,l){this.loggingService.log("%c[WB] Calling FUNCTION: getAllReactionAnnotations","color: green;");let c,d;try{if(e&&(d=`${Qn(e)}`),t&&typeof t=="object"){let m=Oi(t);c=Qn(JSON.stringify(m))}}catch(m){this.loggingService.catch("Error in ReactionService getAllReactionAnnotations: ",m)}return br(this.afAuth).pipe($e(m=>!!m),ye(m=>this.isFeatureAllowed({firebaseUser:m,annotations:[],filteredAnnotations:[]})),ye(m=>m.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(u=>(m.featureAllowed=u,m))):ce(m)),ye(m=>m.featureAllowed?ce(m).pipe(ye(u=>this.docService.getDocumentPaths$().pipe(ge(_=>(this.documentPaths=_,u.documentPaths=_,u)))),ye(u=>d?this.getDataFromDocumentIds([d]).pipe(ge(_=>(u.annotations=_||[],h({},u)))):this.docService.getDocumentIds$().pipe(ye(_=>{let I=_?.length>0?_.map(A=>A.documentId):[this.documentPaths?.documentId??""];return this.getDataFromDocumentIds(I).pipe(ge(A=>(u.annotations=A||[],h({},u))))}))),ye(u=>this.docService.getLocation$().pipe(ge(_=>(u.location=_,u)))),ye(u=>this.docService.getLocations$().pipe(ge(_=>(u.customLocations=_,u)))),ge(u=>{if(u.filteredAnnotations=[],d&&!c)return u.filteredAnnotations=u.annotations?.slice(),u;{let _=[];return c?_.push(c):(_.push(u?.location?.locationId),_.push(...Object.values(u?.customLocations||[]).map(I=>I.locationId))),u.filteredAnnotations=this.filterAnnotationsByLocationIds(u?.annotations,_),u}}),ye(u=>i?ce(u):u?.annotations?.length?this.domService.onWindowResize$().pipe(ge(()=>u)):ce(u)),ye(u=>i?ce(u):ce(u)),ge(u=>u),ye(u=>u?.filteredAnnotations?ce(u?.filteredAnnotations||[]):ce([]))):ce([])),_t(Kt))}isFeatureAllowed(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>y(h({},t),{user:i})))),ye(t=>Mo(t.config,t.user,je.REACTION)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Reaction feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))),_t((t,i)=>t?.featureAllowed===i?.featureAllowed))}getDataFromDocumentIds(e,t){return this.getDataFromDocuments({documentIds:e,filters:t})}getDataFromDocuments(e){if(this.configService?.getApiKey()){let{documentIds:t,filters:i}=e;if(t?.some(d=>!d)||!this.documentPaths)return ce([]);let a=this.docService.getDocumentPaths()?.veltFolderId,l=ce([]),c={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(c.documentId=t?.length?t[0]:void 0,c.organizationId=this.documentPaths?.organizationId),this.userPermissionService?.getIsContextEnabled()){let d=[N.DEFAULT_VELT_CONTEXT,...this.docService.getProcessedDocContext()],m=[];for(let u=0;u<(d?.length??0);u+=N.LISTENER_CONTEXT_BATCH_SIZE)m.push(d?.slice(u,u+N.LISTENER_CONTEXT_BATCH_SIZE)??[]);l=Cn(m.map(u=>this.commonDbService.dbListener({feature:"allReactions",properties:y(h({},c),{firestoreQuery:[Sr(ft("metadata.apiKey","==",this.configService?.getApiKey()),ft("metadata.documentId","in",t),ft("metadata.organizationId","==",this.documentPaths?.organizationId),...a?[ft("metadata.veltFolderId","==",a)]:[],...u?.length?[ft("context.accessFields","array-contains-any",u)]:[])]})}).pipe(sa()))).pipe(ge(u=>Na(u)))}else{let d=[];for(let m=0;m<(t?.length??0);m+=N.LISTENER_BATCH_SIZE)d.push(t?.slice(m,m+N.LISTENER_BATCH_SIZE)??[]);l=Cn(d.map(m=>this.commonDbService.dbListener({feature:"allReactions",properties:y(h({},c),{firestoreQuery:[Sr(ft("metadata.apiKey","==",this.configService?.getApiKey()),ft("metadata.documentId","in",m),ft("metadata.organizationId","==",this.documentPaths?.organizationId),...a?[ft("metadata.veltFolderId","==",a)]:[])]})}).pipe(sa()))).pipe(ge(m=>Na(m)))}return l.pipe(ge(d=>({data:d?.data,operation:d?.operation})),ge(({data:d,operation:m})=>{let u=[];return d&&(u=Object.values(d??{}).filter(_=>typeof _=="object")),u?.forEach(_=>{this.sanitizeReactionAnnotation(_)}),{data:u,operation:m}}),ge(({data:d,operation:m})=>{if(!t)return{data:d,documentMap:{},operation:m};let u=d.reduce((_,I)=>{let A=I.metadata?.documentId;return A&&(_[A]||(_[A]=[]),_[A].push(I)),_},{});return{data:d,documentMap:u,operation:m}}),ge(({data:d,documentMap:m,operation:u})=>{if(!i)if(u?.type==="removed"){if(u?.ids?.length){let _=this.reactionAnnotationById$.value;u?.ids?.forEach(I=>{delete _?.[I]}),this.reactionAnnotationById$.next(_)}}else Object.entries(m??{}).forEach(([_,I])=>{this.setReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:_,annotations:I})});return d}),Jn(d=>(this.loggingService.catch("Error in ReactionService getDataFromDocumentId: ",d),ce([]))))}else return ce([])}setReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:t,annotations:i,queryHash:a}){try{if(t){e||(e=N.NO_ORGANIZATION_ID),a||(a=N.DEFAULT_QUERY_HASH);let l={};i?.forEach(d=>{d?.annotationId&&(l[d?.annotationId]=d)});let c=h(h({},this.reactionAnnotationById$.value),l);this.reactionAnnotationById$.next(c)}}catch(l){this.loggingService.catch("Error in ReactionService setReactionAnnotationsByOrganizationIdAndDocumentId:",l)}}getReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:t}){try{let i={};return Object.values(this.reactionAnnotationById$.value??{}).forEach(a=>{a?.metadata?.documentId==t&&a?.metadata?.organizationId==e&&(i[a?.annotationId]=a)}),Object.values(i)}catch(i){return this.loggingService.catch("Error in ReactionService getReactionAnnotationsByOrganizationIdAndDocumentId:",i),[]}}getLocations$(){return this.docService.getLocation$().pipe(ye(e=>this.docService.getLocations$().pipe(ge(t=>({location:e,locations:t})))),ge(e=>{let t=[];return t.push(e?.location?.locationId),t.push(...Object.values(e.locations||[]).map(i=>i.locationId)),t||[]}))}filterAnnotationsByLocationIds(e,t){try{return e.filter(i=>t.includes(i.locationId))}catch(i){return this.loggingService.catch("Error in ReactionService filterAnnotationsByLocations:",i),[]}}getAnnotationById(e,t){try{let i=this.reactionAnnotationById$.value?.[e];if(i){let{documentId:a,organizationId:l}=t||{};if(a&&i.metadata?.documentId!==a||l&&i.metadata?.organizationId!==l)return}return i}catch(i){this.loggingService.catch("Error in ReactionService getAnnotationById: ",i);return}}getBaseMetadataFromReactionAnnotationId(e){try{let t=this.reactionAnnotationById$.value?.[e];return t?t.metadata:void 0}catch(t){this.loggingService.catch("Error in ReactionService getBaseMetadataFromReactionAnnotationId: ",t);return}}getReactionAnnotationByAnnotationId(e,t){try{return this.reactionAnnotationById$.pipe(ge(()=>this.getAnnotationById(e,t)),ye(i=>i?ce(i):ce(i)))}catch(i){return this.loggingService.catch("Error in ReactionService getReactionAnnotationByAnnotationId: ",i),ce(void 0)}}getReactionAnnotationsBySectionId(e){try{return this.reactionAnnotationById$.pipe(ye(t=>this.docService.getDocumentPaths$().pipe(ge(i=>({documentPaths:i,sectionId:e,reactionAnnotationsMap:t})))),ye(t=>{let i=nl(e,["id","data-id"]);if(i){let a=this.docService.getAdditionLocationFromElement(i);if(a){let l=this.docService.genarateLocationId(a);return this.docService.getLocations$().pipe(ge(c=>{let m=Object.values(c||{}).find(u=>u.locationId===l||a?.id&&u.location.id===a.id);return y(h({},t),{additionalLocation:m,locationOnElement:!!a})}))}}return ce(y(h({},t),{additionalLocation:null,element:i}))}),ye(t=>t?.locationOnElement?ce(t):this.docService.getLocation$().pipe(ge(i=>y(h({},t),{location:i})))),ge(({documentPaths:t,location:i,additionalLocation:a,locationOnElement:l,element:c})=>{let d=null,m=this.docService.getAdditionalDocumentIdFromElement(c),u=m?this.docService.generateDocumentId(m):t?.documentId,_=t?.organizationId;if(u){let I=this.getReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:_,documentId:u});if(I){d=[];for(let A of I)A?.targetElementId===e&&(l?a&&_0({location:a?.location,locationId:a?.locationId},{location:A.location,locationId:A.locationId})&&d.push(A):i?_0({location:i?.location,locationId:i?.locationId},{location:A.location,locationId:A.locationId})&&d.push(A):A?.locationId||d.push(A))}}return d}))}catch(t){return this.loggingService.catch("Error in ReactionService getReactionAnnotationsBySectionId: ",t),ce(null)}}addOrUpdateReaction(e,t,i,a,l,c,d,m){return X(this,null,function*(){try{let u=t?.map(_=>this.getAnnotationById(_)).find(_=>_?.icon===e);if(u){if(!d||d==="delete")return yield this.updateUserInReaction(u)}else if(!d||d==="add")return yield this.addReaction(void 0,e,i,a,l,c,m)}catch(u){this.loggingService.catch("Error in ReactionService addOrUpdateReaction: ",u)}})}addReaction(e,t,i,a,l,c,d){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: addReaction","color: green;");try{let m=this.authService.getUser();if(m)if(m.isReadOnly||m.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add reactions.");else{let u=new wL;if(u.from=m,u.lastUpdated=this.timestamp,u.reactions=[],u.reactions.push({from:m,lastUpdated:this.timestamp}),a&&(u.targetElementId=a),l){u.commentAnnotationId=l;let _=this.commentService?.getAnnotationById(l);if(_?.context?.access&&_?.context?.accessFields){if(!this.userPermissionService?.hasUserContextAccess({userId:m.userId,accessFields:_.context.accessFields})){this.loggingService.catch("User does not have context access to add reaction annotation.",void 0,void 0,!0);return}u.context={access:_.context.access,accessFields:_.context.accessFields}}}if(this.setLocationToReactionAnnotation(u),u.pageInfo=no(),u.pageInfo&&(u.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),t)if(u.icon=t,c)u.iconUrl=c?.url,u.iconEmoji=c?.emoji;else{let _=this.customReactions$.value;if(_){let I=_[t];I?.url&&(u.iconUrl=I?.url),I?.emoji&&(u.iconEmoji=I?.emoji)}}return i&&(u.location={},u.location=h({},i),u.locationId=this.docService.genarateLocationId(u.location)),yield this.saveReactionToDb(u)}}catch(m){this.loggingService.catch("Error in ReactionService addReaction: ",m)}})}setLocationToReactionAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location);try{let i;e.targetElement?.xpath?i=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetElementId&&(i=nl(e.targetElementId,["id","data-id"]));let a=this.docService.getAdditionLocationFromElement(i);if(a){let l=this.docService.addLocation({location:a,source:"internal"});l?.[0]&&(e.locationId=l[0].locationId,e.location=l[0].location)}}catch{}}catch(t){this.loggingService.catch("Error in ReactionService setLocationToReactionAnnotation:",t)}}getElementForReactionAnnotation(e){try{let t;return e.targetElementId&&(t=nl(e.targetElementId,["id","data-id"])),t}catch(t){return this.loggingService.catch("Error in ReactionService getElementForReactionAnnotation: ",t),null}}saveReactionToDb(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: saveReactionToDb","color: green;");try{if(this.authService.getUser()){let t=yield this.docService.getDocumentPaths$().pipe($e(a=>!!a),ut(1)).toPromise();if(!t)throw new Error("Document paths not found.");if(this.documentPaths=t,this.loggingService.log(this.documentPaths),!(yield this.databaseService.getDb().pipe($e(a=>!!a),ut(1)).toPromise()))throw new Error("Database not found.");if(this.documentPaths?.reaction){if(e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo,!e?.metadata?.documentId){e?.metadata||(e.metadata={});let m=this.getElementForReactionAnnotation(e),u=this.docService.getBaseMetadata("reaction",{commentAnnotationId:e.commentAnnotationId,element:m});e.metadata=h(h({},e?.metadata),u)}let a=JSON.parse(JSON.stringify(e));a.position=null;let{documentId:l,organizationId:c}=this.getDocumentIdAndOrganizationIdFromReactionAnnotation(e),d=e.commentAnnotationId?void 0:{annotationData:a,actionType:"add",notificationSource:"reaction"};return yield this.commonDbService.setData({feature:"reaction",properties:{id:e.annotationId,documentId:l,organizationId:c},data:a,extraData:d}),a}else return}}catch(t){this.loggingService.catch("Error in ReactionService saveReactionToDb: ",t)}})}getDocumentIdAndOrganizationIdFromReactionAnnotation(e){try{return{documentId:e?.metadata?.documentId,organizationId:e?.metadata?.organizationId}}catch(t){return this.loggingService.catch("Error in ReactionService getDocumentIdAndOrganizationIdFromReactionAnnotation: ",t),{}}}updateUserInReaction(e){return X(this,null,function*(){try{let t=this.authService.getUser();if(t)return e?.reactions||(e.reactions=[]),e?.reactions?.find(a=>a?.from?.userId===t?.userId)?e.reactions=e?.reactions?.filter(a=>a?.from?.userId!==t?.userId):e.reactions.push({from:t,lastUpdated:this.timestamp}),e.reactions.length?yield this.updateReaction(e):yield this.deleteReactionPinAnnotation(e?.annotationId),e}catch(t){this.loggingService.catch("Error in ReactionService updateUserInReaction: ",t)}})}removeUserFromReaction(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeUserFromReaction","color: green;");try{let t=this.authService.getUser();t&&(e?.reactions||(e.reactions=[]),e.reactions=e?.reactions?.filter(i=>i?.from?.userId!==t?.userId),this.updateReaction(e))}catch(t){this.loggingService.catch("Error in ReactionService removeUserFromReaction: ",t)}}updateReaction(e,t,i){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateReaction","color: green;");try{if(this.authService.getUser()){if(e?.targetElement?.xpath){let d=this.domService.getXPath(e.targetElement.xpath);if(d){let m=d.iterateNext();m&&(Kr(m)||(e.targetElement=null))}}let a=JSON.parse(JSON.stringify(e));if(a.position=null,a.lastUpdated=this.timestamp,!a?.metadata?.documentId){a?.metadata||(a.metadata={});let d=this.docService.getBaseMetadata("reaction",{commentAnnotationId:e.commentAnnotationId});a.metadata=h(h({},a?.metadata),d)}let{documentId:l,organizationId:c}=a?.metadata||{};return i?yield this.commonDbService.updateData({feature:"reaction",properties:{id:e.annotationId,documentId:l,organizationId:c},data:JSON.parse(JSON.stringify(a))}):yield this.commonDbService.setData({feature:"reaction",properties:{id:e.annotationId,documentId:l,organizationId:c},data:JSON.parse(JSON.stringify(a))}),a}}catch(a){this.loggingService.catch("Error in ReactionService updateReaction: ",a)}})}deleteReactionPinAnnotation(e,t){return X(this,null,function*(){try{let i=this.getAnnotationById(e),{documentId:a,organizationId:l}=this.getDocumentIdAndOrganizationIdFromReactionAnnotation(i),c=i&&!i.commentAnnotationId?{annotationData:i,actionType:"delete",notificationSource:"reaction"}:void 0;yield this.commonDbService.deleteData({feature:"reaction",properties:{id:e,documentId:a,organizationId:l},extraData:c})}catch(i){this.loggingService.catch("Error in ReactionService deleteReactionPinAnnotation: ",i)}})}setCustomReactions(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomReactions","color: green;"),this.customReactions$.next(e),this.emojiService.setEmojiList(e)}catch(t){this.loggingService.catch("Error in ReactionService setCustomReactions: ",t)}}enableDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;"),this.darkMode$.value===!0)return;this.darkMode$.next(!0)}catch(e){this.loggingService.catch("Error in ReactionService enableDarkMode: ",e)}}disableDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;"),this.darkMode$.value===!1)return;this.darkMode$.next(!1)}catch(e){this.loggingService.catch("Error in ReactionService disableDarkMode: ",e)}}getDarkMode(){return this.darkMode$.value}getDarkMode$(){return this.darkMode$.asObservable()}sanitizeReactionAnnotation(e){try{e&&(e.iconUrl&&(e.iconUrl=this.domService.sanitizeHtml(e.iconUrl)),e.iconEmoji&&(e.iconEmoji=this.domService.sanitizeHtml(e.iconEmoji)),e.icon&&(e.icon=this.domService.sanitizeHtml(e.icon)))}catch(t){this.loggingService.catch("Error in ReactionService sanitizeReactionAnnotation: ",t)}}get timestamp(){return this.commonDbService.getServerTimestamp()}getReactionAnnotationForClient(e){try{let t=["isReactionResolverUsed","pageInfo","from","involvedUserIds","position"],i=JSON.parse(JSON.stringify(e)),a={};return Object.keys(i).forEach(l=>{t.includes(l)||(l==="reactions"?a.fromUsers=i[l]:a[l]=i[l])}),a}catch(t){return this.loggingService.catch("Error in ReactionService getReactionAnnotationForClient: ",t),e}}};o.\u0275fac=function(t){return new(t||o)(K(eo),K(ct),K(qe),K(Ft),K($n),K(yn),K(st),K(Ue),K(km),K(Vn),K(k),K(al))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Lg={user:"componentConfigSignal.appState.user",isUserAdmin:"componentConfigSignal.appState.isUserAdmin",isKnownUser:"componentConfigSignal.appState.isKnownUser",repliesUniqueUsers:"componentConfigSignal.appState.repliesUniqueUsers",annotation:"componentConfigSignal.data.annotation",annotations:"componentConfigSignal.data.annotations",allAnnotations:"componentConfigSignal.data.allAnnotations",ghostComment:"componentConfigSignal.data.ghostComment",selectedFiles:"parentLocalUIState.selectedFiles",invalidSelectedFiles:"parentLocalUIState.invalidSelectedFiles",selectedAttachments:"parentLocalUIState.selectedAttachments",editComment:"parentLocalUIState.editComment",editCommentIndex:"parentLocalUIState.editCommentIndex",assignTo:"componentConfigSignal.data.assignTo",selectedUserContacts:"componentConfigSignal.data.selectedUserContacts",localRecordedData:"parentLocalUIState.localRecordedData",customList:"componentConfigSignal.data.customList",toOrganizationUserGroup:"componentConfigSignal.data.toOrganizationUserGroup",taggedUserContacts:"componentConfigSignal.data.taggedUserContacts",taggedGroups:"componentConfigSignal.data.taggedGroups",attachmentsToDelete:"parentLocalUIState.attachmentsToDelete",customChipData:"componentConfigSignal.data.customChipData",selectedCustomChipSet:"componentConfigSignal.data.selectedCustomChipSet",currentDialogView:"componentConfigSignal.data.currentDialogView",sidebarMode:"parentLocalUIState.sidebarMode",inboxMode:"parentLocalUIState.inboxMode",dialogMode:"parentLocalUIState.dialogMode",inlineCommentMode:"parentLocalUIState.inlineCommentMode",inlineCommentSectionMode:"parentLocalUIState.inlineCommentSectionMode",focusedThreadMode:"parentLocalUIState.focusedThreadMode",isFocusedThreadEnabled:"parentLocalUIState.isFocusedThreadEnabled",pageModeComposer:"parentLocalUIState.pageModeComposer",darkMode:"parentLocalUIState.darkMode",variant:"parentLocalUIState.variant",disabled:"parentLocalUIState.disabled",commentPinSelected:"parentLocalUIState.commentPinSelected",fullExpanded:"parentLocalUIState.fullExpanded",commentDialogSelected:"parentLocalUIState.commentDialogSelected",readOnly:"parentLocalUIState.readOnly",dialogShadowDOM:"parentLocalUIState.dialogShadowDOM",locationVersion:"parentLocalUIState.locationVersion",composerPosition:"parentLocalUIState.composerPosition",dialogOpenedInSidebar:"parentLocalUIState.dialogOpenedInSidebar",expandOnSelection:"parentLocalUIState.expandOnSelection",selectedVisibility:"parentLocalUIState.selectedVisibility",selectedVisibilityUsers:"parentLocalUIState.selectedVisibilityUsers",containerComponentId:"componentConfigSignal.uiState.containerComponentId",isPrivateComment:"componentConfigSignal.uiState.isPrivateComment",assignToMenuOpened:"parentLocalUIState.assignToMenuOpened",showGhostCommentMessage:"componentConfigSignal.uiState.showGhostCommentMessage",showReplies:"componentConfigSignal.uiState.showReplies",collapsedComments:"componentConfigSignal.uiState.collapsedComments",showAllComments:"componentConfigSignal.uiState.showAllComments",composerContent:"parentLocalUIState.composerContent",composerContentHTML:"parentLocalUIState.composerContentHTML",composerInOpenState:"parentLocalUIState.composerInOpenState",composerMode:"componentConfigSignal.uiState.composerMode",multiThreadAnnotationId:"componentConfigSignal.uiState.multiThreadAnnotationId",maxReplyAvatars:"componentConfigSignal.uiState.maxReplyAvatars",showSuggestionModeActions:"componentConfigSignal.uiState.showSuggestionModeActions",uploadingAttachments:"componentConfigSignal.uiState.uploadingAttachments",playVideoInFullScreen:"componentConfigSignal.uiState.playVideoInFullScreen",commentDialogUniqueId:"componentConfigSignal.uiState.commentDialogUniqueId",recorderInitConfig:"componentConfigSignal.uiState.recorderInitConfig",isInputFocused:"componentConfigSignal.uiState.isInputFocused",showCommentButtons:"componentConfigSignal.uiState.showCommentButtons",isAutocompleteDropdownOpen:"componentConfigSignal.uiState.isAutocompleteDropdownOpen",bottomSheetMode:"componentConfigSignal.uiState.bottomSheetMode",commentComposerMode:"componentConfigSignal.uiState.commentComposerMode",shouldScrollToBottom:"componentConfigSignal.uiState.shouldScrollToBottom",deviceType:"componentConfigSignal.uiState.deviceType",showReplyComposer:"componentConfigSignal.uiState.showReplyComposer",reactionToolOpenIndex:"componentConfigSignal.uiState.reactionToolOpenIndex",openDropdownIndexValue:"componentConfigSignal.uiState.openDropdownIndexValue",hasReactionsByCommentId:"componentConfigSignal.uiState.hasReactionsByCommentId",newComment:"parentLocalUIState.composerContent",newCommentHTML:"parentLocalUIState.composerContentHTML",canResolveAnnotation:"componentConfigSignal.featureState.canResolveAnnotation",canUnresolveAnnotation:"componentConfigSignal.featureState.canUnresolveAnnotation",dialogSelectedByKnownUser:"componentConfigSignal.featureState.dialogSelectedByKnownUser",resolveStatusAccessAdminOnly:"componentConfigSignal.featureState.resolveStatusAccessAdminOnly",enableResolve:"componentConfigSignal.featureState.enableResolve",isPlanExpired:"componentConfigSignal.featureState.isPlanExpired",moderatorMode:"componentConfigSignal.featureState.moderatorMode",enableAutoCategorize:"componentConfigSignal.featureState.enableAutoCategorize",suggestionMode:"componentConfigSignal.featureState.suggestionMode",commentAcceptedStatus:"componentConfigSignal.featureState.commentAcceptedStatus",commentRejectedStatus:"componentConfigSignal.featureState.commentRejectedStatus",enableSignInButton:"componentConfigSignal.featureState.enableSignInButton",enableUpgradeButton:"componentConfigSignal.featureState.enableUpgradeButton",enableGhostCommentsMessage:"componentConfigSignal.featureState.enableGhostCommentsMessage",replyAvatars:"componentConfigSignal.featureState.replyAvatars",userMentions:"componentConfigSignal.featureState.userMentions",recordingSummaryEnabled:"componentConfigSignal.featureState.recordingSummaryEnabled",enableAttachment:"componentConfigSignal.featureState.enableAttachment",allowedFileTypes:"componentConfigSignal.featureState.allowedFileTypes",allowedRecordings:"componentConfigSignal.featureState.allowedRecordings",screenSharingSupported:"componentConfigSignal.featureState.screenSharingSupported",enterKeyToSubmit:"componentConfigSignal.featureState.enterKeyToSubmit",deleteOnBackspace:"componentConfigSignal.featureState.deleteOnBackspace",showScreenSizeInfo:"componentConfigSignal.uiState.showScreenSizeInfo",enableReactions:"componentConfigSignal.featureState.enableReactions",isInsidePdfViewer:"componentConfigSignal.featureState.isInsidePdfViewer",sidebarButtonOnCommentDialogVisible:"componentConfigSignal.uiState.sidebarButtonOnCommentDialogVisible",enableStatus:"componentConfigSignal.featureState.enableStatus",customStatusesShown:"componentConfigSignal.featureState.customStatusesShown",statusOptions:"componentConfigSignal.featureState.statusOptions",enablePriority:"componentConfigSignal.featureState.enablePriority",visibilityOptions:"componentConfigSignal.featureState.visibilityOptions",priorityOptions:"componentConfigSignal.featureState.priorityOptions",enableAssignment:"componentConfigSignal.featureState.enableAssignment",enableNotifications:"componentConfigSignal.featureState.enableNotifications",enableEdit:"componentConfigSignal.featureState.enableEdit",enableDelete:"componentConfigSignal.featureState.enableDelete",enablePrivateMode:"componentConfigSignal.featureState.enablePrivateMode",deleteThreadWithFirstComment:"componentConfigSignal.featureState.deleteThreadWithFirstComment",seenByUsers:"componentConfigSignal.featureState.seenByUsers",allowAssignment:"componentConfigSignal.featureState.enableAssignment",allowToggleNotification:"componentConfigSignal.featureState.enableNotifications",allowEdit:"componentConfigSignal.featureState.enableEdit",allowChangeCommentAccessMode:"componentConfigSignal.featureState.enablePrivateMode",notificationEnabled:"notificationEnabled",mainCommentId:"componentConfigSignal.data.annotation.comments.0.commentId",commentObj:"commentObj",commentIndex:"commentIndex",userContact:"selectorItem.contact",comment:"commentObj",commentAnnotation:"componentConfigSignal.data.annotation",commentAnnotations:"componentConfigSignal.data.annotations",context:"parentLocalUIState.context",focusedAnnotation:"focusedAnnotation",notification:"notification",notificationsPanel:"notificationsPanel",unreadNotificationsForYou:"componentConfigSignal.data.unreadNotificationsForYou",notificationsPanelVisible:"componentConfigSignal.uiState.notificationsPanelVisible",notificationsForYouInSession:"componentConfigSignal.data.notificationsForYouInSession",notificationsInSession:"componentConfigSignal.data.notificationsInSession",notificationsByUserMap:"componentConfigSignal.data.notificationsByUserMap",notificationsByDocumentId:"componentConfigSignal.data.notificationsByDocumentId",notificationsByDate:"componentConfigSignal.data.notificationsByDate",currentDocumentName:"componentConfigSignal.data.currentDocumentName",settingsConfig:"componentConfigSignal.data.settingsConfig",settingsSelectedOption:"componentConfigSignal.data.settingsSelectedOption",selectedTab:"componentConfigSignal.uiState.selectedTab",tabConfig:"componentConfigSignal.uiState.tabConfig",TABS:"componentConfigSignal.uiState.TABS",tabPage:"componentConfigSignal.uiState.tabPage",pageSize:"componentConfigSignal.uiState.pageSize",panelOpenMode:"componentConfigSignal.uiState.panelOpenMode",settingsOpen:"componentConfigSignal.uiState.settingsOpen",settingsAccordionExpanded:"componentConfigSignal.uiState.settingsAccordionExpanded",settingsMutedAll:"componentConfigSignal.uiState.settingsMutedAll",settingsItemRecentlyClosed:"componentConfigSignal.uiState.settingsItemRecentlyClosed",settingsLayout:"componentConfigSignal.uiState.settingsLayout",tabCount:"componentConfigSignal.uiState.tabCount",usersExpanded:"componentConfigSignal.uiState.usersExpanded",documentExpanded:"componentConfigSignal.uiState.documentExpanded",shadowDom:"componentConfigSignal.uiState.shadowDom",settingsEnabled:"componentConfigSignal.featureState.settingsEnabled",selectedMinimalFilterDropdownOption:"selectedMinimalFilterDropdownOption",appliedFiltersCount:"appliedFiltersCount",filteredCommentAnnotationsCount:"filteredCommentAnnotationsCount",unreadCommentAnnotationCount:"unreadCommentAnnotationCount"},Eqe=["user","annotation","annotations","allAnnotations","userContact","comment","commentAnnotation","commentAnnotations","recorderInitConfig","ghostComment","editComment","assignTo","customChipData","currentDialogView","context","focusedAnnotation","notification","notificationsPanel","selectedMinimalFilterDropdownOption","unreadNotificationsForYou","notificationsForYouInSession","notificationsInSession","notificationsByUserMap","notificationsByDocumentId","notificationsByDate","settingsConfig","settingsSelectedOption","settingsAccordionExpanded","tabConfig","tabPage","TABS"],T=(()=>{let _DynamicDataService=class _DynamicDataService{constructor(n,o,r,e,t,i){this.authService=n,this.commentService=o,this.loggingService=r,this.injector=e,this.docService=t,this.configService=i,this.subscriptions=[],this.commonData$=new Se({}),this.evaluateConditionTriggered=new Le,this.conditionRegex=/\{(.*?)\}/g,this.extractedProps={},this.condition="",this.dataComponentConfigSignal=De({});try{this.subscriptions.push(this.authService.getUser$().subscribe(a=>{this.commonData$.next(y(h({},this.commonData$.value),{user:a}))})),this.subscriptions.push(this.commentService.getUnreadCommentAnnotationCountOnCurrentDocument$().subscribe(a=>{this.commonData$.next(y(h({},this.commonData$.value),{unreadCommentAnnotationCount:a?.count||0}))})),this.subscriptions.push(this.commentService.getUnreadCommentCountOnCurrentDocument$().subscribe(a=>{this.commonData$.next(y(h({},this.commonData$.value),{unreadCommentCount:a?.count||0}))})),this.subscriptions.push(this.docService.getUIState$().subscribe(a=>{this.commonData$.next(h(h({},this.commonData$.value),a))})),this.subscriptions.push(this.getCommonData().subscribe(a=>{this.dataComponentConfigSignal.update(l=>(l=h(h({},l),a),l)),this.executeConditionalClasses()})),this.subscriptions.push(this.evaluateConditionTriggered.subscribe(a=>{this.extractedProps=a.extractedProps,this.evaluateCondition(a.className,a.elementRef,a.condition)}))}catch(a){this.loggingService.catch("Error in DynamicDataService constructor: ",a)}}ngOnDestroy(){try{this.subscriptions.forEach(n=>n.unsubscribe())}catch(n){this.loggingService.catch("Error in DynamicDataService ngOnDestroy: ",n)}}getCommonData(){return this.commonData$.asObservable()}getModifiedPathBasedOnCondition(n,o){try{return Object.keys(o).forEach(r=>{o[r].path=this.modifyPathBasedOnCondition(r,n)}),o}catch(r){this.loggingService.catch("Error in DynamicDataService getModifiedPathBasedOnCondition: ",r)}}getComputedValues(n,o,r,e,t,i){try{Object.keys(r).forEach(a=>{let l;if(co(n)?l=ie(()=>El(n(),r[a].path)):l=ie(()=>El(n,r[a].path)),co(l()))xn(()=>{try{let c=l()();r[a].value=c,this.evaluateConditionTriggered.emit({extractedProps:r,className:e,elementRef:t,condition:i})}catch{}},{injector:this.injector});else{let c=l();r[a].value=c,this.evaluateConditionTriggered.emit({extractedProps:r,className:e,elementRef:t,condition:i})}})}catch(a){this.loggingService.catch("Error in DynamicDataService getComputedValues: ",a)}}modifyPathBasedOnCondition(n,o){try{let r=n.match(/^([^\.\[]+)/),e=r?r[1]:n,t=n.slice(e.length);if(Lg[n])return Lg[n];if(["commentDialogOptionsDropdownConfigSignal","commentDialogStatusDropdownConfigSignal"].includes(e)&&t.startsWith(".")){let a=t.slice(1),l=a.match(/^([^\.\[]+)/),c=l?l[1]:a,d=a.slice(c.length);return Lg[c]?Lg[c]+d:"componentConfigSignal."+a}if(e&&o&&typeof o=="function"){let a=o();if(a&&e in a){let c=n.match(/\[(.*?)\]/);if(c&&c[1]){let d=c[1];if(d.includes(".")){let m=d.split(".")[0];if(Lg[m]){let u=d.replace(m,Lg[m]);return n.replace(`[${d}]`,`[${u}]`)}return m&&a&&m in a?n:n.replace(`[${d}]`,`[componentConfigSignal.${d}]`)}}return n}let l=a?.componentConfigSignal;if(l&&typeof l=="function"){let c=l();if(c&&e in c)return"componentConfigSignal."+n}}return Lg[e]?Eqe.includes(e)?Lg[e]+t:Lg[e]:"componentConfigSignal."+n}catch(r){return this.loggingService.catch("Error in DynamicDataService modifyPathBasedOnCondition: ",r),n}}applyConditionalClasses(n,o){try{this.elementRef=n,this.data=o}catch(r){this.loggingService.catch("Error in DynamicDataService applyConditionalClasses: ",r)}}executeConditionalClasses(){try{let n=this.getHostElementAttributes(this.elementRef),r=[...Object.keys(n).filter(e=>e.startsWith("velt-class-")).map(e=>({name:e,value:n[e]}))];if(n["velt-class"]){let e=n["velt-class"],t=/'([^']+)':\s*([^,]+)(?:,|$)/g,i=[],a=0,l=100,c;for(;(c=t.exec(e))!==null;){if(a++>l){this.loggingService.catch("Too many class definitions detected.");break}if(c.length<3)continue;let[,d,m]=c;!d||!m||d.split(" ").forEach(u=>{u.trim()&&i.push({name:`velt-class-${u.trim()}`,value:m.trim()})})}r=[...r,...i]}this.data&&typeof this.data=="object"&&Object.keys(this.data).forEach(e=>{this.updateDataComponentConfigSignal(e,this.data[e])}),r.forEach(e=>{let t=e.name.replace("velt-class-","");this.condition=e.value,this.condition&&(this.extractProps(),this.extractedProps=this.getModifiedPathBasedOnCondition(this.dataComponentConfigSignal,this.extractedProps),this.getComputedValues(this.dataComponentConfigSignal,this.evaluateCondition,this.extractedProps,t,this.elementRef,e.value))})}catch(n){this.loggingService.catch("Error in DynamicDataService applyConditionalClasses: ",n)}}updateDataComponentConfigSignal(n,o){try{n==="dataComponentConfigSignal"?this.dataComponentConfigSignal.set(o):this.dataComponentConfigSignal.update(r=>y(h({},r),{[n]:o}))}catch(r){this.loggingService.catch("Error in DataComponent updateDataComponentConfigSignal: ",r)}}extractProps(){try{this.extractedProps={},this.conditionRegex.lastIndex=0;let n;for(;(n=this.conditionRegex.exec(this.condition))!==null;){let o=n[1];this.extractedProps[o]={value:null,path:null,isDynamicPath:this.hasDynamicParts(o)}}}catch(n){this.loggingService.catch("Error in DynamicDataService extractProps: ",n)}}hasDynamicParts(n){try{let o=/\[[^\]'"]*[^\]'"]\]/.test(n),r=/\[[^[\]]*[\.\[][^[\]]*\]/.test(n);return o||r}catch(o){return this.loggingService.catch("Error checking for dynamic path: ",o),!1}}evaluateCondition(n,o,r){try{if(r){let e=this.extractedProps,t=r.replace(this.conditionRegex,(l,c)=>{let d=e[c];if(d&&d.value!==void 0){let m=d.value;return typeof m=="string"?`'${m}'`:typeof m=="boolean"||typeof m=="number"?String(m):m===null?"null":typeof m=="object"?m?"true":"false":String(m)}return"false"}),i=this.sanitizeCondition(t),a=this.safeEval(i);return n&&o&&(a?this.setHostElementClasses(o,n):this.removeHostElementClasses(o,n)),a}return!1}catch(e){return this.loggingService.catch("Error in IfComponent evaluateCondition: ",e),!1}}sanitizeCondition(n){try{return n.replace(/[^a-zA-Z0-9\s\+\-\*\/\%\(\)\!\=\<\>\|\&\.\[\]\{\},'"]/g,"")}catch(o){return this.loggingService.catch("Error in IfComponent sanitizeCondition: ",o),""}}safeEval(expression){try{if(this.configService.getSafeEval()){let n=this.tokenize(expression.trim());return this.evaluateTokens(n)}else return eval(expression)}catch(n){return this.loggingService.catch("safeEval error",n),!1}}tokenize(n){try{if(!n||n.trim()==="")return[];let o=[],r=0;for(;r<n.length;){let e=n[r];if(/\s/.test(e)){r++;continue}if(e==='"'||e==="'"){let t=e,i="";for(r++;r<n.length;)if(n[r]==="\\"&&r+1<n.length)i+=n[r+1],r+=2;else if(n[r]===t){r++;break}else i+=n[r],r++;o.push({type:"string",value:i});continue}if(e==="("){o.push({type:"lparen",value:"("}),r++;continue}if(e===")"){o.push({type:"rparen",value:")"}),r++;continue}if(r<n.length-2&&n.substring(r,r+3)==="==="){o.push({type:"operator",value:"===",precedence:4}),r+=3;continue}if(r<n.length-2&&n.substring(r,r+3)==="!=="){o.push({type:"operator",value:"!==",precedence:4}),r+=3;continue}if(r<n.length-1&&n.substring(r,r+2)==="&&"){o.push({type:"operator",value:"&&",precedence:2}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)==="||"){o.push({type:"operator",value:"||",precedence:1}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)==="<="){o.push({type:"operator",value:"<=",precedence:4}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)===">="){o.push({type:"operator",value:">=",precedence:4}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)==="=="){o.push({type:"operator",value:"==",precedence:4}),r+=2;continue}if(r<n.length-1&&n.substring(r,r+2)==="!="){o.push({type:"operator",value:"!=",precedence:4}),r+=2;continue}if(e==="!"){o.push({type:"unary",value:"!",precedence:5}),r++;continue}if(e==="<"){o.push({type:"operator",value:"<",precedence:4}),r++;continue}if(e===">"){o.push({type:"operator",value:">",precedence:4}),r++;continue}if(/[a-zA-Z0-9._]/.test(e)){let t="";for(;r<n.length&&/[a-zA-Z0-9._]/.test(n[r]);)t+=n[r],r++;/^-?\d+(\.\d+)?$/.test(t)?o.push({type:"number",value:parseFloat(t)}):t==="true"||t==="false"?o.push({type:"boolean",value:t==="true"}):t==="null"?o.push({type:"null",value:null}):t==="undefined"?o.push({type:"undefined",value:void 0}):o.push({type:"identifier",value:t});continue}r++}return o}catch(o){return this.loggingService.catch("tokenize error",o),[]}}evaluateTokens(n){try{if(!n||n.length===0)return!1;let o=this.infixToPostfix(n);return this.evaluatePostfix(o)}catch(o){return this.loggingService.catch("evaluateTokens error",o),!1}}infixToPostfix(n){try{let o=[],r=[];for(let e of n)if(e.type==="string"||e.type==="number"||e.type==="boolean"||e.type==="null"||e.type==="undefined"||e.type==="identifier")o.push(e);else if(e.type==="unary")r.push(e);else if(e.type==="operator"){for(;r.length>0;){let t=r[r.length-1];if(t.type==="lparen"||t.precedence!==void 0&&t.precedence<e.precedence)break;o.push(r.pop())}r.push(e)}else if(e.type==="lparen")r.push(e);else if(e.type==="rparen"){for(;r.length>0&&r[r.length-1].type!=="lparen";)o.push(r.pop());r.length>0&&r.pop()}for(;r.length>0;){let e=r.pop();e.type!=="lparen"&&e.type!=="rparen"&&o.push(e)}return o}catch(o){return this.loggingService.catch("infixToPostfix error",o),[]}}evaluatePostfix(n){try{let o=[];for(let r of n)if(r.type==="string"||r.type==="number"||r.type==="boolean"||r.type==="null"||r.type==="undefined"||r.type==="identifier")o.push(r.value);else if(r.type==="unary"){if(o.length>=1){let e=o.pop();r.value==="!"&&o.push(!this.isTruthy(e))}}else if(r.type==="operator"&&o.length>=2){let e=o.pop(),t=o.pop();r.value==="&&"?o.push(this.isTruthy(t)&&this.isTruthy(e)):r.value==="||"?o.push(this.isTruthy(t)||this.isTruthy(e)):o.push(this.compare(t,e,r.value))}return o.length===1?this.isTruthy(o[0]):!1}catch(o){return this.loggingService.catch("evaluatePostfix error",o),!1}}parseValue(n){try{let o=n.trim();return o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'")?o.substring(1,o.length-1):/^-?\d+(\.\d+)?$/.test(o)?parseFloat(o):o==="true"?!0:o==="false"?!1:o==="null"?null:o==="undefined"?void 0:o}catch(o){return this.loggingService.catch("parseValue error",o),n}}compare(n,o,r){try{switch(r){case"===":return n===o;case"!==":return n!==o;case"==":return n==o;case"!=":return n!=o;case"<":return n<o;case">":return n>o;case"<=":return n<=o;case">=":return n>=o;default:return!1}}catch(e){return this.loggingService.catch("compare error",e),!1}}isTruthy(n){try{return n==null||n===""||n==="false"?!1:n==="true"?!0:typeof n=="number"?n!==0:!!n}catch(o){return this.loggingService.catch("isTruthy error",o),!1}}getHostElementAttributes(n){try{let o=n,r={};for(let e of o.attributes)r[e.name]=e.value;return r}catch{return{}}}setHostElementClasses(n,o){try{n.classList.add(o)}catch{}}removeHostElementClasses(n,o){try{n.classList.remove(o)}catch{}}};_DynamicDataService.\u0275fac=function(o){return new(o||_DynamicDataService)(K(qe),K(Re),K(k),K(Dt),K(st),K(Ft))},_DynamicDataService.\u0275prov=Ae({token:_DynamicDataService,factory:_DynamicDataService.\u0275fac,providedIn:"root"});let DynamicDataService=_DynamicDataService;return DynamicDataService})();var me=(()=>{let o=class o{set veltIf(e){try{e&&this.setIfCondition(e)}catch(t){this._loggingService.catch("Error in BaseComponent set veltIf:",t)}}constructor(e,t,i){this._elementRef=e,this._dynamicDataService=t,this._loggingService=i,this.componentConfigSignal=De({}),this.veltElement=!0,this.conditionSignal=De(null)}initializeComponentConfigSignal(e){try{this.componentConfigSignal.set(e)}catch(t){this._loggingService.catch("Error in BaseComponent initializeComponentConfigSignal:",t)}}ngOnInit(){try{this._dynamicDataService.applyConditionalClasses(this._elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal})}catch(e){this._loggingService.catch("Error in BaseComponent ngOnInit:",e)}}ngOnDestroy(){}setIfCondition(e){try{this.conditionSignal.set(e)}catch(t){this._loggingService.catch("Error in BaseComponent setIfCondition:",t)}}};o.\u0275fac=function(t){return new(t||o)(x(Q),x(T),x(k))},o.\u0275cmp=O({type:o,selectors:[["app-base"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{componentConfigSignal:"componentConfigSignal",template:"template",wireframe:"wireframe",veltIf:"veltIf"},standalone:!1,decls:0,vars:0,template:function(t,i){},encapsulation:2});let n=o;return n})();var yt=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.configService=t,this.darkMode$=new Se(!1)}setDarkMode(e){try{let t=document.documentElement;if(!t)return;e?t.setAttribute(N.ATTRIBUTES.VELT_THEME,"dark"):t.removeAttribute(N.ATTRIBUTES.VELT_THEME),this.darkMode$.next(e)}catch(t){this.loggingService.catch("Error in theme service setDarkMode: ",t)}}getDarkMode$(){return this.darkMode$.asObservable()}updateListenerOnConfigChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.usePrefersColorScheme){this.enablePrefersColorScheme();return}this.disablePrefersColorScheme()})}catch(e){this.loggingService.catch("Error in theme service updateListenerOnConfigChange: ",e)}}enablePrefersColorScheme(){try{if(this.disablePrefersColorScheme(),!window.matchMedia)return;this.darkModeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.setDarkMode(this.darkModeQuery.matches),this.darkModeQueryListener=e=>{this.setDarkMode(e.matches)},this.darkModeQuery.addEventListener("change",this.darkModeQueryListener)}catch(e){this.loggingService.catch("Error in theme service enablePrefersColorScheme: ",e)}}disablePrefersColorScheme(){try{this.darkModeQuery&&this.darkModeQueryListener&&this.darkModeQuery.removeEventListener("change",this.darkModeQueryListener)}catch(e){this.loggingService.catch("Error in theme service disablePrefersColorScheme: ",e)}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(Ft))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ot=(()=>{let o=class o extends me{onDarkModeChange(){return this.darkModeSubject$.asObservable()}constructor(e,t,i,a,l,c,d){super(e,c,d),this._elementRef=e,this._themeService=t,this._changeDetector=i,this._featureService=a,this._componentDarkModeObservable=l,this._componentDarkMode=null,this._globalDarkMode=!1,this._featureDarkMode=!1,this._themeSubscriptions=[],this._darkMode=!1,this.darkMode=!1,this.darkModeSubject$=new Se(!1);try{this._themeSubscriptions.push(this._themeService.getDarkMode$().subscribe(m=>{this._globalDarkMode=m,this.setDarkMode()})),this._featureService&&(this._featureService instanceof Re?this._themeSubscriptions.push(this._featureService.getCommentContainerDarkMode().subscribe(m=>{this._featureDarkMode=m,this.setDarkMode()})):this._featureService instanceof zi&&this._themeSubscriptions.push(this._featureService.getDarkMode$().subscribe(m=>{m!==null&&(this._featureDarkMode=m),this.setDarkMode()}))),this._componentDarkModeObservable&&this._componentDarkModeObservable instanceof Vt&&this._themeSubscriptions.push(this._componentDarkModeObservable.subscribe(m=>{this._componentDarkMode=m,this.setDarkMode()}))}catch{}}ngOnInit(){super.ngOnInit()}ngOnChanges(e){try{if(e._darkMode){let t=e._darkMode.currentValue;typeof t=="string"&&(t=t==="true"),this._componentDarkMode=t,this.setDarkMode()}}catch{}}setComponentDarkMode(e){try{this._componentDarkMode=e,this.setDarkMode()}catch{}}setDarkMode(){try{this._componentDarkMode===null?this._featureDarkMode?this.darkMode=!0:this.darkMode=!!this._globalDarkMode:this.darkMode=!!this._componentDarkMode,this.darkMode?this._elementRef.nativeElement.hasAttribute("dark")||this._elementRef.nativeElement.setAttribute("dark",""):this._elementRef.nativeElement.hasAttribute("dark")&&this._elementRef.nativeElement.removeAttribute("dark"),this.darkModeSubject$.next(this.darkMode),this._changeDetector&&this._changeDetector.markForCheck()}catch{}}ngOnDestroy(){try{super.ngOnDestroy(),this._themeSubscriptions.forEach(e=>{e.unsubscribe()})}catch{}}};o.\u0275fac=function(t){return new(t||o)(x(Q),x(yt),x(nn),x("FeatureService",8),x(Vt),x(T),x(k))},o.\u0275cmp=O({type:o,selectors:[["app-themed"]],inputs:{_darkMode:[0,"darkMode","_darkMode"]},standalone:!1,features:[P,Qe],decls:0,vars:0,template:function(t,i){},encapsulation:2,changeDetection:0});let n=o;return n})();var Xe=(()=>{let o=class o{constructor(e){this.loggingService=e,this.wireframeMap=new Se(new Map);try{this.loggingService.log("%c[WB] Creating CLASS: WireframeService","color: blue;")}catch(t){this.loggingService.catch("Error in WireframeService constructor: ",t)}}setWireframe(e,t){try{let i=this.wireframeMap.value,a=i.get(e),l=t.children.length>0||t.innerHTML?.trim()?.length>0,c=a&&(a.children.length>0||a.innerHTML?.trim()?.length>0);(!a||l&&!c)&&(i.set(e,t),this.wireframeMap.next(i))}catch(i){this.loggingService.catch("Error in WireframeService setWireframe: ",i)}}setWireframeMap(e){try{let t=this.wireframeMap.value;e.forEach((i,a)=>{let l=t.get(a),c=i.children.length>0||i.innerHTML?.trim()?.length>0,d=l&&(l.children.length>0||l.innerHTML?.trim()?.length>0);(!l||c&&!d)&&t.set(a,i)}),this.wireframeMap.next(t)}catch(t){this.loggingService.catch("Error in WireframeService setWireframeMap: ",t)}}getWireframe(e,t=!0){try{let i=this.wireframeMap.value,a=i.get(e);if(!a&&t){let l=e?.split("---")[0];l&&(a=i.get(l))}return a&&(a?.children?.length>0||a?.innerHTML?.trim()?.length>0)?a:void 0}catch(i){this.loggingService.catch("Error in WireframeService getWireframe: ",i);return}}getConditionElement(e,t=!0){try{let i=this.wireframeMap.value,a=i.get(e);if(!a&&t){let l=e?.split("---")[0];l&&(a=i.get(l))}return a}catch(i){this.loggingService.catch("Error in WireframeService getConditionElement: ",i);return}}getWireframe$(e,t=!0){return this.wireframeMap.asObservable().pipe(ge(i=>this.getWireframe(e,t)))}setChildren(e){try{this.wireframeMap.next(e)}catch(t){this.loggingService.catch("Error in WireframeService setChildren: ",t)}}getWireframeMap(){return this.wireframeMap.value}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var d_e=n=>({componentConfigSignal:n}),wqe=(n,o)=>({condition:n,data:o}),Tqe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-confirm-dialog-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Dqe(n,o){if(n&1&&(C(0),D(1,"app-confirm-dialog-title",5)(2,"app-confirm-dialog-message",5),f(3,"div",6),D(4,"app-confirm-dialog-reject",5)(5,"app-confirm-dialog-approve",5),S(),b()),n&2){let r=s(3);v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal),v(2),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal)}}function Oqe(n,o){if(n&1&&(C(0),p(1,Dqe,6,4,"ng-container",4),b()),n&2){let r=s().ngIf,e=s();v(),g("veltDynamicTemplate",j(3,Tqe,e.template,J(1,d_e,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function Aqe(n,o){if(n&1&&(C(0),p(1,Oqe,2,9,"ng-container",3),b()),n&2){let r=s();v(),g("veltIf",E(3,wqe,r.conditionSignal(),J(1,d_e,r.componentConfigSignal)))}}var ll=(()=>{let o=class o extends Ot{constructor(e,t,i,a,l,c,d){super(l,a,void 0,void 0,void 0,d,e),this.loggingService=e,this.dialogRef=t,this.wireframeService=i,this.themeService=a,this.elementRef=l,this.dynamicDataService=d,this.subscriptions=[],this.componentConfigSignal=De({title:"",message:"",yesButton:"",noButton:"",variant:"",type:"",closeDialog:this.closeDialog.bind(this)}),this.componentId="velt-confirm-dialog",this.veltElement=!0;try{c&&(this.componentConfigSignal.update(m=>(m=h(h({},m),c),m)),c?.darkMode&&[!0,!1].includes(c?.darkMode)&&super.setComponentDarkMode(c?.darkMode)),this.setZIndex()}catch(m){this.loggingService.catch("Error in ConfirmDialogComponent constructor: ",m)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-confirm-dialog-wireframe";super.ngOnInit(),this.componentConfigSignal()?.variant&&(e+=`---${this.componentConfigSignal()?.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let i=document.createElement(t.tagName);i.innerHTML=t.innerHTML,this.template=i}}))}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnInit: ",e)}}ngOnDestroy(){super.ngOnDestroy();try{this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnDestroy: ",e)}}setZIndex(){try{if(this.dialogRef){let e=this.dialogRef._overlayRef;e&&(e.backdropElement&&(e.backdropElement.style.zIndex="2147483647"),e.hostElement&&(e.hostElement.style.zIndex="2147483647"))}}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent setZIndex: ",e)}}closeDialog(e){try{this.dialogRef.close(e)}catch(t){this.loggingService.catch("Error in ConfirmDialogComponent closeDialog: ",t)}}get variantClass(){return Mqe(this.componentConfigSignal()?.type)}};o.\u0275fac=function(t){return new(t||o)(x(k),x(ji),x(Xe),x(yt),x(Q),x(rd,8),x(T))},o.\u0275cmp=O({type:o,selectors:[["snippyly-confirm-dialog"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},standalone:!1,features:[V([T]),P],decls:3,vars:6,consts:[["floatingConfirmationRef",""],[1,"velt-confirm-dialog",3,"ngClass","snippylyOverlay","snippylyOverlayZIndex","snippylyOverlayBackdropZIndex"],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],["mat-dialog-actions","",1,"velt-confirm-dialog-actions"]],template:function(t,i){if(t&1&&(f(0,"div",1,0),p(2,Aqe,2,6,"ng-container",2),S()),t&2){let a=Ee(1);g("ngClass",i.variantClass)("snippylyOverlay",a)("snippylyOverlayZIndex",1200)("snippylyOverlayBackdropZIndex",1100),w("data-testid",i.componentId),v(2),g("ngIf",i.componentConfigSignal())}},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%] *[_ngcontent-%COMP%]{outline:0}[_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-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)}[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-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-confirm-dialog[_ngcontent-%COMP%]{width:455px;padding:40px;display:block;box-sizing:border-box;background-color:var(--velt-background-0)}.velt-confirm-dialog-actions[_ngcontent-%COMP%]{justify-content:space-between;gap:var(--velt-spacing-md);min-height:auto} .velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface:has(snippyly-confirm-dialog){border-radius:var(--velt-border-radius-xl);padding:0}@media (max-width: 768px){.velt-confirm-dialog[_ngcontent-%COMP%]{width:auto;max-width:455px;padding:24px}}"],changeDetection:0});let n=o;return n})();function Mqe(n){return n?`velt-confirm-dialog--${n}`:""}var mn=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A,M,B,q,ae,_e,re,be){this.afAuth=e,this.analyticsService=t,this.authService=i,this.configService=a,this.commonDbService=l,this.commonDbUtilsService=c,this.commentUtilsService=d,this.commentAnnotationsResolverService=m,this.notificationResolverService=u,this.databaseService=_,this.docService=I,this.domService=A,this.iamService=M,this.loggingService=B,this.notificationUtilsService=q,this.usersService=ae,this.functions=_e,this.userPermissionService=re,this.coreActionsService=be,this.db=null,this.notificationsDb=null,this.documentPaths=null,this.notifications$=new Se([]),this.rawNotificationsByIdMap$=new Se(new Map),this.processedNotifications$=new Se([]),this.userNotificationsFromServer$=new Se(null),this.readNotificationsOnForYouTab$=new Se(!1),this.currentDocumentOnly$=new Se(!1),this.notificationViews$=new Se({}),this.notificationsByIdMap$=new Se(new Map),this.historyPanelVisible$=new Se(!1),this.notificationsForYou$=new Se(null),this.notificationsByDocumentIdMap$=new Se(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new Se(null),this.maxNotificationDays$=new Se(15),this.tabConfig$=new Se({people:{enable:!1}}),this.settingsConfig$=new Se(null),this.setSettingsConfigByOrganization$=new Se(!1),this.muteAllNotifications$=new Se(!1),this.enableSettings$=new Se(!1),this.selfNotifications$=new Se(!1),this.settingsInitialConfig$=new Se([{name:"Inbox",id:"inbox",default:"ALL",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]},{name:"Email",id:"email",default:"MINE",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]}]),this.settingsConfigGeneration=0,this.notificationsPanelVisible$=new Se(!1);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe($e(Ie=>!!Ie),ut(1)).subscribe(Ie=>{if(Ie){this.db=Ie;try{let Ce=this.configService.getProxyConfig(),Te=On.firebaseNotificationsDatabaseURL;Ce?.v1DbHost&&Te&&(Te=jN(Te,Ce.v1DbHost)),this.notificationsDb=N_(void 0,Te),Ce?.v1DbHost&&Te&&this.databaseService.lockDatabaseHost(this.notificationsDb)}catch(Ce){this.loggingService.catch("Error initializing notifications DB, using default: ",Ce),this.notificationsDb=Ie}this.getDocumentIds(),this.subscribeGetNotificationsForYou()}},Ie=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",Ie)}),this.authService.getUser$().subscribe(Ie=>{Ie?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Ce=>{this.notificationsByDocumentIdSubscription[Ce]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(Ie=>{if(Ie){let Ce=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(Ie||{}).forEach(Te=>{let Oe=Ce?.[Te]?.notifications;Oe?.length&&Oe.forEach(Me=>{this.notificationUtilsService.mergeLocationWithNotification({notification:Me},Ie)?.notification})}),this.notificationsByDocumentIdMap$.next(Ce)}})}catch(Ie){this.loggingService.catch("Error in NotificationService constructor: ",Ie)}}setDBConfigDataToInitialConfig(e){try{let t=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([i,a])=>{t[i]=a}),this.settingsConfig$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",t)}}getInitialConfigFromDB(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let t=++this.settingsConfigGeneration,i=It(this.authService.getUser()?.userId??""),a=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:this.getSettingsConfigByOrganization()?void 0:e?.documentId,organizationId:e?.organizationId??this.docService.getOrganizationConfig()?.organizationId,userId:i}});if(t!==this.settingsConfigGeneration)return;if(a?.notificationsConfig)this.setDBConfigDataToInitialConfig(a?.notificationsConfig);else{this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue());let l={};this.settingsInitialConfig$.getValue().forEach(d=>{if(d.enable){let m=d?.values?.find(u=>u.id===d.default);l[d.id]=m||d?.values?.[0]||{id:"NONE",name:"None"}}});let c={};Object.keys(l).forEach(d=>{c[d]=l[d].id}),yield this.updateSettingsConfigToDb(c)}}catch(t){this.loggingService.catch("Error in NotificationService getInitialConfigFromDB: ",t)}})}subscribeToUserSettings(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: subscribeToUserSettings","color: green;"),this.userSettingsSubscription&&this.userSettingsSubscription.unsubscribe();let e=It(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe($e(t=>t===!0),ye(()=>Cn([this.docService.getDocumentPaths$(),this.getSettingsConfigByOrganization$(),this.docService.getOrganizationConfig$()]).pipe($e(([t,i,a])=>(i||!!t)&&!!a?.organizationId),ye(([t,i,a])=>Eo(this.getInitialConfigFromDB(t)).pipe(ye(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:i?void 0:t?.documentId,organizationId:t?.organizationId??a?.organizationId,userId:e}}).pipe(ge(l=>{l?.data?.notificationsConfig&&!vr(l?.data?.notificationsConfig??{},this.settingsConfig$.getValue()??{})&&this.setDBConfigDataToInitialConfig(l?.data?.notificationsConfig)})))))))).subscribe()}catch(e){this.loggingService.catch("Error in NotificationService subscribeToUserSettings: ",e)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.setUserNotificationsFromServer(null),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.next(null)}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in NotificationService setCommentService: ",t)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.selfNotifications$.pipe(ye(()=>this.getCurrentDocumentOnly$().pipe(ye(e=>e?this.docService.getDocumentPaths$().pipe(ge(t=>{})):ce(void 0)))),ln(()=>{this.notificationsByDocumentIdMap$.next(null)}),ye(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Rr(),ge(([e,t])=>{let i=e?.map(m=>m.documentId),a=t?.map(m=>m.documentId),l=i?.filter(m=>!a?.includes(m)),c=a?.map(m=>({documentId:m,timestamp:t?.find(u=>u.documentId===m)?.timestamp})).filter(m=>!i?.includes(m.documentId)),d=a?.map(m=>{let u=t?.find(_=>_.documentId===m)?.timestamp;return{documentId:m,timestamp:u}}).filter(m=>{let u=e?.find(_=>_.documentId===m.documentId)?.timestamp;return u&&m.timestamp&&u!==m.timestamp});c?.length&&this.fetchNotificationsForDocumentIds(c),d?.length&&this.fetchNotificationsForDocumentIds(d,1),l?.forEach(m=>{this.removeNotificationsForDocumentId(m)}),t&&!t?.length&&!this.notificationsByDocumentIdMap$.getValue()&&(this.notificationsByDocumentIdMap$.next({}),this.setUserNotificationsFromServer([]))})))).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(ye(t=>this.docService.getOrganizationConfig$().pipe(ge(i=>{let a=null,l=this.configService.getApiKey(),c=i?.organizationId||t?.organizationId;return l&&c&&(a=new Sm({apiKey:l,organizationId:c})),{user:t,documentPaths:a}}))),ye(t=>{let{user:i,documentPaths:a}=t;if(this.getCurrentDocumentOnly()&&!this.docService?.getDocumentPaths()?.documentId)return ce(null);if(i&&a?.organizationNotificationsLastNotificationTimestamp){let l=new Date,c=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;l.setDate(l.getDate()-c);let d=l.getTime(),m=[Sr(ft("timestamp",">=",d),...this.getCurrentDocumentOnly()&&this.docService.getDocumentPaths()?.documentId?[ft("metadata.documentId","==",this.docService.getDocumentPaths()?.documentId)]:[])];return this.getCurrentDocumentOnly()||(m.push(mo("timestamp","desc")),m.push(Cm(e))),this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:m}}).pipe(ge(u=>u?.data),ge(u=>{let _=[];return Object.keys(u||{}).forEach(I=>{let A=this.commonDbService.shouldUseFirestore()?u[I]?.timestamp??0:u[I],M=this.commonDbService.shouldUseFirestore()?u[I]?.deletedNotification??!1:!1;if(M&&M.id&&M?.timestamp===A){let B=M.id,q=u[I]?.metadata?.documentId,ae=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),_e=ae?.[q]??{documentMetadata:null,notifications:[]},re=_e.notifications??[],be=re?.findIndex(Ie=>Ie.id===B);be!==-1&&(re.splice(be,1),this.notificationsByDocumentIdMap$.next(y(h({},ae),{[q]:y(h({},_e),{notifications:re})}))),this.notificationResolverService.notificationDataProviderAvailable()&&this.notificationResolverService.getNotificationById(B)&&this.notificationResolverService.deleteNotification(B,this.docService.getDocumentPaths()?.clientOrganizationId??"")}_.push({documentId:I,timestamp:A})}),_}),Jn(u=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",u),ce([]))))}return ce(null)}))}catch(t){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",t),ce([])}}resolveAndUpdateDocumentNotifications(e,t){try{Object.keys(e).forEach(i=>{let a=e[i]?.documentMetadata||this.docService.getAllDocumentMetadataMap()?.[i]||{},l;if(t==="user")l=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:e[i]?.notifications||[]});else if(t==="notification"){let c=e[i]?.notifications?.reduce((m,u)=>(m[u.notificationId]=u,m),{}),d=this.commonDbUtilsService.mergeNotificationsWithResolvedData({feature:"allDocNotifications",data:c});l=Object.values(d??{})}else{let c=e[i]?.notifications?.reduce((m,u)=>(m[u.notificationId]=u,m),{}),d=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:c});l=Object.values(d??{})}l.forEach(c=>{c.notification=this.getClientNotificationObject(c)}),this.setNotificationForDocumentIdInCache(i,a,l)})}catch(i){this.loggingService.catch("Error in NotificationService resolveAndUpdateDocumentNotifications: ",i)}}resolveAndMergeUserNotifications(e,t,i=!1){try{let a=e;if(i&&t==="comment"){let u=this.getUserNotificationsFromServer()??[],_=new Set(e.map(I=>I.notificationId));a=u.filter(I=>_.has(I.notificationId)).concat(e.filter(I=>!u.some(A=>A.notificationId===I.notificationId)))}let l=a.reduce((u,_)=>(u[_.notificationId]=_,u),{}),c;if(t==="user"){let u=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:l});c=Object.values(u??{})}else if(t==="notification"){let u=this.commonDbUtilsService.mergeNotificationsWithResolvedData({feature:"allUserNotifications",data:l});c=Object.values(u??{})}else{let u=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:l});c=Object.values(u??{})}c.forEach(u=>{u.notification=this.getClientNotificationObject(u)});let d=this.getUserNotificationsFromServer()??[],m=new Map(d.map(u=>[u.notificationId,u]));c.forEach(u=>{m.set(u.notificationId,u)}),this.setUserNotificationsFromServer(Array.from(m.values()))}catch(a){this.loggingService.catch("Error in NotificationService resolveAndMergeUserNotifications: ",a)}}fetchNotificationsForDocumentIds(e,t=15){return X(this,null,function*(){try{if(e?.length){let i=Yr(this.functions,Zr({url:On.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"";if(!a)return[];let l=this.getStartAtTimestamp(),c={};if(e.forEach(re=>{if(re?.documentId){let be=this.getAllowedDocumentMetadataByDocumentId(re.documentId);be&&(c[re.documentId]=be)}}),this.userPermissionService?.isPermissionProviderAvailable())try{let re=[];if(e.forEach(Oe=>{this.docService.getDocumentMetadata(Oe.documentId)||re.push(Oe.documentId)}),re.length){let Oe=this.authService.getUser(),Me=Yr(this.functions,Zr({url:On?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));try{let Be=yield wl({methodName:"getDocumentMetadataFromIds",data:{type:"getDocumentMetadataFromIds",metadata:{organizationId:Oe?.clientOrganizationId,folderId:this.documentPaths?.folderId},documentIds:re},getSdkProxy:Me,userId:Oe?.userId??""});if(Be?.data?.length){let We={};Be.data.forEach(He=>{He?.documentId&&(We[He.documentId]=He)}),this.docService.setAllDocumentMetadata(h(h({},this.docService.getAllDocumentMetadataMap()),We))}}catch(Be){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",Be)}}let be=[],Ie=[];e.forEach(Oe=>{let Me=this.docService.getDocumentMetadata(Oe.documentId);Me?.clientDocumentId?be.push({userId:this.authService.getUser()?.userId??"",resource:{id:Me.clientDocumentId,type:aa.DOCUMENT,source:oo.GET_NOTIFICATIONS,organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??""}}):Ie.push(Oe.documentId)}),Ie.length&&(e=e.filter(Oe=>!Ie.includes(Oe.documentId)));let Ce=at();this.coreActionsService.triggerAction(tt.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:Ce,methodName:oo.GET_NOTIFICATIONS,source:"internal",payload:{requests:be}});let Te=yield this.userPermissionService?.onResourceAccessRequired({requests:be,uniqueId:Ce,methodName:oo.GET_NOTIFICATIONS});Te?.success&&Te?.data?.length?Te.data.forEach(Oe=>{!Oe.hasAccess&&Oe.resourceId&&(e=e.filter(Me=>Me.documentId!==vi(Oe.resourceId)))}):e=[]}catch(re){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",re),e=[]}if(!e.length)return[];let d=this.userPermissionService?.getPermissionsCache()?.filter(re=>re.type===aa.CONTEXT),m={organizationId:a,documentIds:e.filter(re=>!!re.documentId&&!!re.timestamp).map(re=>({documentId:re.documentId,timestamp:re.timestamp??0})),timestamp:l,limitToLast:t,selfNotifications:this.selfNotifications$.value,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),getUserNotifications:!0,isContextEnabled:this.userPermissionService?.getIsContextEnabled(),cachedData:d,isSettingsConfigByOrganization:this.getSettingsConfigByOrganization(),retryConfig:this.userPermissionService?.getPermissionProviderRetryConfig()},u=yield this.notificationUtilsService.handleNotificationEncryption({data:m}),_=yield i({veltData:u}),I=_?.data?.data?.veltData||{},A=_?.data?.data?.veltAdditionalData||{},M="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),B=yield v1(I,M),{userNotifications:q=[],userNotificationIdsInDocNotifications:ae=[],permissionResults:_e=[]}=yield v1(A,M);if(this.userPermissionService?.getIsContextEnabled()){let re=[...this.userPermissionService?.getPermissionsCache()??[],..._e??[]];this.userPermissionService?.setPermissionsCache(re)}if(B&&typeof B=="object"){let re=this.usersService.userDataProviderAvailable(),be=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Ie=this.notificationResolverService.notificationDataProviderAvailable(),Ce=[],Te=[],Oe=[];Object.keys(B).forEach((We,He)=>{let $r=B[We].documentMetadata??this.docService.getAllDocumentMetadataMap()?.[We];if($r){let Et=this.allowedDocumentMetadataMap$.value||{};(!Et?.[We]||!vr(Et?.[We],$r))&&this.allowedDocumentMetadataMap$.next(y(h({},Et),{[We]:$r}))}let nt=B[We].notifications||[];nt.forEach(Et=>{ae.includes(Et.notificationId)&&!q.find(Je=>Je.notificationId===Et.notificationId)&&q.push(JSON.parse(JSON.stringify(Et))),Et.notification=this.getClientNotificationObject(Et)}),this.setNotificationForDocumentIdInCache(We,$r,nt),re&&(Ce.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:nt,shouldAwait:!0,forceResolve:!0})),Ce.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:q,shouldAwait:!0,forceResolve:!0}))),be&&(Te.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:nt,shouldCommentAnnotationsResolverAwait:!0})),Te.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:q,shouldCommentAnnotationsResolverAwait:!0}))),Ie&&(Oe.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:nt,shouldNotificationResolverAwait:!0})),Oe.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:q,shouldNotificationResolverAwait:!0})))});let Me=JSON.parse(JSON.stringify(q));this.setUserNotificationsFromServer([...this.getUserNotificationsFromServer()??[],...q]),(Ie||re||be)&&(()=>{let We=Promise.resolve();if(Ie&&(We=We.then(()=>Promise.allSettled(Oe)).then(()=>{this.resolveAndUpdateDocumentNotifications(B,"notification"),this.resolveAndMergeUserNotifications(Me,"notification")})),re&&(We=We.then(()=>Promise.allSettled(Ce)).then(()=>{this.resolveAndUpdateDocumentNotifications(B,"user"),this.resolveAndMergeUserNotifications(Me,"user")})),be){let He=Ie||re;We=We.then(()=>Promise.allSettled(Te)).then(()=>{this.resolveAndUpdateDocumentNotifications(B,"comment"),this.resolveAndMergeUserNotifications(Me,"comment",He)})}return We})().catch(We=>{this.loggingService.catch("Error in NotificationService resolveChain: ",We)})}}}catch(i){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",i),[]}})}getUserNotificationsFromServer$(){return this.userNotificationsFromServer$.asObservable()}setUserNotificationsFromServer(e){try{let t=JSON.parse(JSON.stringify(e));t=t?.filter((i,a,l)=>a===l.findIndex(c=>c.notificationId===i.notificationId)),this.userNotificationsFromServer$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setUserNotificationsFromServer: ",t)}}getUserNotificationsFromServer(){return this.userNotificationsFromServer$.getValue()}setNotificationForDocumentIdInCache(e,t,i,a){try{let l=this.docService.getOrganizationConfig()?.organizationId??"",c=this.docService.getOrganizationMetadata(l);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),c||(c=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(l)||{})));let d=this.notificationsByDocumentIdMap$.getValue(),m=d?.[e]?.notifications||[],u=this.docService.getLocationMetadatas(),_=i?.map(M=>{let B=M?.notification;return B?(B.metadata&&(B.metadata.documentName=t?.documentName||B.metadata.documentName,B.metadata.organizationMetadata=c||B.metadata.organizationMetadata,B.metadata.documentMetadata=t||B.metadata.documentMetadata),u&&(B=this.notificationUtilsService.mergeLocationWithNotification({notification:B},u)?.notification),B):null})?.filter(M=>!!M)||[],I=new Map(m.map(M=>[M.id,M]));_.forEach(M=>{I.set(M.id,M)});let A=Array.from(I.values()).sort((M,B)=>(B.timestamp||0)-(M.timestamp||0));this.notificationsByDocumentIdMap$.next(y(h({},d),{[e]:{notifications:A,documentMetadata:t}}))}catch(l){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",l)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let t=this.notificationsByDocumentIdMap$.getValue();delete t?.[e],this.notificationsByDocumentIdMap$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",t)}}getStartAtTimestamp(){try{let e=new Date,t=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-t),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.getUserNotificationsFromServer$().pipe(ye(e=>ce(e).pipe($e(t=>!!t),ge(t=>{let i=this.usersService.userDataProviderAvailable(),a=this.commentAnnotationsResolverService?.commentAnnotationDataProviderAvailable(),l=this.notificationResolverService?.notificationDataProviderAvailable();if(l||i||a){let d=t?.reduce((m,u)=>(m[u.notificationId]=u,m),{});l&&(d=this.commonDbUtilsService.mergeNotificationsWithResolvedData({feature:"allUserNotifications",data:d||[]})),i&&(d=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:d||[]})),a&&(d=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:d||[]})),t=Object.values(d??{})}return t.forEach(d=>{d.notification=this.getClientNotificationObject(d)}),t.sort((d,m)=>m.timestamp-d.timestamp),t.map(d=>d.notification).filter(d=>!!d)}),ye(t=>{let i={data:t?.reduce((a,l)=>(a[l.id]={notification:l},a),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:i,feature:"allUserNotifications"}).pipe(ge(a=>Object.values(a?.data||{}).map(l=>l?.notification)))}))),ye(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(ge(()=>e))}),ye(e=>this.allowedDocumentMetadataMap$.pipe(ge(()=>e))),ge(e=>(e?.length&&(e=e.map(t=>{if(t?.metadata){let i=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(t.metadata.documentId),l=this.docService.getOrganizationMetadata(i);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),l||(l=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(i)||{}))),t.metadata.documentName=a?.documentName||t.metadata.documentName,t.metadata.organizationMetadata=l||t.metadata.organizationMetadata,t.metadata.documentMetadata=a||t.metadata.documentMetadata}return t})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(JSON.parse(JSON.stringify(e))):this.notificationsForYou$.next([]),ce(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),ce({})}}subscribeNotificationsData(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let i,a;try{if(e&&(a=Qn(e)),t&&typeof t=="object"){let l=Oi(t);i=Qn(JSON.stringify(l))}}catch(l){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",l)}return br(this.afAuth).pipe($e(l=>!!l),ye(l=>this.isFeatureAllowed({firebaseUser:l})),ye(l=>l.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(c=>(l.featureAllowed=c,l))):ce(l)),ye(l=>!l.featureAllowed||l?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),ce([])):ce(l).pipe(ye(c=>this.docService.getDocumentPaths$().pipe(ge(d=>(this.documentPaths=d,c.documentPaths=d,c)))),ye(c=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>y(h({},t),{user:i})))),ye(t=>Mo(t.config,t.user,je.NOTIFICATION)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe($e(t=>!!t),ye(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let i=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(i+=`/${N.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=Vr(this.db,`${e?i+"/"+N.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+N.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return R8(a).pipe(Jn(l=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",l),ce(null))),ge(l=>{let c=[],d=new Map;l?.raw&&(Object.keys(l?.raw||{}).forEach(u=>{let _=l?.raw[u];_?.id&&c.push(_)}),c.forEach(u=>{u.id&&d.set(u.id,u)})),this.notifications$.next(c),this.rawNotificationsByIdMap$.next(d);let m=[];l?.processed&&Object.keys(l?.processed||{}).forEach(u=>{let _=l?.processed[u];_?.id&&m.push(_)}),this.processedNotifications$.next(m),this.setNotificationsByIdMap()}))}else return ce(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),i;e?.email&&(i=It(e?.email));let a;e?.userId&&(a=It(e?.userId));let l=new Map;this.processedNotifications$.getValue().forEach(d=>{if(d.id&&d?.displayHeadlineMessageTemplate){let m=!1;(i&&d.notifyUsers?.[i]||a&&d.notifyUsers?.[a])&&(m=!0);let u={id:d.id,notificationSource:d.notificationSource,actionType:d.actionType,actionUser:d.actionUser,timestamp:d.timestamp,targetAnnotationId:d.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(d),displayBodyMessage:this.getNotificationBodyMessage(d),forYou:m,notificationSourceData:d.notificationSourceData},_=this.getRawNotificationById(u.id);if(_?.metadata&&(u.metadata={apiKey:_.metadata.apiKey,organizationId:_.metadata.organizationId,clientOrganizationId:_.metadata.clientOrganizationId,documentId:_.metadata.documentId,clientDocumentId:_.metadata.clientDocumentId,location:_?.location,locationId:_?.locationId}),u?.notificationSource==="comment"&&u?.targetAnnotationId){let I=this.commentService?.getAnnotationById(u.targetAnnotationId);I||_?.annotationData&&(I=_.annotationData),I&&(u.notificationSourceData=this.commentService?.getCommentAnnotationForClient(I))}l.set(d.id,u)}}),l.forEach((d,m)=>{d.isUnread=d?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[m]?.views?.[e?.userSnippylyId],l.set(m,d)}),this.notificationsByIdMap$.next(l)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:t,metadata:i,views:a,notification:l}){try{let c=this.authService.getUser(),d=l||e;if(d.id&&d?.displayHeadlineMessageTemplate&&c){let m=null;c?.email&&(m=It(c?.email));let u=null;c?.userId&&(u=It(c?.userId));let _=!1,I=!0;(m&&d.notifyUsers?.[m]||u&&d.notifyUsersByUserId?.[u])&&(_=!0),u&&a?.[u]&&(I=!1);let A={id:d.id};if(l?A=y(h(h({},A),l),{displayHeadlineMessage:this.getNotificationHeadlineMessage(l),displayBodyMessage:this.getNotificationBodyMessage(l),forYou:_,isUnread:I}):A={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:_,isUnread:I,metadata:i},A?.notificationSource==="comment"&&A?.targetAnnotationId){let M=this.commentService?.getAnnotationById(A.targetAnnotationId);M||l?.notificationSourceData&&(M=l?.notificationSourceData),M||t?.annotationData&&(M=t.annotationData),M&&(A.notificationSourceData=this.commentService?.getCommentAnnotationForClient(M))}return t?.targetAnnotationData?.isCommentResolverUsed&&(A.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),l?.isNotificationResolverUsed&&(A.isNotificationResolverUsed=l.isNotificationResolverUsed),A}return}catch(c){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",c);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(ge(e=>e?Object.keys(e??{}).map(t=>{let i=e[t].notifications||[],a=i.filter(c=>c.isUnread).length,l=i.length>0&&i[0]?.timestamp||0;return{documentId:t,notifications:e[t]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:l,documentMetadata:e[t]?.documentMetadata}}).filter(t=>t.notifications?.length>0).sort((t,i)=>i.latestNotificationTimestamp-t.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(ge(e=>{let t=null;return e?(t=[],e.forEach(i=>{i.notifications.forEach(a=>{t?.push(a)})}),t?.sort((i,a)=>a.timestamp-i.timestamp)):null}))}processNotificationData(e){try{let t=e?.annotationData?.metadata,i=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.documentId)||{})),e.metadata||(e.metadata={},this.loggingService.catch("Warning in NotificationService updateNotificationDatabase: ","Document metadata not found")),delete e.metadata.locations,e.metadata.documentMetadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.documentId)||{})),e?.metadata?.documentMetadata?.clientDocumentId&&e?.metadata?.documentMetadata?.documentId&&(e.metadata.documentMetadata.documentId=e?.metadata?.documentMetadata?.clientDocumentId),delete e.metadata.documentMetadata.locations,e.metadata.organizationMetadata=JSON.parse(JSON.stringify(i?this.docService.getOrganizationMetadata(i)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let l=t?.documentId?new Sm({apiKey:a,documentId:t.documentId,organizationId:t?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=l?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=l?.clientOrganizationId||e.actionUser.clientOrganizationId);let c=this.docService.getLocation();c&&(e.location=c?.location,e.locationId=c?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let d=this.commonDbService.getServerTimestamp(),m=this.notificationUtilsService.formatNotification(e,d);return JSON.parse(JSON.stringify(m))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{if(!this.notificationsDb)return;let t=Vr(this.notificationsDb),i=this.processNotificationData(e);I8(t,JSON.parse(JSON.stringify(i)))}catch(t){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",t)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(e){return this.authService.getUser$().pipe(ye(t=>t?t.organizationId?this.getAllNotifications$().pipe(ye(i=>this.notificationsForYou$.pipe(ge(a=>{if(i||a){let l=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(i||[]).forEach(c=>{c.id&&l.set(c.id,c)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(c=>{c.id&&!l.has(c.id)&&l.set(c.id,c)}),Array.from(l.values()).sort((c,d)=>(d.timestamp||0)-(c.timestamp||0))}else return null})))):this.notificationsByIdMap$.asObservable().pipe(ge(i=>Array.from(i.values())),ge(i=>i.sort((a,l)=>l.timestamp-a.timestamp)),Xh()):ce(null)),_t(Kt))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(t){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",t);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(t){this.loggingService.catch("Error in NotificationService setNotificationViews: ",t)}}getNotificationHeadlineMessage(e){try{let t=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let i=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,l=/\{(\w+)\}/g,c=i.replace(l,(d,m)=>(m==="actionUser"||m==="recipientUser")&&a[m]?t?.email&&a[m].email===t?.email||t?.userId&&a[m]?.userId===t?.userId?"You":a[m].name||a[m].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[m]?a[m]:d);return this.domService.sanitizeHtml(c)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",t),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let t=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(i=>{if(i?.userId){let a=this.usersService.getUserById(i?.userId);t=t?.replaceAll(`{{${i.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>'),t=t?.replaceAll(`@User ${i.userId}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(t)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",t),""}}setHistoryPanelVisibility(e,t=!1,i=!1){try{e?document.querySelector(N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,t=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${N.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return X(this,null,function*(){try{let t=JSON.parse(JSON.stringify(this.getUserNotificationsFromServer()??[]));if(e?.length){for(let c=0;c<e.length;c+=50){let m=e.slice(c,c+50).filter(I=>I?.id),u=m.map(I=>this.setNotificationAsRead({notification:I,userNotifications:JSON.parse(JSON.stringify(t))})),_=yield Promise.all(u);m.forEach((I,A)=>{let M=_[A];if(!M.some(q=>q.notificationId===I.id))t=t.filter(q=>q.notificationId!==I.id);else{let q=t.find(_e=>_e.notificationId===I.id),ae=M.find(_e=>_e.notificationId===I.id);q&&ae?.views&&(q.views=ae.views)}})}let a=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(c=>{let d=c.metadata?.documentId;if(d&&a?.[d]){let m=a?.[d]?.notifications||[],u=m.find(_=>_.id===c.id);u&&(u.isUnread=!1),a[d].notifications=m}}),this.notificationsByDocumentIdMap$.next(a),!vr(t,this.getUserNotificationsFromServer())&&this.setUserNotificationsFromServer(t)}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",t)}})}setAllNotificationsAsRead(e){return X(this,null,function*(){try{if(e?.tabId==="for-you"){let t=this.notificationsForYou$.value||[];this.setNotificationsAsRead(t)}else this.getNotifications$().pipe(ut(1)).subscribe(t=>{t&&this.setNotificationsAsRead(t)})}catch(t){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",t)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(ge(e=>e?.filter(i=>i?.isUnread)?.length??null),ye(e=>this.getNotifications$().pipe(ge(t=>{let i=t?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:i}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),ce({forYou:null,all:null})}}setNotificationAsRead(i){return X(this,arguments,function*({notification:e,userNotifications:t}){try{let a=this.authService.getUser();if(a&&e?.id){let l=It(a?.userId),{metadata:c}=e;if(c){let{apiKey:d,organizationId:m,documentId:u}=c;if(d&&m&&u&&l){let _=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:m,documentId:u,apiKey:d}});_?.notificationId&&(_?.views?.[l]||(_.views||(_.views={}),_.views[l]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:m,documentId:u,apiKey:d},data:_})));let I=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:l,documentId:u,organizationId:m}});if(I?.notificationId){if(!this.getReadNotificationsOnForYouTab())yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:l,documentId:u,organizationId:m}}),t=t.filter(A=>A.notificationId!==e.id);else if(!I?.views?.[l]){I.views||(I.views={}),I.views[l]={timestamp:Date.now()};let A=t.find(M=>M.notificationId===e.id);A&&(A.views=I.views),this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:l,documentId:u,organizationId:m},data:I})}}}}}return t}catch(a){return this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",a),t}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(t){this.loggingService.catch("Error in NotificationService setMaxDays: ",t)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setTabConfig: ",t)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}enableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!0)return;this.currentDocumentOnly$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableCurrentDocumentOnly: ",e)}}disableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!1)return;this.currentDocumentOnly$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableCurrentDocumentOnly: ",e)}}getCurrentDocumentOnly$(){return this.currentDocumentOnly$.asObservable()}getCurrentDocumentOnly(){return this.currentDocumentOnly$.value}markNotificationAsReadById(e){return X(this,null,function*(){try{this.getNotifications$().pipe(ut(1)).subscribe(t=>{if(t){let i=t.filter(a=>a.id===e);this.setNotificationsAsRead(i)}})}catch(t){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",t)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(t){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",t),null}}setSettingsConfig(e){try{this.enableSettings$.value&&this.settingsConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfig: ",t)}}setSettingsConfigWithDB(e){try{this.enableSettings$.value&&(this.settingsConfig$.next(e),this.updateSettingsConfigToDb())}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfigWithDB: ",t)}}getSettingsConfig$(){return this.settingsConfig$.asObservable()}getSettingsConfig(){return this.settingsConfig$.value}setMuteAllNotifications(){try{this.muteAllNotifications$.value!==!0&&this.muteAllNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService setSettingsMuteAll: ",e)}}getMuteAllNotifications$(){return this.muteAllNotifications$.asObservable()}getMuteAllNotifications(){return this.muteAllNotifications$.value}enableSettings(){try{this.enableSettings$.value!==!0&&this.enableSettings$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettings: ",e)}}enableSettingsConfigByOrganization(){try{this.getSettingsConfigByOrganization()!==!0&&this.setSettingsConfigByOrganization$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettingsConfigByOrganization: ",e)}}disableSettingsConfigByOrganization(){try{this.getSettingsConfigByOrganization()!==!1&&this.setSettingsConfigByOrganization$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettingsConfigByOrganization: ",e)}}getSettingsConfigByOrganization$(){return this.setSettingsConfigByOrganization$.asObservable()}getSettingsConfigByOrganization(){return this.setSettingsConfigByOrganization$.value}enableSelfNotifications(){try{this.selfNotifications$.value!==!0&&this.selfNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSelfNotifications: ",e)}}disableSelfNotifications(){try{this.selfNotifications$.value!==!1&&this.selfNotifications$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSelfNotifications: ",e)}}disableSettings(){try{this.enableSettings$.value!==!1&&this.enableSettings$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettings: ",e)}}getEnableSettings$(){return this.enableSettings$.asObservable()}getEnableSettings(){return this.enableSettings$.value}setSettingsInitialConfig(e){try{let t=!1;if(e.forEach(i=>{["email","inbox"].includes(i.id)&&(t=!i.values?.every(a=>["ALL","NONE","MINE"].includes(a.id)))}),t){this.loggingService.catch("Invalid config values for email or inbox, It should have only ALL, NONE, MINE values");return}this.settingsInitialConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsInitialConfig: ",t)}}getSettingsInitialConfig$(){return this.settingsInitialConfig$.asObservable()}getSettingsInitialConfig(){return this.settingsInitialConfig$.value}updateSettingsConfigToDb(e){return X(this,null,function*(){try{let t=this.authService.getUser(),i=It(t?.userId??""),a=this.docService.getDocumentPaths(),l=this.docService.getOrganizationConfig(),c=a?.organizationId??l?.organizationId,d=a?.clientOrganizationId??l?.clientOrganizationId,m={apiKey:this.configService.getApiKey(),organizationId:c,documentId:a?.documentId,clientOrganizationId:d,clientDocumentId:a?.clientDocumentId,userId:i,clientUserId:this.authService.getUser()?.userId};i&&this.getEnableSettings()&&this.enableSettings$.value&&(this.getSettingsConfigByOrganization()?this.docService.addUserInfoToOrganization({organizationId:d??t?.clientOrganizationId??"",user:{userId:t?.userId??""},notificationsConfig:e||this.settingsConfig$.getValue()}):a?.documentId&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:a?.documentId,userId:i},data:{id:a?.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:m}})))}catch(t){this.loggingService.catch("Error in NotificationService updateSettingsConfigToDb: ",t)}})}openNotificationsPanel(){try{this.notificationsPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService openNotificationsPanel: ",e)}}closeNotificationsPanel(){try{this.notificationsPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService closeNotificationsPanel: ",e)}}getNotificationsPanelVisible$(){return this.notificationsPanelVisible$.asObservable()}getNotificationsPanelVisible(){return this.notificationsPanelVisible$.value}};o.\u0275fac=function(t){return new(t||o)(K(eo),K(ct),K(qe),K(Ft),K(yn),K(md),K(_m),K(ol),K(ym),K($n),K(st),K(Ue),K(Vn),K(k),K(eU),K(An),K(Oo),K(al),K(nr))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var pv=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A,M){this.analyticsService=e,this.configService=t,this.docService=i,this.databaseService=a,this.commonDbService=l,this.authService=c,this.domService=d,this.afAuth=m,this.iamService=u,this.dialog=_,this.loggingService=I,this.notificationService=A,this.userPermissionService=M,this.areaAnnotationById$=new Se({}),this.documentPaths=null,this.areaEnabled$=new Se(!0),this.allowedElementIds$=new Se([]),this.addAreaMode$=new Se(!1),this.loggingService.log("%c[WB] Creating CLASS: AreaService","color: blue;"),this.analyticsService.setAreaService(this),this.authService.setAreaService(this),this.databaseService.getDb().pipe($e(B=>!!B),ut(1)).subscribe(B=>{B&&this.getDocumentPaths()},B=>{this.loggingService.catch("Error in AreaService getDb subscription: ",B)}),this.domService.onWindowPointerMove$().subscribe(B=>{if(this.addAreaMode$.value){this.highlightElement&&this.domService.removeHighlightFromElement(this.highlightElement);let q=this.domService.getBackgroundElement(B.clientX,B.clientY);q&&(this.isElementInsideAllowedElements(q)?zN(B.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.highlightElement=q,this.domService.highlightElement(this.highlightElement,N.CURSOR.AREA_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},B=>{this.loggingService.catch("Error in AreaService onWindowPointerMove$ subscription: ",B)}),this.domService.onWindowKeyupEsc$().subscribe(B=>{this.addAreaMode$.value&&this.disableAddAreaMode()},B=>{this.loggingService.catch("Error in AreaService onWindowKeyupEsc$ subscription: ",B)}),this.domService.onDocumentClick$().subscribe(B=>{if(B&&this.addAreaMode$.value){if(B.preventDefault(),B.stopPropagation(),!zN(B.target)){let q=this.domService.getBackgroundElement(B.clientX,B.clientY);q&&this.isElementInsideAllowedElements(q)&&this.addArea(B)}this.disableAddAreaMode()}},B=>{this.loggingService.catch("Error in AreaService onDocumentClick$ subscription: ",B)}),this.addAreaMode$.subscribe(B=>{this.highlightElement&&this.domService.removeHighlightFromElement(this.highlightElement),B?this.domService.addClassToElement(document.body,"snippyly-add-area-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-area-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},B=>{this.loggingService.catch("Error in AreaService addAreaMode$ subscription: ",B)}),this.domService.onWindowKeyupBackspace$().subscribe(B=>{this.deleteAreaPinAnnotations("keyupBackspace")},B=>{this.loggingService.catch("Error in AreaService onWindowKeyupBackspace$ subscription: ",B)}),this.domService.onWindowKeyupDelete$().subscribe(B=>{this.deleteAreaPinAnnotations("keyupDelete")},B=>{this.loggingService.catch("Error in AreaService onWindowKeyupDelete$ subscription: ",B)})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in AreaService","color: green;");try{this.areaAnnotationById$.next({}),this.areaEnabled$.next(!0),this.allowedElementIds$.next([]),this.addAreaMode$.next(!1),this.highlightElement=null}catch(e){this.loggingService.catch("Error in AreaService clearCache: ",e)}}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$()}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllAreaAnnotations(e,t,i){this.loggingService.log("%c[WB] Calling FUNCTION: getAllAreaAnnotations","color: green;");let a,l;try{if(e&&(l=Qn(e)),t&&typeof t=="object"){let c=Oi(t);a=Qn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in AreaService getAllAreaAnnotations: ",c)}return br(this.afAuth).pipe($e(c=>!!c),ye(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),ye(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(d=>(c.featureAllowed=d,c))):ce(c)),ye(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(ge(d=>(c.featureAllowed=!d,c))):ce(c)),ye(c=>c.featureAllowed?ce(c).pipe(ye(d=>this.docService.getDocumentPaths$().pipe(ge(m=>(this.documentPaths=m,d.documentPaths=m,d)))),ye(d=>l?this.getDataFromDocumentIds([l]).pipe(ge(m=>(d.annotations=m||[],h({},d)))):this.docService.getDocumentIds$().pipe(ye(m=>{let u=m?.length>0?m.map(_=>_.documentId):[this.documentPaths?.documentId??""];return this.getDataFromDocumentIds(u).pipe(ge(_=>(d.annotations=_||[],h({},d))))}))),ye(d=>this.docService.getLocation$().pipe(ge(m=>(d.location=m,d)))),ye(d=>this.docService.getLocations$().pipe(ge(m=>(d.customLocations=m,d)))),ge(d=>{if(d.filteredAnnotations=[],l&&!a)return d.filteredAnnotations=d.annotations?.slice(),d;{let m=[],u=[];return a?m.push(a):(m.push(d?.location?.locationId),m.push(...Object.values(d?.customLocations||[]).map(_=>_.locationId)),d?.location?.location?.id&&u.push(d?.location?.location?.id)),d.filteredAnnotations=this.filterAnnotationsByLocationIds(d?.annotations,m,u),d}}),ye(d=>i?ce(d):d?.annotations?.length?this.domService.onWindowResize$().pipe(ge(()=>d)):ce(d)),ye(d=>i?ce(d):d?.annotations?.length?this.domService.onDomChange$("AreaService getAllAreaAnnotations").pipe(ge(()=>d)):ce(d)),ge(d=>(d.filteredAnnotations=d.filteredAnnotations?.map(m=>{let u=Object.assign({},m);return u.areaProperties=this.calculateAreaAnnotationPosition(u),u}),d)),ye(d=>d?.filteredAnnotations?ce(d?.filteredAnnotations||[]):ce([])),ye(d=>{if(this.authService.isFeatureAllowed(je.COMMENT))return ce(d);{let m=d?.filter(u=>!u?.targetAnnotations?.filter(_=>_?.type===je.COMMENT)?.length);return ce(m)}})):ce([])),_t(Kt))}isFeatureAllowed(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>y(h({},t),{user:i})))),ye(t=>Mo(t.config,t.user,je.AREA)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Area feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))),_t((t,i)=>t?.featureAllowed===i?.featureAllowed))}getDataFromDocumentIds(e,t){return this.getDataFromDocuments({documentIds:e,filters:t})}getDataFromDocuments(e){if(this.configService.getApiKey()){let{documentIds:t,filters:i}=e;if(t?.some(d=>!d)||!this.documentPaths)return ce([]);let a=this.docService.getDocumentPaths()?.veltFolderId,l=ce([]),c={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(c.documentId=t?.length?t[0]:void 0,c.organizationId=this.documentPaths?.organizationId),this.userPermissionService?.getIsContextEnabled()){let d=[N.DEFAULT_VELT_CONTEXT,...this.docService.getProcessedDocContext()],m=[];for(let u=0;u<(d?.length??0);u+=N.LISTENER_CONTEXT_BATCH_SIZE)m.push(d?.slice(u,u+N.LISTENER_CONTEXT_BATCH_SIZE)??[]);l=Cn(m.map(u=>this.commonDbService.dbListener({feature:"allAreas",properties:y(h({},c),{firestoreQuery:[Sr(ft("metadata.apiKey","==",this.configService?.getApiKey()),ft("metadata.documentId","in",t),ft("metadata.organizationId","==",this.documentPaths?.organizationId),...a?[ft("metadata.veltFolderId","==",a)]:[],...u?.length?[ft("context.accessFields","array-contains-any",u)]:[])]})}).pipe(sa()))).pipe(ge(u=>Na(u)))}else{let d=[];for(let m=0;m<(t?.length??0);m+=N.LISTENER_BATCH_SIZE)d.push(t?.slice(m,m+N.LISTENER_BATCH_SIZE)??[]);l=Cn(d.map(m=>this.commonDbService.dbListener({feature:"allAreas",properties:y(h({},c),{firestoreQuery:[Sr(ft("metadata.apiKey","==",this.configService?.getApiKey()),ft("metadata.documentId","in",m),ft("metadata.organizationId","==",this.documentPaths?.organizationId),...a?[ft("metadata.veltFolderId","==",a)]:[])]})}).pipe(sa()))).pipe(ge(m=>Na(m)))}return l.pipe(ge(({data:d,operation:m})=>{let u=[];return d&&(u=Object.values(d??{}).filter(_=>typeof _=="object")),{data:u,operation:m}}),ge(({data:d,operation:m})=>{if(!t)return{data:d,documentMap:{},operation:m};let u=d.reduce((_,I)=>{let A=I.metadata?.documentId;return A&&(_[A]||(_[A]=[]),_[A].push(I)),_},{});return{data:d,documentMap:u,operation:m}}),ge(({data:d,documentMap:m,operation:u})=>{if(!i)if(u?.type==="removed"){if(u?.ids?.length){let _=this.areaAnnotationById$.value;u?.ids?.forEach(I=>{delete _?.[I]}),this.areaAnnotationById$.next(_)}}else Object.entries(m??{}).forEach(([_,I])=>{this.setAreaAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:_,annotations:I})});return d}))}else return ce([])}setAreaAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:t,annotations:i,queryHash:a}){try{if(t){e||(e=N.NO_ORGANIZATION_ID),a||(a=N.DEFAULT_QUERY_HASH);let l={};i?.forEach(d=>{d?.annotationId&&(l[d?.annotationId]=d)});let c=h(h({},this.areaAnnotationById$.value),l);this.areaAnnotationById$.next(c)}}catch(l){this.loggingService.catch("Error in AreaService setAreaAnnotationsByOrganizationIdAndDocumentId:",l)}}getAnnotationById(e){try{return this.areaAnnotationById$.value?.[e]?this.areaAnnotationById$.value?.[e]:void 0}catch(t){this.loggingService.catch("Error in AreaService getAnnotationById: ",t);return}}filterAnnotationsByLocationIds(e,t,i){try{return e.filter(a=>t.includes(a.locationId)||i?.includes(a?.location?.id)||t?.find(l=>l==a?.location?.id)||i?.find(l=>l==a?.locationId+""))}catch(a){return this.loggingService.catch("Error in AreaService filterAnnotationsByLocations:",a),[]}}calculateAreaAnnotationPosition(e,t=!1){try{if(e.targetElements?.length){let i=e.targetElements[0],a=e.targetElements[1];if(i?.xpath&&a?.xpath||i?.anchor&&a?.anchor){let l=null,c=null;if(i?.anchor){let d=this.domService.resolveAnchorRecord(i.anchor);d?.element&&d?.element instanceof HTMLElement&&!fo(d.element)&&this.domService.isElementVisible(d.element)&&Kr(d.element)&&(l=d.element)}else i?.xpath&&(l=this.domService.getElementFromXPath(i.xpath),l&&fo(l)&&(l=null),this.domService.isXpathWithId(i.xpath)||(!l&&i.cfXpath&&(l=this.domService.getElementFromXPath(i.cfXpath),l&&fo(l)&&(l=null)),!l&&i.fXpath&&(l=this.domService.getElementFromXPath(i.fXpath),l&&fo(l)&&(l=null))));if(a?.anchor){let d=this.domService.resolveAnchorRecord(a.anchor);d?.element&&d?.element instanceof HTMLElement&&!fo(d.element)&&this.domService.isElementVisible(d.element)&&Kr(d.element)&&(c=d.element)}else a?.xpath&&(c=this.domService.getElementFromXPath(a.xpath),c&&fo(c)&&(c=null),this.domService.isXpathWithId(a.xpath)||(!c&&a.cfXpath&&(c=this.domService.getElementFromXPath(a.cfXpath),c&&fo(c)&&(c=null)),!c&&a.fXpath&&(c=this.domService.getElementFromXPath(a.fXpath),c&&fo(c)&&(c=null))));if(l&&c){let d=hZ(l,c);if(d){let m=l,u=c,_=m.getBoundingClientRect(),I=u.getBoundingClientRect(),A=t?_.width:m.offsetWidth||_.width,M=t?_.height:m.offsetHeight||_.height,B=t?I.width:u.offsetWidth||I.width,q=t?I.height:u.offsetHeight||I.height,ae={};A&&M&&(ae={top:M*i.topPercentage/100,left:A*i.leftPercentage/100});let _e={};B&&q&&(_e={top:q*a.topPercentage/100,left:B*a.leftPercentage/100});let re=!t,be=fZ(ae.left,ae.top,l,d,re),Ie=fZ(_e.left,_e.top,c,d,re),Ce,Te,Oe,Me,Be={};be.x>Ie.x?be.y>Ie.y?(Me={x:be.x,y:be.y},Ce={x:Ie.x,y:Ie.y},Be.handle1=Me,Be.handle2=Ce):(Te={x:be.x,y:be.y},Oe={x:Ie.x,y:Ie.y},Be.handle1=Te,Be.handle2=Oe):be.y>Ie.y?(Oe={x:be.x,y:be.y},Te={x:Ie.x,y:Ie.y},Be.handle1=Oe,Be.handle2=Te):(Ce={x:be.x,y:be.y},Me={x:Ie.x,y:Ie.y},Be.handle1=Ce,Be.handle2=Me);let We={topLeft:Ce||{x:Oe?.x,y:Te?.y},bottomRight:Me||{x:Te?.x,y:Oe?.y},topRight:Te||{x:Me?.x,y:Ce?.y},bottomLeft:Oe||{x:Ce?.x,y:Me?.y}};return Be.coordinates=We,Be.targetElement=this.domService.getXPath(d),Be}}}}return}catch(i){this.loggingService.catch("Error in AreaService calculateAreaAnnotationPosition:",i);return}}addArea(e,t=[],i,a,l,c){this.loggingService.log("%c[WB] Calling FUNCTION: addArea","color: green;");try{let d=this.authService.getUser();if(d)if(d.isReadOnly||d.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add areas.");else{let m=new TL;a&&(m.annotationId=a),m.from=d,m.color=N.DEFAULT_ANNOTATION_COLOR,m.lastUpdated=this.timestamp,i&&(m.targetAnnotations=[i]),m.props=new dd;let u=this.domService.getCurrentWindowSizeValue();if(m.props.screenWidth=u.screenWidth,m.props.screenHeight=u.screenHeight,m.props.screenScrollHeight=u.screenScrollHeight,m.props.viewportWidth=window.innerWidth,m.props.viewportHeight=window.innerHeight,e||t?.length>0){let A=e?this.getPointsForAreaPinAnnotation(e):t;m.targetElements=[],A.forEach(M=>{m.targetElements.push(this.domService.getTargetElementForCursorPosition(e,void 0,void 0,void 0,void 0,!0,{clientX:M.x,clientY:M.y}))})}this.setLocationToAreaAnnotation(m),l&&(m.locationId=l.locationId,m.location=l.location),m.pageInfo=no(),m.pageInfo&&(m.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth);let _=this.getElementForAreaAnnotation(m),I=this.docService.getBaseMetadata("area",{element:_});if(m?.metadata||(m.metadata={}),m.metadata=h(h({},m.metadata),I),c?.access&&c?.accessFields){if(!this.userPermissionService?.hasUserContextAccess({userId:d.userId,accessFields:c.accessFields})){this.loggingService.catch("User does not have context access to add area annotation.",void 0,void 0,!0);return}m.context={access:c.access,accessFields:c.accessFields}}return this.saveAreaToDb(m),m}return}catch(d){this.loggingService.catch("Error in AreaService addArea: ",d);return}}setLocationToAreaAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location)}catch(t){this.loggingService.catch("Error in AreaService setLocationToAreaAnnotation:",t)}}getElementForAreaAnnotation(e){try{let t,i,a;if(e.targetElements?.length){if(e.targetElements[0]?.anchor){let l=this.domService.resolveAnchorRecord(e.targetElements[0].anchor);l?.element&&this.domService.isElementVisible(l.element)&&Kr(l.element)&&(i=l.element)}else e.targetElements[0]?.xpath&&(i=this.domService.getElementFromXPath(e.targetElements[0].xpath));if(e.targetElements[1]?.anchor){let l=this.domService.resolveAnchorRecord(e.targetElements[1].anchor);l?.element&&this.domService.isElementVisible(l.element)&&Kr(l.element)&&(a=l.element)}else e.targetElements[1]?.xpath&&(a=this.domService.getElementFromXPath(e.targetElements[1].xpath))}return i&&a&&(t=hZ(i,a)),t}catch(t){return this.loggingService.catch("Error in AreaService getElementForAreaAnnotation: ",t),null}}saveAreaToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveAreaToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(je.AREA)&&Cn([this.docService.getDocumentPaths$(),this.databaseService.getDb()]).pipe($e(([t,i])=>!!t&&!!i),ut(1),ye(([t,i])=>{if(this.documentPaths=t,this.documentPaths?.area){e.annotationId||(e.annotationId=this.commonDbService.generateDocumentId()),e.pageInfo&&(e.pageInfo.areaUrl=this.generateAreaUrl(e));let a=JSON.parse(JSON.stringify(e));if(a.position=null,!a?.metadata?.documentId){a?.metadata||(a.metadata={});let d=this.docService.getBaseMetadata("area");a.metadata=h(h({},a?.metadata),d)}this.domService.toggleAnnotationSelection(a),this.analyticsService.trackEvent(Y.Events.Area.AREA_ADDED,{annotationId:e.annotationId});let{documentId:l,organizationId:c}=this.getDocumentIdAndOrganizationIdFromAreaAnnotation(e);return this.commonDbService.setData({feature:"area",properties:{id:e.annotationId,documentId:l,organizationId:c},data:JSON.parse(JSON.stringify(a))})}else return ce(null)})).subscribe(()=>{},t=>{this.loggingService.catch("Error in AreaService saveAreaToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in AreaService saveAreaToDb: ",t)}}getDocumentIdAndOrganizationIdFromAreaAnnotation(e){try{return{documentId:e?.metadata?.documentId,organizationId:e?.metadata?.organizationId}}catch(t){return this.loggingService.catch("Error in AreaService getDocumentIdAndOrganizationIdFromAreaAnnotation: ",t),{}}}updateArea(e,t=!1,i){try{i&&this.setLocationToAreaAnnotation(e),t&&this.updateNotificationsDatabase(e,FN.UPDATED),this.updateAreaToDb(e)}catch(a){this.loggingService.catch("Error in AreaService updateArea: ",a)}}updateAreaToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateAreaToDb","color: green;");try{if(this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(je.AREA)){let t=JSON.parse(JSON.stringify(e));if(t.position=null,!t?.metadata?.documentId){t?.metadata||(t.metadata={});let l=this.docService.getBaseMetadata("area");t.metadata=h(h({},t?.metadata),l)}let{documentId:i,organizationId:a}=this.getDocumentIdAndOrganizationIdFromAreaAnnotation(e);this.commonDbService.setData({feature:"area",properties:{id:e.annotationId,documentId:i,organizationId:a},data:JSON.parse(JSON.stringify(t))})}}catch(t){this.loggingService.catch("Error in AreaService updateAreaToDb: ",t)}}deleteAreaPinAnnotations(e){try{let t=this.domService.getSelectedAnnotationsMap(),i=this.authService.getUser(),a=[];Object.keys(t??{}).forEach(l=>X(this,null,function*(){let c=t[l];c.type==="area"&&i&&c.from&&(i?.isAdmin||c.from.userId===i.userId)&&a.push(c)})),a?.length&&(this.analyticsService.trackEvent(Y.Events.Area.AREA_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(l=>l.annotationId).join()}),this.dialog.open(ll,{panelClass:"velt-mat-dialog-container",data:{title:"Delete area?",message:"This selected area will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"area"}}).afterClosed().pipe(ut(1)).subscribe(l=>{l&&(a.forEach(c=>X(this,null,function*(){yield this.deleteAreaPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${N.SNIPPYLY_HIGHLIGHT}]`).forEach(d=>{this.domService.removeHighlightFromElement(d)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"area")}catch(t){this.loggingService.catch("Error in AreaService deleteAreaPinAnnotations: ",t)}}getAreaAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:t}){try{let i={};return Object.values(this.areaAnnotationById$.value??{}).forEach(a=>{a?.metadata?.documentId==t&&a?.metadata?.organizationId==e&&(i[a?.annotationId]=a)}),Object.values(i??{})}catch(i){return this.loggingService.catch("Error in AreaService getAreaAnnotationsByOrganizationIdAndDocumentId:",i),[]}}onDeleteTargetAnnotation(e,t){try{if(this.docService.getDocumentId()&&this.areaAnnotationById$.value){let a=Object.values(this.areaAnnotationById$.value||{}),l;t?l=a.find(c=>c?.annotationId===t):l=a.find(c=>c?.targetAnnotations?.find(d=>d?.annotationId===e)),l&&(l.targetAnnotations=l.targetAnnotations?.filter(c=>c?.annotationId!==e),l.targetAnnotations?.length?this.updateAreaToDb(l):this.deleteAreaPinAnnotation(l))}}catch(i){this.loggingService.catch("Error in AreaService onDeleteTargetAnnotation: ",i)}}deleteAreaPinAnnotation(e){if(this.authService.isFeatureAllowed(je.AREA)&&this.documentPaths?.area&&e?.annotationId){this.updateNotificationsDatabase(e,FN.DELETED),this.analyticsService.trackEvent(Y.Events.Area.AREA_DELETED,{annotationId:e.annotationId});let{documentId:t,organizationId:i}=this.getDocumentIdAndOrganizationIdFromAreaAnnotation(e);return this.commonDbService.deleteData({feature:"area",properties:{id:e.annotationId,documentId:t,organizationId:i}})}else return Promise.resolve()}enableArea(){try{this.areaEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in AreaService enableArea: ",e)}}disableArea(){try{this.areaEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in AreaService disableArea: ",e)}}getAreaEnabled$(){try{return this.areaEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in AreaService getAreaEnabled$: ",e),ce(!1)}}getAreaEnabled(){try{return this.areaEnabled$.value}catch(e){return this.loggingService.catch("Error in AreaService getAreaEnabled: ",e),!1}}enableAddAreaMode(){this.authService.isFeatureAllowed(je.AREA)?(this.analyticsService.trackEvent(Y.Events.Area.AREA_ADD_MODE_ENABLED),this.addAreaMode$.next(!0)):this.loggingService.catch("Error in AreaService enableAddAreaMode: ","Area feature is not enabled.")}disableAddAreaMode(){this.analyticsService.trackEvent(Y.Events.Area.AREA_ADD_MODE_DISABLED),this.addAreaMode$.next(!1)}addAreaModeChange(){return this.addAreaMode$.asObservable()}getPointsForAreaPinAnnotation(e){let t=[],i=e,a=i?.touches?.length?i.touches[0]?.clientX:i.clientX,l=i?.touches?.length?i.touches[0]?.clientY:i.clientY;return t.push({x:a,y:l}),t.push({x:a+100,y:l+100}),t}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in AreaService isElementInsideAllowedElements: ",t),!1}}updateNotificationsDatabase(e,t){try{let i={annotationData:e,actionType:t,notificationSource:"area"};this.notificationService.updateNotificationDatabase(i)}catch(i){this.loggingService.catch("Error in AreaService updateNotificationsDatabase: ",i)}}getAreaUrl(e){try{return e?.pageInfo?.areaUrl?e.pageInfo.areaUrl:(e?.pageInfo||(e.pageInfo=no(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.areaUrl=this.generateAreaUrl(e),this.updateArea(e),e.pageInfo?.areaUrl)}catch(t){this.loggingService.catch("Error in AreaService getAreaUrl: ",t);return}}generateAreaUrl(e){let t=new URL(window.location.href);return t.searchParams.delete(N.URL_PARAMS.TAG_ID),t.searchParams.append(N.URL_PARAMS.TAG_ID,e.annotationId),t.href}generateAreaAnnotationId(){return X(this,null,function*(){try{if(this.docService.getDocumentPaths()?.area){let t=this.commonDbService.generateDocumentId();return yield rp(10),t||""}else return""}catch(e){return this.loggingService.catch("Error in AreaService generateAreaAnnotationId: ",e),""}})}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(Ft),K(st),K($n),K(yn),K(qe),K(Ue),K(eo),K(Vn),K(Lo),K(k),K(mn),K(al))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var v_e=n=>{try{let o={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return CS.sanitize(n,o)}catch(o){return lt.catch("Error in File utils sanitizeSvg: ",o),""}},m_e=n=>{try{return n.name.split(".").slice(0,-1).join(".")}catch(o){lt.catch("Error in File utils getFileName: ",o);return}},GQ=n=>{try{return/(?:\.([^.]+))?$/.exec(n?.name)[1]}catch(o){lt.catch("Error in File utils getFileExtension: ",o);return}},g_e=(n,o)=>{try{let r=n.slice(0,-1,n.type);return new File([r],o+"."+GQ(n),{type:n.type})}catch(r){lt.catch("Error in File utils updateFile: ",r);return}};var HQ={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var Fp=(()=>{let o=class o{constructor(e,t,i,a,l){this.authService=e,this.configService=t,this.coreActionsService=i,this.loggingService=a,this.attachmentResolverService=l,this.storage=GD();try{this.configService.getApiKey$().subscribe(c=>{this.apiKey=c}),this.authService.getFirebaseConfig$().subscribe(c=>{if(c&&c.firebaseOptions?.storageBucket){this.storage=GD(void 0,c?.firebaseOptions?.storageBucket);let d=this.configService.getProxyConfig();d?.storageHost&&(this.storage.host=d.storageHost)}},c=>{this.loggingService.catch("Error in StorageService constructor: ",c)})}catch(c){this.loggingService.catch("Error in StorageService constructor:",c)}}createAttachment({path:e,file:t}){try{let i=new cS;i.name=t.name;let a=g_e(t,`${i.attachmentId}_${m_e(t)}`),l=`${this.apiKey}/${e}/${a?.name}`;return i.bucketPath=l,i.size=t.size,i.type=GQ(t),i?.type&&(i.mimeType=HQ[i?.type]),i}catch(i){return this.loggingService.catch("Error in StorageService createAttachment: ",i),null}}sanitizeSvgFile(e){return X(this,null,function*(){if(e.type===HQ.svg)try{let t=yield e.text(),i=v_e(t);return new File([i],e.name,{type:e.type})}catch(t){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",t),e}return e})}uploadAttachmentToStorage(l){return X(this,arguments,function*({attachment:e,file:t,resolve:i,reject:a}){try{let c=HD(this.storage,e.bucketPath),d=HY(c,t,{cacheControl:"public,max-age=3600"});d.on("state_changed",m=>{let u=m.bytesTransferred/m.totalBytes*100},m=>{a(m)},()=>{GY(d.snapshot.ref).then(m=>{e.url=m,i(e)})})}catch(c){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",c),a(c)}})}uploadToResolver(d){return X(this,arguments,function*({file:e,attachment:t,metadata:i,resolve:a,reject:l,scope:c}){try{i.attachmentId=t.attachmentId;let m={attachmentId:t.attachmentId,name:t.name,file:e,metadata:i,mimeType:t.mimeType},u=at();this.coreActionsService.triggerAction(tt.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:u,methodName:As.UPLOAD_TO_RESOLVER,source:"internal",payload:{attachment:m,eventType:xo.ATTACHMENT_ADD}});let _=yield this.attachmentResolverService.saveAttachment({attachment:m,eventType:xo.ATTACHMENT_ADD},u,c);_&&_.data?.url?(t.url=_.data?.url,a(t)):l(new Error("Failed to upload attachment to resolver"))}catch(m){this.loggingService.catch("Error in StorageService uploadToResolver: ",m),l(m)}})}uploadFile({path:e,file:t,useAttachmentResolver:i,metadata:a,attachmentScope:l}){return new Promise((c,d)=>X(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let m=yield this.sanitizeSvgFile(t),u=this.createAttachment({path:e,file:m});if(!u)throw new Error("Attachment not created");i?this.uploadToResolver({file:m,attachment:u,metadata:a,resolve:c,reject:d,scope:l}):this.uploadAttachmentToStorage({attachment:u,file:m,resolve:c,reject:d})}catch(m){this.loggingService.catch("Error in StorageService uploadFile:",m),d(m)}}))}uploadChunk(e,t,i,a){return new Promise((l,c)=>{try{if(a?.useAttachmentResolver){let d=this.createAttachment({path:e,file:t});if(!d){c(new Error("Attachment not created for chunk upload"));return}this.uploadToResolver({file:t,attachment:d,metadata:a.metadata,resolve:m=>l(m.url),reject:c,scope:a.attachmentScope});return}if(this.apiKey){let d=`${this.apiKey}/${e}/${t.name}`,m=HD(this.storage,d),u=HY(m,t,{cacheControl:"public,max-age=3600"});u.on("state_changed",_=>{let I=_.bytesTransferred/_.totalBytes*100},_=>{c(_)},()=>{GY(u.snapshot.ref).then(_=>{l(_)}).catch(_=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${i}:`,_),c(_)})})}else{let d=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",d),c(d)}}catch(d){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${i}: `,d),c(d)}})}downloadAttachment(e){try{if(e.url){let t=new XMLHttpRequest;t.responseType="blob",t.onload=()=>{let i=t.response,a=document.createElement("a"),l=window.URL.createObjectURL(i);a.setAttribute("type","hidden"),a.setAttribute(N.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=l,e?.name&&(a.download=e?.name),document.body.appendChild(a);let c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(c),window.URL.revokeObjectURL(l),a.remove()},t.onerror=()=>{window.open(e.url,"_blank")},t.open("GET",e.url),t.send()}}catch(t){this.loggingService.catch("Error in StorageService downloadAttachment: ",t)}}deleteAttachment({attachment:e,metadata:t,useAttachmentResolver:i,attachmentScope:a}){return new Promise((l,c)=>{if(i){let d=at();this.coreActionsService.triggerAction(tt.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:As.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e.attachmentId,metadata:t}}),this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t},d,a).then(()=>{l(null)}).catch(m=>{c(m)})}else{let d=HD(this.storage,e.bucketPath);$Y(d).then(()=>{l(null)}).catch(m=>{l(null)})}})}deleteFileFromPath(e){return new Promise((t,i)=>{let a=HD(this.storage,e);$Y(a).then(()=>{t(null)}).catch(l=>{i(l)})})}};o.\u0275fac=function(t){return new(t||o)(K(qe),K(Ft),K(nr),K(k),K(Xc))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var go=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new Se(N.CommentAnnotationStatusMap),this._customPriorityMap=new Se(N.CommentAnnotationPriorityMap),this._customCategoryMap=new Se(N.CommentCategoryMap);try{let t=sessionStorage.getItem(N.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let i=sessionStorage.getItem(N.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);i&&this._customStatusMap.next(JSON.parse(i));let a=sessionStorage.getItem(N.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(t){this.loggingService.catch("Error in CustomFilterService constructor: ",t)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(N.CommentAnnotationStatusMap),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(N.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let t={};e.forEach(i=>{t[i.id]=i,i.type||(i.type="ongoing")}),this._customStatusMap.next(t),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",t)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(N.CommentAnnotationPriorityMap),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(N.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let t={};e.forEach(i=>{t[i.id]=i}),this._customPriorityMap.next(t),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",t)}}setCustomCategories(e){try{let t={};e.forEach(i=>{t[i.id]=i}),this._customCategoryMap.next(t),sessionStorage.setItem(N.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",t)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([i,a])=>a.type==="default");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return N.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([i,a])=>a.type==="terminal");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return N.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let t=Object.entries(this._customStatusMap.value).filter(([i,a])=>a.type==="ongoing");if(t)return t.map(i=>i[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[N.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let t=Object.entries(this._customStatusMap.value),i=t.find(([a,l])=>l.type==="default");switch(e.status){case"open":i&&(e.status=i[1]);break;case"inProgress":let a=t.find(([c,d])=>d.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let l=t.find(([c,d])=>d.type==="terminal");l&&(e.status=l[1]);break;default:i&&(e.status=i[1]);break}}return e}catch(t){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",t),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=N.CommentAnnotationPriorityMap[e.priority])}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",t)}return e}convertLegacyCategory(e){try{if(e.commentCategories===void 0||e.commentCategories===null||!Array.isArray(e.commentCategories)||e.commentCategories.length===0)return e;typeof e.commentCategories[0]=="string"&&(e.commentCategories=e.commentCategories.map(t=>N.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var u_e=(()=>{let o=class o{constructor(e,t){this.domService=e,this.loggingService=t,this.keyEventSubject$=new it;try{this.loggingService.log("%c[WB] Creating CLASS: HotkeyService","color: blue;"),this.keyEvent$=this.keyEventSubject$.asObservable().pipe(Xh()),this.domService.onWindowKeydown$().subscribe(i=>{this.keyEventSubject$.next(i)})}catch(i){this.loggingService.catch("Error in HotkeyService constructor: ",i)}}getKeyPressEvent(e,t={}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getKeyPressEvent","color: green;"),this.keyEvent$.pipe($e(i=>i?.key===e),$e(i=>!(!!t?.includeCtrl!==i.ctrlKey||!!t?.includeAlt!==i.altKey||!!t?.includeShift!==i.shiftKey||!!t?.includeMeta!==i.metaKey)),$e(()=>this.isNoInputFocused()))}catch(i){return this.loggingService.catch("Error in HotkeyService getKeyPressEvent: ",i),new Vt}}isNoInputFocused(){try{let e=document.activeElement;for(;e&&e?.tagName!=="BODY";){if(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e?.isContentEditable)return!1;e=e?.parentElement}return!0}catch(e){return this.loggingService.catch("Error in HotkeyService isNoInputFocused: ",e),!1}}};o.\u0275fac=function(t){return new(t||o)(K(Ue),K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();function Rqe(n,o){n&1&&(se(),f(0,"svg",16),D(1,"rect",17)(2,"path",18)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function Nqe(n,o){n&1&&(se(),f(0,"svg",16),D(1,"rect",22)(2,"path",23)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function Fqe(n,o){if(n&1&&(C(0),f(1,"div",6)(2,"div",7),p(3,Rqe,6,0,"svg",8)(4,Nqe,6,0,"ng-template",null,1,Ve),S(),f(6,"div",9),oe(7),R(8,"translate"),D(9,"br"),oe(10),R(11,"translate"),S(),f(12,"div",10)(13,"p"),oe(14),R(15,"translate"),se(),f(16,"svg",11),D(17,"path",12)(18,"path",13)(19,"path",14)(20,"path",15),S(),oe(21),R(22,"translate"),S(),St(),f(23,"p"),oe(24),R(25,"translate"),S()()(),b()),n&2){let r=Ee(5),e=s();v(3),g("ngIf",e.darkMode)("ngIfElse",r),v(4),we(" ",F(8,7,"Allow mic permission to")),v(3),we("",F(11,9,"enable your audio")," "),v(4),we(" ",F(15,11,"1. Click the")," "),v(7),we(" ",F(22,13,"page info icon in your browser\u2019s address bar")," "),v(3),we(" ",F(25,15,"2. Turn on Microphone")," ")}}function Lqe(n,o){n&1&&(se(),f(0,"svg",16),D(1,"rect",17)(2,"path",24)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function Uqe(n,o){n&1&&(se(),f(0,"svg",16),D(1,"rect",22)(2,"path",25)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function Vqe(n,o){if(n&1&&(C(0),f(1,"div",6)(2,"div",7),p(3,Lqe,6,0,"svg",8)(4,Uqe,6,0,"ng-template",null,2,Ve),S(),f(6,"div",9),oe(7),R(8,"translate"),D(9,"br"),oe(10),R(11,"translate"),S(),f(12,"div",10)(13,"p"),oe(14),R(15,"translate"),se(),f(16,"svg",11),D(17,"path",12)(18,"path",13)(19,"path",14)(20,"path",15),S(),oe(21),R(22,"translate"),S(),St(),f(23,"p"),oe(24),R(25,"translate"),S()()(),b()),n&2){let r=Ee(5),e=s();v(3),g("ngIf",e.darkMode)("ngIfElse",r),v(4),we(" ",F(8,7,"Allow camera permission")),v(3),we("",F(11,9,"to enable your video")," "),v(4),we(" ",F(15,11,"1. Click the")," "),v(7),we(" ",F(22,13,"page info icon in your browser\u2019s address bar")," "),v(3),we(" ",F(25,15,"2. Turn on Camera")," ")}}var oU=(()=>{let o=class o{constructor(e,t,i,a,l){this.loggingService=e,this.themeService=t,this.elementRef=i,this.matDialogRef=a,this.data=l,this.veltElement=!0,this.darkMode=!0;try{this.loggingService.log("%c[WB] Creating CLASS: DevicePermissionDeniedDialogComponent","color: blue;"),this.type=this.data?.type,[!0,!1].includes(this.data?.darkMode)&&(this.darkMode=this.data?.darkMode)}catch(c){this.loggingService.catch("Error in DevicePermissionDeniedDialogComponent constructor: ",c)}}ngOnDestroy(){}};o.\u0275fac=function(t){return new(t||o)(x(k),x(yt),x(Q),x(ji,8),x(rd,8))},o.\u0275cmp=O({type:o,selectors:[["velt-device-permission-denied-dialog-internal"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{type:"type"},standalone:!1,decls:5,vars:5,consts:[["devicePermissionDialogRef",""],["defaultAudioIcon",""],["defaultVideoIcon",""],[1,"velt-device-permission-denied-dialog--container",3,"snippylyOverlay","snippylyOverlayZIndex"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"velt-device-permission-denied-dialog"],[1,"velt-device-permission-denied-dialog--icon"],["width","61","height","60","viewBox","0 0 61 60","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf","ngIfElse"],[1,"velt-device-permission-denied-dialog--header"],[1,"velt-device-permission-denied-dialog--content"],["width","13","height","12","viewBox","0 0 13 12","fill","none","xmlns","http://www.w3.org/2000/svg",1,"velt-device-permission-denied-dialog--page-info-icon"],["d","M4.375 2.5C4.375 3.53553 3.53553 4.375 2.5 4.375C1.46447 4.375 0.625 3.53553 0.625 2.5C0.625 1.46447 1.46447 0.625 2.5 0.625C3.53553 0.625 4.375 1.46447 4.375 2.5Z","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["d","M5 2.5H12.5","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["d","M0 8.75H7.5","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["d","M11.875 8.75C11.875 9.78553 11.0355 10.625 10 10.625C8.96447 10.625 8.125 9.78553 8.125 8.75C8.125 7.71447 8.96447 6.875 10 6.875C11.0355 6.875 11.875 7.71447 11.875 8.75Z","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["width","61","height","60","viewBox","0 0 61 60","fill","none","xmlns","http://www.w3.org/2000/svg"],["x","0.5","y","4","width","56","height","56","rx","28","fill","white","fill-opacity","0.04"],["d","M23.5026 20.333C23.5026 19.0069 24.0294 17.7352 24.9671 16.7975C25.9048 15.8598 27.1765 15.333 28.5026 15.333C29.8287 15.333 31.1005 15.8598 32.0381 16.7975C32.9758 17.7352 33.5026 19.0069 33.5026 20.333V28.6663C33.5027 29.1599 33.4297 29.6508 33.2859 30.123M29.9526 33.4563C29.2054 33.6828 28.4155 33.7311 27.6463 33.5973C26.8771 33.4636 26.1499 33.1516 25.5229 32.6863C24.8959 32.2211 24.3866 31.6154 24.0358 30.9179C23.685 30.2204 23.5024 29.4504 23.5026 28.6697V27.003M16.8359 28.6663C16.8356 30.7719 17.405 32.8383 18.484 34.6465C19.5629 36.4546 21.111 37.9371 22.9642 38.9366C24.8174 39.9362 26.9066 40.4156 29.0102 40.324C31.1137 40.2324 33.1533 39.5732 34.9126 38.4163M38.2459 35.083C39.5023 33.1791 40.1701 30.9474 40.1659 28.6663M21.8359 46.9997H35.1693M28.5026 40.333V46.9997","stroke","white","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["d","M13.5 17L43.5 47","stroke","currentColor","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["x","36.5","width","24","height","24","rx","12","fill","currentColor"],["d","M48.5 18.99V19M48.5 14V5","stroke","white","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["x","0.5","y","4","width","56","height","56","rx","28","fill","black","fill-opacity","0.04"],["d","M23.5026 20.333C23.5026 19.0069 24.0294 17.7352 24.9671 16.7975C25.9048 15.8598 27.1765 15.333 28.5026 15.333C29.8287 15.333 31.1005 15.8598 32.0381 16.7975C32.9758 17.7352 33.5026 19.0069 33.5026 20.333V28.6663C33.5027 29.1599 33.4297 29.6508 33.2859 30.123M29.9526 33.4563C29.2054 33.6828 28.4155 33.7311 27.6463 33.5973C26.8771 33.4636 26.1499 33.1516 25.5229 32.6863C24.8959 32.2211 24.3866 31.6154 24.0358 30.9179C23.685 30.2204 23.5024 29.4504 23.5026 28.6697V27.003M16.8359 28.6663C16.8356 30.7719 17.405 32.8383 18.484 34.6465C19.5629 36.4546 21.111 37.9371 22.9642 38.9366C24.8174 39.9362 26.9066 40.4156 29.0102 40.324C31.1137 40.2324 33.1533 39.5732 34.9126 38.4163M38.2459 35.083C39.5023 33.1791 40.1701 30.9474 40.1659 28.6663M21.8359 46.9997H35.1693M28.5026 40.333V46.9997","stroke","black","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["d","M42.375 39.2135C42.7034 39.1007 42.9883 38.8881 43.19 38.6054C43.3917 38.3227 43.5001 37.9841 43.5 37.6369V26.3635C43.4998 26.0795 43.4271 25.8003 43.2888 25.5523C43.1504 25.3043 42.9509 25.0958 42.7093 24.9465C42.4677 24.7973 42.192 24.7122 41.9083 24.6994C41.6246 24.6867 41.3424 24.7466 41.0883 24.8735L33.5 28.6669V30.3335V25.3333C33.5 24.4493 33.1488 23.6014 32.5237 22.9763C31.8986 22.3512 31.0507 22 30.1667 22H25.1667M33.5 37V38.6667C33.5 39.5507 33.1488 40.3986 32.5237 41.0237C31.8986 41.6488 31.0507 42 30.1667 42H16.8333C15.9493 42 15.1014 41.6488 14.4763 41.0237C13.8512 40.3986 13.5 39.5507 13.5 38.6667V25.3333C13.5 24.4493 13.8512 23.6014 14.4763 22.9763C15.1014 22.3512 15.9493 22 16.8333 22H18.5","stroke","white","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["d","M42.375 39.2135C42.7034 39.1007 42.9883 38.8881 43.19 38.6054C43.3917 38.3227 43.5001 37.9841 43.5 37.6369V26.3635C43.4998 26.0795 43.4271 25.8003 43.2888 25.5523C43.1504 25.3043 42.9509 25.0958 42.7093 24.9465C42.4677 24.7973 42.192 24.7122 41.9083 24.6994C41.6246 24.6867 41.3424 24.7466 41.0883 24.8735L33.5 28.6669V30.3335V25.3333C33.5 24.4493 33.1488 23.6014 32.5237 22.9763C31.8986 22.3512 31.0507 22 30.1667 22H25.1667M33.5 37V38.6667C33.5 39.5507 33.1488 40.3986 32.5237 41.0237C31.8986 41.6488 31.0507 42 30.1667 42H16.8333C15.9493 42 15.1014 41.6488 14.4763 41.0237C13.8512 40.3986 13.5 39.5507 13.5 38.6667V25.3333C13.5 24.4493 13.8512 23.6014 14.4763 22.9763C15.1014 22.3512 15.9493 22 16.8333 22H18.5","stroke","currentColor","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){if(t&1&&(f(0,"div",3,0),C(2,4),p(3,Fqe,26,17,"ng-container",5)(4,Vqe,26,17,"ng-container",5),b(),S()),t&2){let a=Ee(1);g("snippylyOverlay",a)("snippylyOverlayZIndex",3e3),v(2),g("ngSwitch",i.type),v(),g("ngSwitchCase","audio"),v(),g("ngSwitchCase","video")}},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-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)}[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-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-mat-dialog-container.velt-device-permission-denied-dialog--panel mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{padding:0;background-color:transparent;box-shadow:none;overflow:unset}.velt-device-permission-denied-dialog[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-lg);align-items:center;justify-content:center;padding:4rem;box-sizing:border-box;word-break:break-word;max-width:600px;max-height:400px;text-align:center;background-color:var(--velt-background-0);border-radius:var(--velt-border-radius-2xl);box-shadow:0 calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((-3rem + 0px) * var(--velt-base-rem-unit)) #1f2f461f}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--icon[_ngcontent-%COMP%]{color:var(--velt-error)}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--header[_ngcontent-%COMP%]{font-size:var(--velt-font-size-lg);font-weight:600;line-height:36px;letter-spacing:-.02em;text-align:center;color:var(--velt-text-0)}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--content[_ngcontent-%COMP%]{font-size:var(--velt-font-size-sm);font-weight:400;line-height:21px;text-align:center;color:var(--velt-text-0)}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--content[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--page-info-icon[_ngcontent-%COMP%]{margin-left:var(--velt-spacing-sm);margin-right:var(--velt-spacing-sm);color:var(--velt-error)}"],changeDetection:0});let n=o;return n})();var xm=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.matDialog=t,this.audioPermissionState$=new Se(null),this.videoPermissionState$=new Se(null);try{this.loggingService.log("%c[WB] Creating CLASS: DevicePermissionService","color: blue;"),this.checkPermissions()}catch(i){this.loggingService.catch("Error in DevicePermissionService constructor: ",i)}}checkPermissions(){try{this.loggingService.log("%c[WB] Calling DevicePermissionService FUNCTION: checkPermissions","color: green;"),new pr().browserName!=="Firefox"&&(navigator.permissions.query({name:"microphone"}).then(t=>{this.audioPermissionState$.next(t.state),t.onchange=()=>{this.audioPermissionState$.next(t.state)}}).catch(t=>{}),navigator.permissions.query({name:"camera"}).then(t=>{this.videoPermissionState$.next(t.state),t.onchange=()=>{this.videoPermissionState$.next(t.state)}}).catch(t=>{}))}catch(e){this.loggingService.catch("Error in DevicePermissionService checkPermissions: ",e)}}getPermissionState$(e){try{switch(this.loggingService.log("%c[WB] Calling DevicePermissionService FUNCTION: getPermissionState$","color: green;"),e){case"audio":return this.getAudioPermissionState$();case"video":return this.getVideoPermissionState$();default:return ce(null)}}catch(t){return this.loggingService.catch("Error in DevicePermissionService getPermissionState$: ",t),ce(null)}}getAudioPermissionState$(){return this.audioPermissionState$.asObservable()}getVideoPermissionState$(){return this.videoPermissionState$.asObservable()}openDevicePermissionDeniedDialog(e,t){try{this.loggingService.log("%c[WB] Calling DevicePermissionService FUNCTION: openDevicePermissionDeniedDialog","color: green;"),this.matDialog.open(oU,{panelClass:["velt-device-permission-denied-dialog--panel","velt-mat-dialog-container"],backdropClass:["velt-device-permission-denied-dialog--backdrop","s-background-blur-1"],data:h({type:e},t||{})})}catch(i){this.loggingService.catch("Error in DevicePermissionService openDevicePermissionDeniedDialog: ",i)}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(Lo))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Bqe=()=>["video","screen"];function jqe(n,o){if(n&1&&D(0,"app-recording-preview-steps-dialog-video",4),n&2){let r=s(2);g("componentConfigSignal",r.componentConfigSignal)}}function $qe(n,o){if(n&1&&D(0,"app-recording-preview-steps-dialog-audio",4),n&2){let r=s(2);g("componentConfigSignal",r.componentConfigSignal)}}function Gqe(n,o){if(n&1&&(C(0),f(1,"div",2,0),p(3,jqe,1,1,"app-recording-preview-steps-dialog-video",3)(4,$qe,1,1,"app-recording-preview-steps-dialog-audio",3),S(),b()),n&2){let r=o.ngIf,e=Ee(2),t=s();v(),g("snippylyOverlay",e)("snippylyOverlayZIndex",2e3),w("aria-label","Recording preview - "+r.type+" mode")("data-testid",t.componentId),v(2),g("ngIf",xt(6,Bqe).includes(r.type)),v(),g("ngIf",r.type==="audio")}}var iU=(()=>{let o=class o{constructor(e,t,i,a,l,c,d){this.loggingService=e,this.recorderService=t,this.dialog=i,this.devicePermissionService=a,this.dialogRef=l,this.elementRef=c,this.data=d,this.darkMode=!1,this.shadowDom=!0,this.startCountdownFrom=3,this.defaultMediaSourceOptions=cv(),this.recordingCountdownEnabled=!1,this.subscriptions=[],this.veltElement=!0,this.componentId="velt-recording-preview-steps-dialog",this.componentConfigSignal=De({closeDialog:this.closeDialog.bind(this),startCountdown:this.startCountdown.bind(this),toggleAudio:this.toggleAudio.bind(this),toggleVideo:this.toggleVideo.bind(this),toggleSettings:this.toggleSettings.bind(this),cancelCountdown:this.cancelCountdown.bind(this),updateMediaConfig:this.updateMediaConfig.bind(this),handleOverlayClick:this.handleOverlayClick.bind(this),countdownStarted:!1,mediaConfig:{audio:{enabled:!1},video:{enabled:!1}},mediaState:{audio:{enabled:!1},video:{enabled:!1}},type:"video",countdown:this.startCountdownFrom,mediaStream:void 0,isSettingsOpen:!1,darkMode:this.darkMode,shadowDom:this.shadowDom,isExplicitShadowDom:!1});try{this.devicePermissionService.getPermissionState$("video").subscribe(m=>{this.componentConfigSignal.update(u=>(u=y(h({},u),{mediaState:y(h({},u.mediaState),{video:{enabled:m!=="denied"}})}),u))}),this.devicePermissionService.getPermissionState$("audio").subscribe(m=>{this.componentConfigSignal.update(u=>(u=y(h({},u),{mediaState:y(h({},u.mediaState),{audio:{enabled:m!=="denied"}})}),u))}),this.subscriptions.push(this.recorderService.getRecordingCountdownEnabled$().subscribe(m=>{this.recordingCountdownEnabled=m})),this.subscriptions.push(this.recorderService.getRecordingMicEnabled$().subscribe(m=>{m!==null&&(m?this.toggleAudioOn():this.toggleAudioOff())})),d&&(d.type&&this.componentConfigSignal.update(m=>(m=y(h({},m),{type:d.type}),m)),d.recordingCountdown!==void 0&&(this.recordingCountdownEnabled=!!d.recordingCountdown),d.mediaConfig&&(d.mediaConfig?.audio?.enabled&&!d.mediaConfig?.audio?.deviceId&&(d.mediaConfig.audio.deviceId=this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId),d.mediaConfig?.video?.enabled&&!d.mediaConfig?.video?.deviceId&&(d.mediaConfig.video.deviceId=this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId),d?.darkMode?this.elementRef.nativeElement.setAttribute("dark",""):this.elementRef.nativeElement.removeAttribute("dark"),this.componentConfigSignal.update(m=>(m=y(h({},m),{shadowDom:d?.shadowDom!==!1,isExplicitShadowDom:!!d?.isExplicitShadowDom,darkMode:d.darkMode||!1}),m)),this.updateMediaConfig(d.mediaConfig)))}catch(m){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent constructor: ",m)}}ngOnInit(){try{this.setupA11yAttributes(),this.componentConfigSignal().type==="screen"&&this.subscriptions.push(this.recorderService.getScreenStream$().subscribe(e=>{e&&e.active&&e.getVideoTracks().some(t=>t.readyState==="live")&&this.componentConfigSignal.update(t=>(t=h({},t),t.mediaConfig.screen={enabled:!0,stream:e},t))}))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Recording preview steps dialog")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=y(h({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngOnChanges: ",t)}}ngAfterViewInit(){try{this.dialogRef.addPanelClass("snippyly-recording-preview-steps-dialog"),this.dialogRef.disableClose=!0}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngAfterViewInit: ",e)}}toggleSettings(e){try{e.stopPropagation(),this.componentConfigSignal.update(t=>(t=y(h({},t),{isSettingsOpen:!t.isSettingsOpen}),t))}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleSettings: ",t)}}toggleAudio(){try{this.componentConfigSignal().mediaConfig.audio||this.componentConfigSignal.update(i=>(i=y(h({},i),{mediaConfig:y(h({},i.mediaConfig),{audio:{enabled:!0}})}),i));let e=!this.componentConfigSignal().mediaConfig.audio?.enabled;this.componentConfigSignal.update(i=>(i=y(h({},i),{mediaConfig:y(h({},i.mediaConfig),{audio:{enabled:e}})}),i));let t=this.componentConfigSignal().mediaStream?.getAudioTracks()[0];t?t.enabled=e:e&&(this.componentConfigSignal.update(i=>(i=y(h({},i),{mediaConfig:y(h({},i.mediaConfig),{audio:y(h({},i.mediaConfig.audio),{deviceId:this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId})})}),i)),this.updateMediaConfig(this.componentConfigSignal().mediaConfig))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleAudio: ",e)}}toggleAudioOn(){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{mediaConfig:y(h({},t.mediaConfig),{audio:{enabled:!0}})}),t));let e=this.componentConfigSignal().mediaStream?.getAudioTracks()[0];e?e.enabled=!0:(this.componentConfigSignal.update(t=>(t=y(h({},t),{mediaConfig:y(h({},t.mediaConfig),{audio:y(h({},t.mediaConfig.audio),{deviceId:this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId})})}),t)),this.updateMediaConfig(this.componentConfigSignal().mediaConfig))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleAudioOn: ",e)}}toggleAudioOff(){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{mediaConfig:y(h({},t.mediaConfig),{audio:{enabled:!1}})}),t));let e=this.componentConfigSignal().mediaStream?.getAudioTracks()[0];e&&(e.enabled=!1)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleAudioOn: ",e)}}toggleVideo(){try{this.componentConfigSignal.update(e=>(e=h({},e),e.mediaConfig.video||(e.mediaConfig.video={enabled:!0}),e.mediaConfig.video.enabled=!e.mediaConfig.video.enabled,e.mediaConfig.video.deviceId=this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId,e)),this.updateMediaConfig(this.componentConfigSignal().mediaConfig)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleVideo: ",e)}}updateMediaConfig(e){try{this.stopMediaStream(),this.getMediaStream(e)}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent updateMediaConfig: ",t)}}getMediaStream(e){try{if(!navigator.mediaDevices){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream: ","No media devices");return}if(!navigator.mediaDevices.getUserMedia){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream: ","No getUserMedia");return}if(e.audio?.enabled||e.video?.enabled){let t=p_e(e);navigator.mediaDevices.getUserMedia(t).then(i=>{this.componentConfigSignal.update(a=>(a=y(h({},a),{mediaConfig:e,mediaStream:i}),a))}).catch(i=>{this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream catch: ",i)})}else this.componentConfigSignal.update(t=>(t=y(h({},t),{mediaStream:void 0,mediaConfig:e}),t))}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream: ",t)}}stopMediaStream(){try{this.componentConfigSignal.update(e=>(e=h({},e),e.mediaStream?.getTracks().forEach(t=>{t.stop()}),e.mediaStream=void 0,e))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent stopMediaStream: ",e)}}startCountdown(){return X(this,null,function*(){try{let t=new pr().getBrowserName()==="Firefox",i=null;if(t&&this.componentConfigSignal().type==="screen")try{let a=this.componentConfigSignal().mediaConfig,l=p_e(a);Object.keys(l).length>0&&(i=yield navigator.mediaDevices.getUserMedia(l))}catch(a){this.loggingService.catch("Error getting Firefox user media stream:",a),i=null}if(this.componentConfigSignal().type==="screen"){if(!this.componentConfigSignal().mediaConfig.screen?.stream)try{let l=yield navigator.mediaDevices.getDisplayMedia({video:!0,audio:!0});this.componentConfigSignal.update(c=>(c=h({},c),c.mediaConfig.screen={enabled:!0,stream:l},c))}catch(l){this.loggingService.catch("Error getting screen media stream:",l),this.cancelCountdown();return}this.componentConfigSignal.update(l=>(l=h({},l),i&&(l.mediaConfig.audio?.enabled&&(l.mediaConfig.audio.stream=i),l.mediaConfig.video?.enabled&&(l.mediaConfig.video.stream=i)),l)),this.componentConfigSignal().mediaConfig.screen?.stream?.getTracks().forEach(l=>{l&&(l.onended=()=>{this.cancelCountdown()})})}this.recordingCountdownEnabled?(this.componentConfigSignal.update(a=>(a=y(h({},a),{countdownStarted:!0}),a)),this.countdownInterval=setInterval(()=>{this.componentConfigSignal().countdown>1?this.componentConfigSignal.update(a=>(a=y(h({},a),{countdown:a.countdown-1}),a)):this.closeDialog(this.componentConfigSignal().mediaConfig)},1e3)):this.closeDialog(this.componentConfigSignal().mediaConfig)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent startCountdown: ",e)}})}cancelCountdown(){try{if(this.componentConfigSignal.update(e=>(e=y(h({},e),{countdownStarted:!1,countdown:this.startCountdownFrom}),e)),this.clearInterval(),this.componentConfigSignal().type==="screen"){let e=this.componentConfigSignal().mediaConfig.screen?.stream;e&&e.getTracks().forEach(t=>{t.stop()}),this.componentConfigSignal.update(t=>(t=h({},t),t.mediaConfig.screen=void 0,t))}}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent cancelCountdown: ",e)}}closeDialog(e){return X(this,null,function*(){try{this.clearInterval(),e||(this.stopMediaStream(),this.componentConfigSignal.update(t=>(t=h({},t),t.mediaConfig&&(t.mediaConfig.screen?.stream&&(t.mediaConfig.screen.stream.getTracks().forEach(i=>i.stop()),t.mediaConfig.screen.stream=void 0),t.mediaConfig.audio?.stream&&(t.mediaConfig.audio.stream.getTracks().forEach(i=>i.stop()),t.mediaConfig.audio.stream=void 0),t.mediaConfig.video?.stream&&(t.mediaConfig.video.stream.getTracks().forEach(i=>i.stop()),t.mediaConfig.video.stream=void 0)),t))),this.dialogRef.close(e)}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent closeDialog: ",t)}})}handleOverlayClick(e){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{isSettingsOpen:!1}),t)),e.stopPropagation()}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent handleOverlayClick: ",t)}}clearInterval(){try{this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=void 0)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent clearInterval: ",e)}}ngOnDestroy(){try{this.clearInterval(),this.stopMediaStream(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Un),x(Lo),x(xm),x(ji),x(Q),x(rd,8))},o.\u0275cmp=O({type:o,selectors:[["snippyly-recording-preview-steps-dialog"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{darkMode:"darkMode",shadowDom:"shadowDom"},standalone:!1,features:[Qe],decls:1,vars:1,consts:[["recordingPreviewDialogRef",""],[4,"ngIf"],["role","dialog","aria-modal","true",3,"snippylyOverlay","snippylyOverlayZIndex"],[3,"componentConfigSignal",4,"ngIf"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&p(0,Gqe,5,7,"ng-container",1),t&2&&g("ngIf",i.componentConfigSignal())},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-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)}[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-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-mat-dialog-container.snippyly-recording-preview-steps-dialog{max-width:none} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background:transparent;padding:0;margin:0;border-radius:var(--velt-border-radius-lg)}"],changeDetection:0});let n=o;return n})();function p_e(n){try{let o={};return n.audio?.enabled&&(o.audio={deviceId:n.audio.deviceId?{exact:n.audio.deviceId}:void 0}),n.video?.enabled&&(o.video={deviceId:n.video.deviceId?{exact:n.video.deviceId}:void 0}),o}catch{return{}}}var rc=(()=>{let o=class o{constructor(e){this.loggingService=e,this.isPipActive$=new Se(!1),this.pipStopRecordingTriggered$=new Se(!1),this.pipPauseRecordingTriggered$=new Se(!1),this.pictureInPicture$=new Se(!1),this.pipClearRecordingTriggered$=new Se(!1)}getPipClearRecordingTriggered$(){return this.pipClearRecordingTriggered$.asObservable()}resetPipClearRecordingTriggered(){this.pipClearRecordingTriggered$.next(!1)}openPictureInPicture(e,t){return X(this,null,function*(){try{if(!this.isPictureInPictureEnabled()||!e||document.pictureInPictureElement||window.documentPictureInPicture?.window)return;if("documentPictureInPicture"in window){yield this.createDocumentPip(e,t);return}if(document.pictureInPictureEnabled){let i=yield this.findVideoElement();if(!i){this.loggingService.warn("No video element found for Picture-in-Picture");return}yield i.requestPictureInPicture(),this.isPipActive$.next(!0);return}}catch(i){this.loggingService.catch("Error in PipService openPictureInPicture:",i)}})}createDocumentPip(e,t){return X(this,null,function*(){try{let i=window.documentPictureInPicture;this.pipWindow=yield i.requestWindow({width:320,height:288}),yield this.addStylesToPip(),yield this.createControlPanelInPip(e,t),this.pipWindow?.addEventListener("unload",()=>{try{this.isPipActive$.next(!1),this.pipWindow=void 0}catch(a){this.loggingService.catch("Error in PipService createDocumentPip unload:",a)}}),this.isPipActive$.next(!0)}catch{this.isPipActive$.next(!1),this.pipWindow=void 0}})}addStylesToPip(){return X(this,null,function*(){try{if(!this.pipWindow)return;this.pipWindow.document.body.style.margin="0",this.pipWindow.document.body.style.padding="0",this.pipWindow.document.body.style.backgroundColor="#000",this.pipWindow.document.body.style.display="flex",this.pipWindow.document.body.style.alignItems="center",this.pipWindow.document.body.style.justifyContent="center"}catch(e){this.loggingService.catch("Error in PipService copyStylesToPip:",e)}})}createControlPanelInPip(e,t){return X(this,null,function*(){if(this.pipWindow)try{let i=this.pipWindow.document.createElement("div");i.style.cssText=`
|
|
409
409
|
display: flex;
|
|
410
410
|
flex-direction: column;
|
|
411
411
|
`;let a=this.pipWindow.document.createElement("div");a.style.cssText=`
|
|
@@ -511,7 +511,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
511
511
|
}
|
|
512
512
|
});
|
|
513
513
|
`;if(typeof Worker<"u"){let i=new Blob([t],{type:"application/javascript"});return new Worker(URL.createObjectURL(i))}return}catch(t){this.loggingService.catch("Error in HeartbeatService setupWebWorker: ",t);return}}setupHeartbeat(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setupHeartbeat","color: green;"),this.worker=this.setupWebWorker(this.HEARTBEAT_DURATION),this.worker){this.worker.onmessage=()=>{this.authService.getUser()&&this.sendHeartbeat()};let i=this.authService.getUser$().subscribe(a=>{a?(this.worker?.postMessage("start"),this.sendHeartbeat()):this.worker?.postMessage("stop")});this.subscriptions.push(i)}else{let i=this.authService.getUser$().pipe(ye(a=>a?Wm(this.HEARTBEAT_DURATION).pipe(So(0)):js)).subscribe(()=>this.sendHeartbeat());this.subscriptions.push(i)}let e=this.docService.getDocumentPaths$().pipe($e(i=>!!i),ln(()=>this.sendHeartbeat())).subscribe();this.subscriptions.push(e);let t=Cn([this.databaseService.getDb().pipe($e(i=>!!i)),this.authService.getUser$(),this.docService.getDocumentPaths$()]).pipe(Rr(),ln(([[i,a,l],[c,d,m]])=>{if(d&&m){let u=this.domService.getTabId();if(u){let _=this.generateHeartbeatId(d.userId,u),I={id:_,organizationId:m.organizationId},A=this.commonDbUtils.getDocumentPath({feature:"heartbeat",properties:I,defaultDocumentPaths:m,apiKey:this.configService.getApiKey(),useFirestore:!1});if(A&&c&&Cc(Vr(c,A)).set(null),m.documentId){let M={id:_,documentId:m.documentId,organizationId:m.organizationId},B=this.commonDbUtils.getDocumentPath({feature:"heartbeatByDocument",properties:M,defaultDocumentPaths:m,apiKey:this.configService.getApiKey(),useFirestore:!1});B&&c&&Cc(Vr(c,B)).set(null)}if(l&&l.documentId&&l.documentId!==m.documentId){let M={id:_,documentId:l.documentId,organizationId:l.organizationId,skipFirestore:!0};this.commonDbService.deleteData({feature:"heartbeatByDocument",properties:M})}}}})).subscribe();this.subscriptions.push(t)}catch(e){this.loggingService.catch("Error in HeartbeatService setupHeartbeat: ",e)}}teardownHeartbeat(){try{this.loggingService.log("%c[WB] Calling FUNCTION: teardownHeartbeat","color: green;"),this.worker&&(this.worker.postMessage("stop"),this.worker.terminate(),this.worker=void 0),this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.heartbeatCreatedTimestamps.clear(),this.initializedHeartbeatIds.clear()}catch(e){this.loggingService.catch("Error in HeartbeatService teardownHeartbeat: ",e)}}sendHeartbeat(){try{this.loggingService.log("%c[WB] Calling HeartbeatService FUNCTION: sendHeartbeat","color: green;");let e=this.authService.getUser(),t=this.docService.getDocumentPaths(),i=this.domService.getTabId();if(e&&t&&i){let a=Date.now(),l=this.generateHeartbeatId(e.userId,i),c=this.docService.getBaseMetadata("heartbeat"),d=c.documentId,m=t.organizationId,u=`${l}_${m}`,_=d?`${l}_${m}_${d}`:null,I=this.heartbeatCreatedTimestamps.get(u)??a;this.heartbeatCreatedTimestamps.has(u)||this.heartbeatCreatedTimestamps.set(u,I);let A=!this.initializedHeartbeatIds.has(u),M={id:l,createdTimestamp:I,lastUpdatedTimestamp:a,userId:e.userId,veltUserId:It(e.userId),tabId:i,metadata:c};if(A?(this.commonDbService.setData({feature:"heartbeat",properties:{id:M.id,skipFirestore:!0},data:M}),this.initializedHeartbeatIds.add(u)):this.commonDbService.updateData({feature:"heartbeat",properties:{id:M.id,skipFirestore:!0},data:M}),d&&_){let B=this.heartbeatCreatedTimestamps.get(_)??a;this.heartbeatCreatedTimestamps.has(_)||this.heartbeatCreatedTimestamps.set(_,B);let q=!this.initializedHeartbeatIds.has(_),ae={id:l,createdTimestamp:B,lastUpdatedTimestamp:a,userId:e.userId,veltUserId:It(e.userId),tabId:i,metadata:c};q?(this.commonDbService.setData({feature:"heartbeatByDocument",properties:{id:ae.id,skipFirestore:!0,documentId:d},data:ae}),this.initializedHeartbeatIds.add(_)):this.commonDbService.updateData({feature:"heartbeatByDocument",properties:{id:ae.id,skipFirestore:!0,documentId:d},data:ae})}}}catch(e){this.loggingService.catch("Error in HeartbeatService sendHeartbeat: ",e)}}generateHeartbeatId(e,t){return It(e+"_"+t)}getHeartbeatData(e){try{let t=this.docService.getDocumentPaths(),i=e?.organizationId||t?.organizationId,a=e?.documentId,l,c={organizationId:i,skipFirestore:!0,useQuery:!0};if(a?(l="allHeartbeatsByDocument",c.documentId=a):l="allHeartbeats",!t)return ce(null);if(e?.userId){let d=e?.limit??50;return c.rtdbQuery=[n0("userId"),Qme(e.userId),hY(d)],this.commonDbService.dbListener({feature:l,properties:c}).pipe($e(m=>!!m?.data),ge(m=>m?.data),ge(m=>m?Object.values(m??{}).map(u=>u):null),ge(m=>{if(m){let u=e?.lastUpdatedTimestamp?.$gte??Date.now()-15e3;return m.filter(_=>!(u&&_.lastUpdatedTimestamp<u))}return m}))}else{let d=e?.orderBy??"lastUpdatedTimestamp",m=e?.lastUpdatedTimestamp?.$gte??Date.now()-15e3,u=e?.limit??50;return c.rtdbQuery=[n0(d),F_(m),hY(u)],this.commonDbService.dbListener({feature:l,properties:c}).pipe($e(_=>!!_?.data),ge(_=>_?.data),ge(_=>_?Object.values(_??{}).map(I=>I):null))}}catch(t){return this.loggingService.catch("Error in HeartbeatService getHeartbeatData: ",t),ce(null)}}getSpecificHeartbeat(e){try{let t=this.generateHeartbeatId(e.userId,e.tabId),a=this.docService.getDocumentPaths()?.organizationId;if(!a)return ce(null);let l,c={id:t,organizationId:a,skipFirestore:!0};return e.documentId?(l="heartbeatByDocument",c.documentId=e.documentId):l="heartbeat",this.commonDbService.dbListener({feature:l,properties:c}).pipe($e(d=>!!d?.data),ge(d=>d?.data),_t((d,m)=>d?.lastUpdatedTimestamp===m?.lastUpdatedTimestamp))}catch(t){return this.loggingService.catch("Error in HeartbeatService getSpecificHeartbeat: ",t),ce(null)}}removeDocumentHeartbeat(e){return X(this,null,function*(){try{let t=this.authService.getUser()?.userId,i=this.domService.getTabId();if(t&&i&&e?.documentId){let a=this.generateHeartbeatId(t,i),l=`${a}_${e.organizationId}_${e.documentId}`;this.heartbeatCreatedTimestamps.delete(l),this.initializedHeartbeatIds.delete(l),yield this.commonDbService.deleteData({feature:"heartbeatByDocument",properties:{id:a,documentId:e.documentId,organizationId:e.organizationId,skipFirestore:!0}})}return Promise.resolve()}catch(t){return this.loggingService.catch("Error in HeartbeatService removeDocumentHeartbeat: ",t),Promise.resolve()}})}getHeartbeat(e){try{return(e?.userId?ce(e.userId):this.authService.getUser$().pipe(ge(i=>i?.userId))).pipe(ye(i=>i?this.docService.getDocumentPaths$().pipe(ye(a=>a?this.getHeartbeatData({userId:i,documentId:a.documentId,organizationId:a.organizationId}):ce(null))):ce(null)),ge(i=>({data:i})),_t(Kt))}catch(t){return this.loggingService.catch("Error in HeartbeatService getHeartbeat: ",t),ce({data:null})}}enableHeartbeat(){try{if(this.heartbeatEnabled$.value===!0)return;this.heartbeatEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HeartbeatService enableHeartbeat: ",e)}}disableHeartbeat(){try{if(this.heartbeatEnabled$.value===!1)return;this.heartbeatEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HeartbeatService disableHeartbeat: ",e)}}getHeartbeatEnabled$(){try{return this.heartbeatEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HeartbeatService getHeartbeatEnabled$: ",e),ce(!1)}}getHeartbeatEnabled(){try{return this.heartbeatEnabled$.value}catch(e){return this.loggingService.catch("Error in HeartbeatService getHeartbeatEnabled: ",e),!1}}ngOnDestroy(){try{this.teardownHeartbeat()}catch(e){this.loggingService.catch("Error in HeartbeatService ngOnDestroy: ",e)}}};o.\u0275fac=function(t){return new(t||o)(K(qe),K(yn),K($n),K(st),K(Ue),K(k),K(Qc),K(md),K(Ft))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var y_e=(()=>{let o=class o{constructor(e,t,i,a,l){this.authService=e,this.coreActionsService=t,this.domService=i,this.loggingService=a,this.usersService=l}findOldestActiveSessionFromHeartbeats(e){try{if(!e||e.length===0)return null;let t=this.authService.getUser(),i=this.domService.getTabId(),a=e.filter(d=>d.lastUpdatedTimestamp>Date.now()-1e4);return a.length===0?null:[...a].sort((d,m)=>d.createdTimestamp-m.createdTimestamp)[0]??null}catch(t){return this.loggingService.catch("Error in findOldestActiveSessionFromHeartbeats: ",t),null}}determineEditorStatus(e){return X(this,null,function*(){try{let{singleEditorModeData:t,heartbeatData:i,externalUserPresence:a,currentUser:l,currentTabId:c}=e,d=JSON.parse(JSON.stringify(t||{})),m={steps:[],timestamp:Date.now()},u=()=>X(this,null,function*(){let M=a?.userIds?.[0],B;if(M){let q=at(),ae=Os.GET_SINGLE_EDITOR_USERS;this.coreActionsService.triggerAction(tt.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:q,moduleName:ae,methodName:gi.SET_SINGLE_EDITOR_MODE_LIVE_STATE_DATA_FOR_DIFFERENT_USER_PRESENT_ON_TAB,source:"internal",payload:{userIds:[M],forceResolve:!0}}),yield this.usersService.resolveUsers({userIds:[M],forceResolve:!0,uniqueId:q,moduleName:ae}),B=this.usersService.getUserById(M)}B?(d.editor=B,d.tabId=`differentUserPresentOnTab_${c}`):(d.editor={userId:`anonymous_${l?.userId}`,name:"Anonymous"},d.tabId=`differentUserPresentOnTab_${c}`)}),_=()=>{d.editor=l,d.tabId=`sameUserPresentOnTab_${c}`},I=!1;if(t?.editor){if(m.steps?.push("SingleEditorModeData: Editor is available."),i?.length){m.steps?.push("Heartbeat data is available.");let M=i?.find(B=>B.userId===t?.editor?.userId&&B.tabId===t?.tabId);if(M&&M.lastUpdatedTimestamp>Date.now()-1e4)m.steps?.push("Editor user heartbeat is recent.");else{m.steps?.push("Editor user heartbeat is not available or not recent.");let B=this.findOldestActiveSessionFromHeartbeats(i);B&&B.userId===l.userId&&B.tabId===c?(m.steps?.push("Current user is the oldest active session."),I=!0):m.steps?.push("Current user is not the oldest active session.")}}!i?.length&&!a&&m.steps?.push("No heartbeat data and no external user presence is available.")}else{if(m.steps?.push("SingleEditorModeData: Editor not available."),i?.length){m.steps?.push("Heartbeat data is available.");let M=this.findOldestActiveSessionFromHeartbeats(i);M&&M.userId===l.userId&&M.tabId===c?(m.steps?.push("Current user is the oldest active session."),I=!0):m.steps?.push("Current user is not the oldest active session.")}else a&&(m.steps?.push("External user presence is available."),a.differentUserPresentOnTab?(m.steps?.push("External user presence: Different user is present on the tab."),yield u(),I=!1):a.sameUserPresentOnTab?(m.steps?.push("External user presence: Same user is present on the tab."),_(),I=!1):(m.steps?.push("External user presence: No user is present on the tab."),I=!0));!i?.length&&!a&&(m.steps?.push("No heartbeat data and no external user presence is available."),I=!0)}let A;return I?A={shouldSetUndefined:!0}:A={data:d},m.singleEditorModeData=t,m.singleEditorModeDataEditorAvailable=!!t?.editor,m.heartbeatData=i,m.externalUserPresence=a,m.currentUser=l,m.currentTabId=c,m.returnValue=A,m.shouldSetUndefined=I,m.steps?.push("Execution completed."),m=this.cleanStats(m),y(h({},A),{stats:m})}catch(t){return this.loggingService.catch("Error in determineEditorStatus: ",t),{data:e?.singleEditorModeData??void 0}}})}cleanStats(e){try{let t=e&&typeof e=="object"?JSON.parse(JSON.stringify(e)):e;return t?.singleEditorModeData?.editor&&(t.singleEditorModeData=y(h({},t.singleEditorModeData),{editor:{userId:t.singleEditorModeData?.editor?.userId}})),t?.returnValue?.data?.editor&&(t.returnValue.data=y(h({},t.returnValue.data),{editor:{userId:t.returnValue.data?.editor?.userId}})),t}catch{return e}}};o.\u0275fac=function(t){return new(t||o)(K(qe),K(nr),K(Ue),K(k),K(An))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var io=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A,M,B,q,ae,_e){this.afAuth=e,this.analyticsService=t,this.authService=i,this.configService=a,this.coreActionsService=l,this.databaseService=c,this.docService=d,this.domService=m,this.heartbeatService=u,this.iamService=_,this.loggingService=I,this.commonDbService=A,this.liveStateActionsService=M,this.liveStateUtilsService=B,this.usersService=q,this.singleEditorDecisionEngine=ae,this.presenceService=_e,this.db=null,this.liveStateAutoSyncStateData$=new Se(null),this.liveStateDataMapDraft={},this.singleEditorMode$=new Se(!1),this.singleEditorModeConfig$=new Se(null),this.singleEditorLiveStateData$=new Se(null),this.singleEditorLiveStateData={},this.editorAccessTimeout$=new Se(N.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME),this.editorAccessTransferOnTimeOut$=new Se(!0),this.defaultSingleEditorUIEnabled$=new Se(!0),this.editorAccessTimer$=new Se(new uS),this.autoSyncState$=new Se(!1),this.serverConnectionState$=new Se(el.PENDING_INIT),this.externalUserPresence$=new Se(null),this.heartbeat$=new Se(!0),this.user=null,this.keydownSubscription=null,this.isEditor$=new Se(null),this.preventEventsOnElementMap={},this.PREVENT_EVENTS=["click","mouseup","mousedown"],this.autoSyncStateHistory=null,this.singleEditorModeContainerIds$=new Se([]),this.inputChangeSubscriptionMap={},this.childListMutationSubscription=null,this.tabId=this.domService.getTabId(),this.heartbeatRestart$=new Se(void 0),this.connectionListenerUnsubscribe=null,this.offlineTimer=null;try{this.loggingService.log("%c[WB] Creating CLASS: LiveStateService","color: blue;"),this.analyticsService.setLiveStateService(this),Cn([this.getSingleEditorMode$(),this.heartbeat$]).subscribe(([re,be])=>{re&&be?this.heartbeatService.enableHeartbeat():this.heartbeatService.disableHeartbeat()}),this.databaseService.getDb().pipe($e(re=>!!re),ut(1)).subscribe(re=>{re&&(this.db=re,this.getUser(),this.getDocumentPaths(),this.subscribeLiveStateData().subscribe(),this.subscribeAutoSyncState().subscribe(),this.singleEditorMode$.subscribe(be=>{be&&this.detectKeydownOnInput()}),this.autoSyncState$.subscribe(be=>{be?(this.detectLiveSyncInputs(),this.observeElementAddedOnDom()):(this.unsubscribeInputChanges(),this.childListMutationSubscription?.unsubscribe(),this.childListMutationSubscription=null)}),this.updateOnDatabaseDisconnect().subscribe(()=>{},be=>{this.loggingService.catch("Error in LiveStateService constructor updateOnDatabaseDisconnect: ",be)}),this.updateServerStateOnDatabaseDisconnect().subscribe(()=>{},be=>{this.loggingService.catch("Error in LiveStateService constructor updateServerStateOnDatabaseDisconnect: ",be)}))},re=>{this.loggingService.catch("Error in LiveStateService getDb subscription: ",re)}),this.liveStateAutoSyncStateData$.pipe($e(re=>Object.keys(re||{}).length>0),_t((re,be)=>JSON.stringify(re||{})===JSON.stringify(be||{}))).subscribe(re=>{re&&(this.getAutoSyncState()&&(!this.autoSyncStateHistory&&re?.history&&this.updateLiveStateSyncInputDataLocally(re.history),re?.current&&this.updateLiveStateSyncInputDataLocally({[re.current.liveStateDataId]:re.current})),!this.autoSyncStateHistory&&re?.history&&(this.autoSyncStateHistory=re.history))}),this.docService.addPreDocumentIdChangeFunction("live-state-service",re=>(this.updateExternalUserPresence(null),this.isUserEditor()?.isEditor&&(!this.getSingleEditorModeConfig()?.singleTabEditor||this.isUserEditor()?.isEditorOnCurrentTab)?this.removeEditorAccess({metadata:{from:"addPreDocumentIdChangeFunction-liveStateService",reason:"Document id changed"},documentPaths:re}):Promise.resolve())),this.authService.addPreSignOutFuction("live-state-signout",this.signOutUser.bind(this)),this.singleEditorLiveStateData$.pipe(Rr()).subscribe(([re,be])=>{try{let Ie=be?.requestEditorAccess?.status,Ce=re?.requestEditorAccess?.status,Te=this.authService.getUser(),Oe=this.getPresenceData();if(Ie==="pending"){if(Te?.userId===be?.editor?.userId){let Me=h({viewer:Vo(be?.requestEditorAccess?.user)??void 0,editor:Vo(be?.editor)??void 0,timestamp:new Date().getTime(),status:"requested"},Oe);this.liveStateActionsService?.onAccessRequested(Me)}return}if(Ie==="cancelled"){if(Te?.userId===be?.editor?.userId){let Me=h({viewer:Vo(be?.requestEditorAccess?.user)??void 0,editor:Vo(be?.editor)??void 0,timestamp:new Date().getTime(),status:"canceled"},Oe);this.liveStateActionsService?.onAccessRequestCanceled(Me)}return}if(Ce==="pending"&&!Ie){if(re?.requestEditorAccess?.user?.userId===be?.editor?.userId){if(re?.requestEditorAccess?.user?.userId===Te?.userId){let Me=h({viewer:Vo(re?.editor)??void 0,editor:Vo(be?.editor)??void 0,timestamp:new Date().getTime(),status:"accepted"},Oe);this.liveStateActionsService?.onAccessAccepted(Me)}return}if(re?.requestEditorAccess?.user?.userId!==be?.editor?.userId){if(re?.requestEditorAccess?.user?.userId===Te?.userId){let Me=h({viewer:Vo(re?.requestEditorAccess?.user)??void 0,editor:Vo(be?.editor)??void 0,timestamp:new Date().getTime(),status:"rejected"},Oe);this.liveStateActionsService?.onAccessRejected(Me)}return}}}catch(Ie){this.loggingService.catch("Error in LiveStateService singleEditorLiveStateData$ subscription: ",Ie)}}),this.isUserEditor$().pipe(_t(Kt)).subscribe(re=>{try{if(re){this.analyticsService.trackEvent(Y.Events.LiveStateSync.SEM_USER_EDITOR_STATS,{isEditor:re?.isEditor,isEditorOnCurrentTab:re?.isEditorOnCurrentTab});let be=this.singleEditorLiveStateData$.value,Ie=this.getPresenceData();if(re?.isEditor)if(re?.isEditorOnCurrentTab){let Ce=h({editor:Vo(be?.editor)??void 0,timestamp:new Date().getTime(),role:"editor"},Ie);this.liveStateActionsService?.onEditorAssigned(Ce)}else{let Ce=h({editor:Vo(be?.editor)??void 0,timestamp:new Date().getTime(),role:"editorOnDifferentTab"},Ie);this.liveStateActionsService?.onEditorOnDifferentTabDetected(Ce)}else{let Ce=h({viewer:Vo(this.authService.getUser())??void 0,timestamp:new Date().getTime(),role:"viewer"},Ie);this.liveStateActionsService?.onViewerAssigned(Ce)}}}catch(be){this.loggingService.catch("Error in LiveStateService isUserEditor$ subscription: ",be)}})}catch(re){this.loggingService.catch("Error in LiveStateService constructor: ",re)}}getPresenceData(){try{let e=this.presenceService.getPresenceUsers();return{totalUsers:e?.length,presenceSnippylyUserIds:e?.map(t=>t.userSnippylyId).filter(t=>!!t),presenceClientUserIds:e?.map(t=>t.userId)}}catch(e){return this.loggingService.catch("Error in LiveStateService getPresenceData: ",e),{}}}observeElementAddedOnDom(){try{this.loggingService.log("%c[WB] Calling FUNCTION: observeElementAddedOnDom","color: green;"),this.childListMutationSubscription&&(this.childListMutationSubscription.unsubscribe(),this.childListMutationSubscription=null),this.childListMutationSubscription=this.domService.getChildListMutation$().subscribe(e=>{e?.length&&e.forEach(t=>{let i=Array.from(t.addedNodes||[]).filter(a=>a instanceof HTMLElement);i?.forEach(a=>{CZ(a,!0)?.forEach(d=>{typeof d?.getAttribute=="function"&&d?.getAttribute(N.ATTRIBUTES.VELT_SYNC_STATE)&&this.subscribeInputChanges(d)})}),i?.length&&this.isEditor$?.value?.isEditor===!1&&(this.disableInputElements(),this.disableElementEvents())})},e=>{this.loggingService.catch("Error in LiveStateService domService getChildListMutation$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in LiveStateService observeElementAddedOnDom: ",e)}}detectKeydownOnInput(){try{this.loggingService.log("%c[WB] Calling FUNCTION: detectKeydownOnInput","color: green;"),this.unsubscribeKeydownSubscription(),this.keydownSubscription=this.domService.onWindowKeydown$().pipe($e(e=>e?.target instanceof HTMLInputElement||e?.target instanceof HTMLTextAreaElement||e?.target instanceof HTMLSelectElement),$e(e=>!!this.isElementInsideSingleEditorModeContainerElements(e?.target)),ut(1)).subscribe(e=>{this.unsubscribeKeydownSubscription(),this.getSingleEditorModeConfig()?.customMode||this.setUserAsEditor({skipEditorCheck:!0})},e=>{this.loggingService.catch("Error in LiveStateService detectKeydownOnInput subscription: ",e)})}catch(e){this.loggingService.catch("Error in LiveStateService detectKeydownOnInput: ",e)}}unsubscribeKeydownSubscription(){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribeKeydownSubscription","color: green;"),this.keydownSubscription&&(this.keydownSubscription.unsubscribe(),this.keydownSubscription=null)}catch(e){this.loggingService.catch("Error in LiveStateService unsubscribeKeydownSubscription: ",e)}}getDocumentPaths(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().subscribe(e=>{this.documentPaths=e,this.updateLiveStateDataFromDraft()})}catch(e){this.loggingService.catch("Error in LiveStateService getDocumentPaths: ",e)}}getUser(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().subscribe(e=>{this.user=e,this.updateLiveStateDataFromDraft()})}catch(e){this.loggingService.catch("Error in LiveStateService getUser: ",e)}}updateLiveStateDataFromDraft(){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateLiveStateDataFromDraft","color: green;"),this.liveStateDataMapDraft?.custom&&this.user&&this.documentPaths&&(Object.keys(this.liveStateDataMapDraft.custom).forEach(e=>{this.setLiveStateData(e,this.liveStateDataMapDraft.custom[e])}),this.liveStateDataMapDraft={})}catch(e){this.loggingService.catch("Error in LiveStateService updateLiveStateDataFromDraft: ",e)}}getActiveHeartbeatStream$(e){return this.heartbeatRestart$.pipe(ut(50),ye(()=>{let t=this.heartbeatService.getHeartbeatData({documentId:this.documentPaths?.documentId}).pipe(ut(1),ye(i=>{let a=this.singleEditorDecisionEngine.findOldestActiveSessionFromHeartbeats(i);return a?this.monitorSession$(a.userId,a.tabId):ce(null)}));return!e?.userId||!e?.tabId?t:this.heartbeatService.getSpecificHeartbeat({userId:e.userId,tabId:e.tabId,documentId:this.documentPaths?.documentId}).pipe(ut(1),ye(i=>!i?.id||Date.now()-i?.lastUpdatedTimestamp>1e4?t:this.monitorSession$(e.userId,e.tabId)))}),_t((t,i)=>this.isHeartbeatSimilar(t,i)))}monitorSession$(e,t){return this.heartbeatService.getSpecificHeartbeat({userId:e,tabId:t,documentId:this.documentPaths?.documentId}).pipe(ye(a=>a?.id?ce(a):(this.heartbeatRestart$.next(),js)),JB({each:1e4,with:()=>(this.heartbeatRestart$.next(),js)}))}isHeartbeatSimilar(e,t){try{return!e&&!t?!0:!e||!t?!1:e?.userId===t?.userId&&e?.tabId===t?.tabId}catch{return!1}}subscribeLiveStateData(){return this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;"),br(this.afAuth).pipe($e(e=>!!e),ye(e=>this.isFeatureAllowed({firebaseUser:e,liveStateData:{}})),ye(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(t=>(e.featureAllowed=t,e))):ce(e)),ye(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(ge(t=>(e.featureAllowed=!t,e))):ce(e)),ye(e=>e.featureAllowed?ce(e).pipe(ye(t=>this.docService.getDocumentPaths$().pipe(ge(i=>(this.documentPaths=i,t.documentPaths=i,t)))),ye(t=>t?.documentPaths?ce(t).pipe(ln(i=>{this.serverConnectionState$?.value===el.PENDING_INIT&&i?.documentPaths?.liveState&&this.serverConnectionState$.next(el.PENDING_DATA)}),ye(i=>this.domService.onNetworkStatusChange$().pipe($e(a=>a),ge(()=>i))),ye(i=>this.getDataFromDocumentId().pipe(ge(a=>(i.singleEditorModeData=a,h({},i))))),ye(i=>this.getSingleEditorMode$().pipe(ge(()=>i))),ge(i=>([el.ONLINE,el.OFFLINE].includes(this.serverConnectionState$?.value)||this.serverConnectionState$.next(el.ONLINE),i)),ye(i=>this.getSingleEditorMode()?this.getExternalUserPresence$().pipe(ge(a=>y(h({},i),{externalUserPresence:a}))):ce(i))):ce(y(h({},t),{liveStateData:{}}))),ye(t=>this.getSingleEditorMode()?this.heartbeatService.getHeartbeatEnabled$().pipe(ye(i=>{if(i){let a=t?.singleEditorModeData?.editor,l=t?.singleEditorModeData?.tabId;return this.getActiveHeartbeatStream$({userId:a?.userId,tabId:l}).pipe(ge(c=>{let d=c?.id?[c]:null;return y(h({},t),{heartbeatData:d})}))}else return ce(y(h({},t),{heartbeatData:null}))})):ce(t)),ye(t=>{if(this.getSingleEditorMode()){let i=[];if(!(Object.keys(t?.singleEditorModeData||{}).length>0)){let l=this.singleEditorLiveStateData$.value&&typeof this.singleEditorLiveStateData$.value=="object"?JSON.parse(JSON.stringify(this.singleEditorLiveStateData$.value)):this.singleEditorLiveStateData$.value;i.push({eventName:Y.Events.LiveStateSync.SEM_SINGLE_EDITOR_LIVE_STATE_EMPTY_DATA_STATS,properties:{previousSingleEditorModeData:l,currentSingleEditorModeData:t?.singleEditorModeData}})}return this.updateSingleEditorLiveSyncData(t?.singleEditorModeData||{},t?.externalUserPresence??null,t?.heartbeatData??null,t,i),ce(t)}else return ce(t)})):ce({})))}updateSingleEditorLiveSyncData(e,t,i,a,l){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateSingleEditorLiveSyncData","color: green;"),vr(e,{})&&!this.keydownSubscription&&this.detectKeydownOnInput();let c=JSON.parse(JSON.stringify(e)),d=yield this.singleEditorDecisionEngine.determineEditorStatus({singleEditorModeData:c,externalUserPresence:t,heartbeatData:i,currentUser:this.authService.getUser(),currentTabId:this.tabId});d?.stats&&l?.push({eventName:Y.Events.LiveStateSync.SEM_SINGLE_EDITOR_DETERMINE_EDITOR_STATUS,properties:{stats:d?.stats}});let m;if(this.domService.getNetworkStatus()||(m=null),e=d?.data??{},d?.shouldSetUndefined||(m=null),(a?a?.documentPaths:this.docService.getDocumentPaths())||(m=null),e&&!e?.editor&&this.isEditor$?.value!==m&&this.isEditor$.next(m),vr(this.singleEditorLiveStateData,e))return;{t&&this.compareServerAndExternalData(c,t),l&&l?.length>0&&l.forEach(I=>{I?.eventName&&this.analyticsService.trackEvent(I.eventName,I.properties)}),this.singleEditorLiveStateData=e,this.singleEditorLiveStateData$.next(e);let _;if(this.singleEditorLiveStateData&&typeof this.singleEditorLiveStateData=="object"&&(_=this.liveStateUtilsService.formatLiveStateSingleEditorModeData(JSON.parse(JSON.stringify(this.singleEditorLiveStateData)))),this.analyticsService.trackEvent(Y.Events.LiveStateSync.SEM_SINGLE_EDITOR_LIVE_STATE_DATA_STATS,{singleEditorLiveStateData:_}),this.singleEditorLiveStateData?.editor){let I=this.authService.getUser();this.singleEditorLiveStateData?.editor?.userId!==I?.userId?this.makeReader():this.makeEditor()}else this.isEditor$?.value!==m&&this.isEditor$.next(m),this.enableInputElements(),this.enableElementEvents();this.editorAccessTimerInterval&&this.singleEditorLiveStateData?.requestEditorAccess?.status!=="pending"&&this.clearEditorAccessTimerInterval(),this.requestAccessTimer&&this.singleEditorLiveStateData?.requestEditorAccess?.status!=="pending"?this.clearRequestAccessTimer():this.singleEditorLiveStateData?.requestEditorAccess?.status==="pending"&&this.isUserEditor()?.isEditor&&this.isUserEditor()?.isEditorOnCurrentTab&&this.setRequestAccessTimer(this.singleEditorLiveStateData?.requestEditorAccess?.editorAccessTimeout||N.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME)}}catch{}})}updateSingleEditorLiveSyncDataOld(a,l){return X(this,arguments,function*(e,t,i=[]){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateSingleEditorLiveSyncData","color: green;"),vr(e,{})){let m=yield this.fetchSingleEditorLiveStateDataFromDatabase();if(!vr(m,e)&&(i.push({eventName:Y.Events.LiveStateSync.SEM_SINGLE_EDITOR_LIVE_STATE_DATA_MISMATCH,properties:{serverData:m,localData:e}}),m&&typeof m=="object")){let u=yield this.liveStateUtilsService.resolveAndMergeSingleEditorLiveStateDataWithUser(JSON.parse(JSON.stringify(m)));e=JSON.parse(JSON.stringify(u))}}vr(e,{})&&!this.keydownSubscription&&this.detectKeydownOnInput();let c=e&&typeof e=="object"?JSON.parse(JSON.stringify(e)):e;if(t&&(e&&typeof e=="object"&&(e=JSON.parse(JSON.stringify(e))),!e?.editor)){let m=this.authService.getUser();if(t?.sameUserPresentOnTab)e.editor=m,e.tabId=`sameUserPresentOnTab_${this.tabId}`;else if(t?.differentUserPresentOnTab){let u=t?.userIds?.[0],_;if(u){let I=at();this.coreActionsService.triggerAction(tt.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:I,methodName:gi.GET_SINGLE_EDITOR_MODE_DATA,source:"internal",payload:{userIds:[u],forceResolve:!0}}),yield this.usersService.resolveUsers({userIds:[u],forceResolve:!0,uniqueId:I}),_=this.usersService.getUserById(u)}_?(e.editor=_,e.tabId=`differentUserPresentOnTab_${this.tabId}`):(e.editor={userId:`anonymous_${m?.userId}`,name:"Anonymous"},e.tabId=`differentUserPresentOnTab_${this.tabId}`)}}let d;if(this.domService.getNetworkStatus()||(d=null),e&&!e?.editor&&this.isEditor$?.value!==d&&!t?.sameUserPresentOnTab&&!t?.differentUserPresentOnTab&&this.isEditor$.next(d),vr(this.singleEditorLiveStateData,e))return;{t&&this.compareServerAndExternalData(c,t),i?.length>0&&i.forEach(u=>{u?.eventName&&this.analyticsService.trackEvent(u.eventName,u.properties)}),this.singleEditorLiveStateData=e,this.singleEditorLiveStateData$.next(e);let m;if(this.singleEditorLiveStateData&&typeof this.singleEditorLiveStateData=="object"&&(m=this.liveStateUtilsService.formatLiveStateSingleEditorModeData(JSON.parse(JSON.stringify(this.singleEditorLiveStateData)))),this.analyticsService.trackEvent(Y.Events.LiveStateSync.SEM_SINGLE_EDITOR_LIVE_STATE_DATA_STATS,{singleEditorLiveStateData:m}),this.singleEditorLiveStateData?.editor){let u=this.authService.getUser();this.singleEditorLiveStateData?.editor?.userId!==u?.userId?this.makeReader():this.makeEditor()}else this.isEditor$?.value!==d&&this.isEditor$.next(d),this.enableInputElements(),this.enableElementEvents();this.editorAccessTimerInterval&&this.singleEditorLiveStateData?.requestEditorAccess?.status!=="pending"&&this.clearEditorAccessTimerInterval(),this.requestAccessTimer&&this.singleEditorLiveStateData?.requestEditorAccess?.status!=="pending"?this.clearRequestAccessTimer():this.singleEditorLiveStateData?.requestEditorAccess?.status==="pending"&&this.isUserEditor()?.isEditor&&this.isUserEditor()?.isEditorOnCurrentTab&&this.setRequestAccessTimer(this.singleEditorLiveStateData?.requestEditorAccess?.editorAccessTimeout||N.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME)}}catch{}})}compareServerAndExternalData(e,t){try{if(t){let i=this.authService.getUser(),a={isEditor:e?.editor?.userId===i?.userId,isEditorOnCurrentTab:e?.editor?.userId===i?.userId&&e?.tabId===this.tabId},l={isEditor:t?.sameUserPresentOnTab&&!t?.differentUserPresentOnTab,isEditorOnCurrentTab:!1};vr(a,l)||this.analyticsService.trackEvent(Y.Events.LiveStateSync.SEM_SINGLE_EDITOR_DATA_MISMATCH_WITH_EXTERNAL,{serverUserEditorAccess:a,externalUserEditorAccess:l,serverData:e,externalData:t})}}catch(i){this.loggingService.catch("Error in LiveStateService compareServerAndExternalData: ",i)}}isFeatureAllowed(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>y(h({},t),{user:i})))),ye(t=>Mo(t.config,t.user,je.LIVE_STATE_SYNC)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Live state sync feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))),_t((t,i)=>t?.featureAllowed===i?.featureAllowed))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe($e(t=>!!t),ye(t=>(this.db=t,this.configService?.getApiKey()&&this.documentPaths?.liveState?this.commonDbService.dbListener({feature:"liveStateSingleEditorMode",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe($e(i=>!!i?.data),ge(i=>i?.data&&typeof i?.data=="object"?JSON.parse(JSON.stringify(i?.data)):i?.data),Jn(i=>(this.loggingService.catch("Error in LiveStateService getDataFromDocumentId: ",i),ce({})))):ce({}))),_t(Kt))}getLiveStateData$(e,t){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getLiveStateData$","color: green;"),br(this.afAuth).pipe($e(i=>!!i),ye(i=>this.isFeatureAllowed({firebaseUser:i,liveStateData:{}})),ye(i=>i.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(a=>(i.featureAllowed=a,i))):ce(i)),ye(i=>i.featureAllowed?this.authService.isPlanExpired$().pipe(ge(a=>(i.featureAllowed=!a,i))):ce(i)),ye(i=>i.featureAllowed?ce(i).pipe(ye(a=>this.docService.getDocumentPaths$().pipe(ge(l=>(this.documentPaths=l,a.documentPaths=l,a)))),ye(a=>{let l=t?.listenToNewChangesOnly?1:0;return this.getLiveStateDataFromDatabase$(e).pipe(_t(Kt),Od(l))}),ge(a=>{if(a)if(e){let l=It(e+""),c=a?.[l];if(c){let d=c?.data;if(c?.tabId&&this.tabId&&c?.tabId===this.tabId)return;if(c?.isDataStringified&&typeof d=="string")try{d=JSON.parse(d)}catch{}return d}else return}else{let l={};return Object.keys(a||{}).forEach(c=>{if(a[c]?.liveStateDataId){let d=a[c],m=d?.data;if(d?.isDataStringified&&typeof m=="string")try{m=JSON.parse(m)}catch{}l[d.liveStateDataId]=m}}),l}return a})):ce(void 0).pipe($e(Boolean))),_t((i,a)=>JSON.stringify(i||{})===JSON.stringify(a||{})),$e(i=>i!==void 0),ge(i=>i))}catch(i){return this.loggingService.catch("Error in LiveStateService getLiveStateData$: ",i),ce(null)}}getLiveStateDataFromDatabase$(e){try{return this.databaseService.getDb().pipe($e(t=>!!t),ye(t=>{this.db=t;let i=e?It(e+""):void 0;return this.configService?.getApiKey()&&this.documentPaths?.liveState?this.commonDbService.dbListener({feature:i?"liveStateCustom":"allLiveStateCustoms",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:i,skipFirestore:!0}}).pipe($e(a=>!!a?.data),ge(a=>a?.data),ge(a=>{if(a)return i?{[i]:a}:a}),Jn(a=>(this.loggingService.catch("Error in LiveStateService getLiveStateDataFromDatabase$: ",a),ce(null)))):ce(void 0)}))}catch(t){return this.loggingService.catch("Error in LiveStateService getLiveStateDataFromDatabase$: ",t),ce(void 0)}}fetchLiveStateData(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: fetchLiveStateData","color: green;");let t=this.databaseService.getDbValue(),i=this.authService.getUser(),a=this.docService.getDocumentPaths(),l=e?.liveStateDataId&&typeof e?.liveStateDataId=="string"?It(e.liveStateDataId):void 0,c=Mo(this.configService.getConfig(),i,je.LIVE_STATE_SYNC);if(this.authService.isPlanExpired()&&(c=!1),t&&i&&a?.liveState&&c){let m=yield this.commonDbService.getData({feature:l?"liveStateCustom":"allLiveStateCustoms",properties:{documentId:a?.documentId,organizationId:a?.organizationId,id:l,skipFirestore:!0}}).then(u=>u?l?{[l]:u}:u:null);if(m)if(l){let u=m?.[l];if(u){let _=u?.data;if(u?.isDataStringified&&typeof _=="string")try{_=JSON.parse(_)}catch{}return _}else return null}else{let u={};return Object.keys(m||{}).forEach(_=>{if(m[_]?.liveStateDataId){let I=m[_],A=I?.data;if(I?.isDataStringified&&typeof A=="string")try{A=JSON.parse(A)}catch{}u[I.liveStateDataId]=A}}),u}}return null}catch(t){return this.loggingService.catch("Error in LiveStateService fetchLiveStateData: ",t),null}})}setLiveStateData(e,t,i){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setLiveStateData","color: green;");try{let a=this.authService.getUser();if(e&&this.documentPaths?.liveState&&a){let l=It(e+""),c=!1;try{if(i?.merge&&typeof t=="object"){let m=yield this.commonDbService.getData({feature:"liveStateCustom",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:l,skipFirestore:!0}});if(m?.isDataStringified){let u=JSON.parse(m?.data);typeof t=="object"&&(t=h(h({},u),t))}}}catch{}try{typeof t=="object"&&(t=JSON.stringify(t),c=!0)}catch{}let d={id:l,lastUpdated:this.timestamp,liveStateDataId:e,data:t,updatedBy:a,tabId:this.tabId,isDataStringified:c};yield this.commonDbService.setData({feature:"liveStateCustom",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:l,skipFirestore:!0},data:JSON.parse(JSON.stringify(d))})}else this.loggingService.warn("liveStateDataId or documentPaths or user is null"),this.liveStateDataMapDraft?.custom||(this.liveStateDataMapDraft.custom={}),e&&(this.liveStateDataMapDraft.custom[e]=t)}catch(a){this.loggingService.catch("Error in LiveStateService _setLiveStateData: ",a)}})}getFormElements(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getInputElements","color: green;"),document.querySelectorAll("input, textarea, select, button, [contenteditable]")}catch(e){return this.loggingService.catch("Error in LiveStateService getInputElements: ",e),null}}disableInputElements(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableInputElements","color: green;"),this.getFormElements()?.forEach(t=>{if(this.isElementInsideSingleEditorModeContainerElements(t)&&!this.isSingleEditorModeDisabledForElement(t)&&!fo(t)){let i=t?.hasAttribute("disabled");t?.hasAttribute("contenteditable")&&(i=t?.getAttribute("contenteditable")==="false"),i||(t.setAttribute("disabled","true"),t.setAttribute(N.ATTRIBUTES.VELT_SYNC_ACCESS_AUTO,"true"),t?.hasAttribute("contenteditable")&&t.setAttribute("contenteditable","false"))}})}catch(e){this.loggingService.catch("Error in LiveStateService disableInputElements: ",e)}}enableInputElements(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableInputElements","color: green;"),this.getFormElements()?.forEach(t=>{t?.hasAttribute(N.ATTRIBUTES.VELT_SYNC_ACCESS_AUTO)&&(t.removeAttribute("disabled"),t.removeAttribute(N.ATTRIBUTES.VELT_SYNC_ACCESS_AUTO),t?.getAttribute("contenteditable")&&t.setAttribute("contenteditable","true"))})}catch(e){this.loggingService.catch("Error in LiveStateService enableInputElements: ",e)}}disableElementEvents(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableElementEvents","color: green;"),document.querySelectorAll(`[${N.ATTRIBUTES.VELT_SYNC_ACCESS}]`)?.forEach(t=>{let i=this.domService.getXPath(t);i&&!this.preventEventsOnElementMap[i]&&(this.preventEventsOnElementMap[i]={element:t,events:{}},this.PREVENT_EVENTS.forEach(a=>{let l=xr(t,a,{capture:!0}).subscribe(c=>{try{c.preventDefault(),c.stopPropagation()}catch(d){this.loggingService.catch("Error in LiveStateService disableElementEvents subscription: ",d)}});this.preventEventsOnElementMap[i]?.events[a]?.unsubscribe(),this.preventEventsOnElementMap[i].events[a]=l}))})}catch(e){this.loggingService.catch("Error in LiveStateService disableElementClicks: ",e)}}enableElementEvents(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableElementEvents","color: green;"),Object.keys(this.preventEventsOnElementMap).forEach(e=>{let t=this.preventEventsOnElementMap[e];Object.keys(t.events||{}).forEach(i=>{t?.events[i]?.unsubscribe()})}),this.preventEventsOnElementMap={}}catch(e){this.loggingService.catch("Error in LiveStateService enableElementClicks: ",e)}}setUserAsEditor(e){return X(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setUserAsEditor","color: green;"),this.user&&this.documentPaths?.liveStateSingleEditorMode){if(this.analyticsService.trackEvent(Y.Events.LiveStateSync.SET_USER_AS_EDITOR_TRIGGERED,{editorUserId:this.user?.userSnippylyId,tabId:this.tabId}),!e?.skipEditorCheck){let i=yield this.fetchSingleEditorLiveStateDataFromDatabase();if(i?.editor?.userId&&i?.tabId){let a=yield ZB(this.heartbeatService.getSpecificHeartbeat({userId:i?.editor?.userId,tabId:i?.tabId,documentId:this.documentPaths?.documentId})),l=null;a&&(l=this.singleEditorDecisionEngine.findOldestActiveSessionFromHeartbeats([a])),l||(i=null)}else i=null;if(i?.editor){let a=this.authService.getUser(),l=null;a?.userId===i?.editor?.userId?i?.tabId===this.tabId?l={code:"same_user_editor_current_tab",message:"Same user is already editor in current tab.",source:"setUserAsEditor"}:l={code:"same_user_editor_different_tab",message:"Same user is already editor in different tab.",source:"setUserAsEditor"}:l={code:"another_user_editor",message:"Another user is already editor.",source:"setUserAsEditor"};let c;return i&&typeof i=="object"&&(c=this.liveStateUtilsService.formatLiveStateSingleEditorModeData(JSON.parse(JSON.stringify(i)))),this.analyticsService.trackEvent(Y.Events.LiveStateSync.SET_USER_AS_EDITOR_ERROR,{error:l,singleEditorLiveStateData:c}),{error:l}}}let t={editor:this.user,tabId:this.tabId,editorAt:this.timestamp};this.commonDbService.setData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0,rtdbTransaction:!0},data:JSON.parse(JSON.stringify(t))})}}catch(t){this.loggingService.catch("Error in LiveStateService setUserAsEditor: ",t)}})}fetchSingleEditorLiveStateDataFromDatabase(){return X(this,null,function*(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: fetchSingleEditorLiveStateDataFromDatabase","color: green;"),yield this.commonDbService.getData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0}})}catch(e){return this.loggingService.catch("Error in LiveStateService fetchSingleEditorLiveStateDataFromDatabase: ",e),null}})}setRequestAccessTimer(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRequestAccessTimer","color: green;"),this.requestAccessTimer||(this.requestAccessTimer=setTimeout(()=>{this.getEditorAccessTransferOnTimeOut()&&this.acceptEditorAccessRequest(),this.clearRequestAccessTimer()},e*1e3),this.setEditorAccessTimerInterval(e))}catch(t){this.loggingService.catch("Error in LiveStateService setRequestAccessTimer: ",t)}}clearRequestAccessTimer(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearRequestAccessTimer","color: green;"),this.requestAccessTimer&&(clearTimeout(this.requestAccessTimer),this.requestAccessTimer=null)}catch(e){this.loggingService.catch("Error in LiveStateService clearRequestAccessTimer: ",e)}}requestEditorAccess(){this.loggingService.log("%c[WB] Calling FUNCTION: requestEditorAccess","color: green;");try{return this.serverConnectionState$.value===el.OFFLINE?(this.loggingService.catch("User is offline."),ce(null)):(this.analyticsService.trackEvent(Y.Events.LiveStateSync.REQUEST_EDITOR_ACCESS_TRIGGERED),new Vt(e=>{let t=null;try{if(this.user&&this.documentPaths?.liveStateSingleEditorMode){let i=this.getEditorAccessTimeout(),a=Vr(this.db,`${this.documentPaths?.liveStateSingleEditorMode}`),l={requestEditorAccess:{user:this.user,requestedAt:this.timestamp,status:"pending",editorAccessTimeout:i,tabId:this.tabId}};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0,rtdbTransaction:!0},errorCallback:c=>{this.loggingService.catch("Error in LiveStateService requestEditorAccess: ",c),e.next(null),e.complete()},callback:()=>{i&&(this.requestAccessTimer=setTimeout(()=>{this.getEditorAccessTransferOnTimeOut()&&this.setUserAsEditor({skipEditorCheck:!0})},(i+3)*1e3),this.setEditorAccessTimerInterval(i+3)),t=this.getSingleEditorLiveStateData$().subscribe(c=>{c&&(c?.requestEditorAccess?c?.requestEditorAccess?.status==="cancelled"&&(e.next(null),e.complete()):c?.editor?.userId===this.user?.userId?(e.next(!0),e.complete()):(e.next(!1),e.complete()))})},data:JSON.parse(JSON.stringify(l))})}else e.next(!1),e.complete()}catch(i){this.loggingService.catch("Error in LiveStateService requestEditorAccess: ",i),e.next(null),e.complete()}return()=>{t&&t?.unsubscribe()}}))}catch(e){return this.loggingService.catch("Error in LiveStateService requestEditorAccess: ",e),ce(null)}}makeEditor(){try{this.loggingService.log("%c[WB] Calling FUNCTION: makeEditor","color: green;");let e=this.singleEditorLiveStateData?.tabId===this.tabId;this.analyticsService.trackEvent(Y.Events.LiveStateSync.SEM_MAKE_EDITOR_TRIGGERED,{editorUserId:this.singleEditorLiveStateData?.editor?.userId,tabId:this.tabId,editorTabId:this.singleEditorLiveStateData?.tabId,isEditor:!0,isEditorOnCurrentTab:e}),this.isEditor$.next({isEditor:!0,isEditorOnCurrentTab:e}),this.getSingleEditorModeConfig()?.customMode||(!this.getSingleEditorModeConfig()?.singleTabEditor||e?(this.enableInputElements(),this.enableElementEvents()):(this.disableInputElements(),this.disableElementEvents())),this.fetchSingleEditorLiveStateDataFromDatabase().then(t=>{this.analyticsService.trackEvent(Y.Events.LiveStateSync.SEM_SINGLE_EDITOR_LIVE_STATE_DATA_ON_MAKE_EDITOR,{editorUserId:this.singleEditorLiveStateData?.editor?.userId,tabId:this.tabId,editorTabId:this.singleEditorLiveStateData?.tabId,isEditor:!0,isEditorOnCurrentTab:e,singleEditorLiveStateDataOnServer:t})}).catch(t=>{})}catch(e){this.loggingService.catch("Error in LiveStateService makeEditor: ",e)}}makeReader(){try{this.loggingService.log("%c[WB] Calling FUNCTION: makeReader","color: green;"),this.analyticsService.trackEvent(Y.Events.LiveStateSync.SEM_MAKE_READER_TRIGGERED,{editorUserId:this.singleEditorLiveStateData?.editor?.userId,tabId:this.tabId,editorTabId:this.singleEditorLiveStateData?.tabId,isEditor:!1,isEditorOnCurrentTab:!1}),this.isEditor$.next({isEditor:!1,isEditorOnCurrentTab:!1}),this.getSingleEditorModeConfig()?.customMode||(this.disableInputElements(),this.disableElementEvents()),this.fetchSingleEditorLiveStateDataFromDatabase().then(e=>{this.analyticsService.trackEvent(Y.Events.LiveStateSync.SEM_SINGLE_EDITOR_LIVE_STATE_DATA_ON_MAKE_READER,{editorUserId:this.singleEditorLiveStateData?.editor?.userId,tabId:this.tabId,editorTabId:this.singleEditorLiveStateData?.tabId,isEditor:!1,isEditorOnCurrentTab:!1,singleEditorLiveStateDataOnServer:e})}).catch(e=>{})}catch(e){this.loggingService.catch("Error in makeReader: ",e)}}acceptEditorAccessRequest(){return X(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: acceptEditorAccessRequest","color: green;"),this.serverConnectionState$.value===el.OFFLINE){this.loggingService.catch("User is offline.");return}if(this.user&&this.singleEditorLiveStateData?.requestEditorAccess&&this.isUserEditor()?.isEditor&&this.documentPaths?.liveStateSingleEditorMode){let e=this.singleEditorLiveStateData?.requestEditorAccess?.user,t=this.singleEditorLiveStateData?.requestEditorAccess?.tabId;if(e&&t){let i={editor:e,requestEditorAccess:null,tabId:t,editorAt:this.timestamp};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0,rtdbTransaction:!0},data:JSON.parse(JSON.stringify(i))}),this.analyticsService.trackEvent(Y.Events.LiveStateSync.ACCEPT_EDITOR_ACCESS_REQUEST_TRIGGERED,{editorUserId:e?.userSnippylyId,tabId:t})}}}catch(e){this.loggingService.catch("Error in acceptEditorAccessRequest: ",e)}})}rejectEditorAccessRequest(){return X(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: rejectEditorAccessRequest","color: green;"),this.serverConnectionState$.value===el.OFFLINE){this.loggingService.catch("User is offline.");return}if(this.user&&this.singleEditorLiveStateData?.requestEditorAccess&&this.isUserEditor()?.isEditor&&this.documentPaths?.liveStateSingleEditorMode){let e={requestEditorAccess:null};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0,rtdbTransaction:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Y.Events.LiveStateSync.REJECT_EDITOR_ACCESS_REQUEST_TRIGGERED)}}catch(e){this.loggingService.catch("Error in LiveStateService rejectEditorAccessRequest: ",e)}})}cancelEditorAccessRequest(){return X(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: cancelEditorAccessRequest","color: green;"),this.serverConnectionState$.value===el.OFFLINE){this.loggingService.catch("User is offline.");return}if(this.user&&this.singleEditorLiveStateData?.requestEditorAccess&&this.documentPaths?.liveStateSingleEditorMode){let e={requestEditorAccess:y(h({},this.singleEditorLiveStateData?.requestEditorAccess),{status:"cancelled"})};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0,rtdbTransaction:!0},data:JSON.parse(JSON.stringify(e))}),e={requestEditorAccess:null},this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0,rtdbTransaction:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Y.Events.LiveStateSync.CANCEL_EDITOR_ACCESS_REQUEST_TRIGGERED)}}catch(e){this.loggingService.catch("Error in LiveStateService cancelEditorAccessRequest: ",e)}})}editCurrentTab(){return X(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: editCurrentTab","color: green;"),this.serverConnectionState$.value===el.OFFLINE){this.loggingService.catch("User is offline.");return}if(this.user&&this.isUserEditor()?.isEditor&&!this.isUserEditor()?.isEditorOnCurrentTab&&this.documentPaths?.liveStateSingleEditorMode){let e={tabId:this.tabId,editor:this.user,editorAt:this.timestamp};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0,rtdbTransaction:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Y.Events.LiveStateSync.EDIT_CURRENT_TAB_TRIGGERED,{tabId:this.tabId})}}catch(e){this.loggingService.catch("Error in LiveStateService editCurrentTab: ",e)}})}isUserEditor$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: isUserEditor$","color: green;"),this.isEditor$.asObservable().pipe(_t(Kt))}catch(e){return this.loggingService.catch("Error in LiveStateService isUserEditor$: ",e),ce(null)}}isUserEditor(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: isUserEditor","color: green;"),this.isEditor$.value}catch(e){return this.loggingService.catch("Error in LiveStateService isUserEditor: ",e),null}}getEditor$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getEditor$","color: green;"),this.getSingleEditorLiveStateData$().pipe(ge(e=>e?.editor||null),_t())}catch(e){return this.loggingService.catch("Error in LiveStateService getEditor$: ",e),ce(null)}}isEditorAccessRequested$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: isEditorAccessRequested$","color: green;"),this.isUserEditor$().pipe(ye(e=>e?.isEditor?this.singleEditorLiveStateData$.pipe(ge(t=>t?.requestEditorAccess?{requestStatus:"requested",requestedBy:t?.requestEditorAccess?.user}:null)):ce(null)),_t((e,t)=>JSON.stringify(e||{})===JSON.stringify(t||{})))}catch(e){return this.loggingService.catch("Error in LiveStateService isEditorAccessRequested$: ",e),ce(null)}}removeEditorAccess(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeEditorAccess","color: green;"),this.analyticsService.trackEvent(Y.Events.LiveStateSync.REMOVE_EDITOR_ACCESS,{removeEditorAccessMetadata:e?.metadata});let t=e?.documentPaths??this.documentPaths;(this.user||this.authService.getAuthUser())&&t?.liveStateSingleEditorMode&&(yield this.commonDbService.deleteData({feature:"liveStateSingleEditorMode",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",skipFirestore:!0}}))}catch(t){this.loggingService.catch("Error in LiveStateService removeEditorAccess: ",t)}})}getSingleEditorLiveStateData$(){return this.singleEditorLiveStateData$.asObservable().pipe(_t(Kt))}subscribeAutoSyncState(){return this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;"),br(this.afAuth).pipe($e(e=>!!e),ye(e=>this.isFeatureAllowed({firebaseUser:e,liveStateData:{}})),ye(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(t=>(e.featureAllowed=t,e))):ce(e)),ye(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(ge(t=>(e.featureAllowed=!t,e))):ce(e)),ye(e=>e.featureAllowed?ce(e).pipe(ye(t=>this.docService.getDocumentPaths$().pipe($e(i=>!!i),ge(i=>(this.documentPaths=i,t.documentPaths=i,t)))),ye(t=>this.domService.onNetworkStatusChange$().pipe($e(i=>i),ge(()=>t))),ye(t=>this.getLiveStateAutoSyncStateDataFromDocumentId().pipe(ge(i=>(t.liveStateData=i,h({},t))))),ge(t=>{if(t.liveStateData)this.liveStateAutoSyncStateData$.next(t.liveStateData);else{let i=this.liveStateAutoSyncStateData$.value;i&&Object.keys(i).length>0&&this.liveStateAutoSyncStateData$.next({})}return t})):ce({})))}getLiveStateAutoSyncStateDataFromDocumentId(e){return this.databaseService.getDb().pipe($e(t=>!!t),ye(t=>(this.db=t,this.configService?.getApiKey()&&this.documentPaths?.liveState?this.commonDbService.dbListener({feature:"liveStateAutoSyncState",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe($e(i=>!!i?.data),ge(i=>i?.data&&typeof i?.data=="object"?JSON.parse(JSON.stringify(i?.data)):i?.data),Jn(i=>(this.loggingService.catch("Error in LiveStateService getLiveStateAutoSyncStateDataFromDocumentId: ",i),ce({})))):ce({}))),_t(Kt))}enableSingleEditorMode(e){try{if(this.singleEditorMode$.value===!0)return;this.singleEditorMode$.next(!0),e?this.singleEditorModeConfig$.next(e):this.singleEditorModeConfig$.next(new FL)}catch(t){this.loggingService.catch("Error in LiveStateService enableSingleEditorMode: ",t)}}disableSingleEditorMode(){try{if(this.singleEditorMode$.value===!1)return;this.singleEditorMode$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableSingleEditorMode: ",e)}}getSingleEditorMode$(){return this.singleEditorMode$.asObservable()}getSingleEditorMode(){return this.singleEditorMode$.value}getSingleEditorModeConfig$(){return this.singleEditorModeConfig$.asObservable()}getSingleEditorModeConfig(){return this.singleEditorModeConfig$.value}enableAutoSyncState(){try{if(this.autoSyncState$.value===!0)return;this.autoSyncState$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableAutoSyncState: ",e)}}disableAutoSyncState(){try{if(this.autoSyncState$.value===!1)return;this.autoSyncState$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableAutoSyncState: ",e)}}getAutoSyncState$(){return this.autoSyncState$.asObservable()}getAutoSyncState(){return this.autoSyncState$.value}setEditorAccessTimeout(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEditorAccessTimeout","color: green;"),e&&this.editorAccessTimeout$.next(e)}catch(t){this.loggingService.catch("Error in LiveStateService setEditorAccessTimeout: ",t)}}getEditorAccessTimeout$(){return this.editorAccessTimeout$.asObservable()}getEditorAccessTimeout(){return this.editorAccessTimeout$.value}enableEditorAccessTransferOnTimeOut(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableEditorAccessTransferOnTimeOut","color: green;"),this.editorAccessTransferOnTimeOut$.value===!0)return;this.editorAccessTransferOnTimeOut$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableEditorAccessTransferOnTimeOut: ",e)}}disableEditorAccessTransferOnTimeOut(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableEditorAccessTransferOnTimeOut","color: green;"),this.editorAccessTransferOnTimeOut$.value===!1)return;this.editorAccessTransferOnTimeOut$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableEditorAccessTransferOnTimeOut: ",e)}}getEditorAccessTransferOnTimeOut$(){return this.editorAccessTransferOnTimeOut$.asObservable()}getEditorAccessTransferOnTimeOut(){return this.editorAccessTransferOnTimeOut$.value}enableDefaultSingleEditorUI(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableDefaultSingleEditorUI","color: green;"),this.defaultSingleEditorUIEnabled$.value===!0)return;this.defaultSingleEditorUIEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableDefaultSingleEditorUI: ",e)}}disableDefaultSingleEditorUI(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableDefaultSingleEditorUI","color: green;"),this.defaultSingleEditorUIEnabled$.value===!1)return;this.defaultSingleEditorUIEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableDefaultSingleEditorUI: ",e)}}getDefaultSingleEditorUIEnabled$(){return this.defaultSingleEditorUIEnabled$.asObservable()}getDefaultSingleEditorUIEnabled(){return this.defaultSingleEditorUIEnabled$.value}setEditorAccessTimerInterval(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEditorAccessTimerInterval","color: green;"),this.clearEditorAccessTimerInterval(),e>0&&(this.editorAccessTimer$.next({state:"inProgress",durationLeft:e}),this.editorAccessTimerInterval=setInterval(()=>{try{e-=1,e<0?this.clearEditorAccessTimerInterval():e?this.editorAccessTimer$.next({state:"inProgress",durationLeft:e}):this.editorAccessTimer$.next({state:"completed"})}catch(t){this.loggingService.catch("Error in LiveStateService setEditorAccessTimerCountdown interval: ",t),this.clearEditorAccessTimerInterval()}},1e3))}catch(t){this.loggingService.catch("Error in LiveStateService setEditorAccessTimerCountdown: ",t),this.clearEditorAccessTimerInterval()}}clearEditorAccessTimerInterval(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearEditorAccessTimerInterval","color: green;"),this.editorAccessTimerInterval&&(clearInterval(this.editorAccessTimerInterval),this.editorAccessTimerInterval=null,this.editorAccessTimer$.next({state:"idle"}))}catch(e){this.loggingService.catch("Error in LiveStateService clearEditorAccessTimerInterval: ",e)}}getEditorAccessTimer$(){return this.editorAccessTimer$.asObservable()}onServerConnectionStateChange$(){return this.serverConnectionState$.asObservable()}updateExternalUserPresence(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateExternalUserPresence","color: green;"),this.externalUserPresence$.next(e)}catch(t){this.loggingService.catch("Error in LiveStateService updateExternalUserPresence: ",t)}}getExternalUserPresence$(){return this.externalUserPresence$.asObservable().pipe(_t(Kt))}getExternalUserPresence(){return this.externalUserPresence$.value}enableHeartbeat(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableHeartbeat","color: green;"),this.heartbeat$.value===!0)return;this.heartbeat$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableHeartbeat: ",e)}}disableHeartbeat(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableHeartbeat","color: green;"),this.heartbeat$.value===!1)return;this.heartbeat$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableHeartbeat: ",e)}}detectLiveSyncInputs(){try{document.querySelectorAll(`[${N.ATTRIBUTES.VELT_SYNC_STATE}]`)?.forEach(t=>{this.subscribeInputChanges(t)})}catch(e){this.loggingService.catch("Error in LiveStateService detectLiveSyncInputs: ",e)}}subscribeInputChanges(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: subscribeInputChanges","color: green;"),e){let t=e.tagName,i=this.domService.getXPath(e),a=It(i);if(this.inputChangeSubscriptionMap[a])this.loggingService.warn("subscription already exists",a,e);else{this.inputChangeSubscriptionMap[a]={id:a,element:e};let l;switch(t?.toLowerCase()){case"input":l=xr(e,"input").pipe(Qr(300)).subscribe(d=>{let m={value:d?.target?.value,tagName:d?.target?.tagName,type:d?.target?.type};this.setLiveStateSyncInputData(d?.target,m)});break;case"textarea":l=xr(e,"input").pipe(Qr(300)).subscribe(d=>{let m={value:d?.target?.value,tagName:d?.target?.tagName};this.setLiveStateSyncInputData(d?.target,m)});break;default:e.getAttribute("contenteditable")&&(l=xr(e,"input").pipe(Qr(300)).subscribe(d=>{let m={innerText:d?.target?.innerText,innerHTML:this.domService.sanitizeHtml(d?.target?.innerHTML),tagName:d?.target?.tagName,isContentEditable:!0};this.setLiveStateSyncInputData(d?.target,m)}));break}l&&(this.inputChangeSubscriptionMap[a]?.subscriptions||(this.inputChangeSubscriptionMap[a]={subscriptions:[]}),this.inputChangeSubscriptionMap[a].subscriptions?.push(l))}}}catch(t){this.loggingService.catch("Error in LiveStateService subscribeInputChanges: ",t)}}unsubscribeInputChanges(){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribeInputChanges","color: green;"),Object.keys(this.inputChangeSubscriptionMap).forEach(e=>{this.inputChangeSubscriptionMap[e]?.subscriptions?.forEach(i=>{i.unsubscribe()})}),this.inputChangeSubscriptionMap={}}catch(e){this.loggingService.catch("Error in LiveStateService unsubscribeInputChanges: ",e)}}setLiveStateSyncInputData(e,t){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLiveStateSyncInputData","color: green;"),this.user&&this.documentPaths?.liveState){let i=this.domService.getXPath(e),a=It(i),l={id:a,lastUpdated:this.timestamp,liveStateDataId:i,data:t,updatedBy:this.user,tabId:this.tabId};this.commonDbService.updateData({feature:"liveStateAutoSyncStateCurrent",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(l))}),this.commonDbService.updateData({feature:"liveStateAutoSyncStateHistoryId",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:a,skipFirestore:!0},data:JSON.parse(JSON.stringify(l))})}}catch(i){this.loggingService.catch("Error in LiveStateService setLiveStateSyncInputData: ",i)}}updateLiveStateSyncInputDataLocally(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateLiveStateSyncInputDataLocally","color: green;"),this.user&&Object.keys(e).forEach(t=>{let i=e[t],a=this.domService.getElementFromXPath(i?.liveStateDataId),l=!1;if(i?.updatedBy?.userSnippylyId!==this.user?.userSnippylyId)l=!0;else{let c=i?.tabId&&this.tabId&&i?.tabId!==this.tabId,d=a?.contains(document.activeElement);c&&!Ghe()&&!d&&(l=!0)}if(l&&a)switch(a.value=i?.data?.value,a.tagName?.toLowerCase()){case"input":a.value=i?.data?.value;break;case"textarea":a.value=i?.data?.value;break;default:a.getAttribute("contenteditable")&&(a.innerHTML=this.domService.sanitizeHtml(i?.data?.innerHTML))}})}catch(t){this.loggingService.catch("Error in LiveStateService updateLiveStateSyncInputDataLocally: ",t)}}setSingleEditorModeContainerIds(e){this.singleEditorModeContainerIds$.next(e||[])}getSingleEditorModeContainerIds(){return this.singleEditorModeContainerIds$.asObservable()}isElementInsideSingleEditorModeContainerElements(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: isElementInsideSingleEditorModeContainerElements","color: green;");let t=this.singleEditorModeContainerIds$.value,i=document.querySelectorAll(`[${N.ATTRIBUTES.VELT_SINGLE_EDITOR_MODE_CONTAINER}]`);if(!t?.length&&!i?.length)return!0;if(t?.length)for(let a=0;a<t.length;a++){let l=document.getElementById(t[a]);if(l&&l.contains(e))return!0}if(i?.length)for(let a=0;a<i.length;a++){let l=i[a];if(l&&l.contains(e))return!0}return!1}catch(t){return this.loggingService.catch("Error in LiveStateService isElementInsideSingleEditorModeContainerElements: ",t),!1}}isSingleEditorModeDisabledForElement(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: isSingleEditorModeDisabledForElement","color: green;"),e){if(e.getAttribute(N.ATTRIBUTES.VELT_SYNC_ACCESS_DISABLED))return!0;{let i=e?.parentElement;if(i)return this.isSingleEditorModeDisabledForElement(i)}}return!1}catch(t){return this.loggingService.catch("Error in LiveStateService isSingleEditorModeDisabledForElement: ",t),!1}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),this.isUserEditor$().pipe(ln(e=>{try{if(this.documentPaths?.liveStateSingleEditorMode){let t=Vr(this.db,`${this.documentPaths?.liveStateSingleEditorMode}`);e?.isEditor&&(!this.getSingleEditorModeConfig()?.singleTabEditor||e?.isEditorOnCurrentTab)?Cc(t).remove():Cc(t).cancel()}}catch(t){this.loggingService.catch("Error in LiveStateService updateOnDatabaseDisconnect tap: ",t)}}))}updateServerStateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateServerStateOnDatabaseDisconnect","color: green;"),br(this.afAuth).pipe($e(e=>!!e),ye(e=>this.docService.getDocumentPaths$().pipe(ge(t=>e))),ln(e=>X(this,null,function*(){try{if(this.connectionListenerUnsubscribe&&(this.connectionListenerUnsubscribe(),this.connectionListenerUnsubscribe=null),this.offlineTimer&&(clearTimeout(this.offlineTimer),this.offlineTimer=null),this.docService.getDocumentPaths()?.liveState&&e){let i=Vr(this.db,".info/connected"),a=!0,l=1500;this.connectionListenerUnsubscribe=Sg(i,c=>{let d=c.val();if(a&&d===!1){a=!1;return}a=!1,this.offlineTimer&&(clearTimeout(this.offlineTimer),this.offlineTimer=null),d?this.serverConnectionState$.value===el.OFFLINE&&this.serverConnectionState$.next(el.ONLINE):this.offlineTimer=setTimeout(()=>{this.serverConnectionState$.next(el.OFFLINE),this.offlineTimer=null},l)})}}catch(t){this.loggingService.catch("Error in updateServerStateOnDatabaseDisconnect:",t)}})))}signOutUser(e){return new Promise((t,i)=>{try{this.documentPaths?.liveStateSingleEditorMode&&e?this.commonDbService.getData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).then(a=>{a&&this.isUserEditor()?.isEditor&&(!this.getSingleEditorModeConfig()?.singleTabEditor||this.isUserEditor()?.isEditorOnCurrentTab)&&this.removeEditorAccess({metadata:{from:"signOutUser-liveStateService",reason:"User signed out"}}),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)}})}getSemStats(){try{let e=!!this.authService?.getUser(),t=!!this.docService?.getDocumentPaths(),i=this.singleEditorMode$.value,a=!!this.singleEditorModeConfig$.value,l=this.isUserEditor(),c;this.singleEditorLiveStateData$.value&&typeof this.singleEditorLiveStateData$.value=="object"&&(c=this.liveStateUtilsService?.formatLiveStateSingleEditorModeData(JSON.parse(JSON.stringify(this.singleEditorLiveStateData$.value))));let d=this.getExternalUserPresence();return{userAvailable:e,documentPathsAvailable:t,singleEditorModeEnabled:i,singleEditorModeConfig:a,isEditor:l,singleEditorLiveStateData:c,userPresence:d}}catch(e){this.loggingService.catch("Error in LiveStateService getSemStats: ",e)}}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(t){return new(t||o)(K(eo),K(ct),K(qe),K(Ft),K(nr),K($n),K(st),K(Ue),K(IU),K(Vn),K(k),K(yn),K(xU),K(XL),K(An),K(y_e),K(oc))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var EU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: LiveStateElement","color: blue;"),this.getLiveStateData$=this._getLiveStateData,this.getLiveStateData=this._getLiveStateData,this.fetchLiveStateData=this._fetchLiveStateData,this.setLiveStateData=this._setLiveStateData,this.enableSingleEditorMode=this._enableSingleEditorMode,this.disableSingleEditorMode=this._disableSingleEditorMode,this.isUserEditor$=this._isUserEditor,this.isUserEditor=this._isUserEditor,this.getEditor=this._getEditor,this.setUserAsEditor=this._setUserAsEditor,this.resetUserAccess=this._resetUserAccess,this.singleEditorModeContainerIds=this._singleEditorModeContainerIds,this.enableAutoSyncState=this._enableAutoSyncState,this.disableAutoSyncState=this._disableAutoSyncState,this.requestEditorAccess=this._requestEditorAccess,this.isEditorAccessRequested=this._isEditorAccessRequested,this.acceptEditorAccessRequest=this._acceptEditorAccessRequest,this.rejectEditorAccessRequest=this._rejectEditorAccessRequest,this.cancelEditorAccessRequest=this._cancelEditorAccessRequest,this.editCurrentTab=this._editCurrentTab,this.setEditorAccessTimeout=this._setEditorAccessTimeout,this.enableEditorAccessTransferOnTimeOut=this._enableEditorAccessTransferOnTimeOut,this.disableEditorAccessTransferOnTimeOut=this._disableEditorAccessTransferOnTimeOut,this.enableDefaultSingleEditorUI=this._enableDefaultSingleEditorUI,this.disableDefaultSingleEditorUI=this._disableDefaultSingleEditorUI,this.getEditorAccessTimer=this._getEditorAccessTimer,this.onServerConnectionStateChange=this._onServerConnectionStateChange,this.updateUserPresence=this._updateUserPresence,this.enableHeartbeat=this._enableHeartbeat,this.disableHeartbeat=this._disableHeartbeat,this.on=this._on}_getLiveStateData(o,r){this.getService(k).log("%c[WB] Calling FUNCTION: getLiveStateData","color: green;");try{return this.trackEvent(Y.Events.LiveStateSync.GET_LIVE_STATE_DATA_TRIGGERED),this.getService(io).getLiveStateData$(o,r)}catch(e){return this.getService(k).catch("Error in _getLiveStateData: ",e),ce(null)}}_fetchLiveStateData(o){this.getService(k).log("%c[WB] Calling FUNCTION: fetchLiveStateData","color: green;");try{return this.trackEvent(Y.Events.LiveStateSync.FETCH_LIVE_STATE_DATA_TRIGGERED,{payload:{request:o}}),this.getService(io).fetchLiveStateData(o)}catch(r){return this.getService(k).catch("Error in _fetchLiveStateData: ",r),Promise.resolve(null)}}_setLiveStateData(o,r,e){this.getService(k).log("%c[WB] Calling FUNCTION: setLiveStateData","color: green;");try{return this.getService(io).setLiveStateData(o,r,e)}catch(t){return this.getService(k).catch("Error in _setLiveStateData: ",t),Promise.resolve()}}_enableSingleEditorMode(o){this.getService(k).log("%c[WB] Calling FUNCTION: enableSingleEditorMode","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.ENABLE_SINGLE_EDITOR_MODE_TRIGGERED),this.getService(io).enableSingleEditorMode(o)}catch(r){this.getService(k).catch("Error in _enableSingleEditorMode: ",r)}}_disableSingleEditorMode(){this.getService(k).log("%c[WB] Calling FUNCTION: disableSingleEditorMode","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.DISABLE_SINGLE_EDITOR_MODE_TRIGGERED),this.getService(io).disableSingleEditorMode()}catch(o){this.getService(k).catch("Error in _disableSingleEditorMode: ",o)}}_isUserEditor(){this.getService(k).log("%c[WB] Calling FUNCTION: isUserEditor$","color: green;");try{return this.trackEvent(Y.Events.LiveStateSync.IS_USER_EDITOR_TRIGGERED),this.getService(io).isUserEditor$()}catch(o){return this.getService(k).catch("Error in _isUserEditor$: ",o),ce(null)}}_getEditor(){this.getService(k).log("%c[WB] Calling FUNCTION: getEditor","color: green;");try{return this.trackEvent(Y.Events.LiveStateSync.GET_EDITOR_TRIGGERED),this.getService(io).getEditor$()}catch(o){return this.getService(k).catch("Error in _getEditor: ",o),ce(null)}}_setUserAsEditor(){this.getService(k).log("%c[WB] Calling FUNCTION: setUserAsEditor","color: green;");try{return this.trackEvent(Y.Events.LiveStateSync.SET_USER_AS_EDITOR_TRIGGERED),this.getService(io).setUserAsEditor()}catch(o){return this.getService(k).catch("Error in _setUserAsEditor: ",o),Promise.resolve()}}_resetUserAccess(){this.getService(k).log("%c[WB] Calling FUNCTION: resetUserAccess","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.RESET_USER_ACCESS_TRIGGERED),this.getService(io).removeEditorAccess({metadata:{from:"resetUserAccess-liveStateSyncElement",reason:"Client called"}})}catch(o){this.getService(k).catch("Error in _resetUserAccess: ",o)}}_singleEditorModeContainerIds(o){this.getService(k).log("%c[WB] Calling FUNCTION: singleEditorModeContainerIds","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.SINGLE_EDITOR_MODE_CONTAINER_IDS_TRIGGERED),this.getService(io).setSingleEditorModeContainerIds(o)}catch(r){this.getService(k).catch("Error in _singleEditorModeContainerIds: ",r)}}_enableAutoSyncState(){this.getService(k).log("%c[WB] Calling FUNCTION: enableAutoSyncState","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.ENABLE_AUTO_SYNC_STATE_TRIGGERED),this.getService(io).enableAutoSyncState()}catch(o){this.getService(k).catch("Error in _enableAutoSyncState: ",o)}}_disableAutoSyncState(){this.getService(k).log("%c[WB] Calling FUNCTION: disableAutoSyncState","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.DISABLE_AUTO_SYNC_STATE_TRIGGERED),this.getService(io).disableAutoSyncState()}catch(o){this.getService(k).catch("Error in _disableAutoSyncState: ",o)}}_requestEditorAccess(){this.getService(k).log("%c[WB] Calling FUNCTION: requestEditorAccess","color: green;");try{return this.trackEvent(Y.Events.LiveStateSync.REQUEST_EDITOR_ACCESS_TRIGGERED),this.getService(io).requestEditorAccess()}catch(o){return this.getService(k).catch("Error in _requestEditorAccess: ",o),ce(null)}}_isEditorAccessRequested(){this.getService(k).log("%c[WB] Calling FUNCTION: isEditorAccessRequested","color: green;");try{return this.trackEvent(Y.Events.LiveStateSync.IS_EDITOR_ACCESS_REQUESTED_TRIGGERED),this.getService(io).isEditorAccessRequested$()}catch(o){return this.getService(k).catch("Error in _isEditorAccessRequested: ",o),ce(null)}}_acceptEditorAccessRequest(){this.getService(k).log("%c[WB] Calling FUNCTION: acceptEditorAccessRequest","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.ACCEPT_EDITOR_ACCESS_REQUEST_TRIGGERED),this.getService(io).acceptEditorAccessRequest()}catch(o){this.getService(k).catch("Error in _acceptEditorAccessRequest: ",o)}}_rejectEditorAccessRequest(){this.getService(k).log("%c[WB] Calling FUNCTION: rejectEditorAccessRequest","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.REJECT_EDITOR_ACCESS_REQUEST_TRIGGERED),this.getService(io).rejectEditorAccessRequest()}catch(o){this.getService(k).catch("Error in _rejectEditorAccessRequest: ",o)}}_cancelEditorAccessRequest(){this.getService(k).log("%c[WB] Calling FUNCTION: cancelEditorAccessRequest","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.CANCEL_EDITOR_ACCESS_REQUEST_TRIGGERED),this.getService(io).cancelEditorAccessRequest()}catch(o){this.getService(k).catch("Error in _cancelEditorAccessRequest: ",o)}}_editCurrentTab(){this.getService(k).log("%c[WB] Calling FUNCTION: editCurrentTab","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.EDIT_CURRENT_TAB_TRIGGERED),this.getService(io).editCurrentTab()}catch(o){this.getService(k).catch("Error in _editCurrentTab: ",o)}}_setEditorAccessTimeout(o){this.getService(k).log("%c[WB] Calling FUNCTION: setEditorAccessTimeout","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.SET_EDITOR_ACCESS_TIMEOUT_TRIGGERED),this.getService(io).setEditorAccessTimeout(o)}catch(r){this.getService(k).catch("Error in _setEditorAccessTimeout: ",r)}}_enableEditorAccessTransferOnTimeOut(){this.getService(k).log("%c[WB] Calling FUNCTION: enableEditorAccessTransferOnTimeOut","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.ENABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED),this.getService(io).enableEditorAccessTransferOnTimeOut()}catch(o){this.getService(k).catch("Error in _enableEditorAccessTransferOnTimeOut: ",o)}}_disableEditorAccessTransferOnTimeOut(){this.getService(k).log("%c[WB] Calling FUNCTION: disableEditorAccessTransferOnTimeOut","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.DISABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED),this.getService(io).disableEditorAccessTransferOnTimeOut()}catch(o){this.getService(k).catch("Error in _disableEditorAccessTransferOnTimeOut: ",o)}}_enableDefaultSingleEditorUI(){this.getService(k).log("%c[WB] Calling FUNCTION: enableDefaultSingleEditorUI","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.ENABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED),this.getService(io).enableDefaultSingleEditorUI()}catch(o){this.getService(k).catch("Error in _enableDefaultSingleEditorUI: ",o)}}_disableDefaultSingleEditorUI(){this.getService(k).log("%c[WB] Calling FUNCTION: disableDefaultSingleEditorUI","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.DISABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED),this.getService(io).disableDefaultSingleEditorUI()}catch(o){this.getService(k).catch("Error in _disableDefaultSingleEditorUI: ",o)}}_getEditorAccessTimer(){this.getService(k).log("%c[WB] Calling FUNCTION: getEditorAccessTimer","color: green;");try{return this.trackEvent(Y.Events.LiveStateSync.GET_EDITOR_ACCESS_TIMER_TRIGGERED),this.getService(io).getEditorAccessTimer$()}catch(o){return this.getService(k).catch("Error in _getEditorAccessTimer: ",o),ce(new uS)}}_onServerConnectionStateChange(){this.getService(k).log("%c[WB] Calling FUNCTION: onServerConnectionStateChange","color: green;");try{return this.trackEvent(Y.Events.LiveStateSync.ON_SERVER_CONNECTION_STATE_CHANGE_TRIGGERED),this.getService(io).onServerConnectionStateChange$()}catch(o){return this.getService(k).catch("Error in _onServerConnectionStateChange: ",o),ce(el.PENDING_INIT)}}_updateUserPresence(o){this.getService(k).log("%c[WB] Calling FUNCTION: updateUserPresence","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.UPDATE_USER_PRESENCE_TRIGGERED,{payload:{userPresence:o}}),this.getService(io).updateExternalUserPresence(o)}catch(r){this.getService(k).catch("Error in _updateUserPresence: ",r)}}_enableHeartbeat(){this.getService(k).log("%c[WB] Calling FUNCTION: enableHeartbeat","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.ENABLE_HEARTBEAT_TRIGGERED),this.getService(io).enableHeartbeat()}catch(o){this.getService(k).catch("Error in _enableHeartbeat: ",o)}}_disableHeartbeat(){this.getService(k).log("%c[WB] Calling FUNCTION: disableHeartbeat","color: green;");try{this.trackEvent(Y.Events.LiveStateSync.DISABLE_HEARTBEAT_TRIGGERED),this.getService(io).disableHeartbeat()}catch(o){this.getService(k).catch("Error in _disableHeartbeat: ",o)}}_on(o){this.getService(k).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(xU).onAction(o)}catch(r){return this.getService(k).catch("Error in _on: ",r),ce(null)}}};var wU=(()=>{let o=class o{constructor(e){this.loggingService=e,this.actionSubjects=new Map,this.defaultSource="internal",this.isUserAdmin=!1,this.subscriptions=[],this.loggingService.log("%c[WB] Creating CLASS: CommentActionsService","color: blue;")}triggerSettingsUpdatedEvent(e){try{this.triggerAction(fhe.SETTINGS_UPDATED,e)}catch(t){this.loggingService.catch("Error in NotificationsActionsService triggerAddCommentAnnotationEvent: ",t)}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.next(t)}catch(i){this.loggingService.catch("Error in NotificationsActionsService triggerAction: ",i)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in NotificationsActionsService onAction: ",t),ce(null)}}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var TU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: ViewsElement","color: blue;"),this.openHistoryPanel=this._openHistoryPanel,this.closeHistoryPanel=this._closeHistoryPanel,this.toggleHistoryPanel=this._toggleHistoryPanel,this.getNotificationsData=this._getNotificationsData,this.setMaxDays=this._setMaxDays,this.setTabConfig=this._setTabConfig,this.enableReadNotificationsOnForYouTab=this._enableReadNotificationsOnForYouTab,this.disableReadNotificationsOnForYouTab=this._disableReadNotificationsOnForYouTab,this.setAllNotificationsAsRead=this._setAllNotificationsAsRead,this.getUnreadNotificationsCount=this._getUnreadNotificationsCount,this.markNotificationAsReadById=this._markNotificationAsReadById,this.setSettings=this._setSettings,this.getSettings=this._getSettings,this.muteAllNotifications=this._muteAllNotifications,this.enableSettings=this._enableSettings,this.enableSettingsAtOrganizationLevel=this._enableSettingsAtOrganizationLevel,this.disableSettingsAtOrganizationLevel=this._disableSettingsAtOrganizationLevel,this.enableSelfNotifications=this._enableSelfNotifications,this.disableSelfNotifications=this._disableSelfNotifications,this.disableSettings=this._disableSettings,this.setSettingsInitialConfig=this._setSettingsInitialConfig,this.openNotificationsPanel=this._openNotificationsPanel,this.closeNotificationsPanel=this._closeNotificationsPanel,this.enableCurrentDocumentOnly=this._enableCurrentDocumentOnly,this.disableCurrentDocumentOnly=this._disableCurrentDocumentOnly,this.on=this._on}_openHistoryPanel(){this.getService(k).log("%c[WB] Calling FUNCTION: _openHistoryPanel","color: green;");try{this.trackEvent(Y.Events.Notifications.OPEN_HISTORY_PANEL_TRIGGERED),this.getService(mn).setHistoryPanelVisibility(!0,!0)}catch(o){this.getService(k).catch("Error in openHistoryPanel: ",o)}}_closeHistoryPanel(){this.getService(k).log("%c[WB] Calling FUNCTION: _closeHistoryPanel","color: green;");try{this.trackEvent(Y.Events.Notifications.CLOSE_HISTORY_PANEL_TRIGGERED),this.getService(mn).setHistoryPanelVisibility(!1,!0)}catch(o){this.getService(k).catch("Error in closeHistoryPanel: ",o)}}_toggleHistoryPanel(){this.getService(k).log("%c[WB] Calling FUNCTION: _toggleHistoryPanel","color: green;");try{this.trackEvent(Y.Events.Notifications.TOGGLE_HISTORY_PANEL_TRIGGERED),this.getService(mn).toggleHistoryPanelVisibility(!0)}catch(o){this.getService(k).catch("Error in toggleHistoryPanel: ",o)}}_getNotificationsData(o){this.getService(k).log("%c[WB] Calling FUNCTION: _getNotificationsData","color: green;");try{return this.trackEvent(Y.Events.Notifications.GET_NOTIFICATIONS_DATA_TRIGGERED),this.getService(mn).getNotifications$(o)}catch(r){return this.getService(k).catch("Error in getNotificationsData: ",r),ce([])}}_setMaxDays(o){this.getService(k).log("%c[WB] Calling FUNCTION: _setMaxDays","color: green;");try{this.trackEvent(Y.Events.Notifications.SET_MAX_DAYS_TRIGGERED,{payload:{days:o}}),this.getService(mn).setMaxDays(o)}catch(r){this.getService(k).catch("Error in setMaxDays: ",r)}}_setTabConfig(o){this.getService(k).log("%c[WB] Calling FUNCTION: _setTabConfig","color: green;");try{this.trackEvent(Y.Events.Notifications.SET_TAB_CONFIG_TRIGGERED,{payload:{tabConfig:o}}),this.getService(mn).setTabConfig(o)}catch(r){this.getService(k).catch("Error in setTabConfig: ",r)}}_enableReadNotificationsOnForYouTab(){this.getService(k).log("%c[WB] Calling FUNCTION: _enableReadNotificationsOnForYouTab","color: green;");try{this.trackEvent(Y.Events.Notifications.ENABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED),this.getService(mn).enableReadNotificationsOnForYouTab()}catch(o){this.getService(k).catch("Error in enableReadNotificationsOnForYouTab: ",o)}}_disableReadNotificationsOnForYouTab(){this.getService(k).log("%c[WB] Calling FUNCTION: _disableReadNotificationsOnForYouTab","color: green;");try{this.trackEvent(Y.Events.Notifications.DISABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED),this.getService(mn).disableReadNotificationsOnForYouTab()}catch(o){this.getService(k).catch("Error in disableReadNotificationsOnForYouTab: ",o)}}_setAllNotificationsAsRead(o){this.getService(k).log("%c[WB] Calling FUNCTION: _setAllNotificationsAsRead","color: green;");try{this.trackEvent(Y.Events.Notifications.SET_ALL_NOTIFICATIONS_AS_READ_TRIGGERED,{payload:{config:o}}),this.getService(mn).setAllNotificationsAsRead(o)}catch(r){this.getService(k).catch("Error in setAllNotificationsAsRead: ",r)}}_getUnreadNotificationsCount(){this.getService(k).log("%c[WB] Calling FUNCTION: _getUnreadNotificationsCount","color: green;");try{return this.trackEvent(Y.Events.Notifications.GET_UNREAD_NOTIFICATIONS_COUNT_TRIGGERED),this.getService(mn).getUnreadNotificationsCount$()}catch(o){return this.getService(k).catch("Error in getUnreadNotificationsCount: ",o),ce({forYou:null,all:null})}}_markNotificationAsReadById(o){this.getService(k).log("%c[WB] Calling FUNCTION: _markNotificationAsReadById","color: green;");try{this.trackEvent(Y.Events.Notifications.MARK_NOTIFICATION_AS_READ_BY_ID_TRIGGERED,{payload:{notificationId:o}}),this.getService(mn).markNotificationAsReadById(o)}catch(r){this.getService(k).catch("Error in markNotificationAsReadById: ",r)}}_setSettings(o){this.getService(k).log("%c[WB] Calling FUNCTION: _setSettings","color: green;");try{this.trackEvent(Y.Events.Notifications.SET_SETTINGS_TRIGGERED,{payload:{config:o}}),this.getService(mn).setSettingsConfigWithDB(o)}catch(r){this.getService(k).catch("Error in setSettings: ",r)}}_getSettings(){this.getService(k).log("%c[WB] Calling FUNCTION: _getSettings","color: green;");try{return this.trackEvent(Y.Events.Notifications.GET_SETTINGS_TRIGGERED),this.getService(mn).getSettingsConfig$()}catch(o){return this.getService(k).catch("Error in getSettings: ",o),ce(null)}}_muteAllNotifications(){this.getService(k).log("%c[WB] Calling FUNCTION: _muteAllNotifications","color: green;");try{this.trackEvent(Y.Events.Notifications.MUTE_ALL_NOTIFICATIONS_TRIGGERED),this.getService(mn).setMuteAllNotifications()}catch(o){this.getService(k).catch("Error in muteAllNotifications: ",o)}}_enableSettings(){this.getService(k).log("%c[WB] Calling FUNCTION: _enableSettings","color: green;");try{this.trackEvent(Y.Events.Notifications.ENABLE_SETTINGS_TRIGGERED),this.getService(mn).enableSettings()}catch(o){this.getService(k).catch("Error in enableSettings: ",o)}}_enableSettingsAtOrganizationLevel(){this.getService(k).log("%c[WB] Calling FUNCTION: _enableSettingsAtOrganizationLevel","color: green;");try{this.trackEvent(Y.Events.Notifications.ENABLE_SETTINGS_AT_ORGANIZATION_LEVEL_TRIGGERED),this.getService(mn).enableSettingsConfigByOrganization()}catch(o){this.getService(k).catch("Error in _enableSettingsAtOrganizationLevel: ",o)}}_disableSettingsAtOrganizationLevel(){this.getService(k).log("%c[WB] Calling FUNCTION: _disableSettingsAtOrganizationLevel","color: green;");try{this.trackEvent(Y.Events.Notifications.DISABLE_SETTINGS_AT_ORGANIZATION_LEVEL_TRIGGERED),this.getService(mn).disableSettingsConfigByOrganization()}catch(o){this.getService(k).catch("Error in disableSettingsAtOrganizationLevel: ",o)}}_enableSelfNotifications(){this.getService(k).log("%c[WB] Calling FUNCTION: _enableSelfNotifications","color: green;");try{this.trackEvent(Y.Events.Notifications.ENABLE_SELF_NOTIFICATIONS_TRIGGERED),this.getService(mn).enableSelfNotifications()}catch(o){this.getService(k).catch("Error in enableSelfNotifications: ",o)}}_disableSelfNotifications(){this.getService(k).log("%c[WB] Calling FUNCTION: _disableSelfNotifications","color: green;");try{this.trackEvent(Y.Events.Notifications.DISABLE_SELF_NOTIFICATIONS_TRIGGERED),this.getService(mn).disableSelfNotifications()}catch(o){this.getService(k).catch("Error in disableSelfNotifications: ",o)}}_disableSettings(){this.getService(k).log("%c[WB] Calling FUNCTION: _disableSettings","color: green;");try{this.trackEvent(Y.Events.Notifications.DISABLE_SETTINGS_TRIGGERED),this.getService(mn).disableSettings()}catch(o){this.getService(k).catch("Error in disableSettings: ",o)}}_setSettingsInitialConfig(o){this.getService(k).log("%c[WB] Calling FUNCTION: _setSettingsInitialConfig","color: green;");try{this.trackEvent(Y.Events.Notifications.SET_SETTINGS_INITIAL_CONFIG_TRIGGERED,{payload:{settings:o}}),this.getService(mn).setSettingsInitialConfig(o)}catch(r){this.getService(k).catch("Error in setSettingsInitialConfig: ",r)}}_on(o){this.getService(k).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(wU).onAction(o)}catch(r){return this.getService(k).catch("Error in _on: ",r),ce(null)}}_openNotificationsPanel(){this.getService(k).log("%c[WB] Calling FUNCTION: _openNotificationsPanel","color: green;");try{this.trackEvent(Y.Events.Notifications.OPEN_NOTIFICATIONS_PANEL_TRIGGERED),this.getService(mn).openNotificationsPanel()}catch(o){this.getService(k).catch("Error in openNotificationsPanel: ",o)}}_closeNotificationsPanel(){this.getService(k).log("%c[WB] Calling FUNCTION: _closeNotificationsPanel","color: green;");try{this.trackEvent(Y.Events.Notifications.CLOSE_NOTIFICATIONS_PANEL_TRIGGERED),this.getService(mn).closeNotificationsPanel()}catch(o){this.getService(k).catch("Error in closeNotificationsPanel: ",o)}}_enableCurrentDocumentOnly(){this.getService(k).log("%c[WB] Calling FUNCTION: _enableCurrentDocumentOnly","color: green;");try{this.trackEvent(Y.Events.Notifications.ENABLE_CURRENT_DOCUMENT_ONLY_TRIGGERED),this.getService(mn).enableCurrentDocumentOnly()}catch(o){this.getService(k).catch("Error in enableCurrentDocumentOnly: ",o)}}_disableCurrentDocumentOnly(){this.getService(k).log("%c[WB] Calling FUNCTION: _disableCurrentDocumentOnly","color: green;");try{this.trackEvent(Y.Events.Notifications.DISABLE_CURRENT_DOCUMENT_ONLY_TRIGGERED),this.getService(mn).disableCurrentDocumentOnly()}catch(o){this.getService(k).catch("Error in disableCurrentDocumentOnly: ",o)}}};var YQ=(()=>{let o=class o{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(tZ.MULTIPLE_USERS_ONLINE,e),this.analyticsService.trackEvent(Y.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(tZ.USER_STATE_CHANGE,e),this.analyticsService.trackEvent(Y.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(ge(t=>({data:t})))}catch(t){return this.loggingService.catch("Error in PresenceActionsService getData: ",t),ce({data:null})}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),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 it),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in PresenceActionsService onAction: ",t),ce(null)}}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(k),K(oc))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var DU=class extends fr{constructor(o){super(o),this.getService(k).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(k).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(Y.Events.Presence.GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(oc).getOnlineUsersOnCurrentDocument()}catch(o){return this.getService(k).catch("Error in _getOnlineUsersOnCurrentDocument: ",o),ce(null)}}_setInactivityTime(o){this.getService(k).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(Y.Events.Presence.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:o}}),isNaN(o)?this.getService(k).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(oc).setInactivityTime(o)}catch(r){this.getService(k).catch("Error in setInactivityTime: ",r)}}_disableFlockMode(){try{this.trackEvent(Y.Events.Presence.DISABLE_FLOCK_MODE_TRIGGERED),this.getService(fv).disableFlockMode()}catch(o){this.getService(k).catch("Error in _disableFlockMode: ",o)}}_enableFlockMode(o){try{this.trackEvent(Y.Events.Presence.ENABLE_FLOCK_MODE_TRIGGERED,{payload:{options:o}}),this.getService(fv).enableFlockMode(o)}catch(r){this.getService(k).catch("Error in _enableFlockMode: ",r)}}_stopFollowingUser(){try{this.trackEvent(Y.Events.Presence.STOP_FOLLOWING_USER_TRIGGERED),this.getService(fv).stopFollowingUser()}catch(o){this.getService(k).catch("Error in _stopFollowingUser: ",o)}}_startFollowingUser(o){try{this.trackEvent(Y.Events.Presence.START_FOLLOWING_USER_TRIGGERED,{payload:{externalId:o}});let r=this.getService(oc).getPresenceUserFromExternalId(o);return r&&r.userSnippylyId&&r.name!==void 0?(this.getService(fv).startFollowingUser(r.userSnippylyId,r.name),{success:!0,msg:"Joined flock session."}):{success:!1,msg:"User could not be found."}}catch(r){return this.getService(k).catch("Error in _startFollowingUser: ",r),{success:!1,msg:"Unknown error.",raw:r}}}_enableSelf(){try{this.trackEvent(Y.Events.Presence.ENABLE_SELF_TRIGGERED),this.getService(oc).enableIncludeSelf()}catch(o){this.getService(k).catch("Error in _enableSelf: ",o)}}_disableSelf(){try{this.trackEvent(Y.Events.Presence.DISABLE_SELF_TRIGGERED),this.getService(oc).disableIncludeSelf()}catch(o){this.getService(k).catch("Error in _disableSelf: ",o)}}_getData(o){this.getService(k).log("%c[WB] Calling FUNCTION: getData","color: green;");try{return this.trackEvent(Y.Events.Presence.GET_PRESENCE_DATA_TRIGGERED,{payload:{query:o}}),o&&typeof o=="object"&&(o=h({},o),o?.documentId&&(o.documentId=vi(o.documentId)),o?.organizationId&&(o.organizationId=Ra(o.organizationId))),this.getService(YQ).getData(o)}catch(r){return this.getService(k).catch("Error in _getData: ",r),ce({data:null})}}_on(o){this.getService(k).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(YQ).onAction(o)}catch(r){return this.getService(k).catch("Error in _on: ",r),ce(null)}}_addUser(o){this.getService(k).log("%c[WB] Calling FUNCTION: addUser","color: green;");try{if(this.trackEvent(Y.Events.Presence.ADD_USER_TRIGGERED,{payload:{userId:o?.user?.userId,localOnly:o?.localOnly}}),!o?.user?.userId){this.getService(k).catch("Error in addUser: ","userId is required");return}this.getService(oc).addCustomUser(o)}catch(r){this.getService(k).catch("Error in addUser: ",r)}}_removeUser(o){this.getService(k).log("%c[WB] Calling FUNCTION: removeUser","color: green;");try{if(this.trackEvent(Y.Events.Presence.REMOVE_USER_TRIGGERED,{payload:{userId:o?.user?.userId,localOnly:o?.localOnly}}),!o?.user?.userId){this.getService(k).catch("Error in removeUser: ","userId is required");return}this.getService(oc).removeCustomUser(o)}catch(r){this.getService(k).catch("Error in removeUser: ",r)}}};var OU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: ReactionElement","color: blue;"),this.enableDarkMode=this._enableDarkMode,this.disableDarkMode=this._disableDarkMode,this.setCustomReactions=this._setCustomReactions}_enableDarkMode(){this.getService(k).log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;");try{this.trackEvent(Y.Events.Reactions.ENABLE_DARK_MODE_TRIGGERED),this.getService(zi).enableDarkMode()}catch(o){this.getService(k).catch("Error in _enableDarkMode: ",o)}}_disableDarkMode(){this.getService(k).log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;");try{this.trackEvent(Y.Events.Reactions.DISABLE_DARK_MODE_TRIGGERED),this.getService(zi).disableDarkMode()}catch(o){this.getService(k).catch("Error in _disableDarkMode: ",o)}}_setCustomReactions(o){this.getService(k).log("%c[WB] Calling FUNCTION: setCustomReactions","color: green;");try{this.trackEvent(Y.Events.Reactions.SET_CUSTOM_REACTIONS_TRIGGERED,{payload:{reactions:o}}),this.getService(zi).setCustomReactions(o)}catch(r){this.getService(k).catch("Error in _setCustomReactions: ",r)}}};var Up=(()=>{let o=class o{constructor(e,t,i){this.loggingService=e,this.recorderAnnotationService=t,this.recorderService=i,this.actionSubjects=new Map,this.subscriptions=[];try{this.recorderAnnotationService.setRecorderActionsService(this),this.recorderService.setRecorderActionsService(this)}catch(a){this.loggingService.catch("Error in RecorderActionsService constructor: ",a)}}onTranscriptionDone(e){try{this.triggerAction(Ss.TRANSCRIPTION_DONE,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onTranscriptionDone: ",t)}}onRecordingDone(e){try{this.triggerAction(Ss.RECORDING_DONE,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onRecordingDone: ",t)}}onRecordingDoneLocal(e){try{this.triggerAction(Ss.RECORDING_DONE_LOCAL,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onRecordingDoneLocal: ",t)}}onRecordingEditDone(e){try{this.triggerAction(Ss.RECORDING_EDIT_DONE,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onRecordingEditDone: ",t)}}onRecordingStarted(e){try{this.triggerAction(Ss.RECORDING_STARTED,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onRecordingStarted: ",t)}}onRecordingPaused(e){try{this.triggerAction(Ss.RECORDING_PAUSED,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onRecordingPaused: ",t)}}onRecordingCancelled(e){try{this.triggerAction(Ss.RECORDING_CANCELLED,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onRecordingCancelled: ",t)}}onRecordingStopped(e){try{this.triggerAction(Ss.RECORDING_STOPPED,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onRecordingStopped: ",t)}}onRecordingResumed(e){try{this.triggerAction(Ss.RECORDING_RESUMED,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onRecordingResumed: ",t)}}onDeleteRecording(e){try{this.triggerAction(Ss.DELETE_RECORDING,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onDeleteRecording: ",t)}}onError(e){try{this.triggerAction(Ss.ERROR,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onError: ",t)}}onRecordingSaveInitiated(e){try{this.triggerAction(Ss.RECORDING_SAVE_INITIATED,e)}catch(t){this.loggingService.catch("Error in RecorderActionsService onRecordingSaveInitiated: ",t)}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.next(t)}catch(i){this.loggingService.catch("Error in RecorderActionsService triggerAction: ",i)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in RecorderActionsService onAction: ",t),ce(null)}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(uo),K(Un))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var AU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: RecorderElement","color: blue;"),this.initRecording=this._initRecording,this.onRecordedData=this._onRecordedData,this.enableDarkMode=this._enableDarkMode,this.disableDarkMode=this._disableDarkMode,this.enableRecordingCountdown=this._enableRecordingCountdown,this.disableRecordingCountdown=this._disableRecordingCountdown,this.getRecordingDataByRecorderId=this._getRecordingDataByRecorderId,this.enableRecordingTranscription=this._enableRecordingTranscription,this.disableRecordingTranscription=this._disableRecordingTranscription,this.getRecordingData=this._getRecordingData,this.enableVideoEditor=this._enableVideoEditor,this.disableVideoEditor=this._disableVideoEditor,this.getRecordings=this._getRecordings,this.fetchRecordings=this._fetchRecordings,this.deleteRecordings=this._deleteRecordings,this.setRecordingQualityConstraints=this._setRecordingQualityConstraints,this.setRecordingEncodingOptions=this._setRecordingEncodingOptions,this.downloadLatestVideo=this._downloadLatestVideo,this.enableRecordingMic=this._enableRecordingMic,this.disableRecordingMic=this._disableRecordingMic,this.enableOnboardingTooltip=this._enableOnboardingTooltip,this.disableOnboardingTooltip=this._disableOnboardingTooltip,this.enableRetakeOnVideoEditor=this._enableRetakeOnVideoEditor,this.disableRetakeOnVideoEditor=this._disableRetakeOnVideoEditor,this.askDevicePermission=this._askDevicePermission,this.setMaxLength=this._setMaxLength,this.openPictureInPicture=this._openPictureInPicture,this.exitPictureInPicture=this._exitPictureInPicture,this.requestScreenPermission=this._requestScreenPermission,this.enablePictureInPicture=this._enablePictureInPicture,this.disablePictureInPicture=this._disablePictureInPicture,this.enablePlaybackOnPreviewClick=this._enablePlaybackOnPreviewClick,this.disablePlaybackOnPreviewClick=this._disablePlaybackOnPreviewClick,this.on=this._on}_initRecording(o,r){this.getService(k).log("%c[WB] Calling FUNCTION: initRecording","color: green;");try{return this.trackEvent(Y.Events.Recording.INIT_RECORDING_TRIGGERED,{payload:{type:o,panelId:r}}),this.getService(Un).initRecording(o,r)}catch(e){return this.getService(k).catch("Error in _initRecording: ",e),ce(null)}}_onRecordedData(){this.getService(k).log("%c[WB] Calling FUNCTION: onRecordedData","color: green;");try{return this.trackEvent(Y.Events.Recording.ON_RECORDED_DATA_TRIGGERED),this.getService(Un).onRecordedData()}catch(o){return this.getService(k).catch("Error in _onRecordedData: ",o),ce(null)}}_enableDarkMode(){this.getService(k).log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;");try{this.trackEvent(Y.Events.Recording.ENABLE_DARK_MODE_TRIGGERED),this.getService(uo).setRecorderContainerDarkMode(!0)}catch(o){this.getService(k).catch("Error in _enableDarkMode: ",o)}}_disableDarkMode(){this.getService(k).log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;");try{this.trackEvent(Y.Events.Recording.DISABLE_DARK_MODE_TRIGGERED),this.getService(uo).setRecorderContainerDarkMode(!1)}catch(o){this.getService(k).catch("Error in _disableDarkMode: ",o)}}_enableRecordingCountdown(){this.getService(k).log("%c[WB] Calling FUNCTION: enableRecordingCountdown","color: green;");try{this.trackEvent(Y.Events.Recording.ENABLE_RECORDING_COUNTDOWN_TRIGGERED),this.getService(Un).enableRecordingCountdown()}catch(o){this.getService(k).catch("Error in _enableRecordingCountdown: ",o)}}_disableRecordingCountdown(){this.getService(k).log("%c[WB] Calling FUNCTION: disableRecordingCountdown","color: green;");try{this.trackEvent(Y.Events.Recording.DISABLE_RECORDING_COUNTDOWN_TRIGGERED),this.getService(Un).disableRecordingCountdown()}catch(o){this.getService(k).catch("Error in _disableRecordingCountdown: ",o)}}_getRecordingDataByRecorderId(o){this.getService(k).log("%c[WB] Calling FUNCTION: getRecordingDataByRecorderId","color: green;");try{return this.trackEvent(Y.Events.Recording.GET_RECORDING_DATA_BY_RECORDER_ID_TRIGGERED,{payload:{recorderId:o}}),this.getService(uo).getRecorderDataByRecorderId(o)}catch(r){return this.getService(k).catch("Error in _getRecordingDataByRecorderId: ",r),ce(null)}}_getRecordings(o){this.getService(k).log("%c[WB] Calling FUNCTION: getRecordings","color: green;");try{return this.trackEvent(Y.Events.Recording.GET_RECORDINGS_TRIGGERED,{payload:{query:o}}),this.getService(uo).getRecordings(o)}catch(r){return this.getService(k).catch("Error in _getRecordings: ",r),ce([])}}_getRecordingData(o){this.getService(k).log("%c[WB] Calling FUNCTION: getRecordingData","color: green;");try{return this.trackEvent(Y.Events.Recording.GET_RECORDING_DATA_TRIGGERED,{payload:{query:o}}),this.getService(uo).getRecorderDataByRecorderIds(o)}catch(r){return this.getService(k).catch("Error in _getRecordingData: ",r),Promise.resolve({data:null})}}_fetchRecordings(o){this.getService(k).log("%c[WB] Calling FUNCTION: fetchRecordings","color: green;");try{return this.trackEvent(Y.Events.Recording.FETCH_RECORDINGS_TRIGGERED,{payload:{query:o}}),this.getService(uo).fetchRecorderDataByRecorderIds(o)}catch(r){return this.getService(k).catch("Error in _fetchRecordings: ",r),Promise.resolve([])}}_deleteRecordings(o){this.getService(k).log("%c[WB] Calling FUNCTION: deleteRecording","color: green;");try{return this.trackEvent(Y.Events.Recording.DELETE_RECORDING_TRIGGERED,{payload:{query:o}}),this.getService(uo).deleteRecorderDataByRecorderIds(o)}catch(r){return this.getService(k).catch("Error in _deleteRecording: ",r),Promise.resolve([])}}_enableRecordingTranscription(){this.getService(k).log("%c[WB] Calling FUNCTION: enableRecordingTranscription","color: green;");try{this.trackEvent(Y.Events.Recording.ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED),this.getService(uo).enableRecordingTranscription()}catch(o){this.getService(k).catch("Error in _enableRecordingTranscription: ",o)}}_disableRecordingTranscription(){this.getService(k).log("%c[WB] Calling FUNCTION: disableRecordingTranscription","color: green;");try{this.trackEvent(Y.Events.Recording.DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED),this.getService(uo).disableRecordingTranscription()}catch(o){this.getService(k).catch("Error in _disableRecordingTranscription: ",o)}}_on(o){this.getService(k).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(Up).onAction(o)}catch(r){return this.getService(k).catch("Error in _on: ",r),ce(null)}}_enableVideoEditor(){this.getService(k).log("%c[WB] Calling FUNCTION: enableVideoEditor","color: green;");try{this.trackEvent(Y.Events.Recording.ENABLE_VIDEO_EDITOR_TRIGGERED),this.getService(Un).enableVideoEditor()}catch(o){this.getService(k).catch("Error in _enableVideoEditor: ",o)}}_disableVideoEditor(){this.getService(k).log("%c[WB] Calling FUNCTION: disableVideoEditor","color: green;");try{this.trackEvent(Y.Events.Recording.DISABLE_VIDEO_EDITOR_TRIGGERED),this.getService(Un).disableVideoEditor()}catch(o){this.getService(k).catch("Error in _disableVideoEditor: ",o)}}_setRecordingQualityConstraints(o){this.getService(k).log("%c[WB] Calling FUNCTION: setRecordingQualityConstraints","color: green;");try{this.trackEvent(Y.Events.Recording.SET_RECORDING_QUALITY_CONSTRAINTS_TRIGGERED,{payload:{constraints:o}}),this.getService(Un).setRecordingQualityConstraints(o)}catch(r){this.getService(k).catch("Error in _setRecordingQualityConstraints: ",r)}}_setRecordingEncodingOptions(o){this.getService(k).log("%c[WB] Calling FUNCTION: setRecordingEncodingOptions","color: green;");try{this.trackEvent(Y.Events.Recording.SET_RECORDING_ENCODING_OPTIONS_TRIGGERED,{payload:{options:o}}),this.getService(Un).setRecordingEncodingOptions(o)}catch(r){this.getService(k).catch("Error in _setRecordingEncodingOptions: ",r)}}_downloadLatestVideo(o){this.getService(k).log("%c[WB] Calling FUNCTION: downloadLatestVideo","color: green;");try{return this.trackEvent(Y.Events.Recording.DOWNLOAD_LATEST_VIDEO_TRIGGERED,{payload:{recorderId:o}}),this.getService(uo).downloadLatestVideo(o)}catch(r){return this.getService(k).catch("Error in _downloadLatestVideo: ",r),Promise.resolve(!1)}}_enableRecordingMic(){this.getService(k).log("%c[WB] Calling FUNCTION: enableRecordingMic","color: green;");try{this.trackEvent(Y.Events.Recording.ENABLE_RECORDING_MIC_TRIGGERED),this.getService(Un).enableRecordingMic()}catch(o){this.getService(k).catch("Error in _enableRecordingMic: ",o)}}_disableRecordingMic(){this.getService(k).log("%c[WB] Calling FUNCTION: disableRecordingMic","color: green;");try{this.trackEvent(Y.Events.Recording.DISABLE_RECORDING_MIC_TRIGGERED),this.getService(Un).disableRecordingMic()}catch(o){this.getService(k).catch("Error in _disableRecordingMic: ",o)}}_enableOnboardingTooltip(){this.getService(k).log("%c[WB] Calling FUNCTION: enableOnboardingTooltip","color: green;");try{this.trackEvent(Y.Events.Recording.ENABLE_ONBOARDING_TOOLTIP_TRIGGERED),this.getService(Un).enableOnboardingTooltip()}catch(o){this.getService(k).catch("Error in _enableOnboardingTooltip: ",o);return}}_disableOnboardingTooltip(){this.getService(k).log("%c[WB] Calling FUNCTION: disableOnboardingTooltip","color: green;");try{this.trackEvent(Y.Events.Recording.DISABLE_ONBOARDING_TOOLTIP_TRIGGERED),this.getService(Un).disableOnboardingTooltip()}catch(o){this.getService(k).catch("Error in _disableOnboardingTooltip: ",o);return}}_enableRetakeOnVideoEditor(){this.getService(k).log("%c[WB] Calling FUNCTION: enableRetakeOnVideoEditor","color: green;");try{this.trackEvent(Y.Events.Recording.ENABLE_RETAKE_ON_VIDEO_EDITOR_TRIGGERED),this.getService(Un).enableRetakeOnVideoEditor()}catch(o){this.getService(k).catch("Error in _enableRetakeOnVideoEditor: ",o)}}_disableRetakeOnVideoEditor(){this.getService(k).log("%c[WB] Calling FUNCTION: disableRetakeOnVideoEditor","color: green;");try{this.trackEvent(Y.Events.Recording.DISABLE_RETAKE_ON_VIDEO_EDITOR_TRIGGERED),this.getService(Un).disableRetakeOnVideoEditor()}catch(o){this.getService(k).catch("Error in _disableRetakeOnVideoEditor: ",o)}}_askDevicePermission(o){this.getService(k).log("%c[WB] Calling FUNCTION: askDevicePermission","color: green;");try{this.trackEvent(Y.Events.Recording.ASK_DEVICE_PERMISSION_TRIGGERED),this.getService(Un).askDevicePermission(o)}catch(r){this.getService(k).catch("Error in _askDevicePermission: ",r)}}_setMaxLength(o){this.getService(k).log("%c[WB] Calling FUNCTION: setMaxLength","color: green;");try{this.trackEvent(Y.Events.Recording.SET_MAX_LENGTH_TRIGGERED,{payload:{seconds:o}}),this.getService(Un).setMaxRecordingLength(o)}catch(r){this.getService(k).catch("Error in _setMaxLength: ",r)}}_openPictureInPicture(){return X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: openPictureInPicture","color: green;");try{this.trackEvent(Y.Events.Recording.OPEN_PICTURE_IN_PICTURE_TRIGGERED),yield this.getService(Un).openPictureInPicture()}catch(o){this.getService(k).catch("Error in _openPictureInPicture: ",o)}})}_exitPictureInPicture(){return X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: exitPictureInPicture","color: green;");try{this.trackEvent(Y.Events.Recording.EXIT_PICTURE_IN_PICTURE_TRIGGERED),yield this.getService(rc).exitPictureInPicture()}catch(o){this.getService(k).catch("Error in _exitPictureInPicture: ",o)}})}_requestScreenPermission(){return X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: requestScreenPermission","color: green;");try{return this.trackEvent(Y.Events.Recording.REQUEST_SCREEN_PERMISSION_TRIGGERED),this.getService(Un).requestScreenPermission()}catch(o){return this.getService(k).catch("Error in _requestScreenPermission: ",o),null}})}_enablePictureInPicture(){this.getService(k).log("%c[WB] Calling FUNCTION: enablePictureInPicture","color: green;");try{this.trackEvent(Y.Events.Recording.ENABLE_PICTURE_IN_PICTURE_TRIGGERED),this.getService(rc).enablePictureInPicture()}catch(o){this.getService(k).catch("Error in _enablePictureInPicture: ",o)}}_disablePictureInPicture(){this.getService(k).log("%c[WB] Calling FUNCTION: disablePictureInPicture","color: green;");try{this.trackEvent(Y.Events.Recording.DISABLE_PICTURE_IN_PICTURE_TRIGGERED),this.getService(rc).disablePictureInPicture()}catch(o){this.getService(k).catch("Error in _disablePictureInPicture: ",o)}}_enablePlaybackOnPreviewClick(){this.getService(k).log("%c[WB] Calling FUNCTION: enablePlaybackOnPreviewClick","color: green;");try{this.trackEvent(Y.Events.Recording.ENABLE_PLAYBACK_ON_PREVIEW_CLICK_TRIGGERED),this.getService(Un).enablePlaybackOnPreviewClick()}catch(o){this.getService(k).catch("Error in _enablePlaybackOnPreviewClick: ",o)}}_disablePlaybackOnPreviewClick(){this.getService(k).log("%c[WB] Calling FUNCTION: disablePlaybackOnPreviewClick","color: green;");try{this.trackEvent(Y.Events.Recording.DISABLE_PLAYBACK_ON_PREVIEW_CLICK_TRIGGERED),this.getService(Un).disablePlaybackOnPreviewClick()}catch(o){this.getService(k).catch("Error in _disablePlaybackOnPreviewClick: ",o)}}};var Vp=(()=>{let o=class o{constructor(e){this.loggingService=e,this.actionSubjects=new Map}onTextSelected(e){try{this.triggerAction(hhe.TEXT_SELECTED,e)}catch(t){this.loggingService.catch("Error in RewriterActionsService onTextSelected: ",t)}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.next(t)}catch(i){this.loggingService.catch("Error in RewriterActionsService triggerAction: ",i)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in RewriterActionsService onAction: ",t),ce(null)}}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var cl=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m){this.analyticsService=e,this.authService=t,this.configService=i,this.domService=a,this.loggingService=l,this.functions=c,this.commentActionsService=d,this.rewriterActionsService=m,this.rewriterAnnotations$=new Se([]),this.rewriterEnabled$=new Se(!1),this.defaultUIEnabled$=new Se(!0),this.latestSelection=null,this.replaceTextInFlight=!1,this.addCommentInFlight=!1,this.getRewriterEnabled$().subscribe(u=>{try{if(u){let _=document.querySelectorAll(N.TAGS.SNIPPYLY_REWRITER);if(!document.querySelectorAll(N.TAGS.VELT_REWRITER)?.length&&!_?.length){let A=document.createElement(N.TAGS.VELT_REWRITER);document.body.appendChild(A),this.authService.getUser$().pipe($e(M=>!!M),ut(1)).subscribe(M=>{this.analyticsService.trackEvent(Y.Events.Rewriter.REWRITER_ENABLED,{isMobileDevice:this.domService.isMobileDevice()})})}}else{let _=document.querySelectorAll(N.TAGS.SNIPPYLY_REWRITER);_?.length&&_.forEach(A=>{A.remove()});let I=document.querySelectorAll(N.TAGS.VELT_REWRITER);I?.length&&I.forEach(A=>{A.remove()})}}catch(_){this.loggingService.catch("Error in rewriterEnabled$: ",_)}},u=>{this.loggingService.catch("Error in rewriterEnabled$ subscription: ",u)})}getRewriterAnnotations$(){try{return this.rewriterAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in getRewriterAnnotations$(): ",e),ce([])}}addRewriter(e,t,i){this.loggingService.log("%c[WB] Calling FUNCTION: addRewriter","color: green;");try{let a=this.authService.getUser();if(a)if(a.isReadOnly||a.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add rewriters.");else{let l=new VL;l.from=a,l.color=N.DEFAULT_ANNOTATION_COLOR,t&&(l.targetTextRange=t),i&&(l.rewriterType=i),this.saveRewriterToDb(l)}}catch(a){this.loggingService.catch("Error in RewriterService addRewriter: ",a)}}saveRewriterToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveRewriterToDb","color: green;");try{e?.annotationId||(e.annotationId=Math.random().toString(36).substring(2)+Date.now().toString(36));let t=this.rewriterAnnotations$.getValue();t.push(e),this.rewriterAnnotations$.next(t),this.domService.toggleAnnotationSelection(e)}catch(t){this.loggingService.catch("Error in RewriterService saveRewriterToDb: ",t)}}removeRewriter(e){try{let t=this.rewriterAnnotations$.getValue(),i=t.findIndex(a=>a.annotationId===e.annotationId);i>-1&&(t.splice(i,1),this.rewriterAnnotations$.next(t))}catch(t){this.loggingService.catch("Error in RewriterService removeRewriter: ",t)}}enableRewriter(){try{this.rewriterEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in RewriterService enableRewriter: ",e)}}disableRewriter(){try{this.rewriterEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in RewriterService disableRewriter: ",e)}}getRewriterEnabled$(){try{return this.rewriterEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in RewriterService getRewriterEnabled$: ",e),ce(!1)}}enableDefaultUI(){try{this.defaultUIEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in RewriterService enableDefaultUI: ",e)}}disableDefaultUI(){try{this.defaultUIEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in RewriterService disableDefaultUI: ",e)}}getDefaultUIEnabled$(){try{return this.defaultUIEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in RewriterService getDefaultUIEnabled$: ",e),ce(!0)}}resetRewriter(){try{this.domService.resetSelectedAnnotationsMap(!1,"rewriter"),this.rewriterAnnotations$.next([])}catch(e){this.loggingService.catch("Error in RewriterService resetRewriter: ",e)}}generateSelectionId(){try{return Math.random().toString(36).substring(2)+Date.now().toString(36)}catch(e){return this.loggingService.catch("Error in RewriterService generateSelectionId:",e),Date.now().toString(36)}}storeSelection(e,t){try{this.latestSelection={event:e,range:t}}catch(i){this.loggingService.catch("Error in RewriterService storeSelection: ",i)}}getSelectionById(e){try{return this.latestSelection?.event.selectionId===e?this.latestSelection:null}catch(t){return this.loggingService.catch("Error in RewriterService getSelectionById:",t),null}}emitAndStoreTextSelected(e,t){try{let i=this.domService.getTargetTextRangeFromSelectionRange(e);if(!i)return;let l={selectionId:this.generateSelectionId(),text:t,targetTextRange:i};this.rewriterActionsService.onTextSelected(l),this.storeSelection(l,e)}catch(i){this.loggingService.catch("Error in RewriterService emitAndStoreTextSelected:",i)}}isReplaceTextInFlight(){return this.replaceTextInFlight}setReplaceTextInFlight(e){this.replaceTextInFlight=e}isAddCommentInFlight(){return this.addCommentInFlight}setAddCommentInFlight(e){this.addCommentInFlight=e}askAi(e){return X(this,null,function*(){try{if(!e.selectedText?.trim())return{text:"",success:!1,error:"No text provided"};let t=this.authService.getUser()?.userId;if(!t)return{text:"",success:!1,error:"User not authenticated"};let i=Yr(this.functions,Zr({url:On.cloudFunction.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()})),a=yield wl({methodName:"rewriterAskAi",data:{type:"rewriterAskAi",data:{model:e.model,prompt:e.prompt,text:e.selectedText}},getSdkProxy:i,userId:t});return lYe(a)}catch(t){return this.loggingService.catch("Error in RewriterService askAi: ",t),{text:"",success:!1,error:"Failed to call AI completion"}}})}replaceText(e){return X(this,null,function*(){try{if(this.replaceTextInFlight)return{success:!1,originalText:"",replacedText:"",error:"Operation already in progress"};this.replaceTextInFlight=!0;try{let t=e.event.targetTextRange,i=e.event.text;return!t?.text||!t?.commonAncestorContainer?{success:!1,originalText:"",replacedText:"",error:"Invalid selection data"}:e.text?.trim()?this.replaceTextInDom(t,e.text)?{success:!0,originalText:i,replacedText:e.text}:{success:!1,originalText:i,replacedText:"",error:"Failed to replace text in DOM"}:{success:!1,originalText:i,replacedText:"",error:"Replacement text is empty"}}finally{this.replaceTextInFlight=!1}}catch(t){return this.loggingService.catch("Error in RewriterService replaceText: ",t),{success:!1,originalText:"",replacedText:"",error:"An unexpected error occurred"}}})}addComment(e){return X(this,null,function*(){try{if(this.addCommentInFlight)return{success:!1,error:"Operation already in progress"};this.addCommentInFlight=!0;try{let t=e.event.targetTextRange;if(!t?.text||!t?.commonAncestorContainer)return{success:!1,error:"Invalid selection data"};if(!e.text?.trim())return{success:!1,error:"Comment text is empty"};let i=this.authService.getUser();if(!i)return{success:!1,error:"User not authenticated"};let a=this.getRangeFromTargetTextRange(t);if(!a)return{success:!1,error:"Could not locate selected text in DOM"};let l=new Pr;l.annotationId=Math.random().toString(36).substring(2)+Date.now().toString(36),l.from=i,l.color=N.DEFAULT_ANNOTATION_COLOR,l.targetTextRange=t;let c=a.getBoundingClientRect();l.positionX=c.x,l.positionY=c.y,l.screenWidth=window.innerWidth,l.screenHeight=window.innerHeight;let d=new tc;return d.commentText=e.text,d.from=i,l.comments=[d],yield this.commentActionsService.addCommentAnnotation({annotation:l},"external"),{success:!0,annotationId:l.annotationId,commentText:e.text}}finally{this.addCommentInFlight=!1}}catch(t){return this.loggingService.catch("Error in RewriterService addComment: ",t),{success:!1,error:"An unexpected error occurred"}}})}getRangeFromTargetTextRange(e){try{if(!e?.text||!e?.commonAncestorContainer)return null;let t=this.domService.getElementFromTargetTextRange(e);if(!t)return null;let i=np(e.text,t,e.occurrence);if(!i?.length)return null;let a=new Range;return a.setStart(i[0].textNode,i[0].startOffset||0),a.setEnd(i[i.length-1].textNode,i[i.length-1].endOffset||0),a.toString()!==e.text?null:a}catch(t){return this.loggingService.catch("Error in RewriterService getRangeFromTargetTextRange: ",t),null}}replaceTextInDom(e,t){try{let i=this.getRangeFromTargetTextRange(e);return i?(i.deleteContents(),i.insertNode(document.createTextNode(t)),i.commonAncestorContainer.parentElement?.normalize(),!0):(this.loggingService.catch("Error in RewriterService replaceTextInDom: Could not reconstruct range from targetTextRange"),!1)}catch(i){return this.loggingService.catch("Error in RewriterService replaceTextInDom: ",i),!1}}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(qe),K(Ft),K(Ue),K(k),K(Oo),K(Rn),K(Vp))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();function lYe(n){return n?.text?{text:n.text,success:!0}:n?.error?{text:"",success:!1,error:n.error}:{text:"",success:!1,error:"AI returned empty response"}}var MU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: RewriterElement","color: blue;"),this.enableRewriter=this._enableRewriter,this.disableRewriter=this._disableRewriter,this.enableDefaultUI=this._enableDefaultUI,this.disableDefaultUI=this._disableDefaultUI,this.on=this._on,this.askAi=this._askAi,this.replaceText=this._replaceText,this.addComment=this._addComment}_enableRewriter(){this.getService(k).log("%c[WB] Calling FUNCTION: _enableLiveRewriter","color: green;");try{this.trackEvent(Y.Events.Rewriter.ENABLE_REWRITER_TRIGGERED),this.getService(cl).enableRewriter()}catch(o){this.getService(k).catch("Error in enableLiveRewriter: ",o)}}_disableRewriter(){this.getService(k).log("%c[WB] Calling FUNCTION: _disableRewriter","color: green;");try{this.trackEvent(Y.Events.Rewriter.DISABLE_REWRITER_TRIGGERED),this.getService(cl).disableRewriter()}catch(o){this.getService(k).catch("Error in disableRewriter: ",o)}}_enableDefaultUI(){this.getService(k).log("%c[WB] Calling FUNCTION: _enableDefaultUI","color: green;");try{this.getService(cl).enableDefaultUI()}catch(o){this.getService(k).catch("Error in enableDefaultUI: ",o)}}_disableDefaultUI(){this.getService(k).log("%c[WB] Calling FUNCTION: _disableDefaultUI","color: green;");try{this.getService(cl).disableDefaultUI()}catch(o){this.getService(k).catch("Error in disableDefaultUI: ",o)}}_on(o){this.getService(k).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.trackEvent(Y.Events.Rewriter.ON_TEXT_SELECTED_SUBSCRIBED,{payload:{action:o}}),this.getService(Vp).onAction(o)}catch(r){return this.getService(k).catch("Error in RewriterElement _on: ",r),ce(null)}}_askAi(o){return X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: _askAi","color: green;");try{return this.trackEvent(Y.Events.Rewriter.ASK_AI_TRIGGERED),yield this.getService(cl).askAi(o)}catch(r){return this.getService(k).catch("Error in RewriterElement _askAi: ",r),{text:"",success:!1,error:"An unexpected error occurred"}}})}_replaceText(o){return X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: _replaceText","color: green;");try{return this.trackEvent(Y.Events.Rewriter.REPLACE_TEXT_TRIGGERED),yield this.getService(cl).replaceText(o)}catch(r){return this.getService(k).catch("Error in RewriterElement _replaceText: ",r),{success:!1,originalText:"",replacedText:"",error:"An unexpected error occurred"}}})}_addComment(o){return X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: _addComment","color: green;");try{return this.trackEvent(Y.Events.Rewriter.ADD_COMMENT_FROM_AI_TRIGGERED),yield this.getService(cl).addComment(o)}catch(r){return this.getService(k).catch("Error in RewriterElement _addComment: ",r),{success:!1,error:"An unexpected error occurred"}}})}};var cYe=()=>({}),Si=(()=>{let o=class o{constructor(){this.height=void 0,this.width=void 0,this.borderRadius=void 0,this.customClass=void 0,this.veltElement=!0}ngOnInit(){}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-skeleton-loader-internal"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{height:"height",width:"width",borderRadius:"borderRadius",customClass:"customClass",customStyles:"customStyles"},standalone:!1,decls:2,vars:11,consts:[[1,"skeleton-loader",3,"ngStyle"]],template:function(t,i){t&1&&(f(0,"div",0),oe(1),S()),t&2&&(ci(i.customClass),gt("--velt-skeleton-loader-height",i.height||"100%")("--velt-skeleton-loader-width",i.width||"100%")("--velt-skeleton-loader-border-radius",i.borderRadius||"inherit"),g("ngStyle",i.customStyles||xt(10,cYe)),v(),we(" ","\u200E ",`
|
|
514
|
-
`))},dependencies:[cg],styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center}.skeleton-loader[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(-90deg,#f0f0f0,#e2e2e2,#f0f0f0);background-size:400% 400%;animation:_ngcontent-%COMP%_skeleton-loading 1.2s ease-in-out 4;height:var(--velt-skeleton-loader-height);width:var(--velt-skeleton-loader-width);border-radius:var(--velt-skeleton-loader-border-radius)}@keyframes _ngcontent-%COMP%_skeleton-loading{0%{background-position:100% 0}to{background-position:-100% 0}}"]});let n=o;return n})();var sYe=["userAvatarRef"],dYe=["*"];function vYe(n,o){if(n&1&&(f(0,"div",7),D(1,"span",8),S()),n&2){let r=s(2).ngIf,e=s();gt("background-color",r.background||"#625DF5"),w("data-testid",e.componentId+"-initial-container"),v(),gt("color",r.textColor||"#FFFFFF"),w("data-modal-author-initial",r.initial)("data-testid",e.componentId+"-initial")}}function mYe(n,o){if(n&1){let r=Z();f(0,"img",9),z("error",function(){L(r);let t=s(3);return U(t.onImageLoadError())})("load",function(){L(r);let t=s(3);return U(t.onImageLoaded())}),S()}if(n&2){let r=s(2).ngIf,e=s();gt("display",r.imgLoaded?"":"none !important"),g("src",r.src,bn),w("alt","User avatar")("data-testid",e.componentId+"-image")}}function gYe(n,o){if(n&1&&(C(0),f(1,"div",4,1),p(3,vYe,2,7,"div",5)(4,mYe,1,5,"ng-template",6),Gt(5),S(),b()),n&2){let r=s().ngIf,e=s();v(),w("data-testid",e.componentId+"-container")("aria-label","User avatar"),v(2),g("ngIf",!r.imgLoaded),v(),g("ngIf",!r.imgLoadError)}}function uYe(n,o){if(n&1&&D(0,"velt-skeleton-loader-internal",10),n&2){let r=s().ngIf;g("height",r.size?r.size+"px":"100%")("width",r.size?r.size+"px":"100%")}}function pYe(n,o){if(n&1&&(C(0),p(1,gYe,6,4,"ng-container",3)(2,uYe,1,2,"ng-template",null,0,Ve),b()),n&2){let r=o.ngIf,e=Ee(3);v(),g("ngIf",r.imgLoaded||(r==null||r.user==null?null:r.user.photoUrl)||(r==null||r.user==null?null:r.user.name)||(r==null||r.user==null?null:r.user.email)||(r==null?null:r.initial))("ngIfElse",e)}}var mr=(()=>{let o=class o{constructor(e,t,i){this.authService=e,this.loggingService=t,this.elementRef=i,this.initial="",this.background="#625DF5",this.textColor="#FFFFFF",this.userAvatarRef=new Q(null),this.componentConfigSignal=De({background:"#625DF5",textColor:"#FFFFFF",initial:"",src:"",imgLoaded:!1,imgLoadError:!1}),this.veltElement=!0,this.componentId="velt-user-avatar"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in UserAvatarComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","img"),e.setAttribute("data-testid",this.componentId+"-container"),this.updateAriaLabel()}catch(e){this.loggingService.catch("Error in UserAvatarComponent setupA11yAttributes:",e)}}updateAriaLabel(){try{this.elementRef.nativeElement.setAttribute("aria-label","User avatar")}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAriaLabel:",e)}}ngAfterViewInit(){this.updateAvatarSize()}ngOnChanges(e){try{if(e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=y(h({},i),{[t]:e[t].currentValue}),i))}),e?.user){let t=e.user.currentValue;t?.photoUrl!==this.componentConfigSignal().src&&this.componentConfigSignal.update(i=>(i=y(h({},i),{src:t?.photoUrl,imgLoaded:!1,imgLoadError:!1}),i)),this.componentConfigSignal.update(i=>(i=y(h({},i),{background:t?.color||this.authService.getUserAvatarColor(t?.userId)}),i)),this.componentConfigSignal.update(i=>(i=y(h({},i),{textColor:t?.textColor||this.authService.getUserTextColor(t?.userId)}),i)),this.componentConfigSignal.update(i=>(i=y(h({},i),{initial:t?.initial||t?.name?.charAt(0)||t?.email?.charAt(0)}),i))}e?.size&&this.updateAvatarSize(),e?.width&&this.updateAvatarSize(),e?.height&&this.updateAvatarSize()}catch(t){this.loggingService.catch("Error in UserAvatarComponent ngOnChanges: ",t)}}onImageLoadError(){try{this.componentConfigSignal.update(e=>(e=y(h({},e),{imgLoadError:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoadError: ",e)}}onImageLoaded(){try{this.componentConfigSignal.update(e=>(e=y(h({},e),{imgLoaded:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoaded: ",e)}}updateAvatarSize(){try{this.elementRef?.nativeElement&&(this.size&&(this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"),this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px")),this.width&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px"),this.height&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"))}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAvatarSize: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(qe),x(k),x(Q))},o.\u0275cmp=O({type:o,selectors:[["snippyly-user-avatar"]],viewQuery:function(t,i){if(t&1&&pt(sYe,5),t&2){let a;vt(a=mt())&&(i.userAvatarRef=a.first)}},hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{initial:"initial",src:"src",background:"background",textColor:"textColor",size:"size",width:"width",height:"height",user:"user"},standalone:!1,features:[Qe],ngContentSelectors:dYe,decls:1,vars:1,consts:[["loadingTemplateRef",""],["userAvatarRef",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],["velt-ignore-change-detection","true","role","img",1,"s-user-avatar-container","velt-user-avatar"],["class","s-user-avatar-initial-container velt-user-avatar--initial-container","aria-hidden","componentConfig.imgLoaded",3,"background-color",4,"ngIf"],[3,"ngIf"],["aria-hidden","componentConfig.imgLoaded",1,"s-user-avatar-initial-container","velt-user-avatar--initial-container"],[1,"s-user-avatar-initial","velt-user-avatar--initial"],["referrerpolicy","no-referrer","velt-ignore-change-detection","true",1,"s-user-avatar-image","velt-user-avatar--image",3,"error","load","src"],["borderRadius","100%",3,"height","width"]],template:function(t,i){t&1&&(zt(),p(0,pYe,4,2,"ng-container",2)),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[xe,Si],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}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));position:static}*[_ngcontent-%COMP%]:empty{display:revert}.s-user-avatar-container[_ngcontent-%COMP%]{position:relative;width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%;display:inline-block}velt-skeleton-loader-internal[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%}.s-user-avatar-initial-container[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;border-radius:50%;align-items:center;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))}.s-user-avatar-image[_ngcontent-%COMP%]{object-fit:cover;border-radius:50%;width:100%;height:100%;display:flex}.s-user-avatar-initial[_ngcontent-%COMP%]{color:#fff;font-size:calc((var(--legacy-velt-user-avatar-initial-font-size) + 0px) * var(--velt-base-rem-unit));position:relative;text-transform:uppercase}.s-user-avatar-initial[_ngcontent-%COMP%]:after{content:attr(data-modal-author-initial);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.velt-user-avatar[_ngcontent-%COMP%], velt-skeleton-loader-internal[_ngcontent-%COMP%]{height:var(--legacy-velt-user-avatar-height, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)));width:var(--legacy-velt-user-avatar-width, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)))}"],changeDetection:0});let n=o;return n})();var x_e={en:{"Action button":"Action button",Yes:"Yes",Delete:"Delete",Cancel:"Cancel","Delete thread?":"Delete thread?","All replies to this thread will be lost.":"All replies to this thread will be lost.","Delete comment?":"Delete comment?","This selected comment will be deleted.":"This selected comment will be deleted.","Delete recording?":"Delete recording?","This selected recording will be deleted.":"This selected recording will be deleted.","Delete area?":"Delete area?","This selected area will be deleted.":"This selected area will be deleted.","Delete arrow?":"Delete arrow?","This selected arrow will be deleted.":"This selected arrow will be deleted.","Delete tag?":"Delete tag?","This selected tag will be deleted.":"This selected tag will be deleted.","Contact us":"Contact us","Let us know how can we help you!":"Let us know how can we help you!","Your email address":"Your email address","How can we help?":"How can we help?",Send:"Send","Allow mic permission to":"Allow mic permission to","enable your audio":"enable your audio","1. Click the":"1. Click the","page info icon in your browser\u2019s address bar":"page info icon in your browser\u2019s address bar","2. Turn on Microphone":"2. Turn on Microphone","2. Turn on Camera":"2. Turn on Camera","Allow camera permission":"Allow camera permission","to enable your video":"to enable your video",dropdown:"dropdown","assign dropdown":"assign dropdown","custom dropdown":"custom dropdown","options dropdown":"options dropdown","priority dropdown":"priority dropdown","status dropdown":"status dropdown","seen dropdown":"seen dropdown",menu:"menu","assign menu":"assign menu","custom menu":"custom menu","options menu":"options menu","priority menu":"priority menu","status menu":"status menu","seen menu":"seen menu","menu items":"menu items","assign menu items":"assign menu items","custom menu items":"custom menu items","options menu items":"options menu items","priority menu items":"priority menu items","status menu items":"status menu items","seen menu items":"seen menu items","Playback Speed":"Playback Speed","Subtitles not available":"Subtitles not available","Transcription not available":"Transcription not available",Feedback:"Feedback","Provide feedback on your Superflow experience.":"Provide feedback on your Superflow experience.","Tell us the details...":"Tell us the details...","You are following":"You are following","You are leading.":"You are leading.",Stop:"Stop",following:"following",leading:"leading","is editing.":"is editing.","requested edit access.":"requested edit access.","You are editing.":"You are editing.","You are editing on different tab.":"You are editing on different tab.","Access Requested":"Access Requested","Request access":"Request access","Edit here":"Edit here",Settings:"Settings",Audio:"Audio",Microphone:"Microphone",Video:"Video",Camera:"Camera","Save changes":"Save changes","Audio settings":"Audio settings","No device found":"No device found","Video settings":"Video settings","Media source settings":"Media source settings","Audio recording preview":"Audio recording preview","Cancel recording":"Cancel recording","Video recording icon":"Video recording icon","Screen recording icon":"Screen recording icon","Audio recording icon":"Audio recording icon","Recording preview bottom panel":"Recording preview bottom panel","Starting recording in":"Starting recording in","Recording control buttons":"Recording control buttons","Toggle camera":"Toggle camera",off:"off",on:"on","Camera is off":"Camera is off","Close recording preview":"Close recording preview","Toggle microphone":"Toggle microphone",Close:"Close",Open:"Open","recording settings":"recording settings","Start Recording":"Start Recording","Report bugs":"Report bugs","Let us know about any bugs so we can fix them ASAP!":"Let us know about any bugs so we can fix them ASAP!","Thank you! We will get back to you soon.":"Thank you! We will get back to you soon.","Thank you for your feedback!":"Thank you for your feedback!","Thanks for reporting the bug. We will get back to you soon.":"Thanks for reporting the bug. We will get back to you soon.","Invitation sent!":"Invitation sent!","User removed!":"User removed!",members:"members","Invalid contact":"Invalid contact","Invalid email":"Invalid email","Comment pin":"Comment pin","Add text comment":"Add text comment","Add comment annotation":"Add comment annotation","Use AI to rewrite selected text":"Use AI to rewrite selected text","Select a shorter text":"Select a shorter text","Select a longer text":"Select a longer text",Rewrite:"Rewrite","Ask ChatGPT":"Ask ChatGPT","Text comment tools":"Text comment tools","Avatar for comment author":"Avatar for comment author","comments in this thread":"comments in this thread","Assign To":"Assign To","Attach files":"Attach files","Attach files input":"Attach files input","All comments":"All comments","View all comments":"View all comments","Approve comment":"Approve comment",Approve:"Approve","Assign thread":"Assign thread",Search:"Search","Search users":"Search users","Avatar for assigned user":"Avatar for assigned user","Assigned to":"Assigned to","Comment assignment details":"Comment assignment details","Assigned to:":"Assigned to:","Comment dialog thread":"Comment dialog thread","Close comment dialog":"Close comment dialog","Comment Index":"Comment Index",Suggestion:"Suggestion","Comment tools and actions":"Comment tools and actions","Mention someone using @ symbol":"Mention someone using @ symbol","Mention someone using @ symbol while editing":"Mention someone using @ symbol while editing","Type @ to mention someone":"Type @ to mention someone","Type @ to mention someone while editing":"Type @ to mention someone while editing","Add file attachment to comment":"Add file attachment to comment","Record voice message":"Record voice message","Click to start voice recording":"Click to start voice recording","Record video message":"Record video message","Click to start screen recording":"Click to start screen recording","Record your screen":"Record your screen","Save new comment":"Save new comment","Save edited comment":"Save edited comment","Assign user":"Assign user","Remove File":"Remove File","Image attachment:":"Image attachment:","unnamed image":"unnamed image","Actions for image:":"Actions for image:","Uploading image:":"Uploading image:","Delete image:":"Delete image:","Preview of image:":"Preview of image:","Remove invalid file:":"Remove invalid file:","Error message:":"Error message:","Invalid file:":"Invalid file:","Actions for invalid file:":"Actions for invalid file:","File error:":"File error:","File cannot be uploaded":"File cannot be uploaded","Preview of invalid file:":"Preview of invalid file:","Invalid file":"Invalid file",unknown:"unknown","Delete file":"Delete file","File attachment:":"File attachment:","unnamed file":"unnamed file","File type icon for":"File type icon for","Details for file:":"Details for file:","Filename:":"Filename:","File size:":"File size:","Uploading file:":"Uploading file:","Actions for file:":"Actions for file:","Remove file:":"Remove file:","Attached files":"Attached files","total attachments":"total attachments","File attachments":"File attachments",valid:"valid","invalid files":"invalid files","User avatar for":"User avatar for","unknown user":"unknown user","New comment composer":"New comment composer","Comment or type @ to add others":"Comment or type @ to add others","Write a comment...":"Write a comment...","Edit comment composer":"Edit comment composer","Comment or add emails with @":"Comment or add emails with @","Private comment mode - only visible to your team":"Private comment mode - only visible to your team","Only for your team":"Only for your team","Screen recording":"Screen recording",unnamed:"unnamed","Screen recording controls":"Screen recording controls","Edit comment section":"Edit comment section","Add new comment section":"Add new comment section","Custom annotation options":"Custom annotation options","Toggle annotation options":"Toggle annotation options","Annotation:":"Annotation:",Select:"Select","Remaining count:":"Remaining count:","Delete comment controls":"Delete comment controls","Delete this comment":"Delete this comment","Ghost comment notification":"Ghost comment notification","Original content not found.":"Original content not found.","Comment dialog header":"Comment dialog header","Comment dialog header controls":"Comment dialog header controls","Comment metadata":"Comment metadata","1 more reply":"1 more reply","more replies":"more replies","Show 1 more reply":"Show 1 more reply","Navigate to comment location":"Navigate to comment location","Assign comment":"Assign comment","Delete thread":"Delete thread","Delete comment":"Delete comment","Edit comment":"Edit comment",Edit:"Edit","Make it private":"Make it private","Make it public":"Make it public",Subscribe:"Subscribe",Unsubscribe:"Unsubscribe","priority level":"priority level","Priority name":"Priority name",P0:"P0",P1:"P1",P2:"P2","Selected priority:":"Selected priority:","Selected priority indicator":"Selected priority indicator","Priority:":"Priority:","Priority item":"Priority item","Thread priority:":"Thread priority:","Private comment banner":"Private comment banner","Resolve thread":"Resolve thread","Sign In":"Sign In","Status dropdown for":"Status dropdown for",comment:"comment","Status name:":"Status name:","Status option:":"Status option:","Status:":"Status:","Accept suggestion":"Accept suggestion",Accept:"Accept","Reject suggestion":"Reject suggestion",Reject:"Reject","Suggestion actions":"Suggestion actions","Delete Attachment":"Delete Attachment","Download Attachment":"Download Attachment",Attachment:"Attachment",preview:"preview","Image attachment controls":"Image attachment controls","Image attachment actions":"Image attachment actions","Delete attachment":"Delete attachment","Download attachment":"Download attachment","File name:":"File name:","Attachment:":"Attachment:",Attachments:"Attachments","Avatar for":"Avatar for",user:"user","Draft comment status":"Draft comment status",Draft:"Draft",Comment:"Comment","Comment by":"Comment by",Me:"Me","Comment reactions":"Comment reactions","Comment recordings":"Comment recordings","Name for":"Name for","Time for":"Time for","Seen by":"Seen by","Users who viewed this comment":"Users who viewed this comment","List of users who have seen this comment":"List of users who have seen this comment","Seen By":"Seen By","Comment viewers list":"Comment viewers list","Show comment viewers":"Show comment viewers","Comment viewers dropdown":"Comment viewers dropdown",now:"now",Unread:"Unread","Comment thread":"Comment thread","Comment content":"Comment content","Author information":"Author information","Author details and status":"Author details and status","Comment device information":"Comment device information","Inline mode metadata":"Inline mode metadata","Comment actions":"Comment actions","Reaction options":"Reaction options","Comment message":"Comment message",of:"of","Show more replies":"Show more replies",replies:"replies",Reply:"Reply",reply:"reply",Show:"Show","Show reply":"Show reply","Unresolve comment":"Unresolve comment","Upgrade plan":"Upgrade plan",Upgrade:"Upgrade","Copy link to comment":"Copy link to comment","Link Copied!":"Link Copied!","Copy thread link":"Copy thread link","Emoji reactions menu":"Emoji reactions menu","Open emoji reactions menu":"Open emoji reactions menu",Priority:"Priority","Private Comment":"Private Comment",Resolve:"Resolve",Unresolve:"Unresolve","Comment bubble":"Comment bubble","Multi-thread comment dialog":"Multi-thread comment dialog","Comment dialog":"Comment dialog","Comment bottom sheet":"Comment bottom sheet","Comment inbox container":"Comment inbox container","Single comment dialog":"Single comment dialog","Ghost comment indicator":"Ghost comment indicator","Private comment":"Private comment","Comment icon":"Comment icon","Exit comment mode":"Exit comment mode","to exit":"to exit",exit:"exit","Private Comment Mode":"Private Comment Mode","Comment Mode":"Comment Mode","Comment mode icon":"Comment mode icon","Comments stream view":"Comments stream view","Comments inbox":"Comments inbox","Comments location overview":"Comments location overview","Comments minimap":"Comments minimap","Go to comments here.":"Go to comments here.","Close comments sidebar":"Close comments sidebar","Add your first comment":"Add your first comment","No comments to display":"No comments to display","filter section":"filter section",All:"All","Close filter panel":"Close filter panel","Apply filters and close panel":"Apply filters and close panel",Done:"Done","checkbox checked":"checkbox checked","checkbox unchecked":"checkbox unchecked",items:"items","Current viewing page":"Current viewing page","This page":"This page",selected:"selected","not selected":"not selected",pages:"pages",people:"people",priorities:"priorities",statuses:"statuses",Filters:"Filters",versions:"versions","View All":"View All","View all":"View all","Comment filters":"Comment filters","Available filters":"Available filters","Apply or cancel filters":"Apply or cancel filters","Filter comments":"Filter comments","filters applied":"filters applied","Return to all comments":"Return to all comments","Back to all comments":"Back to all comments","Search through comments":"Search through comments","Filter and status controls":"Filter and status controls","Unknown user":"Unknown user","Comment dialog for":"Comment dialog for",Collapse:"Collapse",Expand:"Expand","comment group":"comment group",arrow:"arrow","Comments list with":"Comments list with","Location filter options":"Location filter options",Pages:"Pages","Filter comments by location":"Filter comments by location","menu expanded":"menu expanded","menu collapsed":"menu collapsed","Location filter dropdown":"Location filter dropdown","Mark all comments as read":"Mark all comments as read","Mark all as read":"Mark all as read","Mark as read":"Mark as read","Mark as unread":"Mark as unread",Reset:"Reset","Show open comments only":"Show open comments only","Mark all comments as resolved":"Mark all comments as resolved","Mark all as resolved":"Mark all as resolved","Bulk actions for comments":"Bulk actions for comments","Actions menu":"Actions menu",expanded:"expanded",collapsed:"collapsed","Comment actions dropdown":"Comment actions dropdown","Show unread and read comments":"Show unread and read comments","Unread and read":"Unread and read","Show read comments only":"Show read comments only","Read only":"Read only","Show resolved comments only":"Show resolved comments only",Resolved:"Resolved","Show unread comments only":"Show unread comments only","Unread only":"Unread only","Selected indicator":"Selected indicator","Sort comments by date":"Sort comments by date","Sort by date":"Sort by date","Sort comments by unread status":"Sort comments by unread status","Sort by unread":"Sort by unread","Sort and filter comments":"Sort and filter comments","custom filter applied":"custom filter applied","Comment filters and sorting":"Comment filters and sorting",filtered:"filtered","Page comment composer":"Page comment composer","Add a comment to the page":"Add a comment to the page","Comments and feedback panel":"Comments and feedback panel","Reset all comment filters":"Reset all comment filters","Clear filters":"Clear filters","Loading comments":"Loading comments","Comment status filters":"Comment status filters",status:"status","status icon":"status icon","Status filter options":"Status filter options","Status filter dropdown":"Status filter dropdown","Comments sidebar":"Comments sidebar","Comments panel":"Comments panel","Comment composer":"Comment composer","Comments section panel":"Comments section panel",Comments:"Comments","Loading Comments":"Loading Comments","Comments section":"Comments section","No comments found for applied filters.":"No comments found for applied filters.","Comments list":"Comments list","Comment actions menu":"Comment actions menu","More actions":"More actions","Filter and sort options":"Filter and sort options","Collapse threads":"Collapse threads","Comments dialog":"Comments dialog","Clear all filters":"Clear all filters","Comments information":"Comments information","Toggle comments sidebar":"Toggle comments sidebar","Click to mute":"Click to mute","Click to unmute":"Click to unmute","Stop sharing":"Stop sharing","Share screen":"Share screen","Invite users to join this huddle":"Invite users to join this huddle","Please select a contact to invite":"Please select a contact to invite","Chat with everyone":"Chat with everyone","Enable audio or video to change the settings":"Enable audio or video to change the settings","Change audio/video settings":"Change audio/video settings",Leave:"Leave","In-call messages":"In-call messages","Type here...":"Type here...","Audio Huddle":"Audio Huddle","Video Huddle":"Video Huddle","Screen Huddle":"Screen Huddle","1 person is":"1 person is","people are":"people are","on a call now":"on a call now","You can join the call":"You can join the call","Stop Sharing":"Stop Sharing","is sharing now.":"is sharing now.",You:"You","Close notifications panel":"Close notifications panel","Notification item":"Notification item","All notifications list":"All notifications list","All notifications":"All notifications","All notifications read":"All notifications read","Document notification":"Document notification","Document name:":"Document name:",Untitled:"Untitled","Document ID:":"Document ID:",Document:"Document","unread notifications":"unread notifications","Document notifications panel":"Document notifications panel","For you notifications panel":"For you notifications panel","Notification message:":"Notification message:","Notification headline:":"Notification headline:","Notification time:":"Notification time:","Unread notification":"Unread notification",Notification:"Notification",unread:"unread",read:"read",Load:"Load","more notifications":"more notifications","Load More":"Load More","User notifications for":"User notifications for",notification:"notification",notifications:"notifications",available:"available",Notifications:"Notifications","User:":"User:","People notifications panel":"People notifications panel",Documents:"Documents","For You":"For You",People:"People","Notification categories":"Notification categories","Mark all notifications as read":"Mark all notifications as read","Notification actions":"Notification actions","View all notifications":"View all notifications","Notifications panel":"Notifications panel","Notifications bell icon - no unread notifications":"Notifications bell icon - no unread notifications","Notifications count":"Notifications count","Notification bell with":"Notification bell with","User online":"User online","mins ago.":"mins ago.","Reaction count":"Reaction count","Reaction with":"Reaction with","Reaction by":"Reaction by","Users who reacted":"Users who reacted","Reaction details":"Reaction details","React with":"React with",emoji:"emoji","Choose a reaction":"Choose a reaction","Available reactions":"Available reactions","Add reaction":"Add reaction","Reaction selector":"Reaction selector","Start audio recording":"Start audio recording","Audio Recording":"Audio Recording","Screen Recording":"Screen Recording","Start video recording":"Start video recording","Video Recording":"Video Recording","Recording options menu":"Recording options menu","Available recording types":"Available recording types",Record:"Record","Record audio":"Record audio","Record screen":"Record screen","Record video":"Record video","Recording controls for":"Recording controls for",recording:"recording","Stop recording":"Stop recording","Recording duration":"Recording duration","Resume recording":"Resume recording","Pause recording":"Pause recording","Currently recording:":"Currently recording:",none:"none","Audio waveform visualization":"Audio waveform visualization","Currently recording":"Currently recording","Recording paused":"Recording paused","Recording information":"Recording information","Recording controls":"Recording controls","Expand recording panel":"Expand recording panel","Collapse recording panel":"Collapse recording panel","Floating mode container for":"Floating mode container for","Screen recording preview":"Screen recording preview","Expanded view":"Expanded view","Mini preview":"Mini preview","Recording control panel":"Recording control panel","Draggable recording panel":"Draggable recording panel","Currently saving recording":"Currently saving recording","Saving Recording...":"Saving Recording...",Paused:"Paused","Video preview":"Video preview","Screen recording panel":"Screen recording panel","Draggable recording controls":"Draggable recording controls","Video recording preview":"Video recording preview","recording player":"recording player",Draggable:"Draggable",player:"player","recording pin":"recording pin","Created by":"Created by",Play:"Play","Draggable recording pin by":"Draggable recording pin by","Recording player":"Recording player","Audio recording":"Audio recording","Audio player":"Audio player","Audio player controls":"Audio player controls","Audio content and controls":"Audio content and controls","Playback controls":"Playback controls","Playback time":"Playback time","Audio waveform":"Audio waveform",Subtitles:"Subtitles","Additional controls and information":"Additional controls and information","Pause button":"Pause button","Pause audio":"Pause audio","Play audio":"Play audio","Audio progress":"Audio progress","Copy link to recording":"Copy link to recording","Delete recording":"Delete recording","Enter full screen mode":"Enter full screen mode","Recording name:":"Recording name:","Untitled recording":"Untitled recording","Recording player controls":"Recording player controls","Pause video":"Pause video","Play video":"Play video","Video subtitles":"Video subtitles","Toggle subtitles":"Toggle subtitles","Seek video playback":"Seek video playback","Video playback controls":"Video playback controls","Video transcription":"Video transcription","Video player":"Video player","Video player container":"Video player container","Video player with controls":"Video player with controls","Video information and controls":"Video information and controls","Video transcription summary":"Video transcription summary","Fullscreen video player":"Fullscreen video player","Expanded video player":"Expanded video player","Getting data ...":"Getting data ...","Get more options":"Get more options","Max 3 rewrites allowed":"Max 3 rewrites allowed",left:"left","Show original text":"Show original text","Select a rewritten text to create a task":"Select a rewritten text to create a task","Create Task":"Create Task","How would you like to change this copy?":"How would you like to change this copy?",Suggestions:"Suggestions","Selected users":"Selected users","additional users":"additional users",Reassign:"Reassign",Remove:"Remove","Please select a contact to assign":"Please select a contact to assign",Summary:"Summary","see more":"see more","see less":"see less","Invite users":"Invite users","No users are added.":"No users are added.",Invited:"Invited","General access":"General access","Copy Link":"Copy Link","Send invite":"Send invite","Go Back":"Go Back","Total Views":"Total Views","Views Today":"Views Today",View:"View",Views:"Views",Today:"Today","Search comments":"Search comments","In Progress":"In Progress",Status:"Status","Not set":"Not set","Comment Type":"Comment Type",Public:"Public",Private:"Private","Group By":"Group By","Assigned to Me":"Assigned to Me","Added by Me":"Added by Me",Other:"Other",Desktop:"Desktop",Mobile:"Mobile",Tablet:"Tablet",Others:"Others","Default - MacBook Pro Microphone (Built-in)":"Default - MacBook Pro Microphone (Built-in)","iPhone Microphone":"iPhone Microphone","MacBook Pro Microphone (Built-in)":"MacBook Pro Microphone (Built-in)","Sorting options":"Sorting options","Created First":"Created First","Created Last":"Created Last","Updated First":"Updated First","Updated Last":"Updated Last"}};var Ns=(()=>{let o=class o{constructor(e){this.loggingService=e,this.currentLanguageSignal=De(navigator.language.split("-")[0]),this.autoTranslationSignal=De(!1),this.translationsMap=new Map,this.translationCache=new Map,this.translationsUpdateSignal=De(0),this.currentLanguage=this.currentLanguageSignal.asReadonly(),this.autoTranslation=this.autoTranslationSignal.asReadonly(),this.translationsVersion=this.translationsUpdateSignal.asReadonly(),this.currentTranslations=ie(()=>{let t=this.currentLanguageSignal(),i=this.translationsUpdateSignal();return this.translationsMap.get(t)||{}}),this.loggingService.log("%c[WB] Calling FUNCTION: constructor","color: green;"),this.setTranslations(x_e),xn(()=>{let t=this.currentLanguageSignal();this.translationCache.clear(),this.translationsUpdateSignal.update(i=>i+1)})}translate(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: translate","color: green;");let t=this.currentLanguageSignal(),i=this.translationsUpdateSignal(),a=`${t}:${e}:${i}`,l=this.translationCache.get(t);if(l?.has(a))return l.get(a)||e;let c=this.currentTranslations()[e];return this.translationCache.has(t)||this.translationCache.set(t,new Map),this.translationCache.get(t)?.set(a,c||e),g1(c)?e:c}catch{return e}}setTranslations(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setTranslations","color: green;");let t=!1;Object.entries(e).forEach(([i,a])=>{if(a&&typeof a=="object"){let l=this.translationsMap.get(i)||{};Object.keys(a).forEach(d=>{l.hasOwnProperty(d)||(t=!0)});let c=h(h({},l),a);this.translationsMap.set(i,c),this.translationCache.delete(i)}}),this.translationsUpdateSignal.update(i=>i+1),t&&setTimeout(()=>{this.translationsUpdateSignal.update(i=>i+1)},0)}catch(t){this.loggingService.catch("Error in setTranslations: ",t)}}setLanguage(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLanguage","color: green;"),this.currentLanguageSignal.set(e)}catch(t){this.loggingService.catch("Error in setLanguage: ",t)}})}enableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!0)}catch(e){this.loggingService.catch("Error in enableAutoTranslation: ",e)}}disableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!1),this.translationCache.clear()}catch(e){this.loggingService.catch("Error in disableAutoTranslation: ",e)}}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var he=(()=>{let o=class o{constructor(e,t){this.domService=e,this.translateService=t,this.sanitizedCache=new Map}transform(e){if(e==null)return"";let t=typeof e=="boolean"||typeof e=="number"?String(e):e;try{let i=this.translateService.currentLanguage(),a=this.translateService.translationsVersion(),l=`${i}:${t}:${a}`,c=this.sanitizedCache.get(l);if(c)return c;let d=this.translateService.translate(t),m=this.domService.sanitizeHtml(d);return this.sanitizedCache.set(l,m),this.sanitizedCache.size>1e3&&this.sanitizedCache.clear(),m}catch(i){return console.warn("Translation error:",i),t}}};o.\u0275fac=function(t){return new(t||o)(x(Ue,16),x(Ns,16))},o.\u0275pipe=po({name:"translate",type:o,pure:!0,standalone:!1});let n=o;return n})();var fYe=["selectionElementPortalOverlay"],CYe=()=>["velt-overlay-panel"],bYe=n=>[n];function _Ye(n,o){if(n&1&&(C(0),f(1,"span",10),oe(2),R(3,"translate"),S(),b()),n&2){let r=s(),e=r.$implicit,t=r.index,i=s(5);v(),gt("--velt-selection-color",e==null||e.user==null?null:e.user.color),w("data-testid",i.componentId+"-user-name-"+t),v(),Ye(F(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function SYe(n,o){if(n&1&&(C(0),p(1,_Ye,4,6,"ng-container",3),b()),n&2){let r=o.index,e=s(5);v(),g("ngIf",r<e.maxCount)}}function yYe(n,o){if(n&1&&(f(0,"span",11),oe(1),S()),n&2){let r=s(4).ngIf,e=s();gt("--velt-selection-color",(r.selections[0]==null||r.selections[0].user==null?null:r.selections[0].user.color)||"white"),w("data-testid",e.componentId+"-additional-count")("aria-label",(r.selections==null?null:r.selections.length)-e.maxCount+" additional users"),v(),we("+",(r.selections==null?null:r.selections.length)-e.maxCount)}}function kYe(n,o){if(n&1&&(C(0),f(1,"div",7),R(2,"translate"),p(3,SYe,2,1,"ng-container",8)(4,yYe,2,5,"span",9),S(),b()),n&2){let r=s(3).ngIf,e=s();v(),w("data-testid",e.componentId+"-label-container")("aria-label",F(2,4,"Selected users")),v(2),g("ngForOf",r.selections),v(),g("ngIf",(r.selections==null?null:r.selections.length)>e.maxCount)}}function xYe(n,o){if(n&1&&(C(0),D(1,"snippyly-user-avatar",13),b()),n&2){let r=s(),e=r.$implicit,t=r.index;v(),gt("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),g("size",20)("user",e==null?null:e.user)}}function IYe(n,o){if(n&1&&(C(0),p(1,xYe,2,6,"ng-container",3),b()),n&2){let r=o.index,e=s(5);v(),g("ngIf",r<e.maxCount)}}function EYe(n,o){if(n&1&&(f(0,"div",14),R(1,"translate"),f(2,"span",15),oe(3),S()()),n&2){let r=s(4).ngIf,e=s();gt("--velt-selection-user-index",r.selections==null?null:r.selections.length)("background-color",(r.selections[(r.selections==null?null:r.selections.length)-1]==null||r.selections[(r.selections==null?null:r.selections.length)-1].user==null?null:r.selections[(r.selections==null?null:r.selections.length)-1].user.color)||"white"),w("data-testid",e.componentId+"-additional-avatars")("aria-label",(r.selections==null?null:r.selections.length)-e.maxCount+" "+F(1,7,"additional users")),v(3),we("+",(r.selections==null?null:r.selections.length)-e.maxCount)}}function wYe(n,o){if(n&1&&p(0,IYe,2,1,"ng-container",8)(1,EYe,4,9,"div",12),n&2){let r=s(3).ngIf,e=s();g("ngForOf",r.selections),v(),g("ngIf",(r.selections==null?null:r.selections.length)>e.maxCount)}}function TYe(n,o){if(n&1&&p(0,kYe,5,6,"ng-container",6)(1,wYe,2,2,"ng-template",null,2,Ve),n&2){let r=Ee(2),e=s(2).ngIf,t=s();g("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",r)}}function DYe(n,o){if(n&1&&(C(0),D(1,"div",4,0),p(3,TYe,3,2,"ng-template",5,1,Ve),b()),n&2){let r=Ee(2),e=s().ngIf,t=s();v(),gt("top",(e==null||e.position==null?null:e.position.top)+t.offsetTop,"px")("left",(e==null||e.position==null?null:e.position.left)+t.offsetLeft,"px"),g("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),w("data-testid",t.componentId),v(2),g("cdkConnectedOverlayOrigin",r)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",xt(13,CYe))("cdkConnectedOverlayPositions",J(14,bYe,e==null?null:e.overlayPosition))}}function OYe(n,o){if(n&1&&(C(0),p(1,DYe,5,16,"ng-container",3),b()),n&2){let r=o.ngIf;v(),g("ngIf",r==null?null:r.position)}}var I_e=(()=>{let o=class o{get highlight(){return this._highlight}set highlight(e){this._highlight=e,this.calculatePosition()}constructor(e,t,i){this.loggingService=e,this.selectionService=t,this.elementRef=i,this._highlight=new Dp,this.position=null,this.userIndicatorTypes=fS,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=De({userIndicatorPosition:AO.End,userIndicatorType:fS.Avatar,position:null,overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"},selections:[]}),this.veltElement=!0,this.componentId="velt-selection-element";try{this.loggingService.log("%c[WB] Creating CLASS: SelectionElementPortalComponent","color: blue;");let a=this.selectionService.getUserIndicatorPosition(),l=this.selectionService.getUserIndicatorType();this.componentConfigSignal.update(c=>(c=y(h({},c),{userIndicatorPosition:a,userIndicatorType:l}),c)),this.setOverlayPosition(a)}catch(a){this.loggingService.log("Error in SelectionElementPortalComponent constructor: ",a)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","complementary"),e.setAttribute("aria-label","Selection portal")}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent setupA11yAttributes:",e)}}setSelections(e){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{selections:e}),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setSelections: ",t)}}addSelection(e){try{this.componentConfigSignal.update(t=>(t=h({},t),t.selections.push(e),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent addSelection: ",t)}}ngAfterViewInit(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: ngAfterViewInit","color: green;"),this.updateOverlayPosition()}catch(e){this.loggingService.catch("Error in ngAfterViewInit: ",e)}}setOverlayPosition(e){try{switch(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: setOverlayPosition","color: green;"),e){case"start":this.componentConfigSignal.update(t=>(t=y(h({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t));break;default:this.componentConfigSignal.update(t=>(t=y(h({},t),{overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"}}),t))}this.updateOverlayPosition()}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setOverlayPosition: ",t)}}updateOverlayPosition(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: updateOverlayPosition","color: green;"),this.selectionElementPortalOverlay&&this.selectionElementPortalOverlay?.overlayRef?.updatePosition()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent updateOverlayPosition: ",e)}}calculatePosition(){try{if(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: calculatePosition","color: green;"),this.highlight?.targetElement){let e=S3(this.highlight.targetElement);if(e){let t=e.iterateNext(),i,a=null,l=null;try{i=JSON.parse(t?.getAttribute(N.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),a=t?.getAttribute(N.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,a&&this.setOverlayPosition(a),l=t?.getAttribute(N.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(d=>(d=y(h({},d),{userIndicatorPosition:a,userIndicatorType:l}),d))}catch{}let c;if(i?.horizontal&&(c=i.horizontal),a==="start"?c="top-start":c="top-right",t){let d=t.getBoundingClientRect();if(d&&d.width&&d.height)switch(c){case"left":this.position={top:d.height/2-16,left:-4};break;case"left-start":this.position={top:0,left:-4};break;case"top-start":this.position={top:-32,left:0};break;case"top-right":this.position={top:-32,left:d.width};break;case"bottom-left":this.position={top:d.height+4,left:0};break;case"bottom-right":this.position={top:d.height+4,left:d.width-32};break;case"center-left":this.position={top:d.height/2-16,left:-32};break;case"center-right":this.position={top:d.height/2-16,left:d.width+4};break;default:this.position={top:-32,left:d.width}}else this.position=null}else this.position=null}else this.position=null}this.componentConfigSignal.update(e=>(e=y(h({},e),{position:this.position}),e))}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent calculatePosition: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(wc),x(Q))},o.\u0275cmp=O({type:o,selectors:[["app-selection-element-portal"]],viewQuery:function(t,i){if(t&1&&pt(fYe,5),t&2){let a;vt(a=mt())&&(i.selectionElementPortalOverlay=a.first)}},hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{highlight:"highlight",offsetLeft:"offsetLeft",offsetTop:"offsetTop"},standalone:!1,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["selectionElementPortalOverlay","cdkConnectedOverlay"],["defaultAvatarTypeTemplate",""],[4,"ngIf"],["cdkOverlayOrigin","","role","presentation",1,"selection-element-portal",3,"id"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayLockPosition","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass","cdkConnectedOverlayPositions"],[4,"ngIf","ngIfElse"],["role","list",1,"velt-live-selection-element-user-name-container"],[4,"ngFor","ngForOf"],["class","velt-live-selection-element-user-name-plus","role","listitem",3,"--velt-selection-color",4,"ngIf"],["role","listitem",1,"velt-live-selection-element-user-name"],["role","listitem",1,"velt-live-selection-element-user-name-plus"],["class","photo-container","role","listitem",3,"--velt-selection-user-index","background-color",4,"ngIf"],[1,"photo-container","selection-user-avatar",3,"size","user"],["role","listitem",1,"photo-container"],[1,"s-selection-element-avatar-initial"]],template:function(t,i){t&1&&p(0,OYe,2,1,"ng-container",3),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[Yt,xe,_n,pn,mr,he],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-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);position:absolute;top:0;left:0;box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert}.selection-element-portal[_ngcontent-%COMP%]{display:none;position:absolute;top:0;left:0;white-space:nowrap;z-index:1;font-size:var(--velt-font-size-xs)}.photo-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:calc((1.5rem + 0px) * var(--velt-base-rem-unit));height:calc((1.5rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;background-clip:padding-box;border-radius:50%;color:var(--velt-light-mode-white);border:2px solid var(--velt-selection-color);margin-left:-5px;z-index:calc(var(--velt-selection-user-index, 0) * -1)}.photo-container[_ngcontent-%COMP%] .s-selection-element-avatar-initial[_ngcontent-%COMP%]{color:var(--velt-light-mode-white)}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;object-fit:cover} snippyly-user-avatar.selection-user-avatar .s-user-avatar-initial{font-size:var(--velt-font-size-md)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%]{display:flex;gap:var(--velt-spacing-xs);margin-top:5px}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-xs) var(--velt-spacing-sm);font-size:var(--velt-spacing-md);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name-plus[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-x);font-size:var(--velt-font-size-xs);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}"],changeDetection:0});let n=o;return n})();var TS=(n,o)=>{try{let r=MYe(n),e=[],t=[];return r.forEach(i=>{i?.parentElement?.closest(N.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?i?.parentElement?.normalize():t.push(i)}),t.forEach(i=>{let a=PYe(i,o);a&&e.push(a)}),e}catch(r){return lt.catch("Error in highlighter highlightRange: ",r),[]}},MYe=n=>{try{if(n.collapsed)return[];let o=n.commonAncestorContainer;if(n.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(o=n.commonAncestorContainer.parentElement),!o)return[];let r=[],e=o.ownerDocument.createNodeIterator(o,NodeFilter.SHOW_TEXT),t,i=!1;for(;t=e.nextNode();)if(n.intersectsNode(t)){let a=t?.length;n.startContainer===t&&n.startOffset>0&&(t.splitText(n.startOffset),i=!0),n.endContainer===t&&n.endOffset<a&&t.splitText(n.endOffset),r.push(t)}return i&&r.shift(),r}catch(o){return lt.catch("Error in highlighter getTextNodesInRange: ",o),[]}},PYe=(n,o)=>{try{let r=document.createElement(o||N.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return n.parentElement?.replaceChild(r,n),r.appendChild(n),r}catch(r){return lt.catch("Error in highlighter highlightNode: ",r),null}};var wc=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A){this.afAuth=e,this.analyticsService=t,this.authService=i,this.configService=a,this.databaseService=l,this.docService=c,this.domService=d,this.componentFactoryResolver=m,this.injector=u,this.appRef=_,this.loggingService=I,this.commonDbService=A,this.documentPaths=null,this.textSelections={},this.enableSelections$=new Se(!1),this.userIndicatorEnabled$=new Se(!0),this.userIndicatorPosition$=new Se(AO.End),this.userIndicatorType$=new Se(fS.Avatar),this.defaultElementsTrackingEnabled$=new Se(!0),this.defaultStylingEnabled$=new Se(!0),this.inactivityTime=300*1e3,this.userIdleStateDetectionSubscription=null,this.elementSelections={},this.databaseService.getDb().pipe($e(M=>!!M),ut(1)).subscribe(M=>{M&&(this.updateOnDocumentFocusChange(),this.updateOnUserDbConnectionStateChange(M).subscribe(()=>{},B=>{this.loggingService.catch("Error in SelectionService constructor updateOnUserDbConnectionStateChange: ",B)}))},M=>{this.loggingService.catch("Error in SelectionService getDb subscription: ",M)}),this.authService.getUser$().subscribe(M=>{M?this.detectUserIdleState():this.unsubscribeUserIdleStateDetectionSubscription()}),this.docService.getDocumentPaths$().subscribe(M=>{this.documentPaths=M},M=>{this.loggingService.catch("Error in SelectionService getDocumentPaths subscription: ",M)}),this.domService.onDocumentClick$().subscribe(M=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&M?.target&&!window.getSelection()?.toString()){let B=this.getSelectionEnabledElement(M.target);if(B&&!fo(B)){let q=this.domService.getXPath(B);if(q){let ae=new Dp;ae.type="click",ae.targetElement=q,ae.timestamp=this.timestamp,this.setSelection(ae)}}else this.removeSelection()}}catch(B){this.loggingService.catch("Error in SelectionService onDocumentClick$: ",B)}},M=>{this.loggingService.catch("Error in SelectionService onDocumentClick$ subscription: ",M)}),this.domService.onDocumentFocus$().subscribe(M=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&M?.target){let B=this.getSelectionEnabledElement(M.target);if(B&&!fo(B)){let q=this.domService.getXPath(B);if(q){let ae=new Dp;ae.type="focus",ae.targetElement=q,ae.timestamp=this.timestamp,this.setSelection(ae)}}else this.removeSelection()}}catch(B){this.loggingService.catch("Error in SelectionService onDocumentFocus$: ",B)}},M=>{this.loggingService.catch("Error in SelectionService onDocumentFocus$ subscription: ",M)}),this.domService.onWindowKeyupEsc$().subscribe(M=>{this.removeSelection()},M=>{this.loggingService.catch("Error in SelectionService onWindowKeyupEsc$ subscription: ",M)}),this.enableSelections$.pipe(ye(()=>this.isFeatureAllowed$({})),$e(M=>M?.config&&M?.user)).subscribe(M=>{(!M?.featureAllowed||!this.enableSelections$.value)&&this.removeSelection()},M=>{this.loggingService.catch("Error in SelectionService enableSelections$ subscription: ",M)}),this.domService.onSelectionChange$().subscribe(()=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&window.getSelection()?.toString()){let M=window.getSelection()?.getRangeAt(0);if(M.commonAncestorContainer&&!M?.collapsed){let B=xhe([M]),q=new Dp;q.type="selection",q.targetTextRange=B?.length?B[0]:null,q.timestamp=this.timestamp,this.setSelection(q)}}}catch(M){this.loggingService.catch("Error in SelectionService onSelectionChange$: ",M)}},M=>{this.loggingService.catch("Error in SelectionService onSelectionChange$ subscription: ",M)}),this.authService.getUser$().subscribe(M=>{this.user=M},M=>{this.loggingService.catch("Error in SelectionService getUser$ subscription: ",M)}),this.getSelectionsOnCurrentDocument().pipe(Rr()).subscribe(([M,B])=>{try{if(M){let q=[];Object.keys(M).forEach(ae=>{let _e=M[ae],re=B?B[ae]:null;!vr(_e,re)&&ae!==this.getUserIdHash(this.user)&&q.push(_e)}),q.forEach(ae=>{if(ae.targetElement){let _e=this.elementSelections[ae?.targetElement]?.portalRef,be=(this.elementSelections[ae?.targetElement]?.selections||[]).filter(Ie=>this.getUserIdHash(Ie.user)!==this.getUserIdHash(ae?.user));be?.length?(_e.instance.setSelections(be.slice()),this.elementSelections[ae?.targetElement].selections=be.slice(),this.highlightElement(be[0])):(this.removeHighlightFromElement(ae),this.removeSelectionElement(ae))}else ae.targetTextRange&&this.removeHighlightFromText(ae)})}if(B){let q=[];Object.keys(B).forEach(ae=>{let _e=M?M[ae]:null,re=B[ae];!vr(_e,re)&&ae!==this.getUserIdHash(this.user)&&q.push(re)}),q.forEach(ae=>{ae.targetElement?(this.highlightElement(ae),this.getUserIndicatorEnabled()&&this.setElementHighlight(ae)):ae.targetTextRange&&this.highlightText(ae)})}}catch(q){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",q)}},M=>{this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument subscription: ",M)}),this.authService.addPreSignOutFuction("highlight-signout",this.signOutUser.bind(this))}detectUserIdleState(){try{this.unsubscribeUserIdleStateDetectionSubscription();let e=!1;this.userIdleStateDetectionSubscription=this.domService.onWindowPointerMove$().pipe(ou(2e3),ln(()=>{e&&(e=!1)}),Qr(this.inactivityTime),ln(()=>{this.removeSelection(),e=!0})).subscribe()}catch(e){this.loggingService.catch("Error in detectUserIdleState: ",e)}}unsubscribeUserIdleStateDetectionSubscription(){try{this.userIdleStateDetectionSubscription&&(this.userIdleStateDetectionSubscription.unsubscribe(),this.userIdleStateDetectionSubscription=null)}catch(e){this.loggingService.catch("Error in unsubscribeUserIdleStateDetectionSubscription: ",e)}}isFeatureAllowed(){return Mo(this.configService.getConfig(),this.authService.getUser(),je.LIVE_SELECTION)}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.user&&document.visibilityState==="hidden"&&this.removeSelection()})}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}getSelectionsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getSelectionsOnCurrentDocument","color: green;"),br(this.afAuth).pipe($e(e=>!!e),ye(e=>this.isFeatureAllowed$({firebaseUser:e})),ye(e=>e.featureAllowed?ce(e).pipe(ye(t=>this.docService.getDocumentPaths$().pipe(ge(i=>(this.documentPaths=i,t)))),ye(t=>t?.user?t?.user?.isAnonymous?ce(null):this.documentPaths?this.databaseService.getDb().pipe($e(i=>!!i),ye(i=>this.documentPaths?.selection?this.commonDbService.dbListener({feature:"allSelections",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(a=>a?.data),ge(a=>this.filterActiveSelections(a))):ce(null))):ce(null):ce(null))):ce(null)))}isFeatureAllowed$(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>(this.user=i,y(h({},t),{user:i}))))),ye(t=>Mo(t.config,t.user,je.LIVE_SELECTION)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))),_t((t,i)=>t?.featureAllowed===i?.featureAllowed))}filterActiveSelections(e){this.loggingService.log("%c[WB] Calling FUNCTION: filterOnlineUsers","color: green;");try{if(e&&typeof e=="object"&&Object.keys(e).length){let t={},i=this.commonDbService.getServerTimestamp();return Object.keys(e).forEach(a=>{let l=e[a];l?.timestamp&&Math.abs(i-l.timestamp)<this.inactivityTime&&(t[a]=l)}),t}return e}catch(t){return this.loggingService.catch("Error in filterOnlineUsers:",t),e}}setSelection(e){try{if(this.user?.userId&&this.documentPaths?.selection){e.user=this.user;let t=JSON.parse(JSON.stringify(e));t&&!t?.timestamp&&(t.timestamp=this.timestamp),this.commonDbService.updateData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in SelectionService setSelection: ",t)}}removeSelection(){try{this.user?.userId&&this.documentPaths?.selection&&this.commonDbService.deleteData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in SelectionService removeSelection: ",e)}}updateOnUserDbConnectionStateChange(e){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnUserDbConnectionStateChange","color: green;"),br(this.afAuth).pipe($e(t=>!!t),ye(t=>this.docService.getDocumentPaths$().pipe(ge(i=>t))),ln(t=>X(this,null,function*(){try{if(this.documentPaths&&t){let i=yield Xv(t,!0).catch(l=>null);if(!i)return;let{user:a}=i.claims;if(a&&this.documentPaths?.selection){let l=this.getUserIdHash(a);if(l){let c=`${this.documentPaths.selection}/${l}`,d=Vr(e,c);Cc(d).remove().catch(m=>{this.loggingService.catch("Error in SelectionService updateOnUserDbConnectionStateChange onDisconnect:",m)})}}}}catch(i){this.loggingService.catch("Error in SelectionService updateOnUserDbConnectionStateChange:",i)}})))}highlightElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let i=t.iterateNext();if(i){let a=["input","textarea","select","button"],l;try{i?.getAttribute(N.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(l=JSON.parse(i?.getAttribute(N.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"))}catch{}(!l||l?.border)&&this.domService.highlightUserElement(i,e?.user?.color,e?.user?.name,this.getDefaultStylingEnabled())}}}catch(t){this.loggingService.catch("Error in SelectionService highlightElement: ",t)}}removeHighlightFromElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let i=t.iterateNext();i&&this.domService.removeHighlightUserFromElement(i)}}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromElement: ",t)}}highlightText(e){try{if(e?.targetTextRange){let t=np(e.targetTextRange?.text,this.domService.getXPath(e.targetTextRange?.commonAncestorContainer).iterateNext(),e.targetTextRange?.occurrence),i=new Range;try{i.setStart(t[0].textNode,t[0].startOffset||0),i.setEnd(t[t.length-1].textNode,t[t.length-1].endOffset||0)}catch{}if(i.toString()===e.targetTextRange?.text){let a=TS(i,N.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),l=[],c=this.getSelectionUserMarker(e.user);if(a&&a.length&&(a.forEach(d=>{d?.textContent?.trim()&&(this.domService.addClassToElement(d,d.tagName?.toLowerCase()),this.domService.addClassToElement(d,N.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(d,N.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&d.style.setProperty(N.VELT_SELECTION_COLOR,e.user?.color+"55"),l.push({element:d,textNode:d.childNodes[0]}))}),c)){let d=a.filter(u=>u?.textContent?.trim()),m=d?.length?d[d?.length-1]:null;m&&m.parentNode.insertBefore(c,m.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:l,marker:c}}}}catch(t){this.loggingService.catch("Error in SelectionService highlightText: ",t)}}removeHighlightFromText(e){try{let t=this.getUserIdHash(e?.user);t&&this.textSelections[t]?.textNodes?.length&&(this.textSelections[t].textNodes.forEach(i=>{i?.element&&i?.textNode&&i.element.replaceWith(i.textNode),i.textNode&&i.textNode.parentNode?.normalize()}),this.textSelections[t]?.marker&&this.textSelections[t]?.marker?.remove())}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromText: ",t)}}getSelectionUserMarker(e){try{let t=document.createElement("span");t.classList.add("snippyly-user-marker","active"),t.setAttribute("data-name",e?.name+""),t.style.setProperty("--velt-selection-marker-color",e?.color||"#000");let i=document.createElement("span");i.classList.add("snippyly-user-marker-line");let a=document.createElement("span");return a.classList.add("snippyly-user-marker-dot"),i.appendChild(a),t.appendChild(i),setTimeout(()=>{t?.classList?.remove("active")},1e3),t}catch(t){return this.loggingService.catch("Error in SelectionService getSelectionUserMarker: ",t),null}}signOutUser(e){return new Promise((t,i)=>{try{this.documentPaths?.selection&&e?this.commonDbService.getData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).then(a=>{a&&this.commonDbService.deleteData({feature:"selection",errorCallback:l=>{i(l)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}}),t(null)}).catch(a=>{this.loggingService.catch("Error in SelectionService signOutUser subscription: ",a),i(a)}):t(null)}catch(a){this.loggingService.catch("Error in SelectionService signOutUser:",a),i(a)}})}setInactivityTime(e){try{this.inactivityTime=e,this.analyticsService.trackEvent(Y.Events.Selection.SELECTION_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime}),this.detectUserIdleState()}catch(t){this.loggingService.catch("Error in SelectionService setInactivityTime: ",t)}}getInactivityTime(){return this.inactivityTime}enableSelections(e){try{this.enableSelections$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService enableSelections: ",t)}}enableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!0)return;this.userIndicatorEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableUserIndicator: ",e)}}disableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!1)return;this.userIndicatorEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableUserIndicator: ",e)}}getUserIndicatorEnabled$(){return this.userIndicatorEnabled$.asObservable()}getUserIndicatorEnabled(){return this.userIndicatorEnabled$.value}setUserIndicatorPosition(e){try{this.userIndicatorPosition$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorPosition: ",t)}}getUserIndicatorPosition$(){return this.userIndicatorPosition$.asObservable()}getUserIndicatorPosition(){return this.userIndicatorPosition$.value}setUserIndicatorType(e){try{this.userIndicatorType$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorType: ",t)}}getUserIndicatorType$(){return this.userIndicatorType$.asObservable()}getUserIndicatorType(){return this.userIndicatorType$.value}enableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!0)return;this.defaultElementsTrackingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultElementsTracking: ",e)}}disableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!1)return;this.defaultElementsTrackingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultElementsTracking: ",e)}}getDefaultElementsTrackingEnabled$(){return this.defaultElementsTrackingEnabled$.asObservable()}getDefaultElementsTrackingEnabled(){return this.defaultElementsTrackingEnabled$.value}enableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!0)return;this.defaultStylingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultStyling: ",e)}}disableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!1)return;this.defaultStylingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultStyling: ",e)}}getDefaultStylingEnabled$(){return this.defaultStylingEnabled$.asObservable()}getDefaultStylingEnabled(){return this.defaultStylingEnabled$.value}getSelectionEnabledElement(e){try{let t=this.getDefaultElementsTrackingEnabled();return t&&N.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:mZ(e,t)}catch(t){return this.loggingService.catch("Error in SelectionService isElementAllowed: ",t),null}}setElementHighlight(e){try{if(!this.elementSelections[e.targetElement])this.setSelectionElement(e);else{let t=this.elementSelections[e.targetElement].portalRef;this.elementSelections[e.targetElement].selections?.find(a=>this.getUserIdHash(a.user)===this.getUserIdHash(e?.user))||(t.instance.addSelection(e),this.elementSelections[e.targetElement].selections.push(e))}}catch(t){this.loggingService.catch("Error in SelectionService setElementSelection: ",t)}}setSelectionElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let i=t.iterateNext();if(i){let a=this.domService.getHostElement(i),l=new Vi(I_e),c=new Bi(a,this.appRef,this.injector),d=c.attach(l);d.instance.highlight=e,d.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:c,selectionElementPortal:l,portalRef:d,selections:[JSON.parse(JSON.stringify(e))],userTargetElement:i,selectionHostElement:a,targetElement:e.targetElement},this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in SelectionService setSelectionElement: ",t)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:i,selectionHostElement:a}=this.elementSelections[e.targetElement],l=this.domService.getElementOffset(i,a);t.instance.offsetLeft=l.offsetLeft,t.instance.offsetTop=l.offsetTop}catch(t){this.loggingService.catch("Error in SelectionService updateElementOffset: ",t)}}checkElementHighlightsToRemove(e){try{let t=e.map(i=>i.targetElement);Object.keys(this.elementSelections).forEach(i=>{if(!t.includes(i)){let a=this.elementSelections[i];a&&(a.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(a.selectionHostElement)),delete this.elementSelections[i]}})}catch(t){this.loggingService.catch("Error in SelectionService checkElementHighlightsToRemove: ",t)}}removeSelectionElement(e){try{let t=this.elementSelections[e.targetElement];t&&(t.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(t.selectionHostElement)),delete this.elementSelections[e.targetElement]}catch(t){this.loggingService.catch("Error in SelectionService removeSelectionElement: ",t)}}getUserIdHash(e){try{return e?.userId?It(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(t){return new(t||o)(K(eo),K(ct),K(qe),K(Ft),K($n),K(st),K(Ue),K(Qo),K(Dt),K(Ir),K(k),K(yn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var RU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: SelectionElement","color: blue;"),this.enableLiveSelection=this._enableLiveSelection,this.disableLiveSelection=this._disableLiveSelection,this.enableUserIndicator=this._enableUserIndicator,this.disableUserIndicator=this._disableUserIndicator,this.setUserIndicatorPosition=this._setUserIndicatorPosition,this.setUserIndicatorType=this._setUserIndicatorType,this.enableDefaultElementsTracking=this._enableDefaultElementsTracking,this.disableDefaultElementsTracking=this._disableDefaultElementsTracking,this.enableDefaultStyling=this._enableDefaultStyling,this.disableDefaultStyling=this._disableDefaultStyling,this.getLiveSelectionData=this._getLiveSelectionData,this.setInactivityTime=this._setInactivityTime}_enableLiveSelection(){this.getService(k).log("%c[WB] Calling FUNCTION: _enableLiveSelection","color: green;");try{this.trackEvent(Y.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(wc).enableSelections(!0)}catch(o){this.getService(k).catch("Error in enableLiveSelection: ",o)}}_disableLiveSelection(){this.getService(k).log("%c[WB] Calling FUNCTION: _disableLiveSelection","color: green;");try{this.trackEvent(Y.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(wc).enableSelections(!1)}catch(o){this.getService(k).catch("Error in disableLiveSelection: ",o)}}_enableUserIndicator(){this.getService(k).log("%c[WB] Calling FUNCTION: enableUserIndicator","color: green;");try{this.trackEvent(Y.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(wc).enableUserIndicator()}catch(o){this.getService(k).catch("Error in _enableUserIndicator: ",o)}}_disableUserIndicator(){this.getService(k).log("%c[WB] Calling FUNCTION: disableUserIndicator","color: green;");try{this.trackEvent(Y.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(wc).disableUserIndicator()}catch(o){this.getService(k).catch("Error in _disableUserIndicator: ",o)}}_setUserIndicatorPosition(o){this.getService(k).log("%c[WB] Calling FUNCTION: setUserIndicatorPosition","color: green;");try{this.trackEvent(Y.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:o}}),this.getService(wc).setUserIndicatorPosition(o)}catch(r){this.getService(k).catch("Error in _setUserIndicatorPosition: ",r)}}_setUserIndicatorType(o){this.getService(k).log("%c[WB] Calling FUNCTION: setUserIndicatorType","color: green;");try{this.trackEvent(Y.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:o}}),this.getService(wc).setUserIndicatorType(o)}catch(r){this.getService(k).catch("Error in _setUserIndicatorType: ",r)}}_enableDefaultElementsTracking(){this.getService(k).log("%c[WB] Calling FUNCTION: enableDefaultElementsTracking","color: green;");try{this.trackEvent(Y.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(wc).enableDefaultElementsTracking()}catch(o){this.getService(k).catch("Error in _enableDefaultElementsTracking: ",o)}}_disableDefaultElementsTracking(){this.getService(k).log("%c[WB] Calling FUNCTION: disableDefaultElementsTracking","color: green;");try{this.trackEvent(Y.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(wc).disableDefaultElementsTracking()}catch(o){this.getService(k).catch("Error in _disableDefaultElementsTracking: ",o)}}_enableDefaultStyling(){this.getService(k).log("%c[WB] Calling FUNCTION: enableDefaultStyling","color: green;");try{this.trackEvent(Y.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(wc).enableDefaultStyling()}catch(o){this.getService(k).catch("Error in _enableDefaultStyling: ",o)}}_disableDefaultStyling(){this.getService(k).log("%c[WB] Calling FUNCTION: disableDefaultStyling","color: green;");try{this.trackEvent(Y.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(wc).disableDefaultStyling()}catch(o){this.getService(k).catch("Error in _disableDefaultStyling: ",o)}}_getLiveSelectionData(){this.getService(k).log("%c[WB] Calling FUNCTION: getLiveSelectionData","color: green;");try{return this.trackEvent(Y.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(wc).getSelectionsOnCurrentDocument()}catch(o){return this.getService(k).catch("Error in _getLiveSelectionData: ",o),ce(null)}}_setInactivityTime(o){this.getService(k).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(Y.Events.Selection.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:o}}),!isNaN(o)&&o>0?this.getService(wc).setInactivityTime(o):this.getService(k).catch("Error in setInactivityTime: ","Provided value must be a positive number greater than zero.")}catch(r){this.getService(k).catch("Error in setInactivityTime: ",r)}}};var NU=(()=>{let o=class o{constructor(e){this.loggingService=e,this.enabledSignal=De(!1),this.onTargetEditStart=null,this.onTargetEditCommit=null;try{this.enabled$=Use(this.enabledSignal).pipe(_t())}catch(t){this.loggingService.catch("Error in SuggestionModeService constructor: ",t),this.enabled$=new Vt}}enable(e){try{this.onTargetEditStart=e?.onTargetEditStart??null,this.onTargetEditCommit=e?.onTargetEditCommit??null,this.enabledSignal.set(!0)}catch(t){this.loggingService.catch("Error in SuggestionModeService enable: ",t)}}disable(){try{this.onTargetEditStart=null,this.onTargetEditCommit=null,this.enabledSignal.set(!1)}catch(e){this.loggingService.catch("Error in SuggestionModeService disable: ",e)}}isEnabled(){try{return this.enabledSignal()}catch(e){return this.loggingService.catch("Error in SuggestionModeService isEnabled: ",e),!1}}getOnTargetEditStart(){try{return this.onTargetEditStart}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditStart: ",e),null}}getOnTargetEditCommit(){try{return this.onTargetEditCommit}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditCommit: ",e),null}}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var FU=(()=>{let o=class o{constructor(e){this.loggingService=e,this.snapshots=new Map}captureFromGetter(e,t){try{if(!e||typeof t!="function")return!1;let i;try{i=t()}catch(a){return sm()&&this.loggingService.catch(`[velt] Suggestion target "${e}" getter threw: `,a),!1}return this.captureValue(e,i)}catch(i){return this.loggingService.catch("Error in SuggestionSnapshotService captureFromGetter: ",i),!1}}captureValue(e,t){try{if(!e)return!1;let i;try{i=structuredClone(t)}catch(a){return sm()&&this.loggingService.catch(`[velt] Suggestion target "${e}" snapshot failed (value not cloneable). Cause: structuredClone rejected the value (cyclic refs, DOM nodes, or functions are common culprits). Fix: ensure your getter returns plain JSON-serializable data.`,a),!1}return this.snapshots.set(e,i),!0}catch(i){return this.loggingService.catch("Error in SuggestionSnapshotService captureValue: ",i),!1}}getSnapshot(e){try{return this.snapshots.has(e)?this.snapshots.get(e):void 0}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService getSnapshot: ",t);return}}hasSnapshot(e){try{return this.snapshots.has(e)}catch(t){return this.loggingService.catch("Error in SuggestionSnapshotService hasSnapshot: ",t),!1}}clearSnapshot(e){try{this.snapshots.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService clearSnapshot: ",t)}}clearAllSnapshots(){try{this.snapshots.clear()}catch(e){this.loggingService.catch("Error in SuggestionSnapshotService clearAllSnapshots: ",e)}}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var LU=(()=>{let o=class o{constructor(e,t,i){this.loggingService=e,this.modeService=t,this.snapshotService=i,this.registry=new Map,this.warnedUnstableIds=new Set,this.actionsService=null}registerTarget(e,t){try{if(!e||typeof t!="function")return;this.warnIfUnstableId(e);let i=this.registry.get(e)??{};i.getter=t,this.registry.set(e,i)}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService registerTarget: ",i)}}unregisterTarget(e){try{let t=this.registry.get(e);if(!t)return;delete t.getter,t.node||this.registry.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService unregisterTarget: ",t)}}getGetter(e){try{return this.registry.get(e)?.getter}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getGetter: ",t);return}}setActionsService(e){try{this.actionsService=e}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService setActionsService: ",t)}}getNode(e){try{if(!e)return;let t=this.registry.get(e)?.node;if(t&&t.isConnected)return t;let i=this.queryAll(e);if(i.length===0)return;i.length>1&&this.warnDuplicateId(e,i.length);let a=i[0],l=this.registry.get(e)??{};return l.node=a,this.registry.set(e,l),a}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getNode: ",t);return}}getFallbackValue(e){try{let t=this.getNode(e);if(!t)return{hasValue:!1};let i=t.textContent??"";return i.length>0?{hasValue:!0,value:i}:{hasValue:!1}}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService getFallbackValue: ",t),{hasValue:!1}}}isRegistered(e){try{return this.registry.get(e)?.getter?!0:!!this.getNode(e)}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isRegistered: ",t),!1}}countTaggedElements(e){try{let t=e??this.rootEl??document.body;return t?t.querySelectorAll(`[${N.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).length:0}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService countTaggedElements: ",t),0}}startObserving(e=document.body){try{if(this.observer)return;this.rootEl=e,this.scanAndRefresh(e),this.observer=new MutationObserver(()=>{try{this.scanAndRefresh(this.rootEl??document.body)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService observer callback: ",t)}}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[N.ATTRIBUTES.VELT_SUGGESTION_TARGET]}),this.installDelegatedListeners(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService startObserving: ",t)}}stopObserving(){try{this.observer?.disconnect(),this.observer=void 0,this.rootEl&&this.removeDelegatedListeners(this.rootEl),this.rootEl=void 0}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService stopObserving: ",e)}}clear(){try{this.registry.clear(),this.warnedUnstableIds.clear()}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService clear: ",e)}}installDelegatedListeners(e){try{this.boundFocusIn=t=>this.handleFocusIn(t),this.boundChange=t=>this.handleChange(t),this.boundFocusOut=t=>this.handleFocusOut(t),e.addEventListener("focusin",this.boundFocusIn,!0),e.addEventListener("change",this.boundChange,!0),e.addEventListener("focusout",this.boundFocusOut,!0)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService installDelegatedListeners: ",t)}}removeDelegatedListeners(e){try{this.boundFocusIn&&e.removeEventListener("focusin",this.boundFocusIn,!0),this.boundChange&&e.removeEventListener("change",this.boundChange,!0),this.boundFocusOut&&e.removeEventListener("focusout",this.boundFocusOut,!0),this.boundFocusIn=void 0,this.boundChange=void 0,this.boundFocusOut=void 0}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService removeDelegatedListeners: ",t)}}handleFocusIn(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t)return;this.captureSnapshotForTarget(t.targetId,t.element);let i=this.snapshotService.getSnapshot(t.targetId),a={targetId:t.targetId,oldValue:i,newValue:i,element:t.element},l=this.modeService.getOnTargetEditStart();if(l)try{l(a)}catch(c){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditStart customer callback threw: ",c)}this.actionsService?.triggerAction(Il.TARGET_EDIT_START,{details:a,timestamp:Date.now()})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusIn: ",t)}}handleChange(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||!this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleChange: ",t)}}handleFocusOut(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusOut: ",t)}}isAtomicCommitTarget(e){try{if(e instanceof HTMLSelectElement)return!0;if(e instanceof HTMLInputElement){let t=(e.type||"").toLowerCase();return t==="checkbox"||t==="radio"}return!1}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isAtomicCommitTarget: ",t),!1}}processCommit(e,t){try{let i=this.snapshotService.getSnapshot(e),a=this.readElementValue(e,t);if(vr(i,a))return;let l={targetId:e,oldValue:i,newValue:a,element:t},c=this.modeService.getOnTargetEditCommit(),d=!1;if(c){let u=null;try{u=c(l)}catch(_){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditCommit customer callback threw: ",_)}u&&(d=!0,this.invokeAutoCommit({targetId:e,newValue:a,summary:u.summary,metadata:u.metadata}))}let m=u=>X(this,null,function*(){return d?null:this.invokeAutoCommit({targetId:e,newValue:a,summary:u?.summary,metadata:u?.metadata})});this.actionsService?.triggerAction(Il.TARGET_EDIT_COMMIT,{details:l,commitSuggestion:m,timestamp:Date.now()})}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService processCommit: ",i)}}invokeAutoCommit(e){try{return this.actionsService?this.actionsService.commitSuggestion(e).catch(t=>(sm()&&this.loggingService.catch(`[velt] auto-commit for "${e.targetId}" rejected: `,t),null)):(sm()&&this.loggingService.log("[velt] auto-commit skipped: actions service not wired. SuggestionActionsService constructor should call registry.setActionsService(this)."),Promise.resolve(null))}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService invokeAutoCommit: ",t),Promise.resolve(null)}}captureSnapshotForTarget(e,t){try{let i=this.registry.get(e);if(i?.getter){this.snapshotService.captureFromGetter(e,i.getter);return}let a=this.readElementValue(e,t);this.snapshotService.captureValue(e,a)}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService captureSnapshotForTarget: ",i)}}readElementValue(e,t){try{let i=this.registry.get(e);if(i?.getter)try{return i.getter()}catch{return}if(t instanceof HTMLInputElement){let a=(t.type||"").toLowerCase();return a==="checkbox"||a==="radio"?t.checked:a==="number"||a==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}return t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?t.value:(t instanceof HTMLElement&&t.isContentEditable,t.textContent??"")}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService readElementValue: ",i);return}}findTaggedAncestor(e){try{if(!(e instanceof Element))return null;let t=e.closest(`[${N.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`);if(!t)return null;let i=t.getAttribute(N.ATTRIBUTES.VELT_SUGGESTION_TARGET);return i?{element:t,targetId:i}:null}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService findTaggedAncestor: ",t),null}}queryAll(e){try{let t=window.CSS?.escape?window.CSS.escape(e):e.replace(/"/g,'\\"');return Array.from(document.querySelectorAll(`[${N.ATTRIBUTES.VELT_SUGGESTION_TARGET}="${t}"]`))}catch{return[]}}scanAndRefresh(e){try{e.querySelectorAll(`[${N.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).forEach(i=>{let a=i.getAttribute(N.ATTRIBUTES.VELT_SUGGESTION_TARGET);if(!a)return;let l=this.registry.get(a)??{};(!l.node||!l.node.isConnected)&&(l.node=i,this.registry.set(a,l))})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService scanAndRefresh: ",t)}}warnIfUnstableId(e){try{if(!sm()||this.warnedUnstableIds.has(e))return;let t=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i.test(e),i=/\d{10,}/.test(e);(t||i)&&(this.warnedUnstableIds.add(e),this.loggingService.catch(`[velt] Target id "${e}" appears unstable. Cause: contains a UUID or timestamp shape \u2014 these typically change across re-renders. Fix: use a stable customer-owned id (the same one you use in your state). Docs: velt.dev/docs/suggestions/target-ids`,new Error("UNSTABLE_TARGET_ID")))}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService warnIfUnstableId: ",t)}}warnDuplicateId(e,t){try{if(!sm())return;this.loggingService.catch(`[velt] Duplicate target id "${e}" \u2014 ${t} elements share this id. Cause: the same ${N.ATTRIBUTES.VELT_SUGGESTION_TARGET} appears on multiple DOM nodes. Fix: ensure each suggestable element has a unique id. Velt is using the first registered element. Docs: velt.dev/docs/suggestions/target-ids`,new Error("DUPLICATE_TARGET_ID"))}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService warnDuplicateId: ",i)}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(NU),K(FU))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ic=(()=>{let o=class o{constructor(e,t,i,a,l,c){this.loggingService=e,this.modeService=t,this.snapshotService=i,this.targetRegistry=a,this.commentService=l,this.commonDbService=c,this.actionSubjects=new Map,this.observingActive=!1;try{this.targetRegistry.setActionsService(this)}catch(d){this.loggingService.catch("Error in SuggestionActionsService constructor: ",d)}}enableSuggestionMode(e){try{this.modeService.enable(e),this.startObservingIfNeeded(),this.warnIfNoTaggedElements()}catch(t){this.loggingService.catch("Error in SuggestionActionsService enableSuggestionMode: ",t)}}disableSuggestionMode(){try{this.modeService.disable(),this.stopObservingIfNeeded()}catch(e){this.loggingService.catch("Error in SuggestionActionsService disableSuggestionMode: ",e)}}isSuggestionModeEnabled(){try{return this.modeService.isEnabled()}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled: ",e),!1}}isSuggestionModeEnabled$(){try{return this.modeService.enabled$}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled$: ",e),new Vt}}registerTarget(e){try{if(!e?.targetId||typeof e?.getter!="function")return;this.targetRegistry.registerTarget(e.targetId,e.getter)}catch(t){this.loggingService.catch("Error in SuggestionActionsService registerTarget: ",t)}}unregisterTarget(e){try{this.targetRegistry.unregisterTarget(e)}catch(t){this.loggingService.catch("Error in SuggestionActionsService unregisterTarget: ",t)}}startSuggestion(e){try{let t=this.targetRegistry.getGetter(e);if(t){this.snapshotService.captureFromGetter(e,t);return}let i=this.targetRegistry.getFallbackValue(e);i.hasValue?this.snapshotService.captureValue(e,i.value):this.loggingService.warn(`[velt] startSuggestion: target "${e}" not registered. Cause: no getter via registerTarget() and no textContent fallback. Fix: tag the element with data-velt-suggestion-target and register a getter via registerTarget(). Docs: velt.dev/docs/suggestions/targets`)}catch(t){this.loggingService.catch("Error in SuggestionActionsService startSuggestion: ",t)}}commitSuggestion(e){return new Promise((t,i)=>{try{if(!e?.targetId){i(new Error("INVALID_CONFIG"));return}if(!this.modeService.isEnabled()){this.loggingService.warn("[velt] commitSuggestion called while suggestion mode is disabled. Cause: enableSuggestionMode() has not been called (or disableSuggestionMode() was called). Fix: call enableSuggestionMode() before commit, or branch on isSuggestionModeEnabled() in your onSave handler. Docs: velt.dev/docs/suggestions/mode"),i(new Error("MODE_NOT_SUGGESTING"));return}if(!this.targetRegistry.isRegistered(e.targetId)){this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" not registered. Cause: no element has data-velt-suggestion-target="${e.targetId}" and no registerTarget() call provided a getter. Fix: tag the element or register a getter at app boot. Docs: velt.dev/docs/suggestions/targets`),i(new Error("TARGET_NOT_REGISTERED"));return}if(!this.snapshotService.hasSnapshot(e.targetId)){let u=this.targetRegistry.getGetter(e.targetId);if(u){if(!this.snapshotService.captureFromGetter(e.targetId,u)){i(new Error("SNAPSHOT_FAILED"));return}}else{let _=this.targetRegistry.getFallbackValue(e.targetId);if(_.hasValue)this.snapshotService.captureValue(e.targetId,_.value);else{this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" requires registerTarget() for complex values. Cause: complex objects need a getter so the SDK can deep-clone the snapshot. Fix: call velt.getSuggestionElement().registerTarget("${e.targetId}", () => yourState.${e.targetId}) at app boot. Docs: velt.dev/docs/suggestions/getter`),i(new Error("NO_GETTER_FOR_COMPLEX"));return}}}let a=this.snapshotService.getSnapshot(e.targetId),l=e.newValue;if(vr(a,l)){this.loggingService.warn(`[velt] commitSuggestion: no change detected for target "${e.targetId}". Cause: oldValue and newValue are deeply equal. Fix: only call commitSuggestion when the customer actually changed the value. Docs: velt.dev/docs/suggestions/edge-cases`),i(new Error("NO_CHANGE_TO_SUGGEST"));return}let c=new Pr;c.type="suggestion",c.suggestion={status:"pending",targetId:e.targetId,targetType:"custom",oldValue:a,newValue:l,summary:e.summary??null,driftDetected:!1,rejectReason:null,resolvedBy:null,resolvedAt:null},c.metadata=e.metadata??{};let d=e.summary??`[${e.targetId}] changed`,m=new tc;m.commentText=d,m.commentHtml=`<p>${this.escapeHtml(d)}</p>`,c.comments=[m],this.commentService.addComment(void 0,void 0,void 0,void 0,!1,[],void 0,void 0,void 0,void 0,void 0,void 0,void 0,u=>{try{this.snapshotService.clearSnapshot(e.targetId),this.projectAndTrigger(Il.SUGGESTION_CREATED,u.annotation),t({id:u.annotation.annotationId})}catch(_){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion callback: ",_),i(_)}},void 0,void 0,c,void 0,void 0,!0,void 0,void 0,"internal",void 0)}catch(a){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion: ",a),i(a)}})}getSuggestions(e){try{let t=this.commentService.getCommentAnnotationsOnCurrentOrganizationAndDocument()??[],i=[];for(let a of t){if(a.type!=="suggestion"||!a.suggestion)continue;let l=this.projectAnnotationToSuggestion(a);l&&this.matchesFilter(l,e)&&i.push(l)}return i}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions: ",t),[]}}getSuggestions$(e){try{return this.commentService.getCommentAnnotationsOnCurrentOrganizationAndDocument$().pipe(ge(t=>{let i=[];for(let a of t??[]){if(a.type!=="suggestion"||!a.suggestion)continue;let l=this.projectAnnotationToSuggestion(a);l&&this.matchesFilter(l,e)&&i.push(l)}return i}),_t(Kt))}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions$: ",t),new Vt}}getPendingSuggestion(e){try{if(!e)return null;let t=this.getSuggestions({targetId:e,status:"pending"});return t.length===0?null:t.sort((i,a)=>(a.createdAt??0)-(i.createdAt??0))[0]}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion: ",t),null}}getPendingSuggestion$(e){try{return e?this.getSuggestions$({targetId:e,status:"pending"}).pipe(ge(t=>t.length===0?null:t.sort((i,a)=>(a.createdAt??0)-(i.createdAt??0))[0]),_t(Kt)):new Vt}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion$: ",t),new Vt}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.next(t)}catch(i){this.loggingService.catch("Error in SuggestionActionsService triggerAction: ",i)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in SuggestionActionsService onAction: ",t),ce(null)}}projectAndTrigger(e,t){try{if(!t||t.type!=="suggestion"||!t.suggestion)return;let i=this.projectAnnotationToSuggestion(t);if(!i)return;let a=this.timestamp;switch(e){case Il.SUGGESTION_CREATED:{let l={suggestion:i,timestamp:a};this.triggerAction(Il.SUGGESTION_CREATED,l);break}case Il.SUGGESTION_APPROVED:{let l={suggestion:i,timestamp:a};this.triggerAction(Il.SUGGESTION_APPROVED,l);break}case Il.SUGGESTION_REJECTED:{let l={suggestion:i,timestamp:a};this.triggerAction(Il.SUGGESTION_REJECTED,l);break}case Il.SUGGESTION_STALE:{let l={suggestion:i,timestamp:a};this.triggerAction(Il.SUGGESTION_STALE,l);break}}}catch(i){this.loggingService.catch("Error in SuggestionActionsService projectAndTrigger: ",i)}}projectAnnotationToSuggestion(e){try{let t=e.suggestion;if(!t)return;let i={annotationId:e.annotationId,targetId:t.targetId,targetType:t.targetType,oldValue:t.oldValue,newValue:t.newValue,summary:t.summary,metadata:e.metadata??{},driftDetected:!!t.driftDetected,createdBy:e.from,createdAt:e.createdAt??0};switch(t.status){case"pending":return y(h({},i),{status:"pending",rejectReason:null,resolvedBy:null,resolvedAt:null});case"approved":case"apply_failed":return y(h({},i),{status:t.status,rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"rejected":return y(h({},i),{status:"rejected",rejectReason:t.rejectReason??"",resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"stale":return y(h({},i),{status:"stale",rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt});default:return}}catch(t){this.loggingService.catch("Error in SuggestionActionsService projectAnnotationToSuggestion: ",t);return}}startObservingIfNeeded(){try{if(this.observingActive)return;this.observingActive=!0,this.targetRegistry.startObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService startObservingIfNeeded: ",e)}}stopObservingIfNeeded(){try{if(!this.observingActive)return;this.observingActive=!1,this.targetRegistry.stopObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService stopObservingIfNeeded: ",e)}}warnIfNoTaggedElements(){try{this.targetRegistry.countTaggedElements()===0&&this.loggingService.warn('[velt] No suggestable elements found on this page. Cause: no DOM elements have a data-velt-suggestion-target attribute. Fix: tag at least one element with data-velt-suggestion-target="your.id" before enabling suggestion mode. Docs: velt.dev/docs/suggestions/getting-started')}catch(e){this.loggingService.catch("Error in SuggestionActionsService warnIfNoTaggedElements: ",e)}}get timestamp(){return this.commonDbService.getServerTimestamp()}matchesFilter(e,t){try{return t?!(t.targetId&&e.targetId!==t.targetId||t.status&&!(Array.isArray(t.status)?t.status:[t.status]).includes(e.status)):!0}catch(i){return this.loggingService.catch("Error in SuggestionActionsService matchesFilter: ",i),!1}}escapeHtml(e){try{return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch(t){return this.loggingService.catch("Error in SuggestionActionsService escapeHtml: ",t),""}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(NU),K(FU),K(LU),K(Re),K(yn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var UU=class extends fr{constructor(o){super(o),this._enableSuggestionMode=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: enableSuggestionMode","color: green;");try{this.trackEvent(Y.Events.Suggestions.ENABLE_SUGGESTION_MODE_TRIGGERED),this.getService(ic).enableSuggestionMode(r)}catch(e){this.getService(k).catch("Error in _enableSuggestionMode: ",e)}},this._disableSuggestionMode=()=>{this.getService(k).log("%c[WB] Calling FUNCTION: disableSuggestionMode","color: green;");try{this.trackEvent(Y.Events.Suggestions.DISABLE_SUGGESTION_MODE_TRIGGERED),this.getService(ic).disableSuggestionMode()}catch(r){this.getService(k).catch("Error in _disableSuggestionMode: ",r)}},this._isSuggestionModeEnabled=()=>{this.getService(k).log("%c[WB] Calling FUNCTION: isSuggestionModeEnabled","color: green;");try{return this.trackEvent(Y.Events.Suggestions.IS_SUGGESTION_MODE_ENABLED_TRIGGERED),this.getService(ic).isSuggestionModeEnabled()}catch(r){return this.getService(k).catch("Error in _isSuggestionModeEnabled: ",r),!1}},this._isSuggestionModeEnabled$=()=>{this.getService(k).log("%c[WB] Calling FUNCTION: isSuggestionModeEnabled$","color: green;");try{return this.trackEvent(Y.Events.Suggestions.IS_SUGGESTION_MODE_ENABLED_STREAM_TRIGGERED),this.getService(ic).isSuggestionModeEnabled$()}catch(r){return this.getService(k).catch("Error in _isSuggestionModeEnabled$: ",r),new Vt}},this._registerTarget=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: registerTarget","color: green;");try{this.trackEvent(Y.Events.Suggestions.REGISTER_TARGET_TRIGGERED),this.getService(ic).registerTarget(r)}catch(e){this.getService(k).catch("Error in _registerTarget: ",e)}},this._unregisterTarget=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: unregisterTarget","color: green;");try{this.trackEvent(Y.Events.Suggestions.UNREGISTER_TARGET_TRIGGERED),this.getService(ic).unregisterTarget(r)}catch(e){this.getService(k).catch("Error in _unregisterTarget: ",e)}},this._startSuggestion=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: startSuggestion","color: green;");try{this.trackEvent(Y.Events.Suggestions.START_SUGGESTION_TRIGGERED),this.getService(ic).startSuggestion(r)}catch(e){this.getService(k).catch("Error in _startSuggestion: ",e)}},this._commitSuggestion=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: commitSuggestion","color: green;");try{return this.trackEvent(Y.Events.Suggestions.COMMIT_SUGGESTION_TRIGGERED),this.getService(ic).commitSuggestion(r)}catch(e){return this.getService(k).catch("Error in _commitSuggestion: ",e),Promise.reject(e)}},this._getSuggestions=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getSuggestions","color: green;");try{return this.trackEvent(Y.Events.Suggestions.GET_SUGGESTIONS_TRIGGERED),this.getService(ic).getSuggestions(r)}catch(e){return this.getService(k).catch("Error in _getSuggestions: ",e),[]}},this._getSuggestions$=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getSuggestions$","color: green;");try{return this.trackEvent(Y.Events.Suggestions.GET_SUGGESTIONS_STREAM_TRIGGERED),this.getService(ic).getSuggestions$(r)}catch(e){return this.getService(k).catch("Error in _getSuggestions$: ",e),new Vt}},this._getPendingSuggestion=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getPendingSuggestion","color: green;");try{return this.trackEvent(Y.Events.Suggestions.GET_PENDING_SUGGESTION_TRIGGERED),this.getService(ic).getPendingSuggestion(r)}catch(e){return this.getService(k).catch("Error in _getPendingSuggestion: ",e),null}},this._getPendingSuggestion$=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getPendingSuggestion$","color: green;");try{return this.trackEvent(Y.Events.Suggestions.GET_PENDING_SUGGESTION_STREAM_TRIGGERED),this.getService(ic).getPendingSuggestion$(r)}catch(e){return this.getService(k).catch("Error in _getPendingSuggestion$: ",e),new Vt}},this._on=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.trackEvent(Y.Events.Suggestions.ON_TRIGGERED,{payload:{action:r}}),this.getService(ic).onAction(r)}catch(e){return this.getService(k).catch("Error in _on: ",e),ce(null)}},this.getService(k).log("%c[WB] Creating CLASS: SuggestionElement","color: blue;"),this.enableSuggestionMode=this._enableSuggestionMode,this.disableSuggestionMode=this._disableSuggestionMode,this.isSuggestionModeEnabled=this._isSuggestionModeEnabled,this.isSuggestionModeEnabled$=this._isSuggestionModeEnabled$,this.registerTarget=this._registerTarget,this.unregisterTarget=this._unregisterTarget,this.startSuggestion=this._startSuggestion,this.commitSuggestion=this._commitSuggestion,this.getSuggestions=this._getSuggestions,this.getSuggestions$=this._getSuggestions$,this.getPendingSuggestion=this._getPendingSuggestion,this.getPendingSuggestion$=this._getPendingSuggestion$,this.on=this._on}};var ac=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A,M,B,q){this.analyticsService=e,this.configService=t,this.docService=i,this.databaseService=a,this.authService=l,this.domService=c,this.afAuth=d,this.iamService=m,this.avatarService=u,this.contactService=_,this.storageService=I,this.dialog=A,this.loggingService=M,this.notificationService=B,this.commonDbService=q,this.tagAnnotations$=new Se({}),this.tagAnnotationsByDocumentId$=new Se({}),this.documentPaths=null,this.allowedElementIds$=new Se([]),this.addTagMode$=new Se(!1),this.enableTextTags$=new Se(!1),this.loggingService.log("%c[WB] Creating CLASS: TagService","color: blue;"),this.databaseService.getDb().pipe($e(ae=>!!ae),ut(1)).subscribe(ae=>{ae&&this.getDocumentPaths()},ae=>{this.loggingService.catch("Error in TagService getDb subscription: ",ae)}),this.domService.onWindowPointerMove$().subscribe(ae=>{if(this.addTagMode$.value){this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement);let _e=this.domService.getBackgroundElement(ae.clientX,ae.clientY);_e&&(this.isElementInsideAllowedElements(_e)?GN(ae.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement=_e,this.domService.highlightElement(this.hightlightElement,N.CURSOR.TAG_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},ae=>{this.loggingService.catch("Error in TagService onWindowPointerMove$ subscription: ",ae)}),this.domService.onWindowKeyupEsc$().subscribe(ae=>{this.addTagMode$.value&&this.disableAddTagMode()},ae=>{this.loggingService.catch("Error in TagService onWindowKeyupEsc$ subscription: ",ae)}),this.domService.onDocumentClick$().subscribe(ae=>{if(ae&&this.addTagMode$.value){if(ae.preventDefault(),ae.stopPropagation(),!GN(ae.target)){let _e=this.domService.getBackgroundElement(ae.clientX,ae.clientY);_e&&this.isElementInsideAllowedElements(_e)&&this.addTag(ae)}this.disableAddTagMode()}},ae=>{this.loggingService.catch("Error in TagService onDocumentClick$ subscription: ",ae)}),this.addTagMode$.subscribe(ae=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),ae?this.domService.addClassToElement(document.body,"snippyly-add-tag-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-tag-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},ae=>{this.loggingService.catch("Error in TagService addTagMode$ subscription: ",ae)}),this.domService.onWindowKeyupBackspace$().subscribe(ae=>{this.deleteTagPinAnnotations("keyupBackspace")},ae=>{this.loggingService.catch("Error in TagService onWindowKeyupBackspace$ subscription: ",ae)}),this.domService.onWindowKeyupDelete$().subscribe(ae=>{this.deleteTagPinAnnotations("keyupDelete")},ae=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ae)}),this.domService.getDeleteCommmentAnnotations$().subscribe(ae=>{ae?.length&&(ae?.filter(re=>re.type==="tag")).forEach(re=>X(this,null,function*(){yield this.deleteTagPinAnnotation(re)}))},ae=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ae)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$()}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllTagAnnotations(e,t,i){this.loggingService.log("%c[WB] Calling FUNCTION: getAllTagAnnotations","color: green;");let a,l;try{if(e&&(l=Qn(e)),t&&typeof t=="object"){let c=Oi(t);a=Qn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",c)}return br(this.afAuth).pipe($e(c=>!!c),ye(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),ye(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(d=>(c.featureAllowed=d,c))):ce(c)),ye(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(ge(d=>(c.featureAllowed=!d,c))):ce(c)),ye(c=>c.featureAllowed?ce(c).pipe(ye(d=>this.docService.getDocumentPaths$().pipe(ge(m=>(this.documentPaths=m,d.documentPaths=m,d)))),ye(d=>this.getDataFromDocumentId(l).pipe(ge(m=>(d.annotations=m||[],h({},d))))),ye(d=>this.docService.getLocation$().pipe(ge(m=>(d.location=m,d)))),ye(d=>this.docService.getLocations$().pipe(ge(m=>(d.customLocations=m,d)))),ge(d=>{if(d.filteredAnnotations=[],l&&!a)return d.filteredAnnotations=d.annotations?.slice(),d;{let m=[];return a?m.push(a):(m.push(d?.location?.locationId),m.push(...Object.values(d?.customLocations||[]).map(u=>u.locationId))),d.filteredAnnotations=this.filterAnnotationsByLocationIds(d?.annotations,m),d}}),ye(d=>i?ce(d):d?.annotations?.length?this.domService.onWindowResize$().pipe(ge(()=>d)):ce(d)),ye(d=>i?ce(d):d?.annotations?.length?this.domService.onDomChange$("TagService getAllTagAnnotations").pipe(ge(()=>d)):ce(d)),ge(d=>(d?.filteredAnnotations?.forEach(m=>{this.calculateTagAnnotationPosition(m)}),d)),ye(d=>d?.filteredAnnotations?ce(d?.filteredAnnotations||[]):ce([]))):ce([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>y(h({},t),{user:i})))),ye(t=>Mo(t.config,t.user,je.TAG)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Tag feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe($e(t=>!!t),ye(t=>this.configService?.getApiKey()&&this.documentPaths?.tag?this.commonDbService.dbListener({feature:"allTags",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(i=>i?.data),ge(i=>{let a=[];return i&&(a=Object.values(i).filter(l=>typeof l=="object")),this.setTagAnnotationsByDocumentId(e||this.documentPaths?.documentId,a),a})):ce([])))}setTagAnnotationsByDocumentId(e,t){try{e&&this.tagAnnotationsByDocumentId$.next(y(h({},this.tagAnnotationsByDocumentId$.value),{[e]:t}))}catch(i){this.loggingService.catch("Error in TagService setTagAnnotationsByDocumentId:",i)}}filterAnnotationsByLocationIds(e,t){try{return e.filter(i=>t.includes(i.locationId))}catch(i){return this.loggingService.catch("Error in TagService filterAnnotationsByLocations:",i),[]}}calculateTagAnnotationPosition(e){try{if(e.targetElement){let t=this.domService.getXPath(e.targetElement?.xpath);if(t){let i=t.iterateNext();if(i&&Kr(i)){let a=i.getBoundingClientRect();if(a&&a.width&&a.height){let{height:l,width:c}=op(i);e.position={top:l*e.targetElement.topPercentage/100,left:c*e.targetElement.leftPercentage/100}}else e.position=null}else e.position=null}else e.position=null}}catch(t){this.loggingService.catch("Error in TagService calculateTagAnnotationPosition:",t)}}filterPinAnnotations(e,t,i){this.loggingService.log("%c[WB] Calling FUNCTION: filterPinAnnotations","color: green;");try{let a=e?Object.values(e):[];a.forEach((c,d)=>{c?.annotationId&&(c.annotationIndex=d+1)});let l=[];if(t)i?l=a.filter(c=>c.locationId===i):l=a.slice();else{let c=this.docService.getLocation();c&&c.locationId?l=a.filter(d=>d.locationId===c.locationId):l=a.filter(d=>!d.locationId)}return l}catch(a){return this.loggingService.catch("Error in TagService filterPinAnnotations:",a),[]}}addTag(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: addTag","color: green;");try{let i=this.authService.getUser();if(i)if(i.isReadOnly||i.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let a=new PO;a.from=i,a.color=N.DEFAULT_ANNOTATION_COLOR,a.resolved=!1,a.lastUpdated=this.timestamp;let{topPositionX:l,topPositionY:c}=this.domService.getTopLeftPosition();a.positionX=l,a.positionY=c;let d=this.domService.getCurrentWindowSizeValue();if(a.screenWidth=d.screenWidth,a.screenHeight=d.screenHeight,a.screenScrollHeight=d.screenScrollHeight,a.taggedElementPath="",e&&(a.targetElement=this.domService.getTargetElementForCursorPosition(e)),t&&(a.targetTextRange=t),a?.targetElement?.xpath){let m=this.domService.getXPath(a.targetElement.xpath);if(m){let u=m.iterateNext();u&&(Kr(u)||(a.targetElement=null))}}this.setLocationToTagAnnotation(a),a.pageInfo=no(),a.pageInfo&&(a.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),this.saveTagToDb(a)}}catch(i){this.loggingService.catch("Error in TagService addTag: ",i)}}setLocationToTagAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location);try{let i;e.targetElement?.xpath?i=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetTextRange?.commonAncestorContainer&&(i=this.domService.getElementFromXPath(e.targetTextRange.commonAncestorContainer));let a=this.docService.getAdditionLocationFromElement(i);if(a){let l=this.docService.addLocation({location:a,source:"internal"});l?.[0]&&(e.locationId=l[0].locationId,e.location=l[0].location)}}catch{}}catch(t){this.loggingService.catch("Error in TagService setLocationToTagAnnotation:",t)}}saveTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveTagToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(je.TAG)&&this.docService.getDocumentPaths$().pipe($e(t=>!!t),ut(1),ye(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe($e(i=>!!i),ut(1),ye(i=>{if(this.documentPaths?.tag){e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo&&(e.pageInfo.tagUrl=this.generateTagUrl(e));let a=JSON.parse(JSON.stringify(e));return a.position=null,this.domService.toggleAnnotationSelection(a),e.targetTextRange&&sessionStorage.setItem(N.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.analyticsService.trackEvent(Y.Events.Tag.TAG_DRAFT_ADDED,{annotationId:e.annotationId}),this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return ce(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService saveTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService saveTagToDb: ",t)}}updateTag(e,t=!1,i){try{i&&this.setLocationToTagAnnotation(e),t&&this.updateNotificationsDatabase(e,_3.UPDATED),this.updateTagToDb(e)}catch(a){this.loggingService.catch("Error in TagService updateTag: ",a)}}resolveTag(e){try{e.resolved=!0,this.domService.resetSelectedAnnotationsMap(!1),this.updateNotificationsDatabase(e,_3.RESOLVED),this.updateTagToDb(e),this.domService.updateSelectedAnnotationInMap([e]),this.analyticsService.trackEvent(Y.Events.Tag.TAG_RESOLVED,{annotationId:e.annotationId})}catch(t){this.loggingService.catch("Error in TagService resolveTag: ",t)}}updateTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateTagToDb","color: green;");try{if(e?.targetElement?.xpath){let t=this.domService.getXPath(e.targetElement.xpath);if(t){let i=t.iterateNext();i&&(Kr(i)||(e.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(je.TAG)&&this.docService.getDocumentPaths$().pipe($e(t=>!!t),ut(1),ye(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe($e(i=>!!i),ut(1),ye(i=>{if(this.documentPaths?.tag&&e?.annotationId){let a=JSON.parse(JSON.stringify(e));return a.position=null,this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return ce(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService updateTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService updateTagToDb: ",t)}}deleteTagPinAnnotations(e){try{let t=this.domService.getSelectedAnnotationsMap(),i=this.authService.getUser(),a=[];Object.keys(t).forEach(l=>X(this,null,function*(){let c=t[l];c.type==="tag"&&i&&c.from&&(i?.isAdmin||c.from.userId===i.userId)&&a.push(c)})),a?.length&&(this.analyticsService.trackEvent(Y.Events.Tag.TAG_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(l=>l.annotationId).join()}),this.dialog.open(ll,{panelClass:"velt-mat-dialog-container",data:{title:"Delete tag?",message:"This selected tag will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"tag"}}).afterClosed().pipe(ut(1)).subscribe(l=>{l&&(a.forEach(c=>X(this,null,function*(){yield this.deleteTagPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${N.SNIPPYLY_HIGHLIGHT}]`).forEach(d=>{this.domService.removeHighlightFromElement(d)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"tag")}catch(t){this.loggingService.catch("Error in TagService deleteTagPinAnnotations: ",t)}}deleteTagPinAnnotation(e){return this.authService.isFeatureAllowed(je.TAG)&&this.documentPaths?.tag&&e?.annotationId?(this.updateNotificationsDatabase(e,_3.DELETED),this.analyticsService.trackEvent(Y.Events.Tag.TAG_DELETED,{annotationId:e.annotationId}),this.commonDbService.deleteData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0}})):Promise.resolve()}enableAddTagMode(){this.authService.isFeatureAllowed(je.TAG)?(this.analyticsService.trackEvent(Y.Events.Tag.TAG_ADD_MODE_ENABLED),this.addTagMode$.next(!0)):this.loggingService.catch("Error in TagService enableAddTagMode: ","Tag feature is not enabled.")}disableAddTagMode(){this.analyticsService.trackEvent(Y.Events.Tag.TAG_ADD_MODE_DISABLED),this.addTagMode$.next(!1)}addTagModeChange(){return this.addTagMode$.asObservable()}enableTextTags(e){this.enableTextTags$.next(e)}getEnableTextTags$(){return this.enableTextTags$.asObservable()}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in TagService isElementInsideAllowedElements: ",t),!1}}attachTag(e,t=[]){let i=nl(e,t);if(i){let a=this.domService.getXPath(i),l=this.getTagPinAnnotationObject();l&&(l.targetElement={xpath:a,topPercentage:50,leftPercentage:90},this.saveTagToDb(l))}}getTagPinAnnotationObject(){let e=this.authService.getUser();if(e)if(e.isReadOnly||e.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let t=new PO;t.from=e,t.color=N.DEFAULT_ANNOTATION_COLOR,t.resolved=!1,t.lastUpdated=this.timestamp;let{topPositionX:i,topPositionY:a}=this.domService.getTopLeftPosition();t.positionX=i,t.positionY=a;let l=this.domService.getCurrentWindowSizeValue();t.screenWidth=l.screenWidth,t.screenHeight=l.screenHeight,t.screenScrollHeight=l.screenScrollHeight,t.taggedElementPath="";let c=this.docService.getLocation();return c&&(t.locationId=c.locationId,t.location=c.location),t}return null}updateNotificationsDatabase(e,t){try{let i={annotationData:e,actionType:t,notificationSource:"tag"};this.notificationService.updateNotificationDatabase(i)}catch(i){this.loggingService.catch("Error in TagService updateNotificationsDatabase: ",i)}}getUserContacts$(){return this.contactService.getUserContacts$()}addUserContact(e){this.contactService.addUserContact(e)}getTagUrl(e){try{return e?.pageInfo?.tagUrl?e.pageInfo.tagUrl:(e?.pageInfo||(e.pageInfo=no(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.tagUrl=this.generateTagUrl(e),this.updateTag(e),e.pageInfo?.tagUrl)}catch(t){this.loggingService.catch("Error in TagService getTagUrl: ",t);return}}uploadFile(e,t){let i=`${N.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${N.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`;return this.documentPaths?.organizationId&&(i=`${N.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${N.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${N.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`),this.storageService.uploadFile({path:i,file:e})}downloadAttachment(e){this.storageService.downloadAttachment(e)}deleteAttachment(e){return this.storageService.deleteAttachment({attachment:e})}generateTagUrl(e){let t=new URL(window.location.href);return t.searchParams.delete(N.URL_PARAMS.TAG_ID),t.searchParams.append(N.URL_PARAMS.TAG_ID,e.annotationId),t.href}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(Ft),K(st),K($n),K(qe),K(Ue),K(eo),K(Vn),K(bm),K(vn),K(Fp),K(Lo),K(k),K(mn),K(yn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var VU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: TagElement","color: blue;"),this.getAllTagAnnotations=this._getAllTagAnnotations,this.deleteTag=this._deleteTag,this.allowedElementIds=this._allowedElementIds,this.attachTag=this._attachTag,this.addTagModeChange=this._addTagModeChange}_getAllTagAnnotations(o,r){this.getService(k).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(Y.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:o,location:r}}),this.getService(ac).getAllTagAnnotations(o,r)}catch(e){return this.getService(k).catch("Error in _getLiveTagsOnCurrentDocument: ",e),ce(null)}}_deleteTag(){this.getService(k).log("%c[WB] Calling FUNCTION: deleteTag","color: green;");try{this.trackEvent(Y.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(ac).deleteTagPinAnnotations("tagElement")}catch(o){this.getService(k).catch("Error in _deleteTag: ",o)}}_allowedElementIds(o){this.getService(k).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(Y.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(ac).setAllowedElementIds(o)}catch(r){this.getService(k).catch("Error in allowedElementIds: ",r)}}_attachTag(o){this.getService(k).log("%c[WB] Calling FUNCTION: attachTag","color: green;");try{this.trackEvent(Y.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:o}}),this.getService(ac).attachTag(o,["id","data-id"])}catch(r){this.getService(k).catch("Error in _attachTag: ",r)}}_addTagModeChange(){this.getService(k).log("%c[WB] Calling FUNCTION: addTagModeChange","color: green;");try{return this.trackEvent(Y.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(ac).addTagModeChange()}catch(o){return this.getService(k).catch("Error in _addTagModeChange: ",o),ce(!1)}}};var BU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: ViewsElement","color: blue;"),this.getUniqueViewsByUser=this._getUniqueViewsByUser,this.getUniqueViewsByDate=this._getUniqueViewsByDate}_getUniqueViewsByUser(o){this.getService(k).log("%c[WB] Calling FUNCTION: _getUniqueViewsByUser","color: green;");try{return this.trackEvent(Y.Events.Views.GET_UNIQUE_VIEWS_BY_USER_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(Ml).getUniqueViewsByUser(o)}catch(r){return this.getService(k).catch("Error in getUniqueViewsByUser: ",r),ce({})}}_getUniqueViewsByDate(o){this.getService(k).log("%c[WB] Calling FUNCTION: _getUniqueViewsByDate","color: green;");try{return this.trackEvent(Y.Events.Views.GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(Ml).getUniqueViewsByDate(o)}catch(r){return this.getService(k).catch("Error in getUniqueViewsByDate: ",r),ce({})}}};var WO=(()=>{let o=class o{constructor(e,t){this.docService=e,this.loggingService=t}updateDocuments(e){return X(this,null,function*(){try{return yield this.docService.updateDocuments(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateDocuments: ",t),null}})}updateLocations(e){return X(this,null,function*(){try{return yield this.docService.updateLocations(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateLocations: ",t),null}})}fetchDocuments(e){return X(this,null,function*(){try{let t=yield this.docService.fetchDocuments(e),i=[];return t.forEach(a=>{let l=a?.docIamConfig??{},c=a?.metadata??{};c.disabled=!!l?.disabled,c.id=c?.clientDocumentId,c.documentId=c?.clientDocumentId,delete c?.clientDocumentId,c.organizationId=c?.clientOrganizationId,delete c?.clientOrganizationId,delete c?.pageInfo,delete c?.veltFolderId,i.push(c)}),{data:i.reduce((a,l)=>(l?.documentId&&(a[l.documentId]=l),a),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchDocuments: ",t),{data:null}}})}fetchFolders(e){return X(this,null,function*(){try{let t=yield this.docService.fetchFolders(e),i=t?.parentFolders?.map(l=>{let c=l?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,h({},c)});return{data:(t?.data?.map(l=>{let c=l?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,h(h({},c),e?.folderId?{subFolders:i}:{})})).reduce((l,c)=>(c?.folderId&&(l[c.folderId]=c),l),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchFolders: ",t),{data:null}}})}};o.\u0275fac=function(t){return new(t||o)(K(st),K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var jU=(()=>{let o=class o{constructor(e,t,i,a,l){this.authService=e,this.coreActionsService=t,this.docService=i,this.iamService=a,this.loggingService=l,this.veltInitState$=new Se(void 0);try{this.loggingService.log("%c[WB] Creating CLASS: VeltService","color: blue;");let c=this.authService.getUser$(),d=this.docService.getDocumentPaths$(),m=this.iamService.isUserAllowed$();Cn([c,d,m]).subscribe(([u,_,I])=>{u&&_&&I?this.veltInitState$.next(!0):this.veltInitState$.next(!1)}),this.getVeltInitState$().subscribe(u=>{this.coreActionsService.triggerAction(tt.DOCUMENT_INIT,u)})}catch(c){this.loggingService.catch("Error in VeltService constructor: ",c)}}getVeltInitState$(){try{return this.veltInitState$.asObservable().pipe(_t())}catch(e){return this.loggingService.catch("Error in VeltService getVeltInitState$: ",e),ce(void 0)}}};o.\u0275fac=function(t){return new(t||o)(K(qe),K(nr),K(st),K(Vn),K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var $U=class{constructor(o){this.injector=o,this.initConfig=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: initConfig","color: green;");try{r?typeof r!="string"?this.getService(k).catch("Error in initConfig: ","Apikey must be string."):r?.trim()?this.getService(qe).setApiKey(r?.trim(),e):this.getService(k).catch("Error in initConfig: ","Apikey is not provided."):this.getService(k).catch("Error in initConfig: ","Apikey is not provided.")}catch(t){this.getService(k).catch("Error in initConfig: ",t)}},this.identify=(r,e,t)=>(this.getService(k).log("%c[WB] Calling FUNCTION: identify","color: green;"),new Promise((i,a)=>{try{typeof r=="object"&&(r=JSON.parse(JSON.stringify(r)));let l=this.getService(Ft).getApiKey(),c=cd(l,r.userId);if(t?.ha||this.getService(ct).trackEvent(Y.Events.Core.IDENTIFY,{apiKey:l,clientUserId:r.userId,snippylyUserId:c,forceReset:e?.forceReset,user:this.getService(qe).getUserWithoutContacts(r),source:"client",fromProvider:t?.fromProvider},!0,c,r?.userId),!(r&&r.userId))this.getService(k).catch("Error in identify: ","Missing userId in config data."),e?.throwError?a("Missing userId in config data."):i(null);else if(typeof r.userId!="string")this.getService(k).catch("Error in identify: ","userId must be string."),e?.throwError?a("userId must be string."):i(null);else if(r?.groupId&&typeof r?.groupId!="string")this.getService(k).catch("Error in identify: ","groupId must be string."),e?.throwError?a("groupId must be string."):i(null);else{if(r?.groupId)if(r?.groupId?.match(/^[a-zA-Z0-9_]*$/))r.clientGroupId=r.groupId;else{let m=r.groupId;r.clientGroupId=m,r.groupId=It(m)}if(r?.organizationId){let m=r.organizationId;r.clientOrganizationId=m,r.organizationId=It(m)}delete r.isAdmin;let d=N.REGEX_URL_FOR_USER_NAME;r?.name&&d.test(r?.name)&&(r.name=r.name?.split(".")?.slice(0,-1)?.join(".")),r.clientUserName=r.name,r?.name&&r?.name?.length>30&&(r.name=r.name.slice(0,30)),this.getService(qe).initializeClient(r,e||{},new Date().getTime(),void 0,"external").then(m=>{let u;try{m&&(u=JSON.parse(JSON.stringify(m)))}catch{}i(u)}).catch(m=>{this.getService(k).catch("Error in identify: ",m),e?.throwError?a(m):i(null)})}}catch(l){this.getService(k).catch("Error in identify: ",l),e?.throwError?a(l):i(null)}})),this.updateUser=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{if(this.getService(k).catch("DEPRECATED: ","'updateUser' method is deprecated."),r&&typeof r=="object"){if(r=JSON.parse(JSON.stringify(r)),r?.groupId)if(r?.groupId?.match(/^[a-zA-Z0-9_]*$/))r.clientGroupId=r.groupId;else{let e=r.groupId;r.clientGroupId=e,r.groupId=It(e)}delete r.isAdmin,this.getService(qe).updateUser(r)}else this.getService(k).catch("Error in updateUser: ","Invalid user object provided.")}catch(e){this.getService(k).catch("Error in updateUser: ",e)}},this.signOutUser=r=>(this.getService(k).log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),r?.ha||this.trackEvent(Y.Events.Core.SIGN_OUT_USER_TRIGGERED),new Promise((e,t)=>X(this,null,function*(){try{yield this.getService(qe).signOutUser("external"),e(null)}catch(i){this.getService(k).catch("Error in signOutUser: ",i),e(null)}}))),this.setDocument=(r,e,t,i)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setDocument","color: green;");try{i?.ha||this.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:r,documentMetadata:e,methodName:"setDocument",source:"external"}}),r&&r.trim()?(e&&(typeof e=="object"?e=JSON.parse(JSON.stringify(e)):this.getService(k).catch("Error in setDocument: ","Invalid documentMetadata provided.")),yield this.getService(st).setDocument({documentId:r,documentMetadata:e,options:t,source:"external"})):this.getService(k).catch("Error in setDocument: ","Invalid document id provided.")}catch(a){this.getService(k).catch("Error in setDocument: ",a)}}),this.setDocumentId=(r,e,t)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setDocumentId","color: green;");try{if(t?.ha||this.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:r,organizationId:e,methodName:"setDocumentId",source:"external"}}),r&&r.trim())return yield this.getService(st).setDocumentId({documentId:r,clientOrganizationId:e,source:"external"});this.getService(k).catch("Error in setDocumentId: ","Invalid document id provided.")}catch(i){this.getService(k).catch("Error in setDocumentId: ",i)}}),this.setDocuments=(r,e,t)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setDocuments","color: green;");try{t?.ha||this.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:r,options:e,methodName:"setDocuments",source:"external"}}),typeof r=="object"&&r instanceof Array?(r=JSON.parse(JSON.stringify(r)),r=r.filter(i=>typeof i=="object"&&i!==null&&i.id?.trim()),r.length?yield this.getService(st).setDocuments({documents:r,options:e,source:"external"}):this.getService(k).catch("Error in setDocuments: ","Invalid documents provided.")):this.getService(k).catch("Error in setDocuments: ","Invalid documents provided.")}catch(i){this.getService(k).catch("Error in setDocuments: ",i)}}),this.setRootDocument=(r,e)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setRootDocument","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,{payload:{document:r,methodName:"setRootDocument",source:"external"}}),typeof r=="object"?(r=JSON.parse(JSON.stringify(r)),r.id?yield this.getService(st).setRootDocument({document:r,source:"external"}):this.getService(k).catch("Error in setRootDocument: ","Invalid document provided.")):this.getService(k).catch("Error in setRootDocument: ","Invalid document provided.")}catch(t){this.getService(k).catch("Error in setRootDocument: ",t)}}),this.unsetDocumentId=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{r?.ha||this.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:"external"}}),this.getService(st).unsetDocumentId({source:"external"})}catch(e){this.getService(k).catch("Error in unsetDocumentId: ",e)}},this.unsetDocuments=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{r?.ha||this.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:"external"}}),this.getService(st).unsetDocuments({source:"external"})}catch(e){this.getService(k).catch("Error in unsetDocuments: ",e)}},this.fetchDocuments=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: fetchDocuments","color: green;");try{return e?.ha||this.trackEvent(Y.Events.Core.FETCH_DOCUMENTS_TRIGGERED,{payload:{options:r}}),this.getService(WO).fetchDocuments(r)}catch(t){return this.getService(k).catch("Error in fetchDocuments: ",t),Promise.resolve({data:null})}},this.updateDocuments=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: updateDocuments","color: green;");try{return e?.ha||this.trackEvent(Y.Events.Core.UPDATE_DOCUMENTS_TRIGGERED,{payload:{request:r}}),this.getService(WO).updateDocuments(r)}catch(t){return this.getService(k).catch("Error in updateDocuments: ",t),Promise.resolve({data:null})}},this.updateLocations=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: updateLocations","color: green;");try{return e?.ha||this.trackEvent(Y.Events.Core.UPDATE_LOCATIONS_TRIGGERED,{payload:{request:r}}),this.getService(WO).updateLocations(r)}catch(t){return this.getService(k).catch("Error in updateLocations: ",t),Promise.resolve({data:null})}},this.fetchFolders=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: fetchFolders","color: green;");try{return e?.ha||this.trackEvent(Y.Events.Core.FETCH_FOLDERS_TRIGGERED,{payload:{options:r}}),this.getService(WO).fetchFolders(r)}catch(t){return this.getService(k).catch("Error in fetchFolders: ",t),Promise.resolve({data:null})}},this.setUserDataProvider=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setUserDataProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_USER_DATA_PROVIDER_TRIGGERED),this.getService(An).setUserDataProvider(r)}catch(t){this.getService(k).catch("Error in setUserDataProvider: ",t)}},this.setAnonymousUserDataProvider=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setAnonymousUserDataProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ANONYMOUS_USER_DATA_PROVIDER_TRIGGERED),this.getService(An).setAnonymousUserDataProvider(r)}catch(t){this.getService(k).catch("Error in setAnonymousUserDataProvider: ",t)}},this.setDataProviders=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setDataProviders","color: green;");try{if(e?.ha||this.trackEvent(Y.Events.Core.SET_DATA_PROVIDERS_TRIGGERED),r.comment&&this.getService(ol).setCommentAnnotationDataProvider(r.comment),r.user&&this.getService(An).setUserDataProvider(r.user),r.reaction&&this.getService(Jc).setReactionAnnotationDataProvider(r.reaction),r.anonymousUser&&this.getService(An).setAnonymousUserDataProvider(r.anonymousUser),r.recorder&&this.getService(il).setRecorderAnnotationDataProvider(r.recorder),r.notification&&this.getService(ym).setNotificationDataProvider(r.notification),r.activity&&this.getService(Rp).setActivityDataProvider(r.activity),r.attachment)if(r.comment)this.getService(Xc).setAttachmentDataProvider(r.attachment);else throw new Error("Comment data provider is required for attachment data provider")}catch(t){this.getService(k).catch("Error in setDataProviders: ",t)}},this.setPermissionProvider=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setPermissionProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_PERMISSION_PROVIDER_TRIGGERED),this.getService(al).setPermissionProvider(r)}catch(t){this.getService(k).catch("Error in setPermissionProvider: ",t)}},this.setEncryptionProvider=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ENCRYPTION_PROVIDER_TRIGGERED),this.getService(Ft).setEncryptionProvider(r)}catch(t){this.getService(k).catch("Error in setEncryptionProvider: ",t)}},this.setVeltAuthProvider=r=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{return yield this.getService(qe).setVeltAuthProvider(r)}catch(e){return this.getService(k).catch("Error in setVeltAuthProvider: ",e),null}}),this.getDocumentId=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getDocumentId","color: green;");try{return r?.ha||this.trackEvent(Y.Events.Core.GET_DOCUMENT_ID_TRIGGERED),this.getService(st).getDocumentId()}catch(e){this.getService(k).catch("Error in getDocumentId: ",e)}},this.setLocation=(r,e,t)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setLocation","color: green;");try{t?.ha||this.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:r,appendLocation:e,methodName:"setLocation",source:"external"}}),r&&typeof r=="object"?e?this.getService(st).addLocation({location:r,source:"external"}):yield this.getService(st).setLocation({location:r,source:"external"}):this.getService(k).catch("Error in setLocation: ","Invalid location params provided.")}catch(i){this.getService(k).catch("Error in setLocation: ",i)}}),this.setRootLocation=(r,e)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setRootLocation","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:r,methodName:"setRootLocation",source:"external"}}),typeof r=="object"?(r=JSON.parse(JSON.stringify(r)),r.id?yield this.getService(st).setRootLocation({location:r,source:"external"}):this.getService(k).catch("Error in setRootLocation: ","Invalid location provided.")):this.getService(k).catch("Error in setRootLocation: ","Invalid location provided.")}catch(t){this.getService(k).catch("Error in setRootLocation: ",t)}}),this.setLocations=(r,e,t)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setLocations","color: green;");try{t?.ha||this.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:r,options:e,methodName:"setLocations",source:"external"}}),r&&Array.isArray(r)?yield this.getService(st).setLocations({locations:r,options:e,source:"external"}):this.getService(k).catch("Error in setLocations: ","Invalid location params provided.")}catch(i){this.getService(k).catch("Error in setLocations: ",i)}}),this.addLocation=(r,e)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: addLocation","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:r,methodName:"addLocation",source:"external"}}),r&&typeof r=="object"?this.getService(st).addLocation({location:r,source:"external"}):this.getService(k).catch("Error in addLocation: ","Invalid location params provided.")}catch(t){this.getService(k).catch("Error in addLocation: ",t)}}),this.setScrollableElementsIds=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setScrollableElementsIds","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED,{payload:{ids:r}}),r?this.getService(Ue).setScrollableElementsIds(r):this.getService(k).catch("Error in setScrollableElementsIds: ","Invalid ids provided.")}catch(t){this.getService(k).catch("Error in setScrollableElementsIds: ",t)}},this.removeLocation=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: removeLocation","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{location:r},methodName:"removeLocation",source:"external"}),this.getService(st).removeLocation({location:r,source:"external"})}catch(t){this.getService(k).catch("Error in removeLocation: ",t)}},this.removeLocations=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: removeLocations","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:r},methodName:"removeLocations",source:"external"}),this.getService(st).removeLocations({locations:r,source:"external"})}catch(t){this.getService(k).catch("Error in removeLocations: ",t)}},this.unsetLocationIds=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:r},methodName:"unsetLocationIds",source:"external"}),this.getService(st).unsetLocationIds(r,"external")}catch(t){this.getService(k).catch("Error in unsetLocationIds: ",t)}},this.excludeLocationIds=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: excludeLocationIds","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.EXCLUDE_LOCATION_IDS_TRIGGERED,{payload:{ids:r}}),typeof r=="object"&&r instanceof Array&&(r=r.filter(t=>typeof t=="string"),this.getService(st).excludeLocationIds(r))}catch(t){this.getService(k).catch("Error in excludeLocationIds: ",t)}},this.updateContactList=(r,e,t)=>{this.getService(k).log("%c[WB] Calling FUNCTION: updateContactList","color: green;");try{t?.ha||this.trackEvent(Y.Events.Core.UPDATE_CONTACT_LIST_TRIGGERED,{payload:{userContacts:r,config:e}}),typeof r=="object"&&r instanceof Array&&(!e||e&&typeof e=="object")&&(r=JSON.parse(JSON.stringify(r)),this.getService(vn).updateContactList(r,e))}catch(i){this.getService(k).catch("Error in updateContactList: ",i)}},this.removeScrollableElementsIds=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: removeScrollableElementsIds","color: green;");try{r?.ha||this.trackEvent(Y.Events.Core.REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED),this.getService(Ue).removeScrollableElementsIds()}catch(e){this.getService(k).catch("Error in removeScrollableElementsIds: ",e)}},this.getPresenceElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getPresenceElement","color: green;");try{let e=new DU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getPresenceElement: ",e),null}},this.getCursorElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getCursorElement","color: green;");try{let e=new SU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getCursorElement: ",e),null}},this.getCommentElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getCommentElement","color: green;");try{let e=new gU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getCommentElement: ",e),null}},this._suggestionElement=null,this.getSuggestionElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getSuggestionElement","color: green;");try{return this._suggestionElement||(this._suggestionElement=new UU(this.injector)),r?.ha&&this._suggestionElement.ha(r.ha),this._suggestionElement}catch(e){return this.getService(k).catch("Error in getSuggestionElement: ",e),null}},this.getTagElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getTagElement","color: green;");try{let e=new VU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getTagElement: ",e),null}},this.getSelectionElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getSelectionElement","color: green;");try{let e=new RU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getSelectionElement: ",e),null}},this.getRecorderElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getRecorderElement","color: green;");try{let e=new AU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getRecorderElement: ",e),null}},this.getContactElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getContactElement","color: green;");try{let e=new uU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getContactElement: ",e),null}},this.getRewriterElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getRewriterElement","color: green;");try{let e=new MU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getRewriterElement: ",e),null}},this.getHuddleElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getHuddleElement","color: green;");try{let e=new kU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getHuddleElement: ",e),null}},this.getLiveStateSyncElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getLiveStateSyncElement","color: green;");try{let e=new EU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getLiveStateSyncElement: ",e),null}},this.getArrowElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getArrowElement","color: green;");try{let e=new vU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getArrowElement: ",e),null}},this.getViewsElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getViewsElement","color: green;");try{let e=new BU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getViewsElement: ",e),null}},this.getNotificationElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getNotificationElement","color: green;");try{let e=new TU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getNotificationElement: ",e),null}},this.getAutocompleteElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getAutocompleteElement","color: green;");try{let e=new mU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getAutocompleteElement: ",e),null}},this.getDocElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getDocElement","color: green;");try{let e=new yU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getDocElement: ",e),null}},this.getActivityElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getActivityElement","color: green;");try{let e=new cU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getActivityElement: ",e),null}},this.getAreaElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getAreaElement","color: green;");try{let e=new sU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getAreaElement: ",e),null}},this.getReactionElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getReactionElement","color: green;");try{let e=new OU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getReactionElement: ",e),null}},this.getCrdtElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getCrdtElement","color: green;");try{let e=new hU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getCrdtElement: ",e),null}},this.getMetadata=r=>X(this,null,function*(){try{return r?.ha||this.trackEvent(Y.Events.Core.GET_METADATA_TRIGGERED),this.getService(Qc).getGlobalMetadata()}catch(e){return this.getService(k).catch("Error in getMetadata: ",e),null}}),this.fetchDebugInfo=r=>X(this,null,function*(){try{return r?.ha||this.trackEvent(Y.Events.Core.FETCH_DEBUG_INFO_TRIGGERED),this.getService(Qc).getDebugInfo()}catch(e){return this.getService(k).catch("Error in fetchDebugInfo: ",e),null}}),this.getDebugInfo=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_DEBUG_INFO_TRIGGERED),this.getService(Qc).getDebugInfo$()}catch(e){return this.getService(k).catch("Error in getDebugInfo: ",e),ce(null)}},this.disableFeatures=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.DISABLE_FEATURES_TRIGGERED,{payload:{features:r}}),this.getService(Ft).disableFeatures(r)}catch(t){this.getService(k).catch("Error in disableFeatures: ",t)}},this.setDarkMode=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_DARK_MODE_TRIGGERED,{payload:{value:r}}),this.getService(yt).setDarkMode(r)}catch(t){this.getService(k).catch("Error in setDarkMode: ",t)}},this.enableLogs=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.ENABLE_LOGS_TRIGGERED),this.getService(Ft).enableLogs()}catch(e){this.getService(k).catch("Error in enableLogs: ",e)}},this.disableLogs=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.DISABLE_LOGS_TRIGGERED),this.getService(Ft).disableLogs(r)}catch(t){this.getService(k).catch("Error in disableLogs: ",t)}},this.isUserAllowed$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.IS_USER_ALLOWED_TRIGGERED),this.getService(Vn).isUserAllowed$()}catch(e){return this.getService(k).catch("Error in isUserAllowed$: ",e),ce(!1)}},this.getUser=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.GET_USER_TRIGGERED);let e=this.getService(qe).getUser();if(e&&typeof e=="object"){let t=JSON.parse(JSON.stringify(e));return t?.clientOrganizationId&&(t.organizationId=t.clientOrganizationId,delete t.clientOrganizationId),t?.clientGroupId&&(t.groupId=t.clientGroupId,delete t.clientGroupId),delete t.userSnippylyId,t}else return null}catch(e){return this.getService(k).catch("Error in getUser: ",e),null}},this.getCurrentUser=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_CURRENT_USER_TRIGGERED),this.getService(qe).getUser$().pipe(ge(e=>Vo(e)))}catch(e){return this.getService(k).catch("Error in getCurrentUser: ",e),ce(null)}},this.getHeartbeat=(r,e)=>{try{return e?.ha||this.trackEvent(Y.Events.Core.GET_HEARTBEAT_TRIGGERED),this.getService(IU).getHeartbeat(r)}catch(t){return this.getService(k).catch("Error in getHeartbeat: ",t),ce({data:null})}},this.getUserRole$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_USER_ROLE_TRIGGERED),this.getService(Vn).getRole$()}catch(e){return this.getService(k).catch("Error in getUserRole$: ",e),ce("")}},this.getUserPermissions=(r,e)=>X(this,null,function*(){try{return e?.ha||this.trackEvent(Y.Events.Core.GET_USER_PERMISSIONS_TRIGGERED,{payload:{request:r,source:"external"}}),this.getService(al).getUserPermissions(r)}catch(t){return this.getService(k).catch("Error in getUserPermissions$: ",t),{}}}),this.getCurrentUserPermissions=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_CURRENT_USER_PERMISSIONS_TRIGGERED),this.getService(al).getCurrentUserPermissions$()}catch(e){return this.getService(k).catch("Error in getCurrentUserPermissions: ",e),ce(null)}},this.getFeaturesAccessLevelIam$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED),this.getService(Vn).getFeaturesAccessLevel$()}catch(e){return this.getService(k).catch("Error in getFeaturesAccessLevel$: ",e),ce(void 0)}},this.isPlanExpired$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.IS_PLAN_EXPIRED_TRIGGERED),this.getService(qe).isPlanExpired$()}catch(e){return this.getService(k).catch("Error in isPlanExpired$: ",e),ce(!1)}},this.getCustomerMetadata$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_CUSTOMER_METADATA_TRIGGERED),this.getService(st).getCustomerMetadata$()}catch(e){return this.getService(k).catch("Error in getCustomerMetadata$: ",e),ce(null)}},this.getDocumentMetadata=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(st).getDocumentMetadata$()}catch(e){return this.getService(k).catch("Error in getDocumentMetadata: ",e),ce(null)}},this.getVeltInitState=r=>{try{return r?.ha,this.getService(jU).getVeltInitState$()}catch(e){return this.getService(k).catch("Error in getVeltInitState: ",e),ce(void 0)}},this.removeVeltContent=(r,e)=>{try{return e?.ha||this.trackEvent(Y.Events.Core.REMOVE_VELT_CONTENT_TRIGGERED),this.getService(Ue).removeSnippylyContent(r)}catch(t){return this.getService(k).catch("Error in removeVeltContent: ",t),""}},this.injectCustomCss=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.INJECT_CUSTOM_CSS_TRIGGERED),this.getService(k).log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;"),this.getService(Ue).setCustomCss(r)}catch(t){this.getService(k).catch("Error in injectCustomCss: ",t)}},this.setLanguage=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_LANGUAGE_TRIGGERED,{payload:{language:r}}),this.getService(Ns).setLanguage(r)}catch(t){this.getService(k).catch("Error in setLanguage: ",t)}},this.setTranslations=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_TRANSLATIONS_TRIGGERED,{payload:{translations:r}}),this.getService(Ns).setTranslations(r)}catch(t){this.getService(k).catch("Error in setTranslations: ",t)}},this.enableAutoTranslation=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.ENABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ns).enableAutoTranslation()}catch(e){this.getService(k).catch("Error in enableAutoTranslation: ",e)}},this.disableAutoTranslation=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.DISABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ns).disableAutoTranslation()}catch(e){this.getService(k).catch("Error in disableAutoTranslation: ",e)}},this.sf=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SF_TRIGGERED,{payload:{value:r}}),r?(document.querySelector(N.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(N.TAGS.SUPERFLOW_TOOLBAR))&&this.getService(Ft).setSF(r):this.getService(Ft).setSF(r)}catch(t){this.getService(k).catch("Error in sf: ",t)}},this.st=(r,e)=>{try{e?.ha,this.getService(Ft).setSdkType(r)}catch(t){this.getService(k).catch("Error in st: ",t)}},this.getService=r=>this.injector.get(r),this.on=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: on","color: green;");try{return e?.ha,this.getService(nr).onAction(r)}catch(t){return this.getService(k).catch("Error in on: ",t),ce(null)}},this.setUiState=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_UI_STATE_TRIGGERED,{payload:{uiState:r}}),this.getService(st).setUIState(r)}catch(t){this.getService(k).catch("Error in setUiState: ",t)}},this.getUiState=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_UI_STATE_TRIGGERED),this.getService(st).getUIState$()}catch(e){return this.getService(k).catch("Error in getUiState: ",e),ce({})}},this.enableSafeEval=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.ENABLE_SAFE_EVAL_TRIGGERED),this.getService(Ft).enableSafeEval()}catch(e){this.getService(k).catch("Error in enableSafeEval: ",e)}},this.disableSafeEval=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.DISABLE_SAFE_EVAL_TRIGGERED),this.getService(Ft).disableSafeEval()}catch(e){this.getService(k).catch("Error in disableSafeEval: ",e)}},this.enableFirestorePersistentCache=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.ENABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED),this.getService(Ft).enableFirestorePersistentCache()}catch(e){this.getService(k).catch("Error in enableFirestorePersistentCache: ",e)}},this.disableFirestorePersistentCache=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.DISABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED),this.getService(Ft).disableFirestorePersistentCache()}catch(e){this.getService(k).catch("Error in disableFirestorePersistentCache: ",e)}},this.resetVeltButtonState=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.RESET_VELT_BUTTON_STATE_TRIGGERED,{payload:{config:r}}),this.getService(xS).resetVeltButtonState(r)}catch(t){this.getService(k).catch("Error in resetVeltButtonState: ",t)}},this.getService(k).log("%c[WB] Creating CLASS: Snippyly","color: blue;")}trackEvent(o,r={},e=!0){try{r||(r={}),r=y(h({},r),{source:"external"}),this.getService(ct).trackAuthenticatedEvent(o,r,e)}catch(t){this.getService(k).catch("Error in _trackEvent: ",t);return}}};var D_e=(()=>{let o=class o{constructor(){this.veltElement=!0}ngOnInit(){}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["app-external-styles"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},standalone:!1,decls:0,vars:0,template:function(t,i){},styles:[`.cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed;z-index:1000}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}.cdk-overlay-backdrop{position:absolute;inset:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;touch-action:manipulation;z-index:1000;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}@media (prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media (forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}.cdk-overlay-dark-backdrop{background:#00000052}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px;z-index:1000}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}html{--velt-base-rem-unit: 1}velt-wireframe{display:none!important}body.velt-pin-dragging iframe{pointer-events:none!important}:root{--legacy-velt-neutral-0: #000000;--legacy-velt-neutral-1: #141416;--legacy-velt-neutral-2: #23262F;--legacy-velt-neutral-3: #353945;--legacy-velt-neutral-4: #777E90;--legacy-velt-neutral-5: #B1B5C3;--legacy-velt-neutral-6: #E6E8EC;--legacy-velt-neutral-7: #F4F5F6;--legacy-velt-neutral-8: #FCFCFD;--legacy-velt-neutral-9: #FFFFFF;--legacy-velt-dark-1: #141416;--legacy-velt-dark-2: #222226;--legacy-velt-dark-3: #303034;--legacy-velt-dark-4: #404044;--legacy-velt-dark-5: #59595F;--legacy-velt-dark-6: #80808A;--legacy-velt-dark-7: #91919C;--legacy-velt-dark-8: #E5E5E9;--legacy-velt-primary-color: var(--legacy-velt-dark-1);--legacy-velt-primary-dark-color: var(--legacy-velt-dark-8);--legacy-velt-secondary-color: var(--legacy-velt-neutral-4);--legacy-velt-secondary-dark-color: var(--legacy-velt-dark-7);--legacy-velt-bg-color: var(--legacy-velt-neutral-8);--legacy-velt-bg-dark-color: var(--legacy-velt-dark-1);--legacy-velt-border-color: var(--legacy-velt-neutral-6);--legacy-velt-border-dark-color: var(--legacy-velt-dark-3);--legacy-velt-grey-2-color: #D4D6DF;--legacy-velt-grey-2-dark-color: var(--legacy-velt-dark-4);--legacy-velt-grey-4-color: #989898;--legacy-velt-grey-4-dark-color: var(--legacy-velt-dark-6);--legacy-velt-status-open-color: #625DF5;--legacy-velt-status-in-progress-color: #ECB000;--legacy-velt-status-resolved-color: #00C48C;--legacy-velt-purple: #625DF5;--legacy-velt-orange: #ECB000;--legacy-velt-green: #0DCF82;--legacy-velt-blue: #0d6efd;--legacy-velt-primary-btn-color: var(--legacy-velt-purple);--legacy-velt-hyperlink-color: var(--legacy-velt-purple);--legacy-velt-grey-btn-color: var(--legacy-velt-neutral-5);--legacy-velt-header-btn-color: var(--legacy-velt-neutral-3);--legacy-velt-dropdown-item-color: var(--legacy-velt-neutral-2);--legacy-velt-avatar-size: 2rem;--velt-default-font-family: sans-serif;--Icon-Size-Small: 12px;--Icon-Size-Medium: 16px;--Icon-Size-Large: 24px}:root[data-velt-theme=dark]{--legacy-velt-primary-color: var(--legacy-velt-primary-dark-color);--legacy-velt-secondary-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-border-color: var(--legacy-velt-border-dark-color);--legacy-velt-grey-2-color: var(--legacy-velt-grey-2-dark-color);--legacy-velt-grey-4-color: var(--legacy-velt-grey-4-dark-color);--legacy-velt-primary-btn-color: var(--legacy-velt-border-dark-color);--legacy-velt-hyperlink-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-grey-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-header-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-dropdown-item-color: var(--legacy-velt-secondary-dark-color)}:root{--legacy-velt-tool-padding: 6px;--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-3);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}:root[data-velt-theme=dark],:root:not(data-velt-theme) velt-comment-tool[dark],:root:not(data-velt-theme) velt-sidebar-button[dark],:root:not(data-velt-theme) velt-arrow-tool[dark],:root:not(data-velt-theme) velt-reaction-tool[dark],:root:not(data-velt-theme) velt-huddle-tool[dark],:root:not(data-velt-theme) velt-recorder-tool[dark],:root:not(data-velt-theme) velt-user-invite-tool[dark],:root:not(data-velt-theme) velt-user-request-tool[dark],:root:not(data-velt-theme) velt-notifications-tool[dark],:root:not(data-velt-theme) app-recorder-all-tool-menu[dark],:root:not(data-velt-theme) snippyly-recording-preview-steps-dialog[dark],:root:not(data-velt-theme) snippyly-recorder-control-panel-internal[dark],:root:not(data-velt-theme) snippyly-recorder-player-internal[dark],:root:not(data-velt-theme) velt-recorder-player-expanded[dark]:root:not(data-velt-theme) app-transcription-panel[dark]{--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-2);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-5);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-user-avatar,velt-user-avatar{--legacy-velt-user-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-user-avatar-initial-font-size: .8}snippyly-follow-overlay,velt-follow-overlay{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-color);--legacy-velt-follow-overlay-btn-color: var(--legacy-velt-neutral-6);--legacy-velt-follow-overlay-btn-hover-color: var(--legacy-velt-neutral-5);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-color)}snippyly-follow-overlay[dark],velt-follow-overlay[dark]{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-dark-color);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-dark-color)}snippyly-cursor,velt-cursor{--legacy-velt-cursor-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-cursor-video-size: 4.2rem}snippyly-reaction-tool,velt-reaction-tool,app-reaction-tool{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #8F95B2;--legacy-velt-reaction-tool-hover-bg-color: #EAE8F9;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-reaction-tool[dark],velt-reaction-tool[dark],app-reaction-tool[dark]{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #EAE8F9;--legacy-velt-reaction-tool-hover-bg-color: #8F95B2;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}velt-view-analytics-dialog{--legacy-velt-view-analytics-dialog-bg-color: #FFF;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(0, 0, 0, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #111;--legacy-velt-view-analytics-dialog-total-views-text-color: #625DF5;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: #F4F3FF;--legacy-velt-view-analytics-dialog-user-name-color: #4C5366;--legacy-velt-view-analytics-dialog-user-timestamp-color: #959595;--legacy-velt-view-analytics-dialog-back-btn-color: #8F95B2}velt-view-analytics-dialog[dark]{--legacy-velt-view-analytics-dialog-bg-color: #131229;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(255, 255, 255, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #FFF;--legacy-velt-view-analytics-dialog-total-views-text-color: #9491F8;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: rgba(244, 243, 255, .06);--legacy-velt-view-analytics-dialog-user-name-color: #FFF;--legacy-velt-view-analytics-dialog-user-timestamp-color: rgba(255, 255, 255, .4)}velt-reaction-pin-tooltip-internal{--Surface-Neutral-0: #FFF;--Surface-Neutral-2: #F5F5F5;--Surface-Neutral-3: #F0F0F0;--Text-Neutral-0: #0A0A0A;--Text-Neutral-3: #292929;--Text-Neutral-5: #525252;--Text-Neutral-9: #999;--Text-Brand-Primary: #625DF5}velt-reaction-pin-tooltip-internal[dark]{--Surface-Neutral-0: #0F0F0F;--Surface-Neutral-2: #1F1F1F;--Surface-Neutral-3: #2F2F2F;--Text-Neutral-0: #FFF;--Text-Neutral-3: #E0E0E0;--Text-Neutral-5: #C2C2C2;--Text-Neutral-9: #ADADAD;--Text-Brand-Primary: #9491F8}:root{--velt-border-radius-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-3xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-full: calc((5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xs: calc((.625rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xs: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-sm: calc((.875rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-md: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-lg: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xl: calc((1.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-light-mode-green: #0DCF82;--velt-light-mode-magenta: #A259FE;--velt-light-mode-amber: #FF7162;--velt-light-mode-purple: #625DF5;--velt-light-mode-cyan: #4BC9F0;--velt-light-mode-orange: #FE965C;--velt-light-mode-black: #080808;--velt-light-mode-white: #FFFFFF;--velt-light-mode-gray: #EBEBEB;--velt-light-mode-error: #FF7162;--velt-light-mode-error-hover: #DE5041;--velt-light-mode-error-foreground: #FFFFFF;--velt-light-mode-error-light: #FFF4F2;--velt-light-mode-error-transparent: rgba(255, 113, 98, .08);--velt-light-mode-warning: #FFCD2E;--velt-light-mode-warning-hover: #C69400;--velt-light-mode-warning-foreground: #474747;--velt-light-mode-warning-light: #FFFBEE;--velt-light-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-light-mode-success: #198F65;--velt-light-mode-success-hover: #006B41;--velt-light-mode-success-foreground: #FFFFFF;--velt-light-mode-success-light: #EDF6F3;--velt-light-mode-success-transparent: rgba(25, 143, 101, .08);--velt-light-mode-accent: #625DF5;--velt-light-mode-accent-text: #625DF5;--velt-light-mode-accent-hover: #534FCF;--velt-light-mode-accent-foreground: #FFFFFF;--velt-light-mode-accent-light: #F2F2FE;--velt-light-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-light-mode-text-0: #0A0A0A;--velt-light-mode-text-1: #141414;--velt-light-mode-text-2: #1F1F1F;--velt-light-mode-text-3: #292929;--velt-light-mode-text-4: #3D3D3D;--velt-light-mode-text-5: #525252;--velt-light-mode-text-6: #666666;--velt-light-mode-text-7: #7A7A7A;--velt-light-mode-text-8: #858585;--velt-light-mode-text-9: #999999;--velt-light-mode-text-10: #B8B8B8;--velt-light-mode-text-11: #A3A3A3;--velt-light-mode-text-12: #8F8F8F;--velt-light-mode-background-0: #FFFFFF;--velt-light-mode-background-1: #FAFAFA;--velt-light-mode-background-2: #F5F5F5;--velt-light-mode-background-3: #F0F0F0;--velt-light-mode-background-4: #EBEBEB;--velt-light-mode-background-5: #E5E5E5;--velt-light-mode-background-6: #E0E0E0;--velt-light-mode-background-7: #DBDBDB;--velt-light-mode-background-8: #D6D6D6;--velt-light-mode-background-9: #D1D1D1;--velt-light-mode-background-10: #CCCCCC;--velt-light-mode-border-0: #FFFFFF;--velt-light-mode-border-1: #FAFAFA;--velt-light-mode-border-2: #F5F5F5;--velt-light-mode-border-3: #F0F0F0;--velt-light-mode-border-4: #EBEBEB;--velt-light-mode-border-5: #E5E5E5;--velt-light-mode-border-6: #E0E0E0;--velt-light-mode-border-7: #DBDBDB;--velt-light-mode-border-8: #D6D6D6;--velt-light-mode-border-9: #D1D1D1;--velt-light-mode-border-10: #CCCCCC;--velt-light-mode-background-transparent: rgba(255, 255, 255, .8);--velt-light-mode-border-transparent: rgba(0, 0, 0, .16);--velt-light-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-dark-mode-green: #0DCF82;--velt-dark-mode-magenta: #A259FE;--velt-dark-mode-amber: #FF7162;--velt-dark-mode-purple: #625DF5;--velt-dark-mode-cyan: #4BC9F0;--velt-dark-mode-orange: #FE965C;--velt-dark-mode-black: #080808;--velt-dark-mode-white: #FFFFFF;--velt-dark-mode-gray: #EBEBEB;--velt-dark-mode-error: #FF7162;--velt-dark-mode-error-hover: #DE5041;--velt-dark-mode-error-foreground: #FFFFFF;--velt-dark-mode-error-light: #FFF4F2;--velt-dark-mode-error-transparent: rgba(255, 113, 98, .08);--velt-dark-mode-warning: #FFCD2E;--velt-dark-mode-warning-hover: #C69400;--velt-dark-mode-warning-foreground: #474747;--velt-dark-mode-warning-light: #FFFBEE;--velt-dark-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-dark-mode-success: #198F65;--velt-dark-mode-success-hover: #006B41;--velt-dark-mode-success-foreground: #FFFFFF;--velt-dark-mode-success-light: #EDF6F3;--velt-dark-mode-success-transparent: rgba(25, 143, 101, .08);--velt-dark-mode-accent: #625DF5;--velt-dark-mode-accent-text: #9491F8;--velt-dark-mode-accent-hover: #534FCF;--velt-dark-mode-accent-foreground: #FFFFFF;--velt-dark-mode-accent-light: #F2F2FE;--velt-dark-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-dark-mode-text-0: #FFFFFF;--velt-dark-mode-text-1: #F5F5F5;--velt-dark-mode-text-2: #EBEBEB;--velt-dark-mode-text-3: #E0E0E0;--velt-dark-mode-text-4: #D6D6D6;--velt-dark-mode-text-5: #C2C2C2;--velt-dark-mode-text-6: #ADADAD;--velt-dark-mode-text-7: #8F8F8F;--velt-dark-mode-text-8: #7A7A7A;--velt-dark-mode-text-9: #666666;--velt-dark-mode-text-10: #525252;--velt-dark-mode-text-11: #474747;--velt-dark-mode-text-12: #3D3D3D;--velt-dark-mode-background-0: #0F0F0F;--velt-dark-mode-background-1: #1A1A1A;--velt-dark-mode-background-2: #1F1F1F;--velt-dark-mode-background-3: #242424;--velt-dark-mode-background-4: #292929;--velt-dark-mode-background-5: #2E2E2E;--velt-dark-mode-background-6: #333333;--velt-dark-mode-background-7: #383838;--velt-dark-mode-background-8: #3D3D3D;--velt-dark-mode-background-9: #424242;--velt-dark-mode-background-10: #474747;--velt-dark-mode-border-0: #0F0F0F;--velt-dark-mode-border-1: #1A1A1A;--velt-dark-mode-border-2: #1F1F1F;--velt-dark-mode-border-3: #242424;--velt-dark-mode-border-4: #292929;--velt-dark-mode-border-5: #2E2E2E;--velt-dark-mode-border-6: #333333;--velt-dark-mode-border-7: #383838;--velt-dark-mode-border-8: #3D3D3D;--velt-dark-mode-border-9: #424242;--velt-dark-mode-border-10: #474747;--velt-dark-mode-background-transparent: rgba(0, 0, 0, .8);--velt-dark-mode-border-transparent: rgba(255, 255, 255, .16);--velt-dark-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-comment-pin-z-index: 2147483557;--velt-arrow-z-index: 2147483557;--velt-recorder-player-z-index: 2147483557;--velt-cursor-z-index: 2147483647;--velt-persistent-comment-frame-z-index: 2147483647;--velt-toast-popup-z-index: 2147483647;--velt-live-state-sync-overlay-z-index: 2147483647;--velt-follow-mode-overlay-z-index: 2147483647;--velt-comments-minimap-z-index: 2147483637;--velt-global-overlay-z-index: 2147483637}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}.cdk-overlay-container{z-index:var(--velt-global-overlay-z-index)!important}.cdk-overlay-container .velt-overlay-panel.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 80vw);min-width:var(--mat-dialog-container-min-width, 0)}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:#fff;padding:24px}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .mdc-dialog__title:before{height:unset}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-actions{padding:var(--mat-dialog-actions-padding, 8px)}.velt-overlay-panel{background-color:transparent;border:none;box-shadow:none}.velt-overlay-panel.mat-mdc-tooltip-panel .mat-mdc-tooltip{color:#fff;background-color:#0b0b0b;border:1px solid #eeeeee;border-radius:4px;padding:8px 12px;font-size:14px}.velt-menu.mat-mdc-menu-panel{box-shadow:none}video.flip{transform:rotateY(180deg);-webkit-transform:rotateY(180deg);-moz-transform:rotateY(180deg)}body[data-velt-huddle-on-cursor-mode] .cdk-overlay-container{z-index:calc(var(--velt-global-overlay-z-index, 2147483637) - 1)!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor){cursor:none!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor) *{cursor:none!important}body.snippyly-add-comment-mode,body.snippyly-add-comment-mode *{-webkit-user-select:none!important;user-select:none!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true][data-velt-iframe-container-static=true]{position:relative!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true]:before{content:""!important;position:absolute!important;inset:0!important;z-index:1!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] [data-velt-element=true]:not(snippyly-comment-text-portal):not(velt-recorder-control-panel):not([data-velt-screen-recorder-panel=true]){display:none!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight{color:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:inherit!important;background-color:inherit!important;cursor:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{background-color:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight snippyly-comment-text-portal,body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight velt-comment-text-portal{font-family:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-annotation-number{display:none!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)){opacity:1!important;visibility:visible!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)) snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{opacity:.2!important}[data-snippyly-comment-pin-host][data-snippyly-comment-pin-host-static],[data-snippyly-tag-pin-host][data-snippyly-tag-pin-host-static],[data-snippyly-recorder-pin-host][data-snippyly-recorder-pin-host-static],[data-snippyly-arrow-pin-host][data-snippyly-arrow-pin-host-static],[data-snippyly-area-pin-host][data-snippyly-area-pin-host-static],[data-velt-comment-pin-host][data-velt-comment-pin-host-static],[data-velt-tag-pin-host][data-velt-tag-pin-host-static],[data-velt-recorder-pin-host][data-velt-recorder-pin-host-static],[data-velt-arrow-pin-host][data-velt-arrow-pin-host-static],[data-velt-area-pin-host][data-velt-area-pin-host-static]{position:relative}[data-velt-comment-pin-host][data-velt-comment-pin-active=true],[data-velt-area-pin-host][data-velt-area-pin-active=true]{opacity:1!important;visibility:visible!important}.s-display-none,.velt-display-none{display:none!important}.s-flex,.velt-display-flex{display:flex!important}.velt-items-center{align-items:center!important}.s-background-blur-1{-webkit-backdrop-filter:blur(4px)!important;backdrop-filter:blur(4px)!important}.s-background-blur-2{-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important}.s-background-blur-3{-webkit-backdrop-filter:blur(12px)!important;backdrop-filter:blur(12px)!important}.s-background-blur-4{-webkit-backdrop-filter:blur(16px)!important;backdrop-filter:blur(16px)!important}.s-tooltip{position:relative!important}.s-tooltip .s-tooltiptext{visibility:hidden!important;block-size:auto!important;width:max-content!important;top:120%!important;background-color:var(--legacy-velt-bg-color);border:1px solid var(--legacy-velt-border-color);color:var(--legacy-velt-primary-color)!important;text-align:left!important;padding:.5em .75em!important;border-radius:6px!important;font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:2em!important;box-shadow:var(--legacy-velt-box-shadow)!important;position:absolute!important;z-index:1!important;opacity:0!important;transition:opacity .5s!important;left:50%!important;transform:translate(-50%)!important}.s-tooltip .s-tooltiptext:after{content:" "!important;position:absolute!important;top:0!important;left:50%!important;width:12px!important;height:12px!important;border-left:1px solid var(--legacy-velt-border-color);border-top:1px solid var(--legacy-velt-border-color);background-color:var(--legacy-velt-bg-color);border-radius:4px!important;transform:translate(-50%,-41%) rotate(45deg)!important;transform-origin:center!important}.s-tooltip .s-tooltiptext:before{content:" ";position:absolute;top:0;left:50%;width:24px;height:24px;transform:translate(-50%,-41%);background:transparent}.s-tooltip .s-tooltiptext.left{top:50%!important;right:120%!important;transform:translateY(-50%)!important}.s-tooltip .s-tooltiptext.left:after{transform:translate(41%,-50%) rotate(45deg)!important;transform-origin:center!important;left:unset!important;right:0!important;top:50%!important}.s-tooltip .s-tooltiptext.left.top{top:100%!important;transform:translateY(-45%)!important}.s-tooltip .s-tooltiptext.left.top:after{transform:translate(41%,66%) rotate(45deg)!important;top:0!important}.s-tooltip:hover .s-tooltiptext{visibility:visible!important;opacity:1!important}.s-tooltip-light .s-tooltiptext{background-color:#fff!important;color:#000!important;box-shadow:0 2px 8px -2px #9f9f9f!important}.s-tooltip-light .s-tooltiptext:after{background-color:#fff!important}.s-tooltip-link{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.s-cursor-pointer,.velt-cursor-pointer{cursor:pointer!important}.s-shake{animation:shake .82s cubic-bezier(.36,.07,.19,.97) both;transform:translateZ(0);backface-visibility:hidden;perspective:1000px}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(2px,0,0)}30%,50%,70%{transform:translate3d(-4px,0,0)}40%,60%{transform:translate3d(4px,0,0)}}app-render-timer-wrapper{width:100%;height:100%}velt-comment-text[comment-available=true]{color:var(--Constant-Warning---Text, #E2A600);background-color:#e2a6001a;border-bottom:1px solid #E2A600}.velt-mat-bottom-sheet-container.snippyly-comment-bottom-sheet-container,.velt-mat-bottom-sheet-container.snippyly-comment-bottom-sheet-container .mat-bottom-sheet-container{padding:0!important}.velt-mat-bottom-sheet-container.snippyly-comment-bottom-sheet-container .velt-comment-dialog{width:100%!important;min-width:100%!important;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}
|
|
514
|
+
`))},dependencies:[cg],styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center}.skeleton-loader[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(-90deg,#f0f0f0,#e2e2e2,#f0f0f0);background-size:400% 400%;animation:_ngcontent-%COMP%_skeleton-loading 1.2s ease-in-out 4;height:var(--velt-skeleton-loader-height);width:var(--velt-skeleton-loader-width);border-radius:var(--velt-skeleton-loader-border-radius)}@keyframes _ngcontent-%COMP%_skeleton-loading{0%{background-position:100% 0}to{background-position:-100% 0}}"]});let n=o;return n})();var sYe=["userAvatarRef"],dYe=["*"];function vYe(n,o){if(n&1&&(f(0,"div",7),D(1,"span",8),S()),n&2){let r=s(2).ngIf,e=s();gt("background-color",r.background||"#625DF5"),w("data-testid",e.componentId+"-initial-container"),v(),gt("color",r.textColor||"#FFFFFF"),w("data-modal-author-initial",r.initial)("data-testid",e.componentId+"-initial")}}function mYe(n,o){if(n&1){let r=Z();f(0,"img",9),z("error",function(){L(r);let t=s(3);return U(t.onImageLoadError())})("load",function(){L(r);let t=s(3);return U(t.onImageLoaded())}),S()}if(n&2){let r=s(2).ngIf,e=s();gt("display",r.imgLoaded?"":"none !important"),g("src",r.src,bn),w("alt","User avatar")("data-testid",e.componentId+"-image")}}function gYe(n,o){if(n&1&&(C(0),f(1,"div",4,1),p(3,vYe,2,7,"div",5)(4,mYe,1,5,"ng-template",6),Gt(5),S(),b()),n&2){let r=s().ngIf,e=s();v(),w("data-testid",e.componentId+"-container")("aria-label","User avatar"),v(2),g("ngIf",!r.imgLoaded),v(),g("ngIf",!r.imgLoadError)}}function uYe(n,o){if(n&1&&D(0,"velt-skeleton-loader-internal",10),n&2){let r=s().ngIf;g("height",r.size?r.size+"px":"100%")("width",r.size?r.size+"px":"100%")}}function pYe(n,o){if(n&1&&(C(0),p(1,gYe,6,4,"ng-container",3)(2,uYe,1,2,"ng-template",null,0,Ve),b()),n&2){let r=o.ngIf,e=Ee(3);v(),g("ngIf",r.imgLoaded||(r==null||r.user==null?null:r.user.photoUrl)||(r==null||r.user==null?null:r.user.name)||(r==null||r.user==null?null:r.user.email)||(r==null?null:r.initial))("ngIfElse",e)}}var mr=(()=>{let o=class o{constructor(e,t,i){this.authService=e,this.loggingService=t,this.elementRef=i,this.initial="",this.background="#625DF5",this.textColor="#FFFFFF",this.userAvatarRef=new Q(null),this.componentConfigSignal=De({background:"#625DF5",textColor:"#FFFFFF",initial:"",src:"",imgLoaded:!1,imgLoadError:!1}),this.veltElement=!0,this.componentId="velt-user-avatar"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in UserAvatarComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","img"),e.setAttribute("data-testid",this.componentId+"-container"),this.updateAriaLabel()}catch(e){this.loggingService.catch("Error in UserAvatarComponent setupA11yAttributes:",e)}}updateAriaLabel(){try{this.elementRef.nativeElement.setAttribute("aria-label","User avatar")}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAriaLabel:",e)}}ngAfterViewInit(){this.updateAvatarSize()}ngOnChanges(e){try{if(e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=y(h({},i),{[t]:e[t].currentValue}),i))}),e?.user){let t=e.user.currentValue;t?.photoUrl!==this.componentConfigSignal().src&&this.componentConfigSignal.update(i=>(i=y(h({},i),{src:t?.photoUrl,imgLoaded:!1,imgLoadError:!1}),i)),this.componentConfigSignal.update(i=>(i=y(h({},i),{background:t?.color||this.authService.getUserAvatarColor(t?.userId)}),i)),this.componentConfigSignal.update(i=>(i=y(h({},i),{textColor:t?.textColor||this.authService.getUserTextColor(t?.userId)}),i)),this.componentConfigSignal.update(i=>(i=y(h({},i),{initial:t?.initial||t?.name?.charAt(0)||t?.email?.charAt(0)}),i))}e?.size&&this.updateAvatarSize(),e?.width&&this.updateAvatarSize(),e?.height&&this.updateAvatarSize()}catch(t){this.loggingService.catch("Error in UserAvatarComponent ngOnChanges: ",t)}}onImageLoadError(){try{this.componentConfigSignal.update(e=>(e=y(h({},e),{imgLoadError:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoadError: ",e)}}onImageLoaded(){try{this.componentConfigSignal.update(e=>(e=y(h({},e),{imgLoaded:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoaded: ",e)}}updateAvatarSize(){try{this.elementRef?.nativeElement&&(this.size&&(this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"),this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px")),this.width&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px"),this.height&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"))}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAvatarSize: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(qe),x(k),x(Q))},o.\u0275cmp=O({type:o,selectors:[["snippyly-user-avatar"]],viewQuery:function(t,i){if(t&1&&pt(sYe,5),t&2){let a;vt(a=mt())&&(i.userAvatarRef=a.first)}},hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{initial:"initial",src:"src",background:"background",textColor:"textColor",size:"size",width:"width",height:"height",user:"user"},standalone:!1,features:[Qe],ngContentSelectors:dYe,decls:1,vars:1,consts:[["loadingTemplateRef",""],["userAvatarRef",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],["velt-ignore-change-detection","true","role","img",1,"s-user-avatar-container","velt-user-avatar"],["class","s-user-avatar-initial-container velt-user-avatar--initial-container","aria-hidden","componentConfig.imgLoaded",3,"background-color",4,"ngIf"],[3,"ngIf"],["aria-hidden","componentConfig.imgLoaded",1,"s-user-avatar-initial-container","velt-user-avatar--initial-container"],[1,"s-user-avatar-initial","velt-user-avatar--initial"],["referrerpolicy","no-referrer","velt-ignore-change-detection","true",1,"s-user-avatar-image","velt-user-avatar--image",3,"error","load","src"],["borderRadius","100%",3,"height","width"]],template:function(t,i){t&1&&(zt(),p(0,pYe,4,2,"ng-container",2)),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[xe,Si],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}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));position:static}*[_ngcontent-%COMP%]:empty{display:revert}.s-user-avatar-container[_ngcontent-%COMP%]{position:relative;width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%;display:inline-block}velt-skeleton-loader-internal[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%}.s-user-avatar-initial-container[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;border-radius:50%;align-items:center;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))}.s-user-avatar-image[_ngcontent-%COMP%]{object-fit:cover;border-radius:50%;width:100%;height:100%;display:flex}.s-user-avatar-initial[_ngcontent-%COMP%]{color:#fff;font-size:calc((var(--legacy-velt-user-avatar-initial-font-size) + 0px) * var(--velt-base-rem-unit));position:relative;text-transform:uppercase}.s-user-avatar-initial[_ngcontent-%COMP%]:after{content:attr(data-modal-author-initial);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.velt-user-avatar[_ngcontent-%COMP%], velt-skeleton-loader-internal[_ngcontent-%COMP%]{height:var(--legacy-velt-user-avatar-height, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)));width:var(--legacy-velt-user-avatar-width, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)))}"],changeDetection:0});let n=o;return n})();var x_e={en:{"Action button":"Action button",Yes:"Yes",Delete:"Delete",Cancel:"Cancel","Delete thread?":"Delete thread?","All replies to this thread will be lost.":"All replies to this thread will be lost.","Delete comment?":"Delete comment?","This selected comment will be deleted.":"This selected comment will be deleted.","Delete recording?":"Delete recording?","This selected recording will be deleted.":"This selected recording will be deleted.","Delete area?":"Delete area?","This selected area will be deleted.":"This selected area will be deleted.","Delete arrow?":"Delete arrow?","This selected arrow will be deleted.":"This selected arrow will be deleted.","Delete tag?":"Delete tag?","This selected tag will be deleted.":"This selected tag will be deleted.","Contact us":"Contact us","Let us know how can we help you!":"Let us know how can we help you!","Your email address":"Your email address","How can we help?":"How can we help?",Send:"Send","Allow mic permission to":"Allow mic permission to","enable your audio":"enable your audio","1. Click the":"1. Click the","page info icon in your browser\u2019s address bar":"page info icon in your browser\u2019s address bar","2. Turn on Microphone":"2. Turn on Microphone","2. Turn on Camera":"2. Turn on Camera","Allow camera permission":"Allow camera permission","to enable your video":"to enable your video",dropdown:"dropdown","assign dropdown":"assign dropdown","custom dropdown":"custom dropdown","options dropdown":"options dropdown","priority dropdown":"priority dropdown","status dropdown":"status dropdown","seen dropdown":"seen dropdown",menu:"menu","assign menu":"assign menu","custom menu":"custom menu","options menu":"options menu","priority menu":"priority menu","status menu":"status menu","seen menu":"seen menu","menu items":"menu items","assign menu items":"assign menu items","custom menu items":"custom menu items","options menu items":"options menu items","priority menu items":"priority menu items","status menu items":"status menu items","seen menu items":"seen menu items","Playback Speed":"Playback Speed","Subtitles not available":"Subtitles not available","Transcription not available":"Transcription not available",Feedback:"Feedback","Provide feedback on your Superflow experience.":"Provide feedback on your Superflow experience.","Tell us the details...":"Tell us the details...","You are following":"You are following","You are leading.":"You are leading.",Stop:"Stop",following:"following",leading:"leading","is editing.":"is editing.","requested edit access.":"requested edit access.","You are editing.":"You are editing.","You are editing on different tab.":"You are editing on different tab.","Access Requested":"Access Requested","Request access":"Request access","Edit here":"Edit here",Settings:"Settings",Audio:"Audio",Microphone:"Microphone",Video:"Video",Camera:"Camera","Save changes":"Save changes","Audio settings":"Audio settings","No device found":"No device found","Video settings":"Video settings","Media source settings":"Media source settings","Audio recording preview":"Audio recording preview","Cancel recording":"Cancel recording","Video recording icon":"Video recording icon","Screen recording icon":"Screen recording icon","Audio recording icon":"Audio recording icon","Recording preview bottom panel":"Recording preview bottom panel","Starting recording in":"Starting recording in","Recording control buttons":"Recording control buttons","Toggle camera":"Toggle camera",off:"off",on:"on","Camera is off":"Camera is off","Close recording preview":"Close recording preview","Toggle microphone":"Toggle microphone",Close:"Close",Open:"Open","recording settings":"recording settings","Start Recording":"Start Recording","Report bugs":"Report bugs","Let us know about any bugs so we can fix them ASAP!":"Let us know about any bugs so we can fix them ASAP!","Thank you! We will get back to you soon.":"Thank you! We will get back to you soon.","Thank you for your feedback!":"Thank you for your feedback!","Thanks for reporting the bug. We will get back to you soon.":"Thanks for reporting the bug. We will get back to you soon.","Invitation sent!":"Invitation sent!","User removed!":"User removed!",members:"members","Invalid contact":"Invalid contact","Invalid email":"Invalid email","Comment pin":"Comment pin","Add text comment":"Add text comment","Add comment annotation":"Add comment annotation","Use AI to rewrite selected text":"Use AI to rewrite selected text","Select a shorter text":"Select a shorter text","Select a longer text":"Select a longer text",Rewrite:"Rewrite","Ask ChatGPT":"Ask ChatGPT","Text comment tools":"Text comment tools","Avatar for comment author":"Avatar for comment author","comments in this thread":"comments in this thread","Assign To":"Assign To","Attach files":"Attach files","Attach files input":"Attach files input","All comments":"All comments","View all comments":"View all comments","Approve comment":"Approve comment",Approve:"Approve","Assign thread":"Assign thread",Search:"Search","Search users":"Search users","Avatar for assigned user":"Avatar for assigned user","Assigned to":"Assigned to","Comment assignment details":"Comment assignment details","Assigned to:":"Assigned to:","Comment dialog thread":"Comment dialog thread","Close comment dialog":"Close comment dialog","Comment Index":"Comment Index",Suggestion:"Suggestion","Comment tools and actions":"Comment tools and actions","Mention someone using @ symbol":"Mention someone using @ symbol","Mention someone using @ symbol while editing":"Mention someone using @ symbol while editing","Type @ to mention someone":"Type @ to mention someone","Type @ to mention someone while editing":"Type @ to mention someone while editing","Add file attachment to comment":"Add file attachment to comment","Record voice message":"Record voice message","Click to start voice recording":"Click to start voice recording","Record video message":"Record video message","Click to start screen recording":"Click to start screen recording","Record your screen":"Record your screen","Save new comment":"Save new comment","Save edited comment":"Save edited comment","Assign user":"Assign user","Remove File":"Remove File","Image attachment:":"Image attachment:","unnamed image":"unnamed image","Actions for image:":"Actions for image:","Uploading image:":"Uploading image:","Delete image:":"Delete image:","Preview of image:":"Preview of image:","Remove invalid file:":"Remove invalid file:","Error message:":"Error message:","Invalid file:":"Invalid file:","Actions for invalid file:":"Actions for invalid file:","File error:":"File error:","File cannot be uploaded":"File cannot be uploaded","Preview of invalid file:":"Preview of invalid file:","Invalid file":"Invalid file",unknown:"unknown","Delete file":"Delete file","File attachment:":"File attachment:","unnamed file":"unnamed file","File type icon for":"File type icon for","Details for file:":"Details for file:","Filename:":"Filename:","File size:":"File size:","Uploading file:":"Uploading file:","Actions for file:":"Actions for file:","Remove file:":"Remove file:","Attached files":"Attached files","total attachments":"total attachments","File attachments":"File attachments",valid:"valid","invalid files":"invalid files","User avatar for":"User avatar for","unknown user":"unknown user","New comment composer":"New comment composer","Comment or type @ to add others":"Comment or type @ to add others","Write a comment...":"Write a comment...","Edit comment composer":"Edit comment composer","Comment or add emails with @":"Comment or add emails with @","Private comment mode - only visible to your team":"Private comment mode - only visible to your team","Only for your team":"Only for your team","Screen recording":"Screen recording",unnamed:"unnamed","Screen recording controls":"Screen recording controls","Edit comment section":"Edit comment section","Add new comment section":"Add new comment section","Custom annotation options":"Custom annotation options","Toggle annotation options":"Toggle annotation options","Annotation:":"Annotation:",Select:"Select","Remaining count:":"Remaining count:","Delete comment controls":"Delete comment controls","Delete this comment":"Delete this comment","Ghost comment notification":"Ghost comment notification","Original content not found.":"Original content not found.","Comment dialog header":"Comment dialog header","Comment dialog header controls":"Comment dialog header controls","Comment metadata":"Comment metadata","1 more reply":"1 more reply","more replies":"more replies","Show 1 more reply":"Show 1 more reply","Navigate to comment location":"Navigate to comment location","Assign comment":"Assign comment","Delete thread":"Delete thread","Delete comment":"Delete comment","Edit comment":"Edit comment",Edit:"Edit","Make it private":"Make it private","Make it public":"Make it public",Subscribe:"Subscribe",Unsubscribe:"Unsubscribe","priority level":"priority level","Priority name":"Priority name",P0:"P0",P1:"P1",P2:"P2","Selected priority:":"Selected priority:","Selected priority indicator":"Selected priority indicator","Priority:":"Priority:","Priority item":"Priority item","Thread priority:":"Thread priority:","Private comment banner":"Private comment banner","Resolve thread":"Resolve thread","Sign In":"Sign In","Status dropdown for":"Status dropdown for",comment:"comment","Status name:":"Status name:","Status option:":"Status option:","Status:":"Status:","Accept suggestion":"Accept suggestion",Accept:"Accept","Reject suggestion":"Reject suggestion",Reject:"Reject","Suggestion actions":"Suggestion actions","Delete Attachment":"Delete Attachment","Download Attachment":"Download Attachment",Attachment:"Attachment",preview:"preview","Image attachment controls":"Image attachment controls","Image attachment actions":"Image attachment actions","Delete attachment":"Delete attachment","Download attachment":"Download attachment","File name:":"File name:","Attachment:":"Attachment:",Attachments:"Attachments","Avatar for":"Avatar for",user:"user","Draft comment status":"Draft comment status",Draft:"Draft",Comment:"Comment","Comment by":"Comment by",Me:"Me","Comment reactions":"Comment reactions","Comment recordings":"Comment recordings","Name for":"Name for","Time for":"Time for","Seen by":"Seen by","Users who viewed this comment":"Users who viewed this comment","List of users who have seen this comment":"List of users who have seen this comment","Seen By":"Seen By","Comment viewers list":"Comment viewers list","Show comment viewers":"Show comment viewers","Comment viewers dropdown":"Comment viewers dropdown",now:"now",Unread:"Unread","Comment thread":"Comment thread","Comment content":"Comment content","Author information":"Author information","Author details and status":"Author details and status","Comment device information":"Comment device information","Inline mode metadata":"Inline mode metadata","Comment actions":"Comment actions","Reaction options":"Reaction options","Comment message":"Comment message",of:"of","Show more replies":"Show more replies",replies:"replies",Reply:"Reply",reply:"reply",Show:"Show","Show reply":"Show reply","Unresolve comment":"Unresolve comment","Upgrade plan":"Upgrade plan",Upgrade:"Upgrade","Copy link to comment":"Copy link to comment","Link Copied!":"Link Copied!","Copy thread link":"Copy thread link","Emoji reactions menu":"Emoji reactions menu","Open emoji reactions menu":"Open emoji reactions menu",Priority:"Priority","Private Comment":"Private Comment",Resolve:"Resolve",Unresolve:"Unresolve","Comment bubble":"Comment bubble","Multi-thread comment dialog":"Multi-thread comment dialog","Comment dialog":"Comment dialog","Comment bottom sheet":"Comment bottom sheet","Comment inbox container":"Comment inbox container","Single comment dialog":"Single comment dialog","Ghost comment indicator":"Ghost comment indicator","Private comment":"Private comment","Comment icon":"Comment icon","Exit comment mode":"Exit comment mode","to exit":"to exit",exit:"exit","Private Comment Mode":"Private Comment Mode","Comment Mode":"Comment Mode","Comment mode icon":"Comment mode icon","Comments stream view":"Comments stream view","Comments inbox":"Comments inbox","Comments location overview":"Comments location overview","Comments minimap":"Comments minimap","Go to comments here.":"Go to comments here.","Close comments sidebar":"Close comments sidebar","Add your first comment":"Add your first comment","No comments to display":"No comments to display","filter section":"filter section",All:"All","Close filter panel":"Close filter panel","Apply filters and close panel":"Apply filters and close panel",Done:"Done","checkbox checked":"checkbox checked","checkbox unchecked":"checkbox unchecked",items:"items","Current viewing page":"Current viewing page","This page":"This page",selected:"selected","not selected":"not selected",pages:"pages",people:"people",priorities:"priorities",statuses:"statuses",Filters:"Filters",versions:"versions","View All":"View All","View all":"View all","Comment filters":"Comment filters","Available filters":"Available filters","Apply or cancel filters":"Apply or cancel filters","Filter comments":"Filter comments","filters applied":"filters applied","Return to all comments":"Return to all comments","Back to all comments":"Back to all comments","Search through comments":"Search through comments","Filter and status controls":"Filter and status controls","Unknown user":"Unknown user","Comment dialog for":"Comment dialog for",Collapse:"Collapse",Expand:"Expand","comment group":"comment group",arrow:"arrow","Comments list with":"Comments list with","Location filter options":"Location filter options",Pages:"Pages","Filter comments by location":"Filter comments by location","menu expanded":"menu expanded","menu collapsed":"menu collapsed","Location filter dropdown":"Location filter dropdown","Mark all comments as read":"Mark all comments as read","Mark all as read":"Mark all as read","Mark as read":"Mark as read","Mark as unread":"Mark as unread",Reset:"Reset","Show open comments only":"Show open comments only","Mark all comments as resolved":"Mark all comments as resolved","Mark all as resolved":"Mark all as resolved","Bulk actions for comments":"Bulk actions for comments","Actions menu":"Actions menu",expanded:"expanded",collapsed:"collapsed","Comment actions dropdown":"Comment actions dropdown","Show unread and read comments":"Show unread and read comments","Unread and read":"Unread and read","Show read comments only":"Show read comments only","Read only":"Read only","Show resolved comments only":"Show resolved comments only",Resolved:"Resolved","Show unread comments only":"Show unread comments only","Unread only":"Unread only","Selected indicator":"Selected indicator","Sort comments by date":"Sort comments by date","Sort by date":"Sort by date","Sort comments by unread status":"Sort comments by unread status","Sort by unread":"Sort by unread","Sort and filter comments":"Sort and filter comments","custom filter applied":"custom filter applied","Comment filters and sorting":"Comment filters and sorting",filtered:"filtered","Page comment composer":"Page comment composer","Add a comment to the page":"Add a comment to the page","Comments and feedback panel":"Comments and feedback panel","Reset all comment filters":"Reset all comment filters","Clear filters":"Clear filters","Loading comments":"Loading comments","Comment status filters":"Comment status filters",status:"status","status icon":"status icon","Status filter options":"Status filter options","Status filter dropdown":"Status filter dropdown","Comments sidebar":"Comments sidebar","Comments panel":"Comments panel","Comment composer":"Comment composer","Comments section panel":"Comments section panel",Comments:"Comments","Loading Comments":"Loading Comments","Comments section":"Comments section","No comments found for applied filters.":"No comments found for applied filters.","Comments list":"Comments list","Comment actions menu":"Comment actions menu","More actions":"More actions","Filter and sort options":"Filter and sort options","Collapse threads":"Collapse threads","Comments dialog":"Comments dialog","Clear all filters":"Clear all filters","Comments information":"Comments information","Toggle comments sidebar":"Toggle comments sidebar","Click to mute":"Click to mute","Click to unmute":"Click to unmute","Stop sharing":"Stop sharing","Share screen":"Share screen","Invite users to join this huddle":"Invite users to join this huddle","Please select a contact to invite":"Please select a contact to invite","Chat with everyone":"Chat with everyone","Enable audio or video to change the settings":"Enable audio or video to change the settings","Change audio/video settings":"Change audio/video settings",Leave:"Leave","In-call messages":"In-call messages","Type here...":"Type here...","Audio Huddle":"Audio Huddle","Video Huddle":"Video Huddle","Screen Huddle":"Screen Huddle","1 person is":"1 person is","people are":"people are","on a call now":"on a call now","You can join the call":"You can join the call","Stop Sharing":"Stop Sharing","is sharing now.":"is sharing now.",You:"You","Close notifications panel":"Close notifications panel","Notification item":"Notification item","All notifications list":"All notifications list","All notifications":"All notifications","All notifications read":"All notifications read","Document notification":"Document notification","Document name:":"Document name:",Untitled:"Untitled","Document ID:":"Document ID:",Document:"Document","unread notifications":"unread notifications","Document notifications panel":"Document notifications panel","For you notifications panel":"For you notifications panel","Notification message:":"Notification message:","Notification headline:":"Notification headline:","Notification time:":"Notification time:","Unread notification":"Unread notification",Notification:"Notification",unread:"unread",read:"read",Load:"Load","more notifications":"more notifications","Load More":"Load More","User notifications for":"User notifications for",notification:"notification",notifications:"notifications",available:"available",Notifications:"Notifications","User:":"User:","People notifications panel":"People notifications panel",Documents:"Documents","For You":"For You",People:"People","Notification categories":"Notification categories","Mark all notifications as read":"Mark all notifications as read","Notification actions":"Notification actions","View all notifications":"View all notifications","Notifications panel":"Notifications panel","Notifications bell icon - no unread notifications":"Notifications bell icon - no unread notifications","Notifications count":"Notifications count","Notification bell with":"Notification bell with","User online":"User online","mins ago.":"mins ago.","Reaction count":"Reaction count","Reaction with":"Reaction with","Reaction by":"Reaction by","Users who reacted":"Users who reacted","Reaction details":"Reaction details","React with":"React with",emoji:"emoji","Choose a reaction":"Choose a reaction","Available reactions":"Available reactions","Add reaction":"Add reaction","Reaction selector":"Reaction selector","Start audio recording":"Start audio recording","Audio Recording":"Audio Recording","Screen Recording":"Screen Recording","Start video recording":"Start video recording","Video Recording":"Video Recording","Recording options menu":"Recording options menu","Available recording types":"Available recording types",Record:"Record","Record audio":"Record audio","Record screen":"Record screen","Record video":"Record video","Recording controls for":"Recording controls for",recording:"recording","Stop recording":"Stop recording","Recording duration":"Recording duration","Resume recording":"Resume recording","Pause recording":"Pause recording","Currently recording:":"Currently recording:",none:"none","Audio waveform visualization":"Audio waveform visualization","Currently recording":"Currently recording","Recording paused":"Recording paused","Recording information":"Recording information","Recording controls":"Recording controls","Expand recording panel":"Expand recording panel","Collapse recording panel":"Collapse recording panel","Floating mode container for":"Floating mode container for","Screen recording preview":"Screen recording preview","Expanded view":"Expanded view","Mini preview":"Mini preview","Recording control panel":"Recording control panel","Draggable recording panel":"Draggable recording panel","Currently saving recording":"Currently saving recording","Saving Recording...":"Saving Recording...",Paused:"Paused","Video preview":"Video preview","Screen recording panel":"Screen recording panel","Draggable recording controls":"Draggable recording controls","Video recording preview":"Video recording preview","recording player":"recording player",Draggable:"Draggable",player:"player","recording pin":"recording pin","Created by":"Created by",Play:"Play","Draggable recording pin by":"Draggable recording pin by","Recording player":"Recording player","Audio recording":"Audio recording","Audio player":"Audio player","Audio player controls":"Audio player controls","Audio content and controls":"Audio content and controls","Playback controls":"Playback controls","Playback time":"Playback time","Audio waveform":"Audio waveform",Subtitles:"Subtitles","Additional controls and information":"Additional controls and information","Pause button":"Pause button","Pause audio":"Pause audio","Play audio":"Play audio","Audio progress":"Audio progress","Copy link to recording":"Copy link to recording","Delete recording":"Delete recording","Enter full screen mode":"Enter full screen mode","Recording name:":"Recording name:","Untitled recording":"Untitled recording","Recording player controls":"Recording player controls","Pause video":"Pause video","Play video":"Play video","Video subtitles":"Video subtitles","Toggle subtitles":"Toggle subtitles","Seek video playback":"Seek video playback","Video playback controls":"Video playback controls","Video transcription":"Video transcription","Video player":"Video player","Video player container":"Video player container","Video player with controls":"Video player with controls","Video information and controls":"Video information and controls","Video transcription summary":"Video transcription summary","Fullscreen video player":"Fullscreen video player","Expanded video player":"Expanded video player","Getting data ...":"Getting data ...","Get more options":"Get more options","Max 3 rewrites allowed":"Max 3 rewrites allowed",left:"left","Show original text":"Show original text","Select a rewritten text to create a task":"Select a rewritten text to create a task","Create Task":"Create Task","How would you like to change this copy?":"How would you like to change this copy?",Suggestions:"Suggestions","Selected users":"Selected users","additional users":"additional users",Reassign:"Reassign",Remove:"Remove","Please select a contact to assign":"Please select a contact to assign",Summary:"Summary","see more":"see more","see less":"see less","Invite users":"Invite users","No users are added.":"No users are added.",Invited:"Invited","General access":"General access","Copy Link":"Copy Link","Send invite":"Send invite","Go Back":"Go Back","Total Views":"Total Views","Views Today":"Views Today",View:"View",Views:"Views",Today:"Today","Search comments":"Search comments","In Progress":"In Progress",Status:"Status","Not set":"Not set","Comment Type":"Comment Type",Public:"Public",Private:"Private","Group By":"Group By","Assigned to Me":"Assigned to Me","Added by Me":"Added by Me",Other:"Other",Desktop:"Desktop",Mobile:"Mobile",Tablet:"Tablet",Others:"Others","Default - MacBook Pro Microphone (Built-in)":"Default - MacBook Pro Microphone (Built-in)","iPhone Microphone":"iPhone Microphone","MacBook Pro Microphone (Built-in)":"MacBook Pro Microphone (Built-in)","Sorting options":"Sorting options","Created First":"Created First","Created Last":"Created Last","Updated First":"Updated First","Updated Last":"Updated Last"}};var Ns=(()=>{let o=class o{constructor(e){this.loggingService=e,this.currentLanguageSignal=De(navigator.language.split("-")[0]),this.autoTranslationSignal=De(!1),this.translationsMap=new Map,this.translationCache=new Map,this.translationsUpdateSignal=De(0),this.currentLanguage=this.currentLanguageSignal.asReadonly(),this.autoTranslation=this.autoTranslationSignal.asReadonly(),this.translationsVersion=this.translationsUpdateSignal.asReadonly(),this.currentTranslations=ie(()=>{let t=this.currentLanguageSignal(),i=this.translationsUpdateSignal();return this.translationsMap.get(t)||{}}),this.loggingService.log("%c[WB] Calling FUNCTION: constructor","color: green;"),this.setTranslations(x_e),xn(()=>{let t=this.currentLanguageSignal();this.translationCache.clear(),this.translationsUpdateSignal.update(i=>i+1)})}translate(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: translate","color: green;");let t=this.currentLanguageSignal(),i=this.translationsUpdateSignal(),a=`${t}:${e}:${i}`,l=this.translationCache.get(t);if(l?.has(a))return l.get(a)||e;let c=this.currentTranslations()[e];return this.translationCache.has(t)||this.translationCache.set(t,new Map),this.translationCache.get(t)?.set(a,c||e),g1(c)?e:c}catch{return e}}setTranslations(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setTranslations","color: green;");let t=!1;Object.entries(e).forEach(([i,a])=>{if(a&&typeof a=="object"){let l=this.translationsMap.get(i)||{};Object.keys(a).forEach(d=>{l.hasOwnProperty(d)||(t=!0)});let c=h(h({},l),a);this.translationsMap.set(i,c),this.translationCache.delete(i)}}),this.translationsUpdateSignal.update(i=>i+1),t&&setTimeout(()=>{this.translationsUpdateSignal.update(i=>i+1)},0)}catch(t){this.loggingService.catch("Error in setTranslations: ",t)}}setLanguage(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLanguage","color: green;"),this.currentLanguageSignal.set(e)}catch(t){this.loggingService.catch("Error in setLanguage: ",t)}})}enableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!0)}catch(e){this.loggingService.catch("Error in enableAutoTranslation: ",e)}}disableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!1),this.translationCache.clear()}catch(e){this.loggingService.catch("Error in disableAutoTranslation: ",e)}}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var he=(()=>{let o=class o{constructor(e,t){this.domService=e,this.translateService=t,this.sanitizedCache=new Map}transform(e){if(e==null)return"";let t=typeof e=="boolean"||typeof e=="number"?String(e):e;try{let i=this.translateService.currentLanguage(),a=this.translateService.translationsVersion(),l=`${i}:${t}:${a}`,c=this.sanitizedCache.get(l);if(c)return c;let d=this.translateService.translate(t),m=this.domService.sanitizeHtml(d);return this.sanitizedCache.set(l,m),this.sanitizedCache.size>1e3&&this.sanitizedCache.clear(),m}catch(i){return console.warn("Translation error:",i),t}}};o.\u0275fac=function(t){return new(t||o)(x(Ue,16),x(Ns,16))},o.\u0275pipe=po({name:"translate",type:o,pure:!0,standalone:!1});let n=o;return n})();var fYe=["selectionElementPortalOverlay"],CYe=()=>["velt-overlay-panel"],bYe=n=>[n];function _Ye(n,o){if(n&1&&(C(0),f(1,"span",10),oe(2),R(3,"translate"),S(),b()),n&2){let r=s(),e=r.$implicit,t=r.index,i=s(5);v(),gt("--velt-selection-color",e==null||e.user==null?null:e.user.color),w("data-testid",i.componentId+"-user-name-"+t),v(),Ye(F(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function SYe(n,o){if(n&1&&(C(0),p(1,_Ye,4,6,"ng-container",3),b()),n&2){let r=o.index,e=s(5);v(),g("ngIf",r<e.maxCount)}}function yYe(n,o){if(n&1&&(f(0,"span",11),oe(1),S()),n&2){let r=s(4).ngIf,e=s();gt("--velt-selection-color",(r.selections[0]==null||r.selections[0].user==null?null:r.selections[0].user.color)||"white"),w("data-testid",e.componentId+"-additional-count")("aria-label",(r.selections==null?null:r.selections.length)-e.maxCount+" additional users"),v(),we("+",(r.selections==null?null:r.selections.length)-e.maxCount)}}function kYe(n,o){if(n&1&&(C(0),f(1,"div",7),R(2,"translate"),p(3,SYe,2,1,"ng-container",8)(4,yYe,2,5,"span",9),S(),b()),n&2){let r=s(3).ngIf,e=s();v(),w("data-testid",e.componentId+"-label-container")("aria-label",F(2,4,"Selected users")),v(2),g("ngForOf",r.selections),v(),g("ngIf",(r.selections==null?null:r.selections.length)>e.maxCount)}}function xYe(n,o){if(n&1&&(C(0),D(1,"snippyly-user-avatar",13),b()),n&2){let r=s(),e=r.$implicit,t=r.index;v(),gt("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),g("size",20)("user",e==null?null:e.user)}}function IYe(n,o){if(n&1&&(C(0),p(1,xYe,2,6,"ng-container",3),b()),n&2){let r=o.index,e=s(5);v(),g("ngIf",r<e.maxCount)}}function EYe(n,o){if(n&1&&(f(0,"div",14),R(1,"translate"),f(2,"span",15),oe(3),S()()),n&2){let r=s(4).ngIf,e=s();gt("--velt-selection-user-index",r.selections==null?null:r.selections.length)("background-color",(r.selections[(r.selections==null?null:r.selections.length)-1]==null||r.selections[(r.selections==null?null:r.selections.length)-1].user==null?null:r.selections[(r.selections==null?null:r.selections.length)-1].user.color)||"white"),w("data-testid",e.componentId+"-additional-avatars")("aria-label",(r.selections==null?null:r.selections.length)-e.maxCount+" "+F(1,7,"additional users")),v(3),we("+",(r.selections==null?null:r.selections.length)-e.maxCount)}}function wYe(n,o){if(n&1&&p(0,IYe,2,1,"ng-container",8)(1,EYe,4,9,"div",12),n&2){let r=s(3).ngIf,e=s();g("ngForOf",r.selections),v(),g("ngIf",(r.selections==null?null:r.selections.length)>e.maxCount)}}function TYe(n,o){if(n&1&&p(0,kYe,5,6,"ng-container",6)(1,wYe,2,2,"ng-template",null,2,Ve),n&2){let r=Ee(2),e=s(2).ngIf,t=s();g("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",r)}}function DYe(n,o){if(n&1&&(C(0),D(1,"div",4,0),p(3,TYe,3,2,"ng-template",5,1,Ve),b()),n&2){let r=Ee(2),e=s().ngIf,t=s();v(),gt("top",(e==null||e.position==null?null:e.position.top)+t.offsetTop,"px")("left",(e==null||e.position==null?null:e.position.left)+t.offsetLeft,"px"),g("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),w("data-testid",t.componentId),v(2),g("cdkConnectedOverlayOrigin",r)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",xt(13,CYe))("cdkConnectedOverlayPositions",J(14,bYe,e==null?null:e.overlayPosition))}}function OYe(n,o){if(n&1&&(C(0),p(1,DYe,5,16,"ng-container",3),b()),n&2){let r=o.ngIf;v(),g("ngIf",r==null?null:r.position)}}var I_e=(()=>{let o=class o{get highlight(){return this._highlight}set highlight(e){this._highlight=e,this.calculatePosition()}constructor(e,t,i){this.loggingService=e,this.selectionService=t,this.elementRef=i,this._highlight=new Dp,this.position=null,this.userIndicatorTypes=fS,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=De({userIndicatorPosition:AO.End,userIndicatorType:fS.Avatar,position:null,overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"},selections:[]}),this.veltElement=!0,this.componentId="velt-selection-element";try{this.loggingService.log("%c[WB] Creating CLASS: SelectionElementPortalComponent","color: blue;");let a=this.selectionService.getUserIndicatorPosition(),l=this.selectionService.getUserIndicatorType();this.componentConfigSignal.update(c=>(c=y(h({},c),{userIndicatorPosition:a,userIndicatorType:l}),c)),this.setOverlayPosition(a)}catch(a){this.loggingService.log("Error in SelectionElementPortalComponent constructor: ",a)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","complementary"),e.setAttribute("aria-label","Selection portal")}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent setupA11yAttributes:",e)}}setSelections(e){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{selections:e}),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setSelections: ",t)}}addSelection(e){try{this.componentConfigSignal.update(t=>(t=h({},t),t.selections.push(e),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent addSelection: ",t)}}ngAfterViewInit(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: ngAfterViewInit","color: green;"),this.updateOverlayPosition()}catch(e){this.loggingService.catch("Error in ngAfterViewInit: ",e)}}setOverlayPosition(e){try{switch(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: setOverlayPosition","color: green;"),e){case"start":this.componentConfigSignal.update(t=>(t=y(h({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t));break;default:this.componentConfigSignal.update(t=>(t=y(h({},t),{overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"}}),t))}this.updateOverlayPosition()}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setOverlayPosition: ",t)}}updateOverlayPosition(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: updateOverlayPosition","color: green;"),this.selectionElementPortalOverlay&&this.selectionElementPortalOverlay?.overlayRef?.updatePosition()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent updateOverlayPosition: ",e)}}calculatePosition(){try{if(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: calculatePosition","color: green;"),this.highlight?.targetElement){let e=S3(this.highlight.targetElement);if(e){let t=e.iterateNext(),i,a=null,l=null;try{i=JSON.parse(t?.getAttribute(N.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),a=t?.getAttribute(N.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,a&&this.setOverlayPosition(a),l=t?.getAttribute(N.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(d=>(d=y(h({},d),{userIndicatorPosition:a,userIndicatorType:l}),d))}catch{}let c;if(i?.horizontal&&(c=i.horizontal),a==="start"?c="top-start":c="top-right",t){let d=t.getBoundingClientRect();if(d&&d.width&&d.height)switch(c){case"left":this.position={top:d.height/2-16,left:-4};break;case"left-start":this.position={top:0,left:-4};break;case"top-start":this.position={top:-32,left:0};break;case"top-right":this.position={top:-32,left:d.width};break;case"bottom-left":this.position={top:d.height+4,left:0};break;case"bottom-right":this.position={top:d.height+4,left:d.width-32};break;case"center-left":this.position={top:d.height/2-16,left:-32};break;case"center-right":this.position={top:d.height/2-16,left:d.width+4};break;default:this.position={top:-32,left:d.width}}else this.position=null}else this.position=null}else this.position=null}this.componentConfigSignal.update(e=>(e=y(h({},e),{position:this.position}),e))}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent calculatePosition: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(wc),x(Q))},o.\u0275cmp=O({type:o,selectors:[["app-selection-element-portal"]],viewQuery:function(t,i){if(t&1&&pt(fYe,5),t&2){let a;vt(a=mt())&&(i.selectionElementPortalOverlay=a.first)}},hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{highlight:"highlight",offsetLeft:"offsetLeft",offsetTop:"offsetTop"},standalone:!1,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["selectionElementPortalOverlay","cdkConnectedOverlay"],["defaultAvatarTypeTemplate",""],[4,"ngIf"],["cdkOverlayOrigin","","role","presentation",1,"selection-element-portal",3,"id"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayLockPosition","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass","cdkConnectedOverlayPositions"],[4,"ngIf","ngIfElse"],["role","list",1,"velt-live-selection-element-user-name-container"],[4,"ngFor","ngForOf"],["class","velt-live-selection-element-user-name-plus","role","listitem",3,"--velt-selection-color",4,"ngIf"],["role","listitem",1,"velt-live-selection-element-user-name"],["role","listitem",1,"velt-live-selection-element-user-name-plus"],["class","photo-container","role","listitem",3,"--velt-selection-user-index","background-color",4,"ngIf"],[1,"photo-container","selection-user-avatar",3,"size","user"],["role","listitem",1,"photo-container"],[1,"s-selection-element-avatar-initial"]],template:function(t,i){t&1&&p(0,OYe,2,1,"ng-container",3),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[Yt,xe,_n,pn,mr,he],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-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);position:absolute;top:0;left:0;box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert}.selection-element-portal[_ngcontent-%COMP%]{display:none;position:absolute;top:0;left:0;white-space:nowrap;z-index:1;font-size:var(--velt-font-size-xs)}.photo-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:calc((1.5rem + 0px) * var(--velt-base-rem-unit));height:calc((1.5rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;background-clip:padding-box;border-radius:50%;color:var(--velt-light-mode-white);border:2px solid var(--velt-selection-color);margin-left:-5px;z-index:calc(var(--velt-selection-user-index, 0) * -1)}.photo-container[_ngcontent-%COMP%] .s-selection-element-avatar-initial[_ngcontent-%COMP%]{color:var(--velt-light-mode-white)}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;object-fit:cover} snippyly-user-avatar.selection-user-avatar .s-user-avatar-initial{font-size:var(--velt-font-size-md)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%]{display:flex;gap:var(--velt-spacing-xs);margin-top:5px}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-xs) var(--velt-spacing-sm);font-size:var(--velt-spacing-md);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name-plus[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-x);font-size:var(--velt-font-size-xs);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}"],changeDetection:0});let n=o;return n})();var TS=(n,o)=>{try{let r=MYe(n),e=[],t=[];return r.forEach(i=>{i?.parentElement?.closest(N.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?i?.parentElement?.normalize():t.push(i)}),t.forEach(i=>{let a=PYe(i,o);a&&e.push(a)}),e}catch(r){return lt.catch("Error in highlighter highlightRange: ",r),[]}},MYe=n=>{try{if(n.collapsed)return[];let o=n.commonAncestorContainer;if(n.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(o=n.commonAncestorContainer.parentElement),!o)return[];let r=[],e=o.ownerDocument.createNodeIterator(o,NodeFilter.SHOW_TEXT),t,i=!1;for(;t=e.nextNode();)if(n.intersectsNode(t)){let a=t?.length;n.startContainer===t&&n.startOffset>0&&(t.splitText(n.startOffset),i=!0),n.endContainer===t&&n.endOffset<a&&t.splitText(n.endOffset),r.push(t)}return i&&r.shift(),r}catch(o){return lt.catch("Error in highlighter getTextNodesInRange: ",o),[]}},PYe=(n,o)=>{try{let r=document.createElement(o||N.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return n.parentElement?.replaceChild(r,n),r.appendChild(n),r}catch(r){return lt.catch("Error in highlighter highlightNode: ",r),null}};var wc=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A){this.afAuth=e,this.analyticsService=t,this.authService=i,this.configService=a,this.databaseService=l,this.docService=c,this.domService=d,this.componentFactoryResolver=m,this.injector=u,this.appRef=_,this.loggingService=I,this.commonDbService=A,this.documentPaths=null,this.textSelections={},this.enableSelections$=new Se(!1),this.userIndicatorEnabled$=new Se(!0),this.userIndicatorPosition$=new Se(AO.End),this.userIndicatorType$=new Se(fS.Avatar),this.defaultElementsTrackingEnabled$=new Se(!0),this.defaultStylingEnabled$=new Se(!0),this.inactivityTime=300*1e3,this.userIdleStateDetectionSubscription=null,this.elementSelections={},this.databaseService.getDb().pipe($e(M=>!!M),ut(1)).subscribe(M=>{M&&(this.updateOnDocumentFocusChange(),this.updateOnUserDbConnectionStateChange(M).subscribe(()=>{},B=>{this.loggingService.catch("Error in SelectionService constructor updateOnUserDbConnectionStateChange: ",B)}))},M=>{this.loggingService.catch("Error in SelectionService getDb subscription: ",M)}),this.authService.getUser$().subscribe(M=>{M?this.detectUserIdleState():this.unsubscribeUserIdleStateDetectionSubscription()}),this.docService.getDocumentPaths$().subscribe(M=>{this.documentPaths=M},M=>{this.loggingService.catch("Error in SelectionService getDocumentPaths subscription: ",M)}),this.domService.onDocumentClick$().subscribe(M=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&M?.target&&!window.getSelection()?.toString()){let B=this.getSelectionEnabledElement(M.target);if(B&&!fo(B)){let q=this.domService.getXPath(B);if(q){let ae=new Dp;ae.type="click",ae.targetElement=q,ae.timestamp=this.timestamp,this.setSelection(ae)}}else this.removeSelection()}}catch(B){this.loggingService.catch("Error in SelectionService onDocumentClick$: ",B)}},M=>{this.loggingService.catch("Error in SelectionService onDocumentClick$ subscription: ",M)}),this.domService.onDocumentFocus$().subscribe(M=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&M?.target){let B=this.getSelectionEnabledElement(M.target);if(B&&!fo(B)){let q=this.domService.getXPath(B);if(q){let ae=new Dp;ae.type="focus",ae.targetElement=q,ae.timestamp=this.timestamp,this.setSelection(ae)}}else this.removeSelection()}}catch(B){this.loggingService.catch("Error in SelectionService onDocumentFocus$: ",B)}},M=>{this.loggingService.catch("Error in SelectionService onDocumentFocus$ subscription: ",M)}),this.domService.onWindowKeyupEsc$().subscribe(M=>{this.removeSelection()},M=>{this.loggingService.catch("Error in SelectionService onWindowKeyupEsc$ subscription: ",M)}),this.enableSelections$.pipe(ye(()=>this.isFeatureAllowed$({})),$e(M=>M?.config&&M?.user)).subscribe(M=>{(!M?.featureAllowed||!this.enableSelections$.value)&&this.removeSelection()},M=>{this.loggingService.catch("Error in SelectionService enableSelections$ subscription: ",M)}),this.domService.onSelectionChange$().subscribe(()=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&window.getSelection()?.toString()){let M=window.getSelection()?.getRangeAt(0);if(M.commonAncestorContainer&&!M?.collapsed){let B=xhe([M]),q=new Dp;q.type="selection",q.targetTextRange=B?.length?B[0]:null,q.timestamp=this.timestamp,this.setSelection(q)}}}catch(M){this.loggingService.catch("Error in SelectionService onSelectionChange$: ",M)}},M=>{this.loggingService.catch("Error in SelectionService onSelectionChange$ subscription: ",M)}),this.authService.getUser$().subscribe(M=>{this.user=M},M=>{this.loggingService.catch("Error in SelectionService getUser$ subscription: ",M)}),this.getSelectionsOnCurrentDocument().pipe(Rr()).subscribe(([M,B])=>{try{if(M){let q=[];Object.keys(M).forEach(ae=>{let _e=M[ae],re=B?B[ae]:null;!vr(_e,re)&&ae!==this.getUserIdHash(this.user)&&q.push(_e)}),q.forEach(ae=>{if(ae.targetElement){let _e=this.elementSelections[ae?.targetElement]?.portalRef,be=(this.elementSelections[ae?.targetElement]?.selections||[]).filter(Ie=>this.getUserIdHash(Ie.user)!==this.getUserIdHash(ae?.user));be?.length?(_e.instance.setSelections(be.slice()),this.elementSelections[ae?.targetElement].selections=be.slice(),this.highlightElement(be[0])):(this.removeHighlightFromElement(ae),this.removeSelectionElement(ae))}else ae.targetTextRange&&this.removeHighlightFromText(ae)})}if(B){let q=[];Object.keys(B).forEach(ae=>{let _e=M?M[ae]:null,re=B[ae];!vr(_e,re)&&ae!==this.getUserIdHash(this.user)&&q.push(re)}),q.forEach(ae=>{ae.targetElement?(this.highlightElement(ae),this.getUserIndicatorEnabled()&&this.setElementHighlight(ae)):ae.targetTextRange&&this.highlightText(ae)})}}catch(q){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",q)}},M=>{this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument subscription: ",M)}),this.authService.addPreSignOutFuction("highlight-signout",this.signOutUser.bind(this))}detectUserIdleState(){try{this.unsubscribeUserIdleStateDetectionSubscription();let e=!1;this.userIdleStateDetectionSubscription=this.domService.onWindowPointerMove$().pipe(ou(2e3),ln(()=>{e&&(e=!1)}),Qr(this.inactivityTime),ln(()=>{this.removeSelection(),e=!0})).subscribe()}catch(e){this.loggingService.catch("Error in detectUserIdleState: ",e)}}unsubscribeUserIdleStateDetectionSubscription(){try{this.userIdleStateDetectionSubscription&&(this.userIdleStateDetectionSubscription.unsubscribe(),this.userIdleStateDetectionSubscription=null)}catch(e){this.loggingService.catch("Error in unsubscribeUserIdleStateDetectionSubscription: ",e)}}isFeatureAllowed(){return Mo(this.configService.getConfig(),this.authService.getUser(),je.LIVE_SELECTION)}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.user&&document.visibilityState==="hidden"&&this.removeSelection()})}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}getSelectionsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getSelectionsOnCurrentDocument","color: green;"),br(this.afAuth).pipe($e(e=>!!e),ye(e=>this.isFeatureAllowed$({firebaseUser:e})),ye(e=>e.featureAllowed?ce(e).pipe(ye(t=>this.docService.getDocumentPaths$().pipe(ge(i=>(this.documentPaths=i,t)))),ye(t=>t?.user?t?.user?.isAnonymous?ce(null):this.documentPaths?this.databaseService.getDb().pipe($e(i=>!!i),ye(i=>this.documentPaths?.selection?this.commonDbService.dbListener({feature:"allSelections",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(a=>a?.data),ge(a=>this.filterActiveSelections(a))):ce(null))):ce(null):ce(null))):ce(null)))}isFeatureAllowed$(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>(this.user=i,y(h({},t),{user:i}))))),ye(t=>Mo(t.config,t.user,je.LIVE_SELECTION)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))),_t((t,i)=>t?.featureAllowed===i?.featureAllowed))}filterActiveSelections(e){this.loggingService.log("%c[WB] Calling FUNCTION: filterOnlineUsers","color: green;");try{if(e&&typeof e=="object"&&Object.keys(e).length){let t={},i=this.commonDbService.getServerTimestamp();return Object.keys(e).forEach(a=>{let l=e[a];l?.timestamp&&Math.abs(i-l.timestamp)<this.inactivityTime&&(t[a]=l)}),t}return e}catch(t){return this.loggingService.catch("Error in filterOnlineUsers:",t),e}}setSelection(e){try{if(this.user?.userId&&this.documentPaths?.selection){e.user=this.user;let t=JSON.parse(JSON.stringify(e));t&&!t?.timestamp&&(t.timestamp=this.timestamp),this.commonDbService.updateData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in SelectionService setSelection: ",t)}}removeSelection(){try{this.user?.userId&&this.documentPaths?.selection&&this.commonDbService.deleteData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in SelectionService removeSelection: ",e)}}updateOnUserDbConnectionStateChange(e){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnUserDbConnectionStateChange","color: green;"),br(this.afAuth).pipe($e(t=>!!t),ye(t=>this.docService.getDocumentPaths$().pipe(ge(i=>t))),ln(t=>X(this,null,function*(){try{if(this.documentPaths&&t){let i=yield Xv(t,!0).catch(l=>null);if(!i)return;let{user:a}=i.claims;if(a&&this.documentPaths?.selection){let l=this.getUserIdHash(a);if(l){let c=`${this.documentPaths.selection}/${l}`,d=Vr(e,c);Cc(d).remove().catch(m=>{this.loggingService.catch("Error in SelectionService updateOnUserDbConnectionStateChange onDisconnect:",m)})}}}}catch(i){this.loggingService.catch("Error in SelectionService updateOnUserDbConnectionStateChange:",i)}})))}highlightElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let i=t.iterateNext();if(i){let a=["input","textarea","select","button"],l;try{i?.getAttribute(N.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(l=JSON.parse(i?.getAttribute(N.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"))}catch{}(!l||l?.border)&&this.domService.highlightUserElement(i,e?.user?.color,e?.user?.name,this.getDefaultStylingEnabled())}}}catch(t){this.loggingService.catch("Error in SelectionService highlightElement: ",t)}}removeHighlightFromElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let i=t.iterateNext();i&&this.domService.removeHighlightUserFromElement(i)}}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromElement: ",t)}}highlightText(e){try{if(e?.targetTextRange){let t=np(e.targetTextRange?.text,this.domService.getXPath(e.targetTextRange?.commonAncestorContainer).iterateNext(),e.targetTextRange?.occurrence),i=new Range;try{i.setStart(t[0].textNode,t[0].startOffset||0),i.setEnd(t[t.length-1].textNode,t[t.length-1].endOffset||0)}catch{}if(i.toString()===e.targetTextRange?.text){let a=TS(i,N.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),l=[],c=this.getSelectionUserMarker(e.user);if(a&&a.length&&(a.forEach(d=>{d?.textContent?.trim()&&(this.domService.addClassToElement(d,d.tagName?.toLowerCase()),this.domService.addClassToElement(d,N.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(d,N.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&d.style.setProperty(N.VELT_SELECTION_COLOR,e.user?.color+"55"),l.push({element:d,textNode:d.childNodes[0]}))}),c)){let d=a.filter(u=>u?.textContent?.trim()),m=d?.length?d[d?.length-1]:null;m&&m.parentNode.insertBefore(c,m.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:l,marker:c}}}}catch(t){this.loggingService.catch("Error in SelectionService highlightText: ",t)}}removeHighlightFromText(e){try{let t=this.getUserIdHash(e?.user);t&&this.textSelections[t]?.textNodes?.length&&(this.textSelections[t].textNodes.forEach(i=>{i?.element&&i?.textNode&&i.element.replaceWith(i.textNode),i.textNode&&i.textNode.parentNode?.normalize()}),this.textSelections[t]?.marker&&this.textSelections[t]?.marker?.remove())}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromText: ",t)}}getSelectionUserMarker(e){try{let t=document.createElement("span");t.classList.add("snippyly-user-marker","active"),t.setAttribute("data-name",e?.name+""),t.style.setProperty("--velt-selection-marker-color",e?.color||"#000");let i=document.createElement("span");i.classList.add("snippyly-user-marker-line");let a=document.createElement("span");return a.classList.add("snippyly-user-marker-dot"),i.appendChild(a),t.appendChild(i),setTimeout(()=>{t?.classList?.remove("active")},1e3),t}catch(t){return this.loggingService.catch("Error in SelectionService getSelectionUserMarker: ",t),null}}signOutUser(e){return new Promise((t,i)=>{try{this.documentPaths?.selection&&e?this.commonDbService.getData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).then(a=>{a&&this.commonDbService.deleteData({feature:"selection",errorCallback:l=>{i(l)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}}),t(null)}).catch(a=>{this.loggingService.catch("Error in SelectionService signOutUser subscription: ",a),i(a)}):t(null)}catch(a){this.loggingService.catch("Error in SelectionService signOutUser:",a),i(a)}})}setInactivityTime(e){try{this.inactivityTime=e,this.analyticsService.trackEvent(Y.Events.Selection.SELECTION_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime}),this.detectUserIdleState()}catch(t){this.loggingService.catch("Error in SelectionService setInactivityTime: ",t)}}getInactivityTime(){return this.inactivityTime}enableSelections(e){try{this.enableSelections$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService enableSelections: ",t)}}enableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!0)return;this.userIndicatorEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableUserIndicator: ",e)}}disableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!1)return;this.userIndicatorEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableUserIndicator: ",e)}}getUserIndicatorEnabled$(){return this.userIndicatorEnabled$.asObservable()}getUserIndicatorEnabled(){return this.userIndicatorEnabled$.value}setUserIndicatorPosition(e){try{this.userIndicatorPosition$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorPosition: ",t)}}getUserIndicatorPosition$(){return this.userIndicatorPosition$.asObservable()}getUserIndicatorPosition(){return this.userIndicatorPosition$.value}setUserIndicatorType(e){try{this.userIndicatorType$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorType: ",t)}}getUserIndicatorType$(){return this.userIndicatorType$.asObservable()}getUserIndicatorType(){return this.userIndicatorType$.value}enableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!0)return;this.defaultElementsTrackingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultElementsTracking: ",e)}}disableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!1)return;this.defaultElementsTrackingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultElementsTracking: ",e)}}getDefaultElementsTrackingEnabled$(){return this.defaultElementsTrackingEnabled$.asObservable()}getDefaultElementsTrackingEnabled(){return this.defaultElementsTrackingEnabled$.value}enableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!0)return;this.defaultStylingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultStyling: ",e)}}disableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!1)return;this.defaultStylingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultStyling: ",e)}}getDefaultStylingEnabled$(){return this.defaultStylingEnabled$.asObservable()}getDefaultStylingEnabled(){return this.defaultStylingEnabled$.value}getSelectionEnabledElement(e){try{let t=this.getDefaultElementsTrackingEnabled();return t&&N.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:mZ(e,t)}catch(t){return this.loggingService.catch("Error in SelectionService isElementAllowed: ",t),null}}setElementHighlight(e){try{if(!this.elementSelections[e.targetElement])this.setSelectionElement(e);else{let t=this.elementSelections[e.targetElement].portalRef;this.elementSelections[e.targetElement].selections?.find(a=>this.getUserIdHash(a.user)===this.getUserIdHash(e?.user))||(t.instance.addSelection(e),this.elementSelections[e.targetElement].selections.push(e))}}catch(t){this.loggingService.catch("Error in SelectionService setElementSelection: ",t)}}setSelectionElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let i=t.iterateNext();if(i){let a=this.domService.getHostElement(i),l=new Vi(I_e),c=new Bi(a,this.appRef,this.injector),d=c.attach(l);d.instance.highlight=e,d.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:c,selectionElementPortal:l,portalRef:d,selections:[JSON.parse(JSON.stringify(e))],userTargetElement:i,selectionHostElement:a,targetElement:e.targetElement},this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in SelectionService setSelectionElement: ",t)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:i,selectionHostElement:a}=this.elementSelections[e.targetElement],l=this.domService.getElementOffset(i,a);t.instance.offsetLeft=l.offsetLeft,t.instance.offsetTop=l.offsetTop}catch(t){this.loggingService.catch("Error in SelectionService updateElementOffset: ",t)}}checkElementHighlightsToRemove(e){try{let t=e.map(i=>i.targetElement);Object.keys(this.elementSelections).forEach(i=>{if(!t.includes(i)){let a=this.elementSelections[i];a&&(a.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(a.selectionHostElement)),delete this.elementSelections[i]}})}catch(t){this.loggingService.catch("Error in SelectionService checkElementHighlightsToRemove: ",t)}}removeSelectionElement(e){try{let t=this.elementSelections[e.targetElement];t&&(t.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(t.selectionHostElement)),delete this.elementSelections[e.targetElement]}catch(t){this.loggingService.catch("Error in SelectionService removeSelectionElement: ",t)}}getUserIdHash(e){try{return e?.userId?It(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(t){return new(t||o)(K(eo),K(ct),K(qe),K(Ft),K($n),K(st),K(Ue),K(Qo),K(Dt),K(Ir),K(k),K(yn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var RU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: SelectionElement","color: blue;"),this.enableLiveSelection=this._enableLiveSelection,this.disableLiveSelection=this._disableLiveSelection,this.enableUserIndicator=this._enableUserIndicator,this.disableUserIndicator=this._disableUserIndicator,this.setUserIndicatorPosition=this._setUserIndicatorPosition,this.setUserIndicatorType=this._setUserIndicatorType,this.enableDefaultElementsTracking=this._enableDefaultElementsTracking,this.disableDefaultElementsTracking=this._disableDefaultElementsTracking,this.enableDefaultStyling=this._enableDefaultStyling,this.disableDefaultStyling=this._disableDefaultStyling,this.getLiveSelectionData=this._getLiveSelectionData,this.setInactivityTime=this._setInactivityTime}_enableLiveSelection(){this.getService(k).log("%c[WB] Calling FUNCTION: _enableLiveSelection","color: green;");try{this.trackEvent(Y.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(wc).enableSelections(!0)}catch(o){this.getService(k).catch("Error in enableLiveSelection: ",o)}}_disableLiveSelection(){this.getService(k).log("%c[WB] Calling FUNCTION: _disableLiveSelection","color: green;");try{this.trackEvent(Y.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(wc).enableSelections(!1)}catch(o){this.getService(k).catch("Error in disableLiveSelection: ",o)}}_enableUserIndicator(){this.getService(k).log("%c[WB] Calling FUNCTION: enableUserIndicator","color: green;");try{this.trackEvent(Y.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(wc).enableUserIndicator()}catch(o){this.getService(k).catch("Error in _enableUserIndicator: ",o)}}_disableUserIndicator(){this.getService(k).log("%c[WB] Calling FUNCTION: disableUserIndicator","color: green;");try{this.trackEvent(Y.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(wc).disableUserIndicator()}catch(o){this.getService(k).catch("Error in _disableUserIndicator: ",o)}}_setUserIndicatorPosition(o){this.getService(k).log("%c[WB] Calling FUNCTION: setUserIndicatorPosition","color: green;");try{this.trackEvent(Y.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:o}}),this.getService(wc).setUserIndicatorPosition(o)}catch(r){this.getService(k).catch("Error in _setUserIndicatorPosition: ",r)}}_setUserIndicatorType(o){this.getService(k).log("%c[WB] Calling FUNCTION: setUserIndicatorType","color: green;");try{this.trackEvent(Y.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:o}}),this.getService(wc).setUserIndicatorType(o)}catch(r){this.getService(k).catch("Error in _setUserIndicatorType: ",r)}}_enableDefaultElementsTracking(){this.getService(k).log("%c[WB] Calling FUNCTION: enableDefaultElementsTracking","color: green;");try{this.trackEvent(Y.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(wc).enableDefaultElementsTracking()}catch(o){this.getService(k).catch("Error in _enableDefaultElementsTracking: ",o)}}_disableDefaultElementsTracking(){this.getService(k).log("%c[WB] Calling FUNCTION: disableDefaultElementsTracking","color: green;");try{this.trackEvent(Y.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(wc).disableDefaultElementsTracking()}catch(o){this.getService(k).catch("Error in _disableDefaultElementsTracking: ",o)}}_enableDefaultStyling(){this.getService(k).log("%c[WB] Calling FUNCTION: enableDefaultStyling","color: green;");try{this.trackEvent(Y.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(wc).enableDefaultStyling()}catch(o){this.getService(k).catch("Error in _enableDefaultStyling: ",o)}}_disableDefaultStyling(){this.getService(k).log("%c[WB] Calling FUNCTION: disableDefaultStyling","color: green;");try{this.trackEvent(Y.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(wc).disableDefaultStyling()}catch(o){this.getService(k).catch("Error in _disableDefaultStyling: ",o)}}_getLiveSelectionData(){this.getService(k).log("%c[WB] Calling FUNCTION: getLiveSelectionData","color: green;");try{return this.trackEvent(Y.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(wc).getSelectionsOnCurrentDocument()}catch(o){return this.getService(k).catch("Error in _getLiveSelectionData: ",o),ce(null)}}_setInactivityTime(o){this.getService(k).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(Y.Events.Selection.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:o}}),!isNaN(o)&&o>0?this.getService(wc).setInactivityTime(o):this.getService(k).catch("Error in setInactivityTime: ","Provided value must be a positive number greater than zero.")}catch(r){this.getService(k).catch("Error in setInactivityTime: ",r)}}};var NU=(()=>{let o=class o{constructor(e){this.loggingService=e,this.enabledSignal=De(!1),this.onTargetEditStart=null,this.onTargetEditCommit=null;try{this.enabled$=Use(this.enabledSignal).pipe(_t())}catch(t){this.loggingService.catch("Error in SuggestionModeService constructor: ",t),this.enabled$=new Vt}}enable(e){try{this.onTargetEditStart=e?.onTargetEditStart??null,this.onTargetEditCommit=e?.onTargetEditCommit??null,this.enabledSignal.set(!0)}catch(t){this.loggingService.catch("Error in SuggestionModeService enable: ",t)}}disable(){try{this.onTargetEditStart=null,this.onTargetEditCommit=null,this.enabledSignal.set(!1)}catch(e){this.loggingService.catch("Error in SuggestionModeService disable: ",e)}}isEnabled(){try{return this.enabledSignal()}catch(e){return this.loggingService.catch("Error in SuggestionModeService isEnabled: ",e),!1}}getOnTargetEditStart(){try{return this.onTargetEditStart}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditStart: ",e),null}}getOnTargetEditCommit(){try{return this.onTargetEditCommit}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditCommit: ",e),null}}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var FU=(()=>{let o=class o{constructor(e){this.loggingService=e,this.snapshots=new Map}captureFromGetter(e,t){try{if(!e||typeof t!="function")return!1;let i;try{i=t()}catch(a){return sm()&&this.loggingService.catch(`[velt] Suggestion target "${e}" getter threw: `,a),!1}return this.captureValue(e,i)}catch(i){return this.loggingService.catch("Error in SuggestionSnapshotService captureFromGetter: ",i),!1}}captureValue(e,t){try{if(!e)return!1;let i;try{i=structuredClone(t)}catch(a){return sm()&&this.loggingService.catch(`[velt] Suggestion target "${e}" snapshot failed (value not cloneable). Cause: structuredClone rejected the value (cyclic refs, DOM nodes, or functions are common culprits). Fix: ensure your getter returns plain JSON-serializable data.`,a),!1}return this.snapshots.set(e,i),!0}catch(i){return this.loggingService.catch("Error in SuggestionSnapshotService captureValue: ",i),!1}}getSnapshot(e){try{return this.snapshots.has(e)?this.snapshots.get(e):void 0}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService getSnapshot: ",t);return}}hasSnapshot(e){try{return this.snapshots.has(e)}catch(t){return this.loggingService.catch("Error in SuggestionSnapshotService hasSnapshot: ",t),!1}}clearSnapshot(e){try{this.snapshots.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService clearSnapshot: ",t)}}clearAllSnapshots(){try{this.snapshots.clear()}catch(e){this.loggingService.catch("Error in SuggestionSnapshotService clearAllSnapshots: ",e)}}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var LU=(()=>{let o=class o{constructor(e,t,i){this.loggingService=e,this.modeService=t,this.snapshotService=i,this.registry=new Map,this.warnedUnstableIds=new Set,this.actionsService=null}registerTarget(e,t){try{if(!e||typeof t!="function")return;this.warnIfUnstableId(e);let i=this.registry.get(e)??{};i.getter=t,this.registry.set(e,i)}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService registerTarget: ",i)}}unregisterTarget(e){try{let t=this.registry.get(e);if(!t)return;delete t.getter,t.node||this.registry.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService unregisterTarget: ",t)}}getGetter(e){try{return this.registry.get(e)?.getter}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getGetter: ",t);return}}setActionsService(e){try{this.actionsService=e}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService setActionsService: ",t)}}getNode(e){try{if(!e)return;let t=this.registry.get(e)?.node;if(t&&t.isConnected)return t;let i=this.queryAll(e);if(i.length===0)return;i.length>1&&this.warnDuplicateId(e,i.length);let a=i[0],l=this.registry.get(e)??{};return l.node=a,this.registry.set(e,l),a}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getNode: ",t);return}}getFallbackValue(e){try{let t=this.getNode(e);if(!t)return{hasValue:!1};let i=t.textContent??"";return i.length>0?{hasValue:!0,value:i}:{hasValue:!1}}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService getFallbackValue: ",t),{hasValue:!1}}}isRegistered(e){try{return this.registry.get(e)?.getter?!0:!!this.getNode(e)}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isRegistered: ",t),!1}}countTaggedElements(e){try{let t=e??this.rootEl??document.body;return t?t.querySelectorAll(`[${N.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).length:0}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService countTaggedElements: ",t),0}}startObserving(e=document.body){try{if(this.observer)return;this.rootEl=e,this.scanAndRefresh(e),this.observer=new MutationObserver(()=>{try{this.scanAndRefresh(this.rootEl??document.body)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService observer callback: ",t)}}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[N.ATTRIBUTES.VELT_SUGGESTION_TARGET]}),this.installDelegatedListeners(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService startObserving: ",t)}}stopObserving(){try{this.observer?.disconnect(),this.observer=void 0,this.rootEl&&this.removeDelegatedListeners(this.rootEl),this.rootEl=void 0}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService stopObserving: ",e)}}clear(){try{this.registry.clear(),this.warnedUnstableIds.clear()}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService clear: ",e)}}installDelegatedListeners(e){try{this.boundFocusIn=t=>this.handleFocusIn(t),this.boundChange=t=>this.handleChange(t),this.boundFocusOut=t=>this.handleFocusOut(t),e.addEventListener("focusin",this.boundFocusIn,!0),e.addEventListener("change",this.boundChange,!0),e.addEventListener("focusout",this.boundFocusOut,!0)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService installDelegatedListeners: ",t)}}removeDelegatedListeners(e){try{this.boundFocusIn&&e.removeEventListener("focusin",this.boundFocusIn,!0),this.boundChange&&e.removeEventListener("change",this.boundChange,!0),this.boundFocusOut&&e.removeEventListener("focusout",this.boundFocusOut,!0),this.boundFocusIn=void 0,this.boundChange=void 0,this.boundFocusOut=void 0}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService removeDelegatedListeners: ",t)}}handleFocusIn(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t)return;this.captureSnapshotForTarget(t.targetId,t.element);let i=this.snapshotService.getSnapshot(t.targetId),a={targetId:t.targetId,oldValue:i,newValue:i,element:t.element},l=this.modeService.getOnTargetEditStart();if(l)try{l(a)}catch(c){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditStart customer callback threw: ",c)}this.actionsService?.triggerAction(Il.TARGET_EDIT_START,{details:a,timestamp:Date.now()})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusIn: ",t)}}handleChange(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||!this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleChange: ",t)}}handleFocusOut(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusOut: ",t)}}isAtomicCommitTarget(e){try{if(e instanceof HTMLSelectElement)return!0;if(e instanceof HTMLInputElement){let t=(e.type||"").toLowerCase();return t==="checkbox"||t==="radio"}return!1}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isAtomicCommitTarget: ",t),!1}}processCommit(e,t){try{let i=this.snapshotService.getSnapshot(e),a=this.readElementValue(e,t);if(vr(i,a))return;let l={targetId:e,oldValue:i,newValue:a,element:t},c=this.modeService.getOnTargetEditCommit(),d=!1;if(c){let u=null;try{u=c(l)}catch(_){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditCommit customer callback threw: ",_)}u&&(d=!0,this.invokeAutoCommit({targetId:e,newValue:a,summary:u.summary,metadata:u.metadata}))}let m=u=>X(this,null,function*(){return d?null:this.invokeAutoCommit({targetId:e,newValue:a,summary:u?.summary,metadata:u?.metadata})});this.actionsService?.triggerAction(Il.TARGET_EDIT_COMMIT,{details:l,commitSuggestion:m,timestamp:Date.now()})}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService processCommit: ",i)}}invokeAutoCommit(e){try{return this.actionsService?this.actionsService.commitSuggestion(e).catch(t=>(sm()&&this.loggingService.catch(`[velt] auto-commit for "${e.targetId}" rejected: `,t),null)):(sm()&&this.loggingService.log("[velt] auto-commit skipped: actions service not wired. SuggestionActionsService constructor should call registry.setActionsService(this)."),Promise.resolve(null))}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService invokeAutoCommit: ",t),Promise.resolve(null)}}captureSnapshotForTarget(e,t){try{let i=this.registry.get(e);if(i?.getter){this.snapshotService.captureFromGetter(e,i.getter);return}let a=this.readElementValue(e,t);this.snapshotService.captureValue(e,a)}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService captureSnapshotForTarget: ",i)}}readElementValue(e,t){try{let i=this.registry.get(e);if(i?.getter)try{return i.getter()}catch{return}if(t instanceof HTMLInputElement){let a=(t.type||"").toLowerCase();return a==="checkbox"||a==="radio"?t.checked:a==="number"||a==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}return t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?t.value:(t instanceof HTMLElement&&t.isContentEditable,t.textContent??"")}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService readElementValue: ",i);return}}findTaggedAncestor(e){try{if(!(e instanceof Element))return null;let t=e.closest(`[${N.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`);if(!t)return null;let i=t.getAttribute(N.ATTRIBUTES.VELT_SUGGESTION_TARGET);return i?{element:t,targetId:i}:null}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService findTaggedAncestor: ",t),null}}queryAll(e){try{let t=window.CSS?.escape?window.CSS.escape(e):e.replace(/"/g,'\\"');return Array.from(document.querySelectorAll(`[${N.ATTRIBUTES.VELT_SUGGESTION_TARGET}="${t}"]`))}catch{return[]}}scanAndRefresh(e){try{e.querySelectorAll(`[${N.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).forEach(i=>{let a=i.getAttribute(N.ATTRIBUTES.VELT_SUGGESTION_TARGET);if(!a)return;let l=this.registry.get(a)??{};(!l.node||!l.node.isConnected)&&(l.node=i,this.registry.set(a,l))})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService scanAndRefresh: ",t)}}warnIfUnstableId(e){try{if(!sm()||this.warnedUnstableIds.has(e))return;let t=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i.test(e),i=/\d{10,}/.test(e);(t||i)&&(this.warnedUnstableIds.add(e),this.loggingService.catch(`[velt] Target id "${e}" appears unstable. Cause: contains a UUID or timestamp shape \u2014 these typically change across re-renders. Fix: use a stable customer-owned id (the same one you use in your state). Docs: velt.dev/docs/suggestions/target-ids`,new Error("UNSTABLE_TARGET_ID")))}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService warnIfUnstableId: ",t)}}warnDuplicateId(e,t){try{if(!sm())return;this.loggingService.catch(`[velt] Duplicate target id "${e}" \u2014 ${t} elements share this id. Cause: the same ${N.ATTRIBUTES.VELT_SUGGESTION_TARGET} appears on multiple DOM nodes. Fix: ensure each suggestable element has a unique id. Velt is using the first registered element. Docs: velt.dev/docs/suggestions/target-ids`,new Error("DUPLICATE_TARGET_ID"))}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService warnDuplicateId: ",i)}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(NU),K(FU))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ic=(()=>{let o=class o{constructor(e,t,i,a,l,c){this.loggingService=e,this.modeService=t,this.snapshotService=i,this.targetRegistry=a,this.commentService=l,this.commonDbService=c,this.actionSubjects=new Map,this.observingActive=!1;try{this.targetRegistry.setActionsService(this)}catch(d){this.loggingService.catch("Error in SuggestionActionsService constructor: ",d)}}enableSuggestionMode(e){try{this.modeService.enable(e),this.startObservingIfNeeded(),this.warnIfNoTaggedElements()}catch(t){this.loggingService.catch("Error in SuggestionActionsService enableSuggestionMode: ",t)}}disableSuggestionMode(){try{this.modeService.disable(),this.stopObservingIfNeeded()}catch(e){this.loggingService.catch("Error in SuggestionActionsService disableSuggestionMode: ",e)}}isSuggestionModeEnabled(){try{return this.modeService.isEnabled()}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled: ",e),!1}}isSuggestionModeEnabled$(){try{return this.modeService.enabled$}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled$: ",e),new Vt}}registerTarget(e){try{if(!e?.targetId||typeof e?.getter!="function")return;this.targetRegistry.registerTarget(e.targetId,e.getter)}catch(t){this.loggingService.catch("Error in SuggestionActionsService registerTarget: ",t)}}unregisterTarget(e){try{this.targetRegistry.unregisterTarget(e)}catch(t){this.loggingService.catch("Error in SuggestionActionsService unregisterTarget: ",t)}}startSuggestion(e){try{let t=this.targetRegistry.getGetter(e);if(t){this.snapshotService.captureFromGetter(e,t);return}let i=this.targetRegistry.getFallbackValue(e);i.hasValue?this.snapshotService.captureValue(e,i.value):this.loggingService.warn(`[velt] startSuggestion: target "${e}" not registered. Cause: no getter via registerTarget() and no textContent fallback. Fix: tag the element with data-velt-suggestion-target and register a getter via registerTarget(). Docs: velt.dev/docs/suggestions/targets`)}catch(t){this.loggingService.catch("Error in SuggestionActionsService startSuggestion: ",t)}}commitSuggestion(e){return new Promise((t,i)=>{try{if(!e?.targetId){i(new Error("INVALID_CONFIG"));return}if(!this.modeService.isEnabled()){this.loggingService.warn("[velt] commitSuggestion called while suggestion mode is disabled. Cause: enableSuggestionMode() has not been called (or disableSuggestionMode() was called). Fix: call enableSuggestionMode() before commit, or branch on isSuggestionModeEnabled() in your onSave handler. Docs: velt.dev/docs/suggestions/mode"),i(new Error("MODE_NOT_SUGGESTING"));return}if(!this.targetRegistry.isRegistered(e.targetId)){this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" not registered. Cause: no element has data-velt-suggestion-target="${e.targetId}" and no registerTarget() call provided a getter. Fix: tag the element or register a getter at app boot. Docs: velt.dev/docs/suggestions/targets`),i(new Error("TARGET_NOT_REGISTERED"));return}if(!this.snapshotService.hasSnapshot(e.targetId)){let u=this.targetRegistry.getGetter(e.targetId);if(u){if(!this.snapshotService.captureFromGetter(e.targetId,u)){i(new Error("SNAPSHOT_FAILED"));return}}else{let _=this.targetRegistry.getFallbackValue(e.targetId);if(_.hasValue)this.snapshotService.captureValue(e.targetId,_.value);else{this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" requires registerTarget() for complex values. Cause: complex objects need a getter so the SDK can deep-clone the snapshot. Fix: call velt.getSuggestionElement().registerTarget("${e.targetId}", () => yourState.${e.targetId}) at app boot. Docs: velt.dev/docs/suggestions/getter`),i(new Error("NO_GETTER_FOR_COMPLEX"));return}}}let a=this.snapshotService.getSnapshot(e.targetId),l=e.newValue;if(vr(a,l)){this.loggingService.warn(`[velt] commitSuggestion: no change detected for target "${e.targetId}". Cause: oldValue and newValue are deeply equal. Fix: only call commitSuggestion when the customer actually changed the value. Docs: velt.dev/docs/suggestions/edge-cases`),i(new Error("NO_CHANGE_TO_SUGGEST"));return}let c=new Pr;c.type="suggestion",c.suggestion={status:"pending",targetId:e.targetId,targetType:"custom",oldValue:a,newValue:l,summary:e.summary??null,driftDetected:!1,rejectReason:null,resolvedBy:null,resolvedAt:null},c.metadata=e.metadata??{};let d=e.summary??`[${e.targetId}] changed`,m=new tc;m.commentText=d,m.commentHtml=`<p>${this.escapeHtml(d)}</p>`,c.comments=[m],this.commentService.addComment(void 0,void 0,void 0,void 0,!1,[],void 0,void 0,void 0,void 0,void 0,void 0,void 0,u=>{try{this.snapshotService.clearSnapshot(e.targetId),this.projectAndTrigger(Il.SUGGESTION_CREATED,u.annotation),t({id:u.annotation.annotationId})}catch(_){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion callback: ",_),i(_)}},void 0,void 0,c,void 0,void 0,!0,void 0,void 0,"internal",void 0)}catch(a){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion: ",a),i(a)}})}getSuggestions(e){try{let t=this.commentService.getCommentAnnotationsOnCurrentOrganizationAndDocument()??[],i=[];for(let a of t){if(a.type!=="suggestion"||!a.suggestion)continue;let l=this.projectAnnotationToSuggestion(a);l&&this.matchesFilter(l,e)&&i.push(l)}return i}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions: ",t),[]}}getSuggestions$(e){try{return this.commentService.getCommentAnnotationsOnCurrentOrganizationAndDocument$().pipe(ge(t=>{let i=[];for(let a of t??[]){if(a.type!=="suggestion"||!a.suggestion)continue;let l=this.projectAnnotationToSuggestion(a);l&&this.matchesFilter(l,e)&&i.push(l)}return i}),_t(Kt))}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions$: ",t),new Vt}}getPendingSuggestion(e){try{if(!e)return null;let t=this.getSuggestions({targetId:e,status:"pending"});return t.length===0?null:t.sort((i,a)=>(a.createdAt??0)-(i.createdAt??0))[0]}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion: ",t),null}}getPendingSuggestion$(e){try{return e?this.getSuggestions$({targetId:e,status:"pending"}).pipe(ge(t=>t.length===0?null:t.sort((i,a)=>(a.createdAt??0)-(i.createdAt??0))[0]),_t(Kt)):new Vt}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion$: ",t),new Vt}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.next(t)}catch(i){this.loggingService.catch("Error in SuggestionActionsService triggerAction: ",i)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new it),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in SuggestionActionsService onAction: ",t),ce(null)}}projectAndTrigger(e,t){try{if(!t||t.type!=="suggestion"||!t.suggestion)return;let i=this.projectAnnotationToSuggestion(t);if(!i)return;let a=this.timestamp;switch(e){case Il.SUGGESTION_CREATED:{let l={suggestion:i,timestamp:a};this.triggerAction(Il.SUGGESTION_CREATED,l);break}case Il.SUGGESTION_APPROVED:{let l={suggestion:i,timestamp:a};this.triggerAction(Il.SUGGESTION_APPROVED,l);break}case Il.SUGGESTION_REJECTED:{let l={suggestion:i,timestamp:a};this.triggerAction(Il.SUGGESTION_REJECTED,l);break}case Il.SUGGESTION_STALE:{let l={suggestion:i,timestamp:a};this.triggerAction(Il.SUGGESTION_STALE,l);break}}}catch(i){this.loggingService.catch("Error in SuggestionActionsService projectAndTrigger: ",i)}}projectAnnotationToSuggestion(e){try{let t=e.suggestion;if(!t)return;let i={annotationId:e.annotationId,targetId:t.targetId,targetType:t.targetType,oldValue:t.oldValue,newValue:t.newValue,summary:t.summary,metadata:e.metadata??{},driftDetected:!!t.driftDetected,createdBy:e.from,createdAt:e.createdAt??0};switch(t.status){case"pending":return y(h({},i),{status:"pending",rejectReason:null,resolvedBy:null,resolvedAt:null});case"approved":case"apply_failed":return y(h({},i),{status:t.status,rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"rejected":return y(h({},i),{status:"rejected",rejectReason:t.rejectReason??null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"stale":return y(h({},i),{status:"stale",rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt});default:return}}catch(t){this.loggingService.catch("Error in SuggestionActionsService projectAnnotationToSuggestion: ",t);return}}startObservingIfNeeded(){try{if(this.observingActive)return;this.observingActive=!0,this.targetRegistry.startObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService startObservingIfNeeded: ",e)}}stopObservingIfNeeded(){try{if(!this.observingActive)return;this.observingActive=!1,this.targetRegistry.stopObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService stopObservingIfNeeded: ",e)}}warnIfNoTaggedElements(){try{this.targetRegistry.countTaggedElements()===0&&this.loggingService.warn('[velt] No suggestable elements found on this page. Cause: no DOM elements have a data-velt-suggestion-target attribute. Fix: tag at least one element with data-velt-suggestion-target="your.id" before enabling suggestion mode. Docs: velt.dev/docs/suggestions/getting-started')}catch(e){this.loggingService.catch("Error in SuggestionActionsService warnIfNoTaggedElements: ",e)}}get timestamp(){return this.commonDbService.getServerTimestamp()}matchesFilter(e,t){try{return t?!(t.targetId&&e.targetId!==t.targetId||t.status&&!(Array.isArray(t.status)?t.status:[t.status]).includes(e.status)):!0}catch(i){return this.loggingService.catch("Error in SuggestionActionsService matchesFilter: ",i),!1}}escapeHtml(e){try{return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch(t){return this.loggingService.catch("Error in SuggestionActionsService escapeHtml: ",t),""}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(NU),K(FU),K(LU),K(Re),K(yn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var UU=class extends fr{constructor(o){super(o),this._enableSuggestionMode=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: enableSuggestionMode","color: green;");try{this.trackEvent(Y.Events.Suggestions.ENABLE_SUGGESTION_MODE_TRIGGERED),this.getService(ic).enableSuggestionMode(r)}catch(e){this.getService(k).catch("Error in _enableSuggestionMode: ",e)}},this._disableSuggestionMode=()=>{this.getService(k).log("%c[WB] Calling FUNCTION: disableSuggestionMode","color: green;");try{this.trackEvent(Y.Events.Suggestions.DISABLE_SUGGESTION_MODE_TRIGGERED),this.getService(ic).disableSuggestionMode()}catch(r){this.getService(k).catch("Error in _disableSuggestionMode: ",r)}},this._isSuggestionModeEnabled=()=>{this.getService(k).log("%c[WB] Calling FUNCTION: isSuggestionModeEnabled","color: green;");try{return this.trackEvent(Y.Events.Suggestions.IS_SUGGESTION_MODE_ENABLED_TRIGGERED),this.getService(ic).isSuggestionModeEnabled()}catch(r){return this.getService(k).catch("Error in _isSuggestionModeEnabled: ",r),!1}},this._isSuggestionModeEnabled$=()=>{this.getService(k).log("%c[WB] Calling FUNCTION: isSuggestionModeEnabled$","color: green;");try{return this.trackEvent(Y.Events.Suggestions.IS_SUGGESTION_MODE_ENABLED_STREAM_TRIGGERED),this.getService(ic).isSuggestionModeEnabled$()}catch(r){return this.getService(k).catch("Error in _isSuggestionModeEnabled$: ",r),new Vt}},this._registerTarget=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: registerTarget","color: green;");try{this.trackEvent(Y.Events.Suggestions.REGISTER_TARGET_TRIGGERED),this.getService(ic).registerTarget(r)}catch(e){this.getService(k).catch("Error in _registerTarget: ",e)}},this._unregisterTarget=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: unregisterTarget","color: green;");try{this.trackEvent(Y.Events.Suggestions.UNREGISTER_TARGET_TRIGGERED),this.getService(ic).unregisterTarget(r)}catch(e){this.getService(k).catch("Error in _unregisterTarget: ",e)}},this._startSuggestion=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: startSuggestion","color: green;");try{this.trackEvent(Y.Events.Suggestions.START_SUGGESTION_TRIGGERED),this.getService(ic).startSuggestion(r)}catch(e){this.getService(k).catch("Error in _startSuggestion: ",e)}},this._commitSuggestion=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: commitSuggestion","color: green;");try{return this.trackEvent(Y.Events.Suggestions.COMMIT_SUGGESTION_TRIGGERED),this.getService(ic).commitSuggestion(r)}catch(e){return this.getService(k).catch("Error in _commitSuggestion: ",e),Promise.reject(e)}},this._getSuggestions=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getSuggestions","color: green;");try{return this.trackEvent(Y.Events.Suggestions.GET_SUGGESTIONS_TRIGGERED),this.getService(ic).getSuggestions(r)}catch(e){return this.getService(k).catch("Error in _getSuggestions: ",e),[]}},this._getSuggestions$=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getSuggestions$","color: green;");try{return this.trackEvent(Y.Events.Suggestions.GET_SUGGESTIONS_STREAM_TRIGGERED),this.getService(ic).getSuggestions$(r)}catch(e){return this.getService(k).catch("Error in _getSuggestions$: ",e),new Vt}},this._getPendingSuggestion=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getPendingSuggestion","color: green;");try{return this.trackEvent(Y.Events.Suggestions.GET_PENDING_SUGGESTION_TRIGGERED),this.getService(ic).getPendingSuggestion(r)}catch(e){return this.getService(k).catch("Error in _getPendingSuggestion: ",e),null}},this._getPendingSuggestion$=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getPendingSuggestion$","color: green;");try{return this.trackEvent(Y.Events.Suggestions.GET_PENDING_SUGGESTION_STREAM_TRIGGERED),this.getService(ic).getPendingSuggestion$(r)}catch(e){return this.getService(k).catch("Error in _getPendingSuggestion$: ",e),new Vt}},this._on=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.trackEvent(Y.Events.Suggestions.ON_TRIGGERED,{payload:{action:r}}),this.getService(ic).onAction(r)}catch(e){return this.getService(k).catch("Error in _on: ",e),ce(null)}},this.getService(k).log("%c[WB] Creating CLASS: SuggestionElement","color: blue;"),this.enableSuggestionMode=this._enableSuggestionMode,this.disableSuggestionMode=this._disableSuggestionMode,this.isSuggestionModeEnabled=this._isSuggestionModeEnabled,this.isSuggestionModeEnabled$=this._isSuggestionModeEnabled$,this.registerTarget=this._registerTarget,this.unregisterTarget=this._unregisterTarget,this.startSuggestion=this._startSuggestion,this.commitSuggestion=this._commitSuggestion,this.getSuggestions=this._getSuggestions,this.getSuggestions$=this._getSuggestions$,this.getPendingSuggestion=this._getPendingSuggestion,this.getPendingSuggestion$=this._getPendingSuggestion$,this.on=this._on}};var ac=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A,M,B,q){this.analyticsService=e,this.configService=t,this.docService=i,this.databaseService=a,this.authService=l,this.domService=c,this.afAuth=d,this.iamService=m,this.avatarService=u,this.contactService=_,this.storageService=I,this.dialog=A,this.loggingService=M,this.notificationService=B,this.commonDbService=q,this.tagAnnotations$=new Se({}),this.tagAnnotationsByDocumentId$=new Se({}),this.documentPaths=null,this.allowedElementIds$=new Se([]),this.addTagMode$=new Se(!1),this.enableTextTags$=new Se(!1),this.loggingService.log("%c[WB] Creating CLASS: TagService","color: blue;"),this.databaseService.getDb().pipe($e(ae=>!!ae),ut(1)).subscribe(ae=>{ae&&this.getDocumentPaths()},ae=>{this.loggingService.catch("Error in TagService getDb subscription: ",ae)}),this.domService.onWindowPointerMove$().subscribe(ae=>{if(this.addTagMode$.value){this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement);let _e=this.domService.getBackgroundElement(ae.clientX,ae.clientY);_e&&(this.isElementInsideAllowedElements(_e)?GN(ae.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement=_e,this.domService.highlightElement(this.hightlightElement,N.CURSOR.TAG_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},ae=>{this.loggingService.catch("Error in TagService onWindowPointerMove$ subscription: ",ae)}),this.domService.onWindowKeyupEsc$().subscribe(ae=>{this.addTagMode$.value&&this.disableAddTagMode()},ae=>{this.loggingService.catch("Error in TagService onWindowKeyupEsc$ subscription: ",ae)}),this.domService.onDocumentClick$().subscribe(ae=>{if(ae&&this.addTagMode$.value){if(ae.preventDefault(),ae.stopPropagation(),!GN(ae.target)){let _e=this.domService.getBackgroundElement(ae.clientX,ae.clientY);_e&&this.isElementInsideAllowedElements(_e)&&this.addTag(ae)}this.disableAddTagMode()}},ae=>{this.loggingService.catch("Error in TagService onDocumentClick$ subscription: ",ae)}),this.addTagMode$.subscribe(ae=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),ae?this.domService.addClassToElement(document.body,"snippyly-add-tag-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-tag-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},ae=>{this.loggingService.catch("Error in TagService addTagMode$ subscription: ",ae)}),this.domService.onWindowKeyupBackspace$().subscribe(ae=>{this.deleteTagPinAnnotations("keyupBackspace")},ae=>{this.loggingService.catch("Error in TagService onWindowKeyupBackspace$ subscription: ",ae)}),this.domService.onWindowKeyupDelete$().subscribe(ae=>{this.deleteTagPinAnnotations("keyupDelete")},ae=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ae)}),this.domService.getDeleteCommmentAnnotations$().subscribe(ae=>{ae?.length&&(ae?.filter(re=>re.type==="tag")).forEach(re=>X(this,null,function*(){yield this.deleteTagPinAnnotation(re)}))},ae=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ae)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$()}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllTagAnnotations(e,t,i){this.loggingService.log("%c[WB] Calling FUNCTION: getAllTagAnnotations","color: green;");let a,l;try{if(e&&(l=Qn(e)),t&&typeof t=="object"){let c=Oi(t);a=Qn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",c)}return br(this.afAuth).pipe($e(c=>!!c),ye(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),ye(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(d=>(c.featureAllowed=d,c))):ce(c)),ye(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(ge(d=>(c.featureAllowed=!d,c))):ce(c)),ye(c=>c.featureAllowed?ce(c).pipe(ye(d=>this.docService.getDocumentPaths$().pipe(ge(m=>(this.documentPaths=m,d.documentPaths=m,d)))),ye(d=>this.getDataFromDocumentId(l).pipe(ge(m=>(d.annotations=m||[],h({},d))))),ye(d=>this.docService.getLocation$().pipe(ge(m=>(d.location=m,d)))),ye(d=>this.docService.getLocations$().pipe(ge(m=>(d.customLocations=m,d)))),ge(d=>{if(d.filteredAnnotations=[],l&&!a)return d.filteredAnnotations=d.annotations?.slice(),d;{let m=[];return a?m.push(a):(m.push(d?.location?.locationId),m.push(...Object.values(d?.customLocations||[]).map(u=>u.locationId))),d.filteredAnnotations=this.filterAnnotationsByLocationIds(d?.annotations,m),d}}),ye(d=>i?ce(d):d?.annotations?.length?this.domService.onWindowResize$().pipe(ge(()=>d)):ce(d)),ye(d=>i?ce(d):d?.annotations?.length?this.domService.onDomChange$("TagService getAllTagAnnotations").pipe(ge(()=>d)):ce(d)),ge(d=>(d?.filteredAnnotations?.forEach(m=>{this.calculateTagAnnotationPosition(m)}),d)),ye(d=>d?.filteredAnnotations?ce(d?.filteredAnnotations||[]):ce([]))):ce([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe($e(t=>!!t),ge(t=>y(h({},e),{config:t})),ye(t=>this.authService.getUser$().pipe(ge(i=>y(h({},t),{user:i})))),ye(t=>Mo(t.config,t.user,je.TAG)?ce(y(h({},t),{featureAllowed:!0})):(this.loggingService.warn("Tag feature is not allowed."),ce(y(h({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe($e(t=>!!t),ye(t=>this.configService?.getApiKey()&&this.documentPaths?.tag?this.commonDbService.dbListener({feature:"allTags",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(i=>i?.data),ge(i=>{let a=[];return i&&(a=Object.values(i).filter(l=>typeof l=="object")),this.setTagAnnotationsByDocumentId(e||this.documentPaths?.documentId,a),a})):ce([])))}setTagAnnotationsByDocumentId(e,t){try{e&&this.tagAnnotationsByDocumentId$.next(y(h({},this.tagAnnotationsByDocumentId$.value),{[e]:t}))}catch(i){this.loggingService.catch("Error in TagService setTagAnnotationsByDocumentId:",i)}}filterAnnotationsByLocationIds(e,t){try{return e.filter(i=>t.includes(i.locationId))}catch(i){return this.loggingService.catch("Error in TagService filterAnnotationsByLocations:",i),[]}}calculateTagAnnotationPosition(e){try{if(e.targetElement){let t=this.domService.getXPath(e.targetElement?.xpath);if(t){let i=t.iterateNext();if(i&&Kr(i)){let a=i.getBoundingClientRect();if(a&&a.width&&a.height){let{height:l,width:c}=op(i);e.position={top:l*e.targetElement.topPercentage/100,left:c*e.targetElement.leftPercentage/100}}else e.position=null}else e.position=null}else e.position=null}}catch(t){this.loggingService.catch("Error in TagService calculateTagAnnotationPosition:",t)}}filterPinAnnotations(e,t,i){this.loggingService.log("%c[WB] Calling FUNCTION: filterPinAnnotations","color: green;");try{let a=e?Object.values(e):[];a.forEach((c,d)=>{c?.annotationId&&(c.annotationIndex=d+1)});let l=[];if(t)i?l=a.filter(c=>c.locationId===i):l=a.slice();else{let c=this.docService.getLocation();c&&c.locationId?l=a.filter(d=>d.locationId===c.locationId):l=a.filter(d=>!d.locationId)}return l}catch(a){return this.loggingService.catch("Error in TagService filterPinAnnotations:",a),[]}}addTag(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: addTag","color: green;");try{let i=this.authService.getUser();if(i)if(i.isReadOnly||i.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let a=new PO;a.from=i,a.color=N.DEFAULT_ANNOTATION_COLOR,a.resolved=!1,a.lastUpdated=this.timestamp;let{topPositionX:l,topPositionY:c}=this.domService.getTopLeftPosition();a.positionX=l,a.positionY=c;let d=this.domService.getCurrentWindowSizeValue();if(a.screenWidth=d.screenWidth,a.screenHeight=d.screenHeight,a.screenScrollHeight=d.screenScrollHeight,a.taggedElementPath="",e&&(a.targetElement=this.domService.getTargetElementForCursorPosition(e)),t&&(a.targetTextRange=t),a?.targetElement?.xpath){let m=this.domService.getXPath(a.targetElement.xpath);if(m){let u=m.iterateNext();u&&(Kr(u)||(a.targetElement=null))}}this.setLocationToTagAnnotation(a),a.pageInfo=no(),a.pageInfo&&(a.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),this.saveTagToDb(a)}}catch(i){this.loggingService.catch("Error in TagService addTag: ",i)}}setLocationToTagAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location);try{let i;e.targetElement?.xpath?i=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetTextRange?.commonAncestorContainer&&(i=this.domService.getElementFromXPath(e.targetTextRange.commonAncestorContainer));let a=this.docService.getAdditionLocationFromElement(i);if(a){let l=this.docService.addLocation({location:a,source:"internal"});l?.[0]&&(e.locationId=l[0].locationId,e.location=l[0].location)}}catch{}}catch(t){this.loggingService.catch("Error in TagService setLocationToTagAnnotation:",t)}}saveTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveTagToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(je.TAG)&&this.docService.getDocumentPaths$().pipe($e(t=>!!t),ut(1),ye(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe($e(i=>!!i),ut(1),ye(i=>{if(this.documentPaths?.tag){e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo&&(e.pageInfo.tagUrl=this.generateTagUrl(e));let a=JSON.parse(JSON.stringify(e));return a.position=null,this.domService.toggleAnnotationSelection(a),e.targetTextRange&&sessionStorage.setItem(N.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.analyticsService.trackEvent(Y.Events.Tag.TAG_DRAFT_ADDED,{annotationId:e.annotationId}),this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return ce(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService saveTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService saveTagToDb: ",t)}}updateTag(e,t=!1,i){try{i&&this.setLocationToTagAnnotation(e),t&&this.updateNotificationsDatabase(e,_3.UPDATED),this.updateTagToDb(e)}catch(a){this.loggingService.catch("Error in TagService updateTag: ",a)}}resolveTag(e){try{e.resolved=!0,this.domService.resetSelectedAnnotationsMap(!1),this.updateNotificationsDatabase(e,_3.RESOLVED),this.updateTagToDb(e),this.domService.updateSelectedAnnotationInMap([e]),this.analyticsService.trackEvent(Y.Events.Tag.TAG_RESOLVED,{annotationId:e.annotationId})}catch(t){this.loggingService.catch("Error in TagService resolveTag: ",t)}}updateTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateTagToDb","color: green;");try{if(e?.targetElement?.xpath){let t=this.domService.getXPath(e.targetElement.xpath);if(t){let i=t.iterateNext();i&&(Kr(i)||(e.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(je.TAG)&&this.docService.getDocumentPaths$().pipe($e(t=>!!t),ut(1),ye(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe($e(i=>!!i),ut(1),ye(i=>{if(this.documentPaths?.tag&&e?.annotationId){let a=JSON.parse(JSON.stringify(e));return a.position=null,this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return ce(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService updateTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService updateTagToDb: ",t)}}deleteTagPinAnnotations(e){try{let t=this.domService.getSelectedAnnotationsMap(),i=this.authService.getUser(),a=[];Object.keys(t).forEach(l=>X(this,null,function*(){let c=t[l];c.type==="tag"&&i&&c.from&&(i?.isAdmin||c.from.userId===i.userId)&&a.push(c)})),a?.length&&(this.analyticsService.trackEvent(Y.Events.Tag.TAG_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(l=>l.annotationId).join()}),this.dialog.open(ll,{panelClass:"velt-mat-dialog-container",data:{title:"Delete tag?",message:"This selected tag will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"tag"}}).afterClosed().pipe(ut(1)).subscribe(l=>{l&&(a.forEach(c=>X(this,null,function*(){yield this.deleteTagPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${N.SNIPPYLY_HIGHLIGHT}]`).forEach(d=>{this.domService.removeHighlightFromElement(d)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"tag")}catch(t){this.loggingService.catch("Error in TagService deleteTagPinAnnotations: ",t)}}deleteTagPinAnnotation(e){return this.authService.isFeatureAllowed(je.TAG)&&this.documentPaths?.tag&&e?.annotationId?(this.updateNotificationsDatabase(e,_3.DELETED),this.analyticsService.trackEvent(Y.Events.Tag.TAG_DELETED,{annotationId:e.annotationId}),this.commonDbService.deleteData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0}})):Promise.resolve()}enableAddTagMode(){this.authService.isFeatureAllowed(je.TAG)?(this.analyticsService.trackEvent(Y.Events.Tag.TAG_ADD_MODE_ENABLED),this.addTagMode$.next(!0)):this.loggingService.catch("Error in TagService enableAddTagMode: ","Tag feature is not enabled.")}disableAddTagMode(){this.analyticsService.trackEvent(Y.Events.Tag.TAG_ADD_MODE_DISABLED),this.addTagMode$.next(!1)}addTagModeChange(){return this.addTagMode$.asObservable()}enableTextTags(e){this.enableTextTags$.next(e)}getEnableTextTags$(){return this.enableTextTags$.asObservable()}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in TagService isElementInsideAllowedElements: ",t),!1}}attachTag(e,t=[]){let i=nl(e,t);if(i){let a=this.domService.getXPath(i),l=this.getTagPinAnnotationObject();l&&(l.targetElement={xpath:a,topPercentage:50,leftPercentage:90},this.saveTagToDb(l))}}getTagPinAnnotationObject(){let e=this.authService.getUser();if(e)if(e.isReadOnly||e.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let t=new PO;t.from=e,t.color=N.DEFAULT_ANNOTATION_COLOR,t.resolved=!1,t.lastUpdated=this.timestamp;let{topPositionX:i,topPositionY:a}=this.domService.getTopLeftPosition();t.positionX=i,t.positionY=a;let l=this.domService.getCurrentWindowSizeValue();t.screenWidth=l.screenWidth,t.screenHeight=l.screenHeight,t.screenScrollHeight=l.screenScrollHeight,t.taggedElementPath="";let c=this.docService.getLocation();return c&&(t.locationId=c.locationId,t.location=c.location),t}return null}updateNotificationsDatabase(e,t){try{let i={annotationData:e,actionType:t,notificationSource:"tag"};this.notificationService.updateNotificationDatabase(i)}catch(i){this.loggingService.catch("Error in TagService updateNotificationsDatabase: ",i)}}getUserContacts$(){return this.contactService.getUserContacts$()}addUserContact(e){this.contactService.addUserContact(e)}getTagUrl(e){try{return e?.pageInfo?.tagUrl?e.pageInfo.tagUrl:(e?.pageInfo||(e.pageInfo=no(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.tagUrl=this.generateTagUrl(e),this.updateTag(e),e.pageInfo?.tagUrl)}catch(t){this.loggingService.catch("Error in TagService getTagUrl: ",t);return}}uploadFile(e,t){let i=`${N.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${N.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`;return this.documentPaths?.organizationId&&(i=`${N.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${N.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${N.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`),this.storageService.uploadFile({path:i,file:e})}downloadAttachment(e){this.storageService.downloadAttachment(e)}deleteAttachment(e){return this.storageService.deleteAttachment({attachment:e})}generateTagUrl(e){let t=new URL(window.location.href);return t.searchParams.delete(N.URL_PARAMS.TAG_ID),t.searchParams.append(N.URL_PARAMS.TAG_ID,e.annotationId),t.href}};o.\u0275fac=function(t){return new(t||o)(K(ct),K(Ft),K(st),K($n),K(qe),K(Ue),K(eo),K(Vn),K(bm),K(vn),K(Fp),K(Lo),K(k),K(mn),K(yn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var VU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: TagElement","color: blue;"),this.getAllTagAnnotations=this._getAllTagAnnotations,this.deleteTag=this._deleteTag,this.allowedElementIds=this._allowedElementIds,this.attachTag=this._attachTag,this.addTagModeChange=this._addTagModeChange}_getAllTagAnnotations(o,r){this.getService(k).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(Y.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:o,location:r}}),this.getService(ac).getAllTagAnnotations(o,r)}catch(e){return this.getService(k).catch("Error in _getLiveTagsOnCurrentDocument: ",e),ce(null)}}_deleteTag(){this.getService(k).log("%c[WB] Calling FUNCTION: deleteTag","color: green;");try{this.trackEvent(Y.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(ac).deleteTagPinAnnotations("tagElement")}catch(o){this.getService(k).catch("Error in _deleteTag: ",o)}}_allowedElementIds(o){this.getService(k).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(Y.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(ac).setAllowedElementIds(o)}catch(r){this.getService(k).catch("Error in allowedElementIds: ",r)}}_attachTag(o){this.getService(k).log("%c[WB] Calling FUNCTION: attachTag","color: green;");try{this.trackEvent(Y.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:o}}),this.getService(ac).attachTag(o,["id","data-id"])}catch(r){this.getService(k).catch("Error in _attachTag: ",r)}}_addTagModeChange(){this.getService(k).log("%c[WB] Calling FUNCTION: addTagModeChange","color: green;");try{return this.trackEvent(Y.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(ac).addTagModeChange()}catch(o){return this.getService(k).catch("Error in _addTagModeChange: ",o),ce(!1)}}};var BU=class extends fr{constructor(o){super(o),this.getService(k).log("%c[WB] Creating CLASS: ViewsElement","color: blue;"),this.getUniqueViewsByUser=this._getUniqueViewsByUser,this.getUniqueViewsByDate=this._getUniqueViewsByDate}_getUniqueViewsByUser(o){this.getService(k).log("%c[WB] Calling FUNCTION: _getUniqueViewsByUser","color: green;");try{return this.trackEvent(Y.Events.Views.GET_UNIQUE_VIEWS_BY_USER_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(Ml).getUniqueViewsByUser(o)}catch(r){return this.getService(k).catch("Error in getUniqueViewsByUser: ",r),ce({})}}_getUniqueViewsByDate(o){this.getService(k).log("%c[WB] Calling FUNCTION: _getUniqueViewsByDate","color: green;");try{return this.trackEvent(Y.Events.Views.GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(Ml).getUniqueViewsByDate(o)}catch(r){return this.getService(k).catch("Error in getUniqueViewsByDate: ",r),ce({})}}};var WO=(()=>{let o=class o{constructor(e,t){this.docService=e,this.loggingService=t}updateDocuments(e){return X(this,null,function*(){try{return yield this.docService.updateDocuments(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateDocuments: ",t),null}})}updateLocations(e){return X(this,null,function*(){try{return yield this.docService.updateLocations(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateLocations: ",t),null}})}fetchDocuments(e){return X(this,null,function*(){try{let t=yield this.docService.fetchDocuments(e),i=[];return t.forEach(a=>{let l=a?.docIamConfig??{},c=a?.metadata??{};c.disabled=!!l?.disabled,c.id=c?.clientDocumentId,c.documentId=c?.clientDocumentId,delete c?.clientDocumentId,c.organizationId=c?.clientOrganizationId,delete c?.clientOrganizationId,delete c?.pageInfo,delete c?.veltFolderId,i.push(c)}),{data:i.reduce((a,l)=>(l?.documentId&&(a[l.documentId]=l),a),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchDocuments: ",t),{data:null}}})}fetchFolders(e){return X(this,null,function*(){try{let t=yield this.docService.fetchFolders(e),i=t?.parentFolders?.map(l=>{let c=l?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,h({},c)});return{data:(t?.data?.map(l=>{let c=l?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,h(h({},c),e?.folderId?{subFolders:i}:{})})).reduce((l,c)=>(c?.folderId&&(l[c.folderId]=c),l),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchFolders: ",t),{data:null}}})}};o.\u0275fac=function(t){return new(t||o)(K(st),K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var jU=(()=>{let o=class o{constructor(e,t,i,a,l){this.authService=e,this.coreActionsService=t,this.docService=i,this.iamService=a,this.loggingService=l,this.veltInitState$=new Se(void 0);try{this.loggingService.log("%c[WB] Creating CLASS: VeltService","color: blue;");let c=this.authService.getUser$(),d=this.docService.getDocumentPaths$(),m=this.iamService.isUserAllowed$();Cn([c,d,m]).subscribe(([u,_,I])=>{u&&_&&I?this.veltInitState$.next(!0):this.veltInitState$.next(!1)}),this.getVeltInitState$().subscribe(u=>{this.coreActionsService.triggerAction(tt.DOCUMENT_INIT,u)})}catch(c){this.loggingService.catch("Error in VeltService constructor: ",c)}}getVeltInitState$(){try{return this.veltInitState$.asObservable().pipe(_t())}catch(e){return this.loggingService.catch("Error in VeltService getVeltInitState$: ",e),ce(void 0)}}};o.\u0275fac=function(t){return new(t||o)(K(qe),K(nr),K(st),K(Vn),K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var $U=class{constructor(o){this.injector=o,this.initConfig=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: initConfig","color: green;");try{r?typeof r!="string"?this.getService(k).catch("Error in initConfig: ","Apikey must be string."):r?.trim()?this.getService(qe).setApiKey(r?.trim(),e):this.getService(k).catch("Error in initConfig: ","Apikey is not provided."):this.getService(k).catch("Error in initConfig: ","Apikey is not provided.")}catch(t){this.getService(k).catch("Error in initConfig: ",t)}},this.identify=(r,e,t)=>(this.getService(k).log("%c[WB] Calling FUNCTION: identify","color: green;"),new Promise((i,a)=>{try{typeof r=="object"&&(r=JSON.parse(JSON.stringify(r)));let l=this.getService(Ft).getApiKey(),c=cd(l,r.userId);if(t?.ha||this.getService(ct).trackEvent(Y.Events.Core.IDENTIFY,{apiKey:l,clientUserId:r.userId,snippylyUserId:c,forceReset:e?.forceReset,user:this.getService(qe).getUserWithoutContacts(r),source:"client",fromProvider:t?.fromProvider},!0,c,r?.userId),!(r&&r.userId))this.getService(k).catch("Error in identify: ","Missing userId in config data."),e?.throwError?a("Missing userId in config data."):i(null);else if(typeof r.userId!="string")this.getService(k).catch("Error in identify: ","userId must be string."),e?.throwError?a("userId must be string."):i(null);else if(r?.groupId&&typeof r?.groupId!="string")this.getService(k).catch("Error in identify: ","groupId must be string."),e?.throwError?a("groupId must be string."):i(null);else{if(r?.groupId)if(r?.groupId?.match(/^[a-zA-Z0-9_]*$/))r.clientGroupId=r.groupId;else{let m=r.groupId;r.clientGroupId=m,r.groupId=It(m)}if(r?.organizationId){let m=r.organizationId;r.clientOrganizationId=m,r.organizationId=It(m)}delete r.isAdmin;let d=N.REGEX_URL_FOR_USER_NAME;r?.name&&d.test(r?.name)&&(r.name=r.name?.split(".")?.slice(0,-1)?.join(".")),r.clientUserName=r.name,r?.name&&r?.name?.length>30&&(r.name=r.name.slice(0,30)),this.getService(qe).initializeClient(r,e||{},new Date().getTime(),void 0,"external").then(m=>{let u;try{m&&(u=JSON.parse(JSON.stringify(m)))}catch{}i(u)}).catch(m=>{this.getService(k).catch("Error in identify: ",m),e?.throwError?a(m):i(null)})}}catch(l){this.getService(k).catch("Error in identify: ",l),e?.throwError?a(l):i(null)}})),this.updateUser=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{if(this.getService(k).catch("DEPRECATED: ","'updateUser' method is deprecated."),r&&typeof r=="object"){if(r=JSON.parse(JSON.stringify(r)),r?.groupId)if(r?.groupId?.match(/^[a-zA-Z0-9_]*$/))r.clientGroupId=r.groupId;else{let e=r.groupId;r.clientGroupId=e,r.groupId=It(e)}delete r.isAdmin,this.getService(qe).updateUser(r)}else this.getService(k).catch("Error in updateUser: ","Invalid user object provided.")}catch(e){this.getService(k).catch("Error in updateUser: ",e)}},this.signOutUser=r=>(this.getService(k).log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),r?.ha||this.trackEvent(Y.Events.Core.SIGN_OUT_USER_TRIGGERED),new Promise((e,t)=>X(this,null,function*(){try{yield this.getService(qe).signOutUser("external"),e(null)}catch(i){this.getService(k).catch("Error in signOutUser: ",i),e(null)}}))),this.setDocument=(r,e,t,i)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setDocument","color: green;");try{i?.ha||this.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:r,documentMetadata:e,methodName:"setDocument",source:"external"}}),r&&r.trim()?(e&&(typeof e=="object"?e=JSON.parse(JSON.stringify(e)):this.getService(k).catch("Error in setDocument: ","Invalid documentMetadata provided.")),yield this.getService(st).setDocument({documentId:r,documentMetadata:e,options:t,source:"external"})):this.getService(k).catch("Error in setDocument: ","Invalid document id provided.")}catch(a){this.getService(k).catch("Error in setDocument: ",a)}}),this.setDocumentId=(r,e,t)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setDocumentId","color: green;");try{if(t?.ha||this.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:r,organizationId:e,methodName:"setDocumentId",source:"external"}}),r&&r.trim())return yield this.getService(st).setDocumentId({documentId:r,clientOrganizationId:e,source:"external"});this.getService(k).catch("Error in setDocumentId: ","Invalid document id provided.")}catch(i){this.getService(k).catch("Error in setDocumentId: ",i)}}),this.setDocuments=(r,e,t)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setDocuments","color: green;");try{t?.ha||this.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:r,options:e,methodName:"setDocuments",source:"external"}}),typeof r=="object"&&r instanceof Array?(r=JSON.parse(JSON.stringify(r)),r=r.filter(i=>typeof i=="object"&&i!==null&&i.id?.trim()),r.length?yield this.getService(st).setDocuments({documents:r,options:e,source:"external"}):this.getService(k).catch("Error in setDocuments: ","Invalid documents provided.")):this.getService(k).catch("Error in setDocuments: ","Invalid documents provided.")}catch(i){this.getService(k).catch("Error in setDocuments: ",i)}}),this.setRootDocument=(r,e)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setRootDocument","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,{payload:{document:r,methodName:"setRootDocument",source:"external"}}),typeof r=="object"?(r=JSON.parse(JSON.stringify(r)),r.id?yield this.getService(st).setRootDocument({document:r,source:"external"}):this.getService(k).catch("Error in setRootDocument: ","Invalid document provided.")):this.getService(k).catch("Error in setRootDocument: ","Invalid document provided.")}catch(t){this.getService(k).catch("Error in setRootDocument: ",t)}}),this.unsetDocumentId=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{r?.ha||this.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:"external"}}),this.getService(st).unsetDocumentId({source:"external"})}catch(e){this.getService(k).catch("Error in unsetDocumentId: ",e)}},this.unsetDocuments=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{r?.ha||this.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:"external"}}),this.getService(st).unsetDocuments({source:"external"})}catch(e){this.getService(k).catch("Error in unsetDocuments: ",e)}},this.fetchDocuments=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: fetchDocuments","color: green;");try{return e?.ha||this.trackEvent(Y.Events.Core.FETCH_DOCUMENTS_TRIGGERED,{payload:{options:r}}),this.getService(WO).fetchDocuments(r)}catch(t){return this.getService(k).catch("Error in fetchDocuments: ",t),Promise.resolve({data:null})}},this.updateDocuments=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: updateDocuments","color: green;");try{return e?.ha||this.trackEvent(Y.Events.Core.UPDATE_DOCUMENTS_TRIGGERED,{payload:{request:r}}),this.getService(WO).updateDocuments(r)}catch(t){return this.getService(k).catch("Error in updateDocuments: ",t),Promise.resolve({data:null})}},this.updateLocations=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: updateLocations","color: green;");try{return e?.ha||this.trackEvent(Y.Events.Core.UPDATE_LOCATIONS_TRIGGERED,{payload:{request:r}}),this.getService(WO).updateLocations(r)}catch(t){return this.getService(k).catch("Error in updateLocations: ",t),Promise.resolve({data:null})}},this.fetchFolders=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: fetchFolders","color: green;");try{return e?.ha||this.trackEvent(Y.Events.Core.FETCH_FOLDERS_TRIGGERED,{payload:{options:r}}),this.getService(WO).fetchFolders(r)}catch(t){return this.getService(k).catch("Error in fetchFolders: ",t),Promise.resolve({data:null})}},this.setUserDataProvider=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setUserDataProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_USER_DATA_PROVIDER_TRIGGERED),this.getService(An).setUserDataProvider(r)}catch(t){this.getService(k).catch("Error in setUserDataProvider: ",t)}},this.setAnonymousUserDataProvider=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setAnonymousUserDataProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ANONYMOUS_USER_DATA_PROVIDER_TRIGGERED),this.getService(An).setAnonymousUserDataProvider(r)}catch(t){this.getService(k).catch("Error in setAnonymousUserDataProvider: ",t)}},this.setDataProviders=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setDataProviders","color: green;");try{if(e?.ha||this.trackEvent(Y.Events.Core.SET_DATA_PROVIDERS_TRIGGERED),r.comment&&this.getService(ol).setCommentAnnotationDataProvider(r.comment),r.user&&this.getService(An).setUserDataProvider(r.user),r.reaction&&this.getService(Jc).setReactionAnnotationDataProvider(r.reaction),r.anonymousUser&&this.getService(An).setAnonymousUserDataProvider(r.anonymousUser),r.recorder&&this.getService(il).setRecorderAnnotationDataProvider(r.recorder),r.notification&&this.getService(ym).setNotificationDataProvider(r.notification),r.activity&&this.getService(Rp).setActivityDataProvider(r.activity),r.attachment)if(r.comment)this.getService(Xc).setAttachmentDataProvider(r.attachment);else throw new Error("Comment data provider is required for attachment data provider")}catch(t){this.getService(k).catch("Error in setDataProviders: ",t)}},this.setPermissionProvider=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setPermissionProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_PERMISSION_PROVIDER_TRIGGERED),this.getService(al).setPermissionProvider(r)}catch(t){this.getService(k).catch("Error in setPermissionProvider: ",t)}},this.setEncryptionProvider=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ENCRYPTION_PROVIDER_TRIGGERED),this.getService(Ft).setEncryptionProvider(r)}catch(t){this.getService(k).catch("Error in setEncryptionProvider: ",t)}},this.setVeltAuthProvider=r=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{return yield this.getService(qe).setVeltAuthProvider(r)}catch(e){return this.getService(k).catch("Error in setVeltAuthProvider: ",e),null}}),this.getDocumentId=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getDocumentId","color: green;");try{return r?.ha||this.trackEvent(Y.Events.Core.GET_DOCUMENT_ID_TRIGGERED),this.getService(st).getDocumentId()}catch(e){this.getService(k).catch("Error in getDocumentId: ",e)}},this.setLocation=(r,e,t)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setLocation","color: green;");try{t?.ha||this.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:r,appendLocation:e,methodName:"setLocation",source:"external"}}),r&&typeof r=="object"?e?this.getService(st).addLocation({location:r,source:"external"}):yield this.getService(st).setLocation({location:r,source:"external"}):this.getService(k).catch("Error in setLocation: ","Invalid location params provided.")}catch(i){this.getService(k).catch("Error in setLocation: ",i)}}),this.setRootLocation=(r,e)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setRootLocation","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:r,methodName:"setRootLocation",source:"external"}}),typeof r=="object"?(r=JSON.parse(JSON.stringify(r)),r.id?yield this.getService(st).setRootLocation({location:r,source:"external"}):this.getService(k).catch("Error in setRootLocation: ","Invalid location provided.")):this.getService(k).catch("Error in setRootLocation: ","Invalid location provided.")}catch(t){this.getService(k).catch("Error in setRootLocation: ",t)}}),this.setLocations=(r,e,t)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: setLocations","color: green;");try{t?.ha||this.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:r,options:e,methodName:"setLocations",source:"external"}}),r&&Array.isArray(r)?yield this.getService(st).setLocations({locations:r,options:e,source:"external"}):this.getService(k).catch("Error in setLocations: ","Invalid location params provided.")}catch(i){this.getService(k).catch("Error in setLocations: ",i)}}),this.addLocation=(r,e)=>X(this,null,function*(){this.getService(k).log("%c[WB] Calling FUNCTION: addLocation","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:r,methodName:"addLocation",source:"external"}}),r&&typeof r=="object"?this.getService(st).addLocation({location:r,source:"external"}):this.getService(k).catch("Error in addLocation: ","Invalid location params provided.")}catch(t){this.getService(k).catch("Error in addLocation: ",t)}}),this.setScrollableElementsIds=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: setScrollableElementsIds","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED,{payload:{ids:r}}),r?this.getService(Ue).setScrollableElementsIds(r):this.getService(k).catch("Error in setScrollableElementsIds: ","Invalid ids provided.")}catch(t){this.getService(k).catch("Error in setScrollableElementsIds: ",t)}},this.removeLocation=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: removeLocation","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{location:r},methodName:"removeLocation",source:"external"}),this.getService(st).removeLocation({location:r,source:"external"})}catch(t){this.getService(k).catch("Error in removeLocation: ",t)}},this.removeLocations=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: removeLocations","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:r},methodName:"removeLocations",source:"external"}),this.getService(st).removeLocations({locations:r,source:"external"})}catch(t){this.getService(k).catch("Error in removeLocations: ",t)}},this.unsetLocationIds=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:r},methodName:"unsetLocationIds",source:"external"}),this.getService(st).unsetLocationIds(r,"external")}catch(t){this.getService(k).catch("Error in unsetLocationIds: ",t)}},this.excludeLocationIds=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: excludeLocationIds","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.EXCLUDE_LOCATION_IDS_TRIGGERED,{payload:{ids:r}}),typeof r=="object"&&r instanceof Array&&(r=r.filter(t=>typeof t=="string"),this.getService(st).excludeLocationIds(r))}catch(t){this.getService(k).catch("Error in excludeLocationIds: ",t)}},this.updateContactList=(r,e,t)=>{this.getService(k).log("%c[WB] Calling FUNCTION: updateContactList","color: green;");try{t?.ha||this.trackEvent(Y.Events.Core.UPDATE_CONTACT_LIST_TRIGGERED,{payload:{userContacts:r,config:e}}),typeof r=="object"&&r instanceof Array&&(!e||e&&typeof e=="object")&&(r=JSON.parse(JSON.stringify(r)),this.getService(vn).updateContactList(r,e))}catch(i){this.getService(k).catch("Error in updateContactList: ",i)}},this.removeScrollableElementsIds=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: removeScrollableElementsIds","color: green;");try{r?.ha||this.trackEvent(Y.Events.Core.REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED),this.getService(Ue).removeScrollableElementsIds()}catch(e){this.getService(k).catch("Error in removeScrollableElementsIds: ",e)}},this.getPresenceElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getPresenceElement","color: green;");try{let e=new DU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getPresenceElement: ",e),null}},this.getCursorElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getCursorElement","color: green;");try{let e=new SU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getCursorElement: ",e),null}},this.getCommentElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getCommentElement","color: green;");try{let e=new gU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getCommentElement: ",e),null}},this._suggestionElement=null,this.getSuggestionElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getSuggestionElement","color: green;");try{return this._suggestionElement||(this._suggestionElement=new UU(this.injector)),r?.ha&&this._suggestionElement.ha(r.ha),this._suggestionElement}catch(e){return this.getService(k).catch("Error in getSuggestionElement: ",e),null}},this.getTagElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getTagElement","color: green;");try{let e=new VU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getTagElement: ",e),null}},this.getSelectionElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getSelectionElement","color: green;");try{let e=new RU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getSelectionElement: ",e),null}},this.getRecorderElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getRecorderElement","color: green;");try{let e=new AU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getRecorderElement: ",e),null}},this.getContactElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getContactElement","color: green;");try{let e=new uU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getContactElement: ",e),null}},this.getRewriterElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getRewriterElement","color: green;");try{let e=new MU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getRewriterElement: ",e),null}},this.getHuddleElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getHuddleElement","color: green;");try{let e=new kU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getHuddleElement: ",e),null}},this.getLiveStateSyncElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getLiveStateSyncElement","color: green;");try{let e=new EU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getLiveStateSyncElement: ",e),null}},this.getArrowElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getArrowElement","color: green;");try{let e=new vU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getArrowElement: ",e),null}},this.getViewsElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getViewsElement","color: green;");try{let e=new BU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getViewsElement: ",e),null}},this.getNotificationElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getNotificationElement","color: green;");try{let e=new TU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getNotificationElement: ",e),null}},this.getAutocompleteElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getAutocompleteElement","color: green;");try{let e=new mU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getAutocompleteElement: ",e),null}},this.getDocElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getDocElement","color: green;");try{let e=new yU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getDocElement: ",e),null}},this.getActivityElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getActivityElement","color: green;");try{let e=new cU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getActivityElement: ",e),null}},this.getAreaElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getAreaElement","color: green;");try{let e=new sU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getAreaElement: ",e),null}},this.getReactionElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getReactionElement","color: green;");try{let e=new OU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getReactionElement: ",e),null}},this.getCrdtElement=r=>{this.getService(k).log("%c[WB] Calling FUNCTION: getCrdtElement","color: green;");try{let e=new hU(this.injector);return r?.ha&&e.ha(r.ha),e}catch(e){return this.getService(k).catch("Error in getCrdtElement: ",e),null}},this.getMetadata=r=>X(this,null,function*(){try{return r?.ha||this.trackEvent(Y.Events.Core.GET_METADATA_TRIGGERED),this.getService(Qc).getGlobalMetadata()}catch(e){return this.getService(k).catch("Error in getMetadata: ",e),null}}),this.fetchDebugInfo=r=>X(this,null,function*(){try{return r?.ha||this.trackEvent(Y.Events.Core.FETCH_DEBUG_INFO_TRIGGERED),this.getService(Qc).getDebugInfo()}catch(e){return this.getService(k).catch("Error in fetchDebugInfo: ",e),null}}),this.getDebugInfo=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_DEBUG_INFO_TRIGGERED),this.getService(Qc).getDebugInfo$()}catch(e){return this.getService(k).catch("Error in getDebugInfo: ",e),ce(null)}},this.disableFeatures=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.DISABLE_FEATURES_TRIGGERED,{payload:{features:r}}),this.getService(Ft).disableFeatures(r)}catch(t){this.getService(k).catch("Error in disableFeatures: ",t)}},this.setDarkMode=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_DARK_MODE_TRIGGERED,{payload:{value:r}}),this.getService(yt).setDarkMode(r)}catch(t){this.getService(k).catch("Error in setDarkMode: ",t)}},this.enableLogs=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.ENABLE_LOGS_TRIGGERED),this.getService(Ft).enableLogs()}catch(e){this.getService(k).catch("Error in enableLogs: ",e)}},this.disableLogs=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.DISABLE_LOGS_TRIGGERED),this.getService(Ft).disableLogs(r)}catch(t){this.getService(k).catch("Error in disableLogs: ",t)}},this.isUserAllowed$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.IS_USER_ALLOWED_TRIGGERED),this.getService(Vn).isUserAllowed$()}catch(e){return this.getService(k).catch("Error in isUserAllowed$: ",e),ce(!1)}},this.getUser=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.GET_USER_TRIGGERED);let e=this.getService(qe).getUser();if(e&&typeof e=="object"){let t=JSON.parse(JSON.stringify(e));return t?.clientOrganizationId&&(t.organizationId=t.clientOrganizationId,delete t.clientOrganizationId),t?.clientGroupId&&(t.groupId=t.clientGroupId,delete t.clientGroupId),delete t.userSnippylyId,t}else return null}catch(e){return this.getService(k).catch("Error in getUser: ",e),null}},this.getCurrentUser=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_CURRENT_USER_TRIGGERED),this.getService(qe).getUser$().pipe(ge(e=>Vo(e)))}catch(e){return this.getService(k).catch("Error in getCurrentUser: ",e),ce(null)}},this.getHeartbeat=(r,e)=>{try{return e?.ha||this.trackEvent(Y.Events.Core.GET_HEARTBEAT_TRIGGERED),this.getService(IU).getHeartbeat(r)}catch(t){return this.getService(k).catch("Error in getHeartbeat: ",t),ce({data:null})}},this.getUserRole$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_USER_ROLE_TRIGGERED),this.getService(Vn).getRole$()}catch(e){return this.getService(k).catch("Error in getUserRole$: ",e),ce("")}},this.getUserPermissions=(r,e)=>X(this,null,function*(){try{return e?.ha||this.trackEvent(Y.Events.Core.GET_USER_PERMISSIONS_TRIGGERED,{payload:{request:r,source:"external"}}),this.getService(al).getUserPermissions(r)}catch(t){return this.getService(k).catch("Error in getUserPermissions$: ",t),{}}}),this.getCurrentUserPermissions=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_CURRENT_USER_PERMISSIONS_TRIGGERED),this.getService(al).getCurrentUserPermissions$()}catch(e){return this.getService(k).catch("Error in getCurrentUserPermissions: ",e),ce(null)}},this.getFeaturesAccessLevelIam$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED),this.getService(Vn).getFeaturesAccessLevel$()}catch(e){return this.getService(k).catch("Error in getFeaturesAccessLevel$: ",e),ce(void 0)}},this.isPlanExpired$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.IS_PLAN_EXPIRED_TRIGGERED),this.getService(qe).isPlanExpired$()}catch(e){return this.getService(k).catch("Error in isPlanExpired$: ",e),ce(!1)}},this.getCustomerMetadata$=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_CUSTOMER_METADATA_TRIGGERED),this.getService(st).getCustomerMetadata$()}catch(e){return this.getService(k).catch("Error in getCustomerMetadata$: ",e),ce(null)}},this.getDocumentMetadata=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(st).getDocumentMetadata$()}catch(e){return this.getService(k).catch("Error in getDocumentMetadata: ",e),ce(null)}},this.getVeltInitState=r=>{try{return r?.ha,this.getService(jU).getVeltInitState$()}catch(e){return this.getService(k).catch("Error in getVeltInitState: ",e),ce(void 0)}},this.removeVeltContent=(r,e)=>{try{return e?.ha||this.trackEvent(Y.Events.Core.REMOVE_VELT_CONTENT_TRIGGERED),this.getService(Ue).removeSnippylyContent(r)}catch(t){return this.getService(k).catch("Error in removeVeltContent: ",t),""}},this.injectCustomCss=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.INJECT_CUSTOM_CSS_TRIGGERED),this.getService(k).log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;"),this.getService(Ue).setCustomCss(r)}catch(t){this.getService(k).catch("Error in injectCustomCss: ",t)}},this.setLanguage=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_LANGUAGE_TRIGGERED,{payload:{language:r}}),this.getService(Ns).setLanguage(r)}catch(t){this.getService(k).catch("Error in setLanguage: ",t)}},this.setTranslations=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_TRANSLATIONS_TRIGGERED,{payload:{translations:r}}),this.getService(Ns).setTranslations(r)}catch(t){this.getService(k).catch("Error in setTranslations: ",t)}},this.enableAutoTranslation=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.ENABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ns).enableAutoTranslation()}catch(e){this.getService(k).catch("Error in enableAutoTranslation: ",e)}},this.disableAutoTranslation=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.DISABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ns).disableAutoTranslation()}catch(e){this.getService(k).catch("Error in disableAutoTranslation: ",e)}},this.sf=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SF_TRIGGERED,{payload:{value:r}}),r?(document.querySelector(N.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(N.TAGS.SUPERFLOW_TOOLBAR))&&this.getService(Ft).setSF(r):this.getService(Ft).setSF(r)}catch(t){this.getService(k).catch("Error in sf: ",t)}},this.st=(r,e)=>{try{e?.ha,this.getService(Ft).setSdkType(r)}catch(t){this.getService(k).catch("Error in st: ",t)}},this.getService=r=>this.injector.get(r),this.on=(r,e)=>{this.getService(k).log("%c[WB] Calling FUNCTION: on","color: green;");try{return e?.ha,this.getService(nr).onAction(r)}catch(t){return this.getService(k).catch("Error in on: ",t),ce(null)}},this.setUiState=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_UI_STATE_TRIGGERED,{payload:{uiState:r}}),this.getService(st).setUIState(r)}catch(t){this.getService(k).catch("Error in setUiState: ",t)}},this.getUiState=r=>{try{return r?.ha||this.trackEvent(Y.Events.Core.GET_UI_STATE_TRIGGERED),this.getService(st).getUIState$()}catch(e){return this.getService(k).catch("Error in getUiState: ",e),ce({})}},this.enableSafeEval=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.ENABLE_SAFE_EVAL_TRIGGERED),this.getService(Ft).enableSafeEval()}catch(e){this.getService(k).catch("Error in enableSafeEval: ",e)}},this.disableSafeEval=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.DISABLE_SAFE_EVAL_TRIGGERED),this.getService(Ft).disableSafeEval()}catch(e){this.getService(k).catch("Error in disableSafeEval: ",e)}},this.enableFirestorePersistentCache=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.ENABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED),this.getService(Ft).enableFirestorePersistentCache()}catch(e){this.getService(k).catch("Error in enableFirestorePersistentCache: ",e)}},this.disableFirestorePersistentCache=r=>{try{r?.ha||this.trackEvent(Y.Events.Core.DISABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED),this.getService(Ft).disableFirestorePersistentCache()}catch(e){this.getService(k).catch("Error in disableFirestorePersistentCache: ",e)}},this.resetVeltButtonState=(r,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.RESET_VELT_BUTTON_STATE_TRIGGERED,{payload:{config:r}}),this.getService(xS).resetVeltButtonState(r)}catch(t){this.getService(k).catch("Error in resetVeltButtonState: ",t)}},this.getService(k).log("%c[WB] Creating CLASS: Snippyly","color: blue;")}trackEvent(o,r={},e=!0){try{r||(r={}),r=y(h({},r),{source:"external"}),this.getService(ct).trackAuthenticatedEvent(o,r,e)}catch(t){this.getService(k).catch("Error in _trackEvent: ",t);return}}};var D_e=(()=>{let o=class o{constructor(){this.veltElement=!0}ngOnInit(){}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["app-external-styles"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},standalone:!1,decls:0,vars:0,template:function(t,i){},styles:[`.cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed;z-index:1000}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}.cdk-overlay-backdrop{position:absolute;inset:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;touch-action:manipulation;z-index:1000;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}@media (prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media (forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}.cdk-overlay-dark-backdrop{background:#00000052}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px;z-index:1000}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}html{--velt-base-rem-unit: 1}velt-wireframe{display:none!important}body.velt-pin-dragging iframe{pointer-events:none!important}:root{--legacy-velt-neutral-0: #000000;--legacy-velt-neutral-1: #141416;--legacy-velt-neutral-2: #23262F;--legacy-velt-neutral-3: #353945;--legacy-velt-neutral-4: #777E90;--legacy-velt-neutral-5: #B1B5C3;--legacy-velt-neutral-6: #E6E8EC;--legacy-velt-neutral-7: #F4F5F6;--legacy-velt-neutral-8: #FCFCFD;--legacy-velt-neutral-9: #FFFFFF;--legacy-velt-dark-1: #141416;--legacy-velt-dark-2: #222226;--legacy-velt-dark-3: #303034;--legacy-velt-dark-4: #404044;--legacy-velt-dark-5: #59595F;--legacy-velt-dark-6: #80808A;--legacy-velt-dark-7: #91919C;--legacy-velt-dark-8: #E5E5E9;--legacy-velt-primary-color: var(--legacy-velt-dark-1);--legacy-velt-primary-dark-color: var(--legacy-velt-dark-8);--legacy-velt-secondary-color: var(--legacy-velt-neutral-4);--legacy-velt-secondary-dark-color: var(--legacy-velt-dark-7);--legacy-velt-bg-color: var(--legacy-velt-neutral-8);--legacy-velt-bg-dark-color: var(--legacy-velt-dark-1);--legacy-velt-border-color: var(--legacy-velt-neutral-6);--legacy-velt-border-dark-color: var(--legacy-velt-dark-3);--legacy-velt-grey-2-color: #D4D6DF;--legacy-velt-grey-2-dark-color: var(--legacy-velt-dark-4);--legacy-velt-grey-4-color: #989898;--legacy-velt-grey-4-dark-color: var(--legacy-velt-dark-6);--legacy-velt-status-open-color: #625DF5;--legacy-velt-status-in-progress-color: #ECB000;--legacy-velt-status-resolved-color: #00C48C;--legacy-velt-purple: #625DF5;--legacy-velt-orange: #ECB000;--legacy-velt-green: #0DCF82;--legacy-velt-blue: #0d6efd;--legacy-velt-primary-btn-color: var(--legacy-velt-purple);--legacy-velt-hyperlink-color: var(--legacy-velt-purple);--legacy-velt-grey-btn-color: var(--legacy-velt-neutral-5);--legacy-velt-header-btn-color: var(--legacy-velt-neutral-3);--legacy-velt-dropdown-item-color: var(--legacy-velt-neutral-2);--legacy-velt-avatar-size: 2rem;--velt-default-font-family: sans-serif;--Icon-Size-Small: 12px;--Icon-Size-Medium: 16px;--Icon-Size-Large: 24px}:root[data-velt-theme=dark]{--legacy-velt-primary-color: var(--legacy-velt-primary-dark-color);--legacy-velt-secondary-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-border-color: var(--legacy-velt-border-dark-color);--legacy-velt-grey-2-color: var(--legacy-velt-grey-2-dark-color);--legacy-velt-grey-4-color: var(--legacy-velt-grey-4-dark-color);--legacy-velt-primary-btn-color: var(--legacy-velt-border-dark-color);--legacy-velt-hyperlink-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-grey-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-header-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-dropdown-item-color: var(--legacy-velt-secondary-dark-color)}:root{--legacy-velt-tool-padding: 6px;--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-3);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}:root[data-velt-theme=dark],:root:not(data-velt-theme) velt-comment-tool[dark],:root:not(data-velt-theme) velt-sidebar-button[dark],:root:not(data-velt-theme) velt-arrow-tool[dark],:root:not(data-velt-theme) velt-reaction-tool[dark],:root:not(data-velt-theme) velt-huddle-tool[dark],:root:not(data-velt-theme) velt-recorder-tool[dark],:root:not(data-velt-theme) velt-user-invite-tool[dark],:root:not(data-velt-theme) velt-user-request-tool[dark],:root:not(data-velt-theme) velt-notifications-tool[dark],:root:not(data-velt-theme) app-recorder-all-tool-menu[dark],:root:not(data-velt-theme) snippyly-recording-preview-steps-dialog[dark],:root:not(data-velt-theme) snippyly-recorder-control-panel-internal[dark],:root:not(data-velt-theme) snippyly-recorder-player-internal[dark],:root:not(data-velt-theme) velt-recorder-player-expanded[dark]:root:not(data-velt-theme) app-transcription-panel[dark]{--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-2);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-5);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-user-avatar,velt-user-avatar{--legacy-velt-user-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-user-avatar-initial-font-size: .8}snippyly-follow-overlay,velt-follow-overlay{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-color);--legacy-velt-follow-overlay-btn-color: var(--legacy-velt-neutral-6);--legacy-velt-follow-overlay-btn-hover-color: var(--legacy-velt-neutral-5);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-color)}snippyly-follow-overlay[dark],velt-follow-overlay[dark]{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-dark-color);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-dark-color)}snippyly-cursor,velt-cursor{--legacy-velt-cursor-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-cursor-video-size: 4.2rem}snippyly-reaction-tool,velt-reaction-tool,app-reaction-tool{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #8F95B2;--legacy-velt-reaction-tool-hover-bg-color: #EAE8F9;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-reaction-tool[dark],velt-reaction-tool[dark],app-reaction-tool[dark]{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #EAE8F9;--legacy-velt-reaction-tool-hover-bg-color: #8F95B2;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}velt-view-analytics-dialog{--legacy-velt-view-analytics-dialog-bg-color: #FFF;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(0, 0, 0, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #111;--legacy-velt-view-analytics-dialog-total-views-text-color: #625DF5;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: #F4F3FF;--legacy-velt-view-analytics-dialog-user-name-color: #4C5366;--legacy-velt-view-analytics-dialog-user-timestamp-color: #959595;--legacy-velt-view-analytics-dialog-back-btn-color: #8F95B2}velt-view-analytics-dialog[dark]{--legacy-velt-view-analytics-dialog-bg-color: #131229;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(255, 255, 255, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #FFF;--legacy-velt-view-analytics-dialog-total-views-text-color: #9491F8;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: rgba(244, 243, 255, .06);--legacy-velt-view-analytics-dialog-user-name-color: #FFF;--legacy-velt-view-analytics-dialog-user-timestamp-color: rgba(255, 255, 255, .4)}velt-reaction-pin-tooltip-internal{--Surface-Neutral-0: #FFF;--Surface-Neutral-2: #F5F5F5;--Surface-Neutral-3: #F0F0F0;--Text-Neutral-0: #0A0A0A;--Text-Neutral-3: #292929;--Text-Neutral-5: #525252;--Text-Neutral-9: #999;--Text-Brand-Primary: #625DF5}velt-reaction-pin-tooltip-internal[dark]{--Surface-Neutral-0: #0F0F0F;--Surface-Neutral-2: #1F1F1F;--Surface-Neutral-3: #2F2F2F;--Text-Neutral-0: #FFF;--Text-Neutral-3: #E0E0E0;--Text-Neutral-5: #C2C2C2;--Text-Neutral-9: #ADADAD;--Text-Brand-Primary: #9491F8}:root{--velt-border-radius-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-3xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-full: calc((5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xs: calc((.625rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xs: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-sm: calc((.875rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-md: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-lg: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xl: calc((1.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-light-mode-green: #0DCF82;--velt-light-mode-magenta: #A259FE;--velt-light-mode-amber: #FF7162;--velt-light-mode-purple: #625DF5;--velt-light-mode-cyan: #4BC9F0;--velt-light-mode-orange: #FE965C;--velt-light-mode-black: #080808;--velt-light-mode-white: #FFFFFF;--velt-light-mode-gray: #EBEBEB;--velt-light-mode-error: #FF7162;--velt-light-mode-error-hover: #DE5041;--velt-light-mode-error-foreground: #FFFFFF;--velt-light-mode-error-light: #FFF4F2;--velt-light-mode-error-transparent: rgba(255, 113, 98, .08);--velt-light-mode-warning: #FFCD2E;--velt-light-mode-warning-hover: #C69400;--velt-light-mode-warning-foreground: #474747;--velt-light-mode-warning-light: #FFFBEE;--velt-light-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-light-mode-success: #198F65;--velt-light-mode-success-hover: #006B41;--velt-light-mode-success-foreground: #FFFFFF;--velt-light-mode-success-light: #EDF6F3;--velt-light-mode-success-transparent: rgba(25, 143, 101, .08);--velt-light-mode-accent: #625DF5;--velt-light-mode-accent-text: #625DF5;--velt-light-mode-accent-hover: #534FCF;--velt-light-mode-accent-foreground: #FFFFFF;--velt-light-mode-accent-light: #F2F2FE;--velt-light-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-light-mode-text-0: #0A0A0A;--velt-light-mode-text-1: #141414;--velt-light-mode-text-2: #1F1F1F;--velt-light-mode-text-3: #292929;--velt-light-mode-text-4: #3D3D3D;--velt-light-mode-text-5: #525252;--velt-light-mode-text-6: #666666;--velt-light-mode-text-7: #7A7A7A;--velt-light-mode-text-8: #858585;--velt-light-mode-text-9: #999999;--velt-light-mode-text-10: #B8B8B8;--velt-light-mode-text-11: #A3A3A3;--velt-light-mode-text-12: #8F8F8F;--velt-light-mode-background-0: #FFFFFF;--velt-light-mode-background-1: #FAFAFA;--velt-light-mode-background-2: #F5F5F5;--velt-light-mode-background-3: #F0F0F0;--velt-light-mode-background-4: #EBEBEB;--velt-light-mode-background-5: #E5E5E5;--velt-light-mode-background-6: #E0E0E0;--velt-light-mode-background-7: #DBDBDB;--velt-light-mode-background-8: #D6D6D6;--velt-light-mode-background-9: #D1D1D1;--velt-light-mode-background-10: #CCCCCC;--velt-light-mode-border-0: #FFFFFF;--velt-light-mode-border-1: #FAFAFA;--velt-light-mode-border-2: #F5F5F5;--velt-light-mode-border-3: #F0F0F0;--velt-light-mode-border-4: #EBEBEB;--velt-light-mode-border-5: #E5E5E5;--velt-light-mode-border-6: #E0E0E0;--velt-light-mode-border-7: #DBDBDB;--velt-light-mode-border-8: #D6D6D6;--velt-light-mode-border-9: #D1D1D1;--velt-light-mode-border-10: #CCCCCC;--velt-light-mode-background-transparent: rgba(255, 255, 255, .8);--velt-light-mode-border-transparent: rgba(0, 0, 0, .16);--velt-light-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-dark-mode-green: #0DCF82;--velt-dark-mode-magenta: #A259FE;--velt-dark-mode-amber: #FF7162;--velt-dark-mode-purple: #625DF5;--velt-dark-mode-cyan: #4BC9F0;--velt-dark-mode-orange: #FE965C;--velt-dark-mode-black: #080808;--velt-dark-mode-white: #FFFFFF;--velt-dark-mode-gray: #EBEBEB;--velt-dark-mode-error: #FF7162;--velt-dark-mode-error-hover: #DE5041;--velt-dark-mode-error-foreground: #FFFFFF;--velt-dark-mode-error-light: #FFF4F2;--velt-dark-mode-error-transparent: rgba(255, 113, 98, .08);--velt-dark-mode-warning: #FFCD2E;--velt-dark-mode-warning-hover: #C69400;--velt-dark-mode-warning-foreground: #474747;--velt-dark-mode-warning-light: #FFFBEE;--velt-dark-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-dark-mode-success: #198F65;--velt-dark-mode-success-hover: #006B41;--velt-dark-mode-success-foreground: #FFFFFF;--velt-dark-mode-success-light: #EDF6F3;--velt-dark-mode-success-transparent: rgba(25, 143, 101, .08);--velt-dark-mode-accent: #625DF5;--velt-dark-mode-accent-text: #9491F8;--velt-dark-mode-accent-hover: #534FCF;--velt-dark-mode-accent-foreground: #FFFFFF;--velt-dark-mode-accent-light: #F2F2FE;--velt-dark-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-dark-mode-text-0: #FFFFFF;--velt-dark-mode-text-1: #F5F5F5;--velt-dark-mode-text-2: #EBEBEB;--velt-dark-mode-text-3: #E0E0E0;--velt-dark-mode-text-4: #D6D6D6;--velt-dark-mode-text-5: #C2C2C2;--velt-dark-mode-text-6: #ADADAD;--velt-dark-mode-text-7: #8F8F8F;--velt-dark-mode-text-8: #7A7A7A;--velt-dark-mode-text-9: #666666;--velt-dark-mode-text-10: #525252;--velt-dark-mode-text-11: #474747;--velt-dark-mode-text-12: #3D3D3D;--velt-dark-mode-background-0: #0F0F0F;--velt-dark-mode-background-1: #1A1A1A;--velt-dark-mode-background-2: #1F1F1F;--velt-dark-mode-background-3: #242424;--velt-dark-mode-background-4: #292929;--velt-dark-mode-background-5: #2E2E2E;--velt-dark-mode-background-6: #333333;--velt-dark-mode-background-7: #383838;--velt-dark-mode-background-8: #3D3D3D;--velt-dark-mode-background-9: #424242;--velt-dark-mode-background-10: #474747;--velt-dark-mode-border-0: #0F0F0F;--velt-dark-mode-border-1: #1A1A1A;--velt-dark-mode-border-2: #1F1F1F;--velt-dark-mode-border-3: #242424;--velt-dark-mode-border-4: #292929;--velt-dark-mode-border-5: #2E2E2E;--velt-dark-mode-border-6: #333333;--velt-dark-mode-border-7: #383838;--velt-dark-mode-border-8: #3D3D3D;--velt-dark-mode-border-9: #424242;--velt-dark-mode-border-10: #474747;--velt-dark-mode-background-transparent: rgba(0, 0, 0, .8);--velt-dark-mode-border-transparent: rgba(255, 255, 255, .16);--velt-dark-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-comment-pin-z-index: 2147483557;--velt-arrow-z-index: 2147483557;--velt-recorder-player-z-index: 2147483557;--velt-cursor-z-index: 2147483647;--velt-persistent-comment-frame-z-index: 2147483647;--velt-toast-popup-z-index: 2147483647;--velt-live-state-sync-overlay-z-index: 2147483647;--velt-follow-mode-overlay-z-index: 2147483647;--velt-comments-minimap-z-index: 2147483637;--velt-global-overlay-z-index: 2147483637}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}.cdk-overlay-container{z-index:var(--velt-global-overlay-z-index)!important}.cdk-overlay-container .velt-overlay-panel.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 80vw);min-width:var(--mat-dialog-container-min-width, 0)}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:#fff;padding:24px}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .mdc-dialog__title:before{height:unset}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-actions{padding:var(--mat-dialog-actions-padding, 8px)}.velt-overlay-panel{background-color:transparent;border:none;box-shadow:none}.velt-overlay-panel.mat-mdc-tooltip-panel .mat-mdc-tooltip{color:#fff;background-color:#0b0b0b;border:1px solid #eeeeee;border-radius:4px;padding:8px 12px;font-size:14px}.velt-menu.mat-mdc-menu-panel{box-shadow:none}video.flip{transform:rotateY(180deg);-webkit-transform:rotateY(180deg);-moz-transform:rotateY(180deg)}body[data-velt-huddle-on-cursor-mode] .cdk-overlay-container{z-index:calc(var(--velt-global-overlay-z-index, 2147483637) - 1)!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor){cursor:none!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor) *{cursor:none!important}body.snippyly-add-comment-mode,body.snippyly-add-comment-mode *{-webkit-user-select:none!important;user-select:none!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true][data-velt-iframe-container-static=true]{position:relative!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true]:before{content:""!important;position:absolute!important;inset:0!important;z-index:1!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] [data-velt-element=true]:not(snippyly-comment-text-portal):not(velt-recorder-control-panel):not([data-velt-screen-recorder-panel=true]){display:none!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight{color:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:inherit!important;background-color:inherit!important;cursor:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{background-color:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight snippyly-comment-text-portal,body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight velt-comment-text-portal{font-family:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-annotation-number{display:none!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)){opacity:1!important;visibility:visible!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)) snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{opacity:.2!important}[data-snippyly-comment-pin-host][data-snippyly-comment-pin-host-static],[data-snippyly-tag-pin-host][data-snippyly-tag-pin-host-static],[data-snippyly-recorder-pin-host][data-snippyly-recorder-pin-host-static],[data-snippyly-arrow-pin-host][data-snippyly-arrow-pin-host-static],[data-snippyly-area-pin-host][data-snippyly-area-pin-host-static],[data-velt-comment-pin-host][data-velt-comment-pin-host-static],[data-velt-tag-pin-host][data-velt-tag-pin-host-static],[data-velt-recorder-pin-host][data-velt-recorder-pin-host-static],[data-velt-arrow-pin-host][data-velt-arrow-pin-host-static],[data-velt-area-pin-host][data-velt-area-pin-host-static]{position:relative}[data-velt-comment-pin-host][data-velt-comment-pin-active=true],[data-velt-area-pin-host][data-velt-area-pin-active=true]{opacity:1!important;visibility:visible!important}.s-display-none,.velt-display-none{display:none!important}.s-flex,.velt-display-flex{display:flex!important}.velt-items-center{align-items:center!important}.s-background-blur-1{-webkit-backdrop-filter:blur(4px)!important;backdrop-filter:blur(4px)!important}.s-background-blur-2{-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important}.s-background-blur-3{-webkit-backdrop-filter:blur(12px)!important;backdrop-filter:blur(12px)!important}.s-background-blur-4{-webkit-backdrop-filter:blur(16px)!important;backdrop-filter:blur(16px)!important}.s-tooltip{position:relative!important}.s-tooltip .s-tooltiptext{visibility:hidden!important;block-size:auto!important;width:max-content!important;top:120%!important;background-color:var(--legacy-velt-bg-color);border:1px solid var(--legacy-velt-border-color);color:var(--legacy-velt-primary-color)!important;text-align:left!important;padding:.5em .75em!important;border-radius:6px!important;font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:2em!important;box-shadow:var(--legacy-velt-box-shadow)!important;position:absolute!important;z-index:1!important;opacity:0!important;transition:opacity .5s!important;left:50%!important;transform:translate(-50%)!important}.s-tooltip .s-tooltiptext:after{content:" "!important;position:absolute!important;top:0!important;left:50%!important;width:12px!important;height:12px!important;border-left:1px solid var(--legacy-velt-border-color);border-top:1px solid var(--legacy-velt-border-color);background-color:var(--legacy-velt-bg-color);border-radius:4px!important;transform:translate(-50%,-41%) rotate(45deg)!important;transform-origin:center!important}.s-tooltip .s-tooltiptext:before{content:" ";position:absolute;top:0;left:50%;width:24px;height:24px;transform:translate(-50%,-41%);background:transparent}.s-tooltip .s-tooltiptext.left{top:50%!important;right:120%!important;transform:translateY(-50%)!important}.s-tooltip .s-tooltiptext.left:after{transform:translate(41%,-50%) rotate(45deg)!important;transform-origin:center!important;left:unset!important;right:0!important;top:50%!important}.s-tooltip .s-tooltiptext.left.top{top:100%!important;transform:translateY(-45%)!important}.s-tooltip .s-tooltiptext.left.top:after{transform:translate(41%,66%) rotate(45deg)!important;top:0!important}.s-tooltip:hover .s-tooltiptext{visibility:visible!important;opacity:1!important}.s-tooltip-light .s-tooltiptext{background-color:#fff!important;color:#000!important;box-shadow:0 2px 8px -2px #9f9f9f!important}.s-tooltip-light .s-tooltiptext:after{background-color:#fff!important}.s-tooltip-link{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.s-cursor-pointer,.velt-cursor-pointer{cursor:pointer!important}.s-shake{animation:shake .82s cubic-bezier(.36,.07,.19,.97) both;transform:translateZ(0);backface-visibility:hidden;perspective:1000px}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(2px,0,0)}30%,50%,70%{transform:translate3d(-4px,0,0)}40%,60%{transform:translate3d(4px,0,0)}}app-render-timer-wrapper{width:100%;height:100%}velt-comment-text[comment-available=true]{color:var(--Constant-Warning---Text, #E2A600);background-color:#e2a6001a;border-bottom:1px solid #E2A600}.velt-mat-bottom-sheet-container.snippyly-comment-bottom-sheet-container,.velt-mat-bottom-sheet-container.snippyly-comment-bottom-sheet-container .mat-bottom-sheet-container{padding:0!important}.velt-mat-bottom-sheet-container.snippyly-comment-bottom-sheet-container .velt-comment-dialog{width:100%!important;min-width:100%!important;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}
|
|
515
515
|
`],encapsulation:2,changeDetection:0});let n=o;return n})();var Em=(()=>{let o=class o{constructor(e){this.loggingService=e,this.toasts$=new Se([])}setToast(e){try{e.id||(e.id=Math.random()),this.toasts$.next([...this.toasts$.value,e]),e.duration&&e.duration>0&&is(e.duration).pipe(ut(1)).subscribe(()=>{this.removeToast(e)},t=>{this.loggingService.catch("Error in ToastService setToast timer subscription: ",t)})}catch(t){this.loggingService.catch("Error in ToastService setToast: ",t)}}removeToast(e){try{this.toasts$.next(this.toasts$.value.filter(t=>t.id!==e.id))}catch(t){this.loggingService.catch("Error in ToastService removeToast: ",t)}}getToasts$(){return this.toasts$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();function LYe(n,o){n&1&&(se(),f(0,"svg",6),D(1,"path",7),S())}function UYe(n,o){n&1&&(se(),f(0,"svg",6),D(1,"path",8)(2,"path",9),S())}function VYe(n,o){if(n&1){let r=Z();f(0,"div",2),p(1,LYe,2,0,"svg",3)(2,UYe,3,0,"svg",3),oe(3),R(4,"translate"),se(),f(5,"svg",4),z("click",function(){let t=L(r).$implicit,i=s();return U(i.removeToast(t))}),D(6,"path",5),S()()}if(n&2){let r=o.$implicit;g("@fade",!0),v(),g("ngIf",r.type==="success"),v(),g("ngIf",r.type==="error"),v(),we(" ",F(4,4,r.message)," ")}}var O_e=(()=>{let o=class o{constructor(e,t,i){this.loggingService=e,this.toastService=t,this.elementRef=i,this.toasts=[],this.subscriptions=[];try{this.subscriptions.push(this.toastService.getToasts$().subscribe(a=>{this.toasts=a}))}catch(a){console.log(a)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}ngAfterViewInit(){try{setTimeout(()=>{this.moveToastTagToEnd()},5e3)}catch{}}moveToastTagToEnd(){try{let e=this.elementRef?.nativeElement;document.body.appendChild(e)}catch(e){this.loggingService.catch("Error in ToastPopupComponent moveToastTagToEnd: ",e)}}removeToast(e){this.toastService.removeToast(e)}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Em),x(Q))},o.\u0275cmp=O({type:o,selectors:[["velt-toast-popup"]],standalone:!1,decls:2,vars:1,consts:[[1,"s-notification-container"],["class","s-notification",4,"ngFor","ngForOf"],[1,"s-notification"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"s-last-item","s-notification-close-btn",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z","fill","#E6E8EC"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM17.7071 9.70711C18.0976 9.31658 18.0976 8.68342 17.7071 8.29289C17.3166 7.90237 16.6834 7.90237 16.2929 8.29289L11 13.5858L8.70711 11.2929C8.31658 10.9024 7.68342 10.9024 7.29289 11.2929C6.90237 11.6834 6.90237 12.3166 7.29289 12.7071L10.2929 15.7071C10.6834 16.0976 11.3166 16.0976 11.7071 15.7071L17.7071 9.70711Z","fill","#0DCF82"],["fill-rule","evenodd","clip-rule","evenodd","d","M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.29289 8.29289C8.68342 7.90237 9.31658 7.90237 9.70711 8.29289L12 10.5858L14.2929 8.29289C14.6834 7.90237 15.3166 7.90237 15.7071 8.29289C16.0976 8.68342 16.0976 9.31658 15.7071 9.70711L13.4142 12L15.7071 14.2929C16.0976 14.6834 16.0976 15.3166 15.7071 15.7071C15.3166 16.0976 14.6834 16.0976 14.2929 15.7071L12 13.4142L9.70711 15.7071C9.31658 16.0976 8.68342 16.0976 8.29289 15.7071C7.90237 15.3166 7.90237 14.6834 8.29289 14.2929L10.5858 12L8.29289 9.70711C7.90237 9.31658 7.90237 8.68342 8.29289 8.29289Z","fill","#FF7162"]],template:function(t,i){t&1&&(f(0,"div",0),p(1,VYe,7,6,"div",1),S()),t&2&&(v(),g("ngForOf",i.toasts))},dependencies:[Yt,xe,he],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}.s-notification-container[_ngcontent-%COMP%]{position:fixed!important;top:5%!important;left:50%!important;transform:translate(-50%)!important;display:flex!important;justify-content:center!important;align-items:center!important;z-index:var(--velt-toast-popup-z-index)!important;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;flex-direction:column!important}.s-notification[_ngcontent-%COMP%]{display:flex!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((10rem + 0px) * var(--velt-base-rem-unit))!important;background:#23262f!important;color:#e6e8ec!important;width:calc((30rem + 0px) * var(--velt-base-rem-unit))!important;max-width:90vw!important;align-items:center!important}.s-last-item[_ngcontent-%COMP%]{margin-left:auto!important}.s-notification-close-btn[_ngcontent-%COMP%]{cursor:pointer!important}"],data:{animation:[IK("fade",[mN("false",im({opacity:0})),mN("true",im({opacity:1})),gN("false => true",[im({opacity:0}),vN(1e3,im({opacity:1}))]),gN("true => false",[vN(1e3,im({opacity:0}))])])]},changeDetection:0});let n=o;return n})();var JQ=n=>({componentConfigSignal:n}),A_e=(n,o)=>({condition:n,data:o}),jYe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-single-editor-mode-panel-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function $Ye(n,o){n&1&&et(0)}function GYe(n,o){if(n&1&&(f(0,"velt-shadow-dom-internal"),p(1,$Ye,1,0,"ng-container",4),S()),n&2){s(3);let r=Ee(2);v(),g("ngTemplateOutlet",r)}}function HYe(n,o){if(n&1&&(C(0),p(1,GYe,2,1,"velt-shadow-dom-internal",3),b()),n&2){let r=s().ngIf,e=s(),t=Ee(2);v(),g("ngIf",r.shadowDom&&!e.template||e.template&&e.isExplicitShadowDom)("ngIfElse",t)}}function zYe(n,o){if(n&1&&(C(0),p(1,HYe,2,2,"ng-container",2),b()),n&2){let r=s();v(),g("veltIf",E(3,A_e,r.conditionSignal(),J(1,JQ,r.componentConfigSignal)))}}function WYe(n,o){if(n&1&&(C(0),f(1,"div",8),D(2,"velt-single-editor-mode-panel-viewer-text",9)(3,"velt-single-editor-mode-panel-editor-text",9)(4,"velt-single-editor-mode-panel-countdown",9)(5,"velt-single-editor-mode-panel-request-access",9)(6,"velt-single-editor-mode-panel-reject-request",9)(7,"velt-single-editor-mode-panel-edit-here",9),S(),b()),n&2){let r=s(6);v(2),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal)}}function qYe(n,o){if(n&1&&(C(0),p(1,WYe,8,6,"ng-container",7),b()),n&2){let r=s(3).ngIf,e=s(2);v(),g("veltDynamicTemplate",j(3,jYe,e.template,J(1,JQ,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function YYe(n,o){if(n&1&&(f(0,"div",6),p(1,qYe,2,9,"ng-container",2),S()),n&2){let r=s(2).ngIf,e=s(2);pe("velt-single-editor-mode-panel-container-no-pointer",r.type==="editor")("no-pointer",r.type==="editor"),v(),g("veltIf",E(7,A_e,e.conditionSignal(),J(5,JQ,e.componentConfigSignal)))}}function KYe(n,o){if(n&1&&(C(0),p(1,YYe,2,10,"div",5),b()),n&2){let r=s().ngIf;v(),g("ngIf",r.leaderName!==""||r.type==="editor")}}function ZYe(n,o){if(n&1&&(C(0),p(1,KYe,2,1,"ng-container",1),b()),n&2){let r=o.ngIf;v(),g("ngIf",r.singleEditorMode)}}function JYe(n,o){if(n&1&&p(0,ZYe,2,1,"ng-container",1),n&2){let r=s();g("ngIf",r.componentConfigSignal())}}var eC=(()=>{let o=class o extends Ot{set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.isExplicitShadowDom=!!t,this.componentConfigSignal.update(i=>(i=y(h({},i),{shadowDom:t}),i))}catch(t){this.loggingService.catch("Error in SingleEditorModePanelComponent _shadowDom: ",t)}}constructor(e,t,i,a,l,c,d){super(e,l,void 0,void 0,void 0,c,a),this.elementRef=e,this.authService=t,this.liveStateService=i,this.loggingService=a,this.themeService=l,this.dynamicDataService=c,this.wireframeService=d,this.isExplicitShadowDom=!1,this.subscriptions=[],this.componentConfigSignal=De({singleEditorMode:!1,defaultSingleEditorUIEnabled:!1,editAccessRequested:!1,leaderName:"",type:"reader",requestEditorAccessCountdown:0,singleEditorLiveStateData:null,singleEditorConfig:null,isUserEditor:null,variant:this.variant,shadowDom:!0,requestEditorAccess:this.requestEditorAccess.bind(this),cancelEditorAccessRequest:this.cancelEditorAccessRequest.bind(this),rejectEditorAccessRequest:this.rejectEditorAccessRequest.bind(this),acceptEditorAccessRequest:this.acceptEditorAccessRequest.bind(this),editCurrentTab:this.editCurrentTab.bind(this)}),this.componentId="velt-single-editor-mode-panel";try{this.loggingService.log("%c[WB] Calling FUNCTION: SingleEditorModePanelComponent constructor","color: green;"),this.subscriptions.push(this.liveStateService.getSingleEditorMode$().subscribe(m=>{this.componentConfigSignal.update(u=>y(h({},u),{singleEditorMode:m}))})),this.subscriptions.push(this.liveStateService.getDefaultSingleEditorUIEnabled$().subscribe(m=>{this.componentConfigSignal.update(u=>y(h({},u),{defaultSingleEditorUIEnabled:m}))})),this.subscriptions.push(this.liveStateService.getSingleEditorModeConfig$().subscribe(m=>{this.componentConfigSignal.update(u=>y(h({},u),{singleEditorConfig:m}))})),this.subscriptions.push(this.liveStateService.isUserEditor$().subscribe(m=>{this.componentConfigSignal.update(u=>y(h({},u),{isUserEditor:m}))})),this.subscriptions.push(this.liveStateService.getSingleEditorLiveStateData$().subscribe(m=>{let u=this.componentConfigSignal().singleEditorLiveStateData?.requestEditorAccess?.user?.userId,_=m?.requestEditorAccess?.user?.userId;if(u&&_&&u!==_&&this.componentConfigSignal().requestEditorAccessCountdown&&this.removeRequestEditorAccessCountdown(),this.componentConfigSignal.update(I=>y(h({},I),{singleEditorLiveStateData:m})),m){this.componentConfigSignal.update(A=>y(h({},A),{leaderName:m?.editor?.name||m?.editor?.email||""}));let I=this.authService.getUser();I?.userId===m?.editor?.userId?this.componentConfigSignal.update(A=>y(h({},A),{type:"editor"})):this.componentConfigSignal.update(A=>y(h({},A),{type:"reader"})),I?.userId===m?.requestEditorAccess?.user?.userId&&m?.requestEditorAccess?.status==="pending"?this.componentConfigSignal.update(A=>y(h({},A),{editAccessRequested:!0})):this.componentConfigSignal.update(A=>y(h({},A),{editAccessRequested:!1})),this.componentConfigSignal().type==="editor"&&!this.componentConfigSignal().requestEditorAccessCountdown&&m?.requestEditorAccess?.status==="pending"?this.showRequestEditorAccessCountdown():this.removeRequestEditorAccessCountdown()}}))}catch(m){this.loggingService.catch("Error in SingleEditorModePanelComponent constructor: ",m)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-single-editor-mode-panel-wireframe";this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let i=document.createElement(t.tagName);i.innerHTML=t.innerHTML,this.template=i}})}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent ngOnDestroy: ",e)}}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=y(h({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in SingleEditorModePanelComponent ngOnChanges: ",t)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent setupA11yAttributes:",e)}}showRequestEditorAccessCountdown(){try{this.loggingService.log("%c[WB] Calling FUNCTION: showRequestEditorAccessCountdown","color: green;"),this.componentConfigSignal.update(e=>(e=y(h({},e),{requestEditorAccessCountdown:e.singleEditorLiveStateData?.requestEditorAccess?.editorAccessTimeout||N.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME}),e)),this.interval=setInterval(()=>{this.componentConfigSignal.update(e=>y(h({},e),{requestEditorAccessCountdown:e.requestEditorAccessCountdown-1})),this.componentConfigSignal().requestEditorAccessCountdown<=0&&clearInterval(this.interval)},1e3)}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent showRequestEditorAccessCountdown: ",e)}}removeRequestEditorAccessCountdown(){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeRequestEditorAccessCountdown","color: green;"),this.componentConfigSignal.update(e=>y(h({},e),{requestEditorAccessCountdown:0})),clearInterval(this.interval)}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent removeRequestEditorAccessCountdown: ",e)}}requestEditorAccess(){try{this.loggingService.log("%c[WB] Calling FUNCTION: requestEditorAccess","color: green;"),this.componentConfigSignal().editAccessRequested||this.liveStateService.requestEditorAccess().subscribe()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent requestEditorAccess: ",e)}}cancelEditorAccessRequest(){try{this.loggingService.log("%c[WB] Calling FUNCTION: cancelEditorAccessRequest","color: green;"),this.liveStateService.cancelEditorAccessRequest()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent cancelEditorAccessRequest: ",e)}}acceptEditorAccessRequest(){try{this.loggingService.log("%c[WB] Calling FUNCTION: acceptEditorAccessRequest","color: green;"),this.liveStateService.acceptEditorAccessRequest()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent acceptEditorAccessRequest: ",e)}}rejectEditorAccessRequest(){try{this.loggingService.log("%c[WB] Calling FUNCTION: rejectEditorAccessRequest","color: green;"),this.liveStateService.rejectEditorAccessRequest()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent rejectEditorAccessRequest: ",e)}}editCurrentTab(){try{this.loggingService.log("%c[WB] Calling FUNCTION: editCurrentTab","color: green;"),this.liveStateService.editCurrentTab()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent editCurrentTab: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(Q),x(qe),x(io),x(k),x(yt),x(T),x(Xe))},o.\u0275cmp=O({type:o,selectors:[["velt-single-editor-mode-panel"]],inputs:{variant:"variant",_shadowDom:[0,"shadowDom","_shadowDom"]},standalone:!1,features:[V([T]),P,Qe],decls:3,vars:1,consts:[["liveStateSyncPanelRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["data-velt-ignore","","class","velt-single-editor-mode-panel-container single-editor-mode-panel-container",3,"velt-single-editor-mode-panel-container-no-pointer","no-pointer",4,"ngIf"],["data-velt-ignore","",1,"velt-single-editor-mode-panel-container","single-editor-mode-panel-container"],[4,"veltDynamicTemplate"],["data-velt-ignore","",1,"velt-single-editor-mode-panel","follow-dialog"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&p(0,zYe,2,6,"ng-container",1)(1,JYe,1,1,"ng-template",null,0,Ve),t&2&&g("ngIf",i.componentConfigSignal())},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-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-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-single-editor-mode-panel[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs);display:flex;justify-content:center;align-items:center;gap:var(--velt-spacing-sm);width:fit-content;padding:var(--velt-spacing-sm) var(--velt-spacing-md);background-color:var(--velt-background-0);color:var(--velt-text-0);border-radius:var(--velt-border-radius-full);box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--velt-border-4)}.velt-single-editor-mode-panel-container.velt-single-editor-mode-panel-container-no-pointer[_ngcontent-%COMP%]{pointer-events:none}"],changeDetection:0});let n=o;return n})();function QYe(n,o){if(n&1&&(C(0),f(1,"div",1),D(2,"velt-single-editor-mode-panel",2),S(),b()),n&2){let r=s(2);v(2),g("variant",r.variant)}}function eKe(n,o){if(n&1&&(C(0),p(1,QYe,3,1,"ng-container",0),b()),n&2){let r=o.ngIf;v(),g("ngIf",r.singleEditorMode&&r.defaultSingleEditorUIEnabled)}}var M_e=(()=>{let o=class o extends Ot{constructor(e,t,i,a,l,c){super(e,t,void 0,void 0,void 0,i,a),this.elementRef=e,this.themeService=t,this.dynamicDataService=i,this.loggingService=a,this.liveStateService=l,this.domService=c,this.subscriptions=[],this.componentConfigSignal=De({singleEditorMode:!1,defaultSingleEditorUIEnabled:!1,variant:this.variant}),this.componentId="velt-live-state-sync-overlay";try{this.subscriptions.push(this.liveStateService.getSingleEditorMode$().subscribe(d=>{this.componentConfigSignal.update(m=>y(h({},m),{singleEditorMode:d}))})),this.subscriptions.push(this.liveStateService.getDefaultSingleEditorUIEnabled$().subscribe(d=>{this.componentConfigSignal.update(m=>y(h({},m),{defaultSingleEditorUIEnabled:d}))}))}catch(d){this.loggingService.catch("Error in LiveStateSyncOverlayComponent constructor: ",d)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent ngOnInit: ",e)}}ngAfterViewInit(){try{this.subscriptions.push(this.domService.subscribeInjectCustomCss(this.elementRef))}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent ngAfterViewInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","dialog"),e.setAttribute("aria-labelledby",this.componentId),e.setAttribute("aria-modal","true")}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent setupA11yAttributes: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(Q),x(yt),x(T),x(k),x(io),x(Ue))},o.\u0275cmp=O({type:o,selectors:[["snippyly-live-state-sync-overlay"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","",1,"velt-live-state-sync-overlay-container","live-state-sync-overlay-container"],[3,"variant"]],template:function(t,i){t&1&&p(0,eKe,2,1,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[xe,eC],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}body.velt-pin-dragging iframe{pointer-events:none!important}.velt-live-state-sync-overlay-container{position:fixed;bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));left:50%;transform:translate(-50%);background-color:transparent;z-index:var(--velt-live-state-sync-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}
|
|
516
516
|
`],encapsulation:3,changeDetection:0});let n=o;return n})();function nKe(n,o){n&1&&D(0,"app-external-styles")}var XQ=(()=>{let o=class o{set signInButton(e){this.translateService.setLanguage(e)}set translations(e){try{let t=e;if(typeof e=="string"&&(t=JSON.parse(e)),!t||typeof t!="object")return;this.translateService.setTranslations(t)}catch(t){this.loggingService.catch("Error in AppComponent set translations: ",t)}}set _autoTranslation(e){let t=e;typeof e=="string"&&(t=JSON.parse(e)),t?this.translateService.enableAutoTranslation():this.translateService.disableAutoTranslation()}onResize(e){this.setSnippylyViewportSize()}constructor(e,t,i,a,l,c,d,m,u,_,I,A){this.docService=e,this.domService=t,this.loggingService=i,this.viewportRuler=a,this.themeService=l,this.breakpointObserver=c,this.translateService=d,this.notificationService=m,this.veltService=u,this.injector=_,this.configService=I,this.cd=A,this.snippyly=new $U(this.injector),this.stylesEnabled=null,this.getSnippyly=new Le,this.subscriptions=[],this.veltElement=!0,this.loggingService.log("%c[WB] Creating CLASS: AppComponent","color: blue;");try{this.subscriptions.push(this.docService.getDocumentPaths$().subscribe(()=>{this.domService.removeScrollableElementsIds()},M=>{this.loggingService.catch("Error in AppComponent getDocumentPaths subscription:",M)})),this.subscriptions.push(this.configService.getConfig$().pipe($e(M=>M!=null),ut(1)).subscribe(M=>{try{this.stylesEnabled=M?.globalStyles!==!1,this.cd.detectChanges()}catch(B){this.loggingService.catch("Error in AppComponent config subscription:",B)}})),this.updateDeviceType(),this.updateDeviceOrientation(),this.setVeltVersion()}catch(M){this.loggingService.catch("Error in AppComponent constructor:",M)}}ngOnInit(){}ngAfterViewInit(){try{this.domService.setDeviceInfo(),this.setSnippylyViewportSize(),this.getSnippyly.emit(this.snippyly),this.setSnippylyRemBaseUnit(),this.subscriptions.push(this.domService.onWindowResize$().subscribe(()=>{this.setSnippylyRemBaseUnit()})),this.themeService.updateListenerOnConfigChange()}catch(e){this.loggingService.catch("Error in App After view init: ",e)}}setVeltVersion(){try{window?.Velt?.version&&localStorage.setItem(N.LOCAL_STORAGE.VELT_VERSION,window.Velt.version)}catch(e){this.loggingService.catch("Error in AppComponent setVeltVersion: ",e)}}updateDeviceType(){try{Object.values(to).forEach(t=>{pr.Breakpoints[t]=this.breakpointObserver.isMatched(t),this.subscriptions.push(this.breakpointObserver.observe(t).subscribe(i=>{pr.Breakpoints[t]=i.matches}))})}catch(e){this.loggingService.catch("Error in AppComponent updateDeviceType: ",e)}}updateDeviceOrientation(){try{Object.values(s1).forEach(t=>{pr.Orientations[t]=window.matchMedia(t).matches,this.subscriptions.push(this.breakpointObserver.observe(t).subscribe(i=>{pr.Orientations[t]=i.matches}))})}catch(e){this.loggingService.catch("Error in AppComponent updateDeviceOrientation: ",e)}}observeHtmlTagChanges(){}setSnippylyRemBaseUnit(){try{let e=document.documentElement,t=window.getComputedStyle(e),i=16,a=+t.fontSize.replace("px",""),l=a?i/a:1;e.style.setProperty(N.VELT_BASE_REM_UNIT,l+"")}catch(e){this.loggingService.catch("Error in AppComponent setSnippylyRemBaseUnit: ",e)}}setSnippylyViewportSize(){try{setTimeout(()=>{let e=this.viewportRuler.getViewportSize(),t=document.documentElement;t.style.setProperty(N.VELT_VIEWPORT_WIDTH,e.width+"px"),t.style.setProperty(N.VELT_VIEWPORT_HEIGHT,e.height+"px")},100)}catch{}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()}),this.themeService.disablePrefersColorScheme()}catch{}}};o.\u0275fac=function(t){return new(t||o)(x(st),x(Ue),x(k),x(Wl),x(yt),x(Zo),x(Ns),x(mn),x(jU),x(Dt),x(Ft),x(nn))},o.\u0275cmp=O({type:o,selectors:[["app-root"]],hostVars:1,hostBindings:function(t,i){t&1&&z("resize",function(l){return i.onResize(l)},lT),t&2&&w("data-velt-element",i.veltElement)},inputs:{snippyly:"snippyly",signInButton:[0,"language","signInButton"],translations:"translations",_autoTranslation:[0,"autoTranslation","_autoTranslation"]},outputs:{getSnippyly:"getSnippyly"},standalone:!1,decls:3,vars:1,consts:[[4,"ngIf"]],template:function(t,i){t&1&&(p(0,nKe,1,0,"app-external-styles",0),D(1,"velt-toast-popup")(2,"snippyly-live-state-sync-overlay")),t&2&&g("ngIf",i.stylesEnabled===!0)},dependencies:[xe,D_e,O_e,M_e],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important} snippyly-highlight-user-text.velt-live-selection-on-text-default{background-color:var(--velt-selection-color, rgba(162, 89, 254, .5333333333))!important} .velt-live-selection-on-element-default{outline:2px solid var(--velt-selection-color, #a259fe)!important} .snippyly-highlight{outline:var(--legacy-velt-comment-pin-highlight, 2px dashed #a259fe)!important} [snippyly-highlight-preview=true]{outline:2px solid green!important} body.snippyly-add-comment-mode.show-pin-cursor:not[data-velt-element], body.snippyly-add-comment-mode.show-pin-cursor[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not[data-velt-element]{cursor:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0iIzYyNURGNSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV8yMDMyXzIzNjgxIiBmaWxsPSJ3aGl0ZSI+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiLz4KPC9tYXNrPgo8cGF0aCBkPSJNMC4zNTI5NDEgMThDMC4xNTgwMTcgMTggLTYuOTA3MTVlLTA5IDE3Ljg0MiAtMS41NDI3NWUtMDggMTcuNjQ3MUwtMy45MzQwMmUtMDcgOUMtNi4xMDY3M2UtMDcgNC4wMjk0NCA0LjAyOTQ0IC0xLjc2MTMyZS0wNyA5IC0zLjkzNDAyZS0wN1YtMy45MzQwMmUtMDdDMTMuOTcwNiAtNi4xMDY3M2UtMDcgMTggNC4wMjk0NCAxOCA5VjlDMTggMTMuOTcwNiAxMy45NzA2IDE4IDkgMThMMC4zNTI5NDEgMThaIiBmaWxsPSIjMTQxNDE2Ii8+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfMjAzMl8yMzY4MSkiLz4KPC9zdmc+Cg==) 0 31,auto} body.snippyly-add-tag-mode.show-pin-cursor:not[data-velt-element], body.snippyly-add-tag-mode.show-pin-cursor[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not[data-velt-element]{cursor:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczpieD0iaHR0cHM6Ly9ib3h5LXN2Zy5jb20iPgogIDxlbGxpcHNlIHN0eWxlPSJzdHJva2U6IHJnYigwLCAwLCAwKTsgZmlsbDogcmdiKDE2MiwgODksIDI1NCk7IHBhaW50LW9yZGVyOiBmaWxsOyBzdHJva2Utd2lkdGg6IDBweDsiIGN4PSIxNiIgY3k9IjE2IiByeD0iMTYiIHJ5PSIxNiIvPgogIDxwYXRoIGQ9Ik0gOS4zMzMgMjIgQyA5LjMzMyAyMiA4IDIyIDggMjAuNjY3IEMgOCAxOS4zMzMgOS4zMzMgMTUuMzMzIDE2IDE1LjMzMyBDIDIyLjY2NyAxNS4zMzMgMjQgMTkuMzMzIDI0IDIwLjY2NyBDIDI0IDIyIDIyLjY2NyAyMiAyMi42NjcgMjIgTCA5LjMzMyAyMiBaIE0gMTYgMTQgQyAxOS4wNzkgMTQgMjEuMDA0IDEwLjY2NyAxOS40NjQgOCBDIDE4Ljc1IDYuNzYyIDE3LjQyOSA2IDE2IDYgQyAxMi45MjEgNiAxMC45OTYgOS4zMzMgMTIuNTM2IDEyIEMgMTMuMjUgMTMuMjM3IDE0LjU3MSAxNCAxNiAxNCBaIiBzdHlsZT0iZmlsbDogcmdiKDI1NSwgMjU1LCAyNTUpOyIgYng6b3JpZ2luPSIwLjUgMC41Ii8+Cjwvc3ZnPg==) 16 16,auto!important} body.snippyly-add-arrow-mode.show-pin-cursor:not[data-velt-element], body.snippyly-add-arrow-mode.show-pin-cursor[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not[data-velt-element]{cursor:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNiAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy44MDU0IDEwLjAyMDdDMTQuNTQxMiA5Ljk5MTMxIDE1LjExMzggOS4zNzA5OCAxNS4wODQzIDguNjM1MThMMTQuODMwNiAyLjI4OTM5QzE0LjgwMjggMS41OTQ4NiAxNC4yNDYxIDEuMDM4MTkgMTMuNTUxNiAxLjAxMDQxTDcuMjA1NzEgMC43NTY1MzdDNi40Njk5MiAwLjcyNzEwMiA1Ljg0OTU4IDEuMjk5NzIgNS44MjAxNSAyLjAzNTUxQzUuNzkwNzEgMi43NzEzIDYuMzYzMzMgMy4zOTE2NCA3LjA5OTEyIDMuNDIxMDdMMTAuNDAyMSAzLjU1MzIxTDEuMjQxNzcgMTIuNzEzNkMwLjcyMTA2NyAxMy4yMzQzIDAuNzIxMDY3IDE0LjA3ODUgMS4yNDE3NyAxNC41OTkyQzEuNzYyNDYgMTUuMTE5OSAyLjYwNjY4IDE1LjExOTkgMy4xMjczOCAxNC41OTkyTDEyLjI4NzcgNS40Mzg4NkwxMi40MTk4IDguNzQxNzVDMTIuNDQ5MiA5LjQ3NzU0IDEzLjA2OTYgMTAuMDUwMiAxMy44MDU0IDEwLjAyMDdaIiBmaWxsPSIjOEY5NUIyIi8+Cjwvc3ZnPgo=) 15 0,auto!important} .selection-element-portal{display:flex!important} .snippyly-user-marker{cursor:default;display:inline;position:relative} .snippyly-user-marker:after{color:#fff;content:attr(data-name);display:none;font-style:normal;font-weight:400;left:0;line-height:1;opacity:0;position:absolute;top:-30px;transition:opacity .2s linear,transform .3s ease-in-out;white-space:nowrap;z-index:99999;padding:4px!important;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit));border-radius:8px;font-family:var(--velt-default-font-family, unset);transform:translate(-50%)} .snippyly-user-marker:hover:after, .snippyly-user-marker.active:after{animation:all 1s ease-in-out;display:block;opacity:1} .snippyly-user-marker .snippyly-user-marker-line{bottom:0;height:100%;position:absolute;width:0} .snippyly-user-marker .snippyly-user-marker-line .snippyly-user-marker-dot{border-radius:50%;cursor:default;display:block;height:4px;left:50%;position:absolute;top:-3px;transform:translate(-50%,-50%);width:4px} .snippyly-user-marker:after{background-color:var(--velt-selection-marker-color)!important} .snippyly-user-marker .snippyly-user-marker-line, .snippyly-user-marker .snippyly-user-marker-dot{border:1px solid var(--velt-selection-marker-color)!important;background-color:var(--velt-selection-marker-color)!important} .v-device-info-tooltip-container{display:flex;padding:calc((.25rem + 0px) * var(--velt-base-rem-unit)) calc((.5rem + 0px) * var(--velt-base-rem-unit));margin:calc((.5rem + 0px) * var(--velt-base-rem-unit));align-items:flex-start;flex-direction:column;gap:calc((.2rem + 0px) * var(--velt-base-rem-unit));border-radius:calc((.5rem + 0px) * var(--velt-base-rem-unit));background:var(--neutrals-1, #141416);color:var(--neutrals-10, #FFF);font-size:calc((.75rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-weight:400;line-height:normal} .v-device-info-tooltip-container.dark{background:var(--neutrals-3, #353945);color:var(--neutrals-10, #FFF)} .huddle-all-menu-panel{box-shadow:0 calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((3rem + 0px) * var(--velt-base-rem-unit)) #0000002d!important;background-color:#fff!important;border-radius:8px;color:#000} .huddle-all-menu-panel .mat-mdc-menu-item{background-color:#fff!important;padding:0 calc((1rem + 0px) * var(--velt-base-rem-unit))!important;height:40px!important;min-height:40px!important;width:100%!important;font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;gap:8px!important;align-items:center!important;border:0!important;font-weight:unset!important;text-transform:unset!important;font-family:var(--velt-default-font-family, unset)!important} .huddle-all-menu-panel .mat-mdc-menu-item .mat-mdc-menu-item-text{font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;gap:8px!important;align-items:center!important;border:0!important;font-weight:unset!important;text-transform:unset!important;font-family:var(--velt-default-font-family, unset)!important} .huddle-all-menu-panel .mat-mdc-menu-item:hover{background-color:#f1f1f1!important} .huddle-all-menu-panel .mat-mdc-menu-item:disabled{color:#c4c4c4!important} .snippyly-huddle-menu-panel-overlay-panel{z-index:2147483617!important} .snippyly-huddle-banner-panel{top:0!important;left:0!important} .snippyly-huddle-banner-panel .huddle-banner{border:1px solid rgba(26,28,30,.1);box-shadow:0 2px 12px #001c3b1f;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;position:fixed;background:#fff;z-index:2;top:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;right:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#000} .snippyly-huddle-banner-panel .huddle-banner>div{display:flex} .snippyly-huddle-banner-panel .huddle-banner>div>*{padding:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .title{font-weight:600;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;margin:0!important} .snippyly-huddle-banner-panel .huddle-banner>div .subtitle{font-weight:400;font-size:14px!important;line-height:21px!important;margin:0} .snippyly-huddle-banner-panel .huddle-banner>div .action-btn-container{margin:calc((.75rem + 0px) * var(--velt-base-rem-unit)) 0 calc((.25rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .action-btn-container button{cursor:pointer} .snippyly-huddle-banner-panel .huddle-banner>div .join-btn{padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;background:#625df5;border-radius:90px!important;border:0;margin-right:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important;font-weight:700;transition:.2s;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .join-btn:hover{background:#4742dc} .snippyly-huddle-banner-panel .huddle-banner>div .cancel-btn{color:#777e91;background:transparent;border:0;font-weight:700;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .close-btn{cursor:pointer} .velt-recorder-all-tool--menu-panel{overflow:unset!important} .velt-recorder-all-tool--menu-panel .mat-mdc-menu-content{padding:0!important} .v-view-analytics-overlay-panel{z-index:2147483617!important}"],changeDetection:0});let n=o;return n})();var Ar=(()=>{let o=class o{constructor(){this.subscriptions=[]}ngAfterViewInit(){this.overlay instanceof _n?this.setOverlayZIndex(this.overlay):this.overlay instanceof i3?this.setMatAutocompleteZIndex(this.overlay):this.overlay instanceof HTMLElement&&this.setElementZIndex(this.overlay)}setOverlayZIndex(e){this.overlay instanceof _n&&this.subscriptions.push(e.positionChange.pipe(ut(1)).subscribe(()=>{e?.overlayRef&&e?.overlayRef?.hostElement&&this.zIndex&&(e.overlayRef.hostElement.style.zIndex=this.zIndex?.toString())},t=>{}))}setMatAutocompleteZIndex(e){try{this.overlay instanceof i3&&this.subscriptions.push(e.opened.pipe(ut(1)).subscribe(()=>{setTimeout(()=>{if(e?.panel?.nativeElement){let t=e.panel.nativeElement?.closest(".cdk-overlay-connected-position-bounding-box");t&&(t.style.zIndex=this.zIndex?.toString())}},100)},t=>{}))}catch{}}setElementZIndex(e){try{this.overlay instanceof HTMLElement&&setTimeout(()=>{let t=e?.closest(".cdk-global-overlay-wrapper")||e?.closest(".cdk-overlay-connected-position-bounding-box");t&&this.zIndex&&(t.style.zIndex=this.zIndex?.toString());let a=e?.closest(".cdk-overlay-container")?.querySelector(".cdk-overlay-backdrop");a&&this.backdropZIndex&&(this.originalBackdropZIndex=a.style.zIndex,a.style.zIndex=this.backdropZIndex?.toString(),this.backdropElement=a)},100)}catch{}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()}),this.backdropElement&&this.originalBackdropZIndex&&(this.backdropElement.style.zIndex=this.originalBackdropZIndex?.toString())}catch{}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275dir=Xt({type:o,selectors:[["","snippylyOverlay",""]],inputs:{overlay:[0,"snippylyOverlay","overlay"],zIndex:[0,"snippylyOverlayZIndex","zIndex"],backdropZIndex:[0,"snippylyOverlayBackdropZIndex","backdropZIndex"]},standalone:!1});let n=o;return n})();var rKe=["*"],oKe=()=>["snippyly-overlay-panel","snippyly-lightbox-overlay-panel","velt-overlay-panel"];function iKe(n,o){if(n&1){let r=Z();f(0,"div",5),z("click",function(t){return L(r),s(2).closeImageInFullScreen(),U(t.stopPropagation())})("pointerdown",function(t){return L(r),U(t.stopPropagation())}),D(1,"img",6),S()}if(n&2){let r=s(2);w("aria-label","Image Preview")("data-testid",r.componentId+"-overlay-container"),v(),g("src",r.src,bn)("alt","Image preview"),w("data-testid",r.componentId+"-image")}}function aKe(n,o){if(n&1&&(C(0),Gt(1),D(2,"div",3,0),p(4,iKe,2,5,"ng-template",4,1,Ve),b()),n&2){let r=o.ngIf,e=Ee(3),t=Ee(5),i=s();v(2),w("data-testid",i.componentId+"-trigger"),v(2),g("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",r.showImageInFullScreen)("cdkConnectedOverlayPanelClass",xt(7,oKe))("cdkConnectedOverlayDisableClose",!0)("snippylyOverlay",t)("snippylyOverlayZIndex",2147483627)}}var P_e=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.elementRef=t,this.componentConfigSignal=De({showImageInFullScreen:!1}),this.veltElement=!0,this.componentId="velt-lightbox";try{this.loggingService.log("%c[WB] Creating Class: LightboxComponent","color: blue;")}catch(i){this.loggingService.catch("Error in LightboxComponent constructor: ",i)}}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in LightboxComponent setupA11yAttributes:",e)}}openImageInFullScreen(){try{this.loggingService.log("%c[WB] LightboxComponent FUNCTION: openImageInFullScreen","color: green;"),this.componentConfigSignal.update(e=>(e=y(h({},e),{showImageInFullScreen:!0}),e))}catch(e){this.loggingService.catch("Error in LightboxComponent openImageInFullScreen: ",e)}}closeImageInFullScreen(){try{this.loggingService.log("%c[WB] LightboxComponent FUNCTION: closeImageInFullScreen","color: green;"),this.componentConfigSignal.update(e=>(e=y(h({},e),{showImageInFullScreen:!1}),e))}catch(e){this.loggingService.catch("Error in LightboxComponent closeImageInFullScreen: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q))},o.\u0275cmp=O({type:o,selectors:[["snippyly-lightbox"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{src:"src"},standalone:!1,ngContentSelectors:rKe,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],[4,"ngIf"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayDisableClose","snippylyOverlay","snippylyOverlayZIndex"],["role","dialog","aria-modal","true","tabindex","-1",1,"snippyly-image-overlay-container",3,"click","pointerdown"],[3,"src","alt"]],template:function(t,i){t&1&&(zt(),p(0,aKe,6,8,"ng-container",2)),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[xe,_n,pn,Ar],styles:["[_nghost-%COMP%]{display:flex} .snippyly-lightbox-overlay-panel{inset:0!important} .snippyly-lightbox-overlay-panel .snippyly-image-overlay-container{width:100vw;height:100vh;display:flex;align-items:center;justify-content:center;background:#d3d3d37a;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:2147483627} .snippyly-lightbox-overlay-panel img{max-width:80vw;max-height:80vh;border-radius:var(--velt-border-radius-sm)}"],changeDetection:0});let n=o;return n})();var lKe=["menuRef"],cKe=["menuTrigger"],sKe=["*"];function dKe(n,o){n&1&&(C(0),D(1,"button",5),b())}var QQ=(()=>{let o=class o{constructor(e){this.loggingService=e,this.menuItems=[],this.veltElement=!0}ngOnInit(){}ngAfterViewInit(){try{let e=this.menuTrigger?.nativeElement?.querySelector("[menu-items]");if(e){e.style.display="none";for(let t=0;t<e.children.length;t++){let i=e.children[t];this.menuItems.push(i)}setTimeout(()=>{this.addMenuOptions()},100)}}catch(e){this.loggingService.catch("Error in MenuComponent afterViewInit: ",e)}}ngAfterContentInit(){}addMenuOptions(){try{this.menuRef&&this.menuRef._allItems.forEach((e,t)=>{e._getHostElement()?.appendChild(this.menuItems[t])})}catch(e){this.loggingService.catch("Error in MenuComponent addMenuOptions: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k))},o.\u0275cmp=O({type:o,selectors:[["snippyly-menu"]],viewQuery:function(t,i){if(t&1&&(pt(lKe,5),pt(cKe,5)),t&2){let a;vt(a=mt())&&(i.menuRef=a.first),vt(a=mt())&&(i.menuTrigger=a.first)}},hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},standalone:!1,ngContentSelectors:sKe,decls:7,vars:4,consts:[["menuTrigger","","menuTriggerRef","matMenuTrigger"],["menuRef","matMenu"],[3,"matMenuTriggerFor"],[1,"velt-menu","snippyly-menu-panel"],[4,"ngFor","ngForOf"],["mat-menu-item",""]],template:function(t,i){if(t&1&&(zt(),f(0,"div",2,0),Gt(3),S(),f(4,"mat-menu",3,1),p(6,dKe,2,0,"ng-container",4),S()),t&2){let a=Ee(2),l=Ee(5);pe("active",a==null?null:a.menuOpen),g("matMenuTriggerFor",l),v(6),g("ngForOf",i.menuItems)}},dependencies:[Yt,od,_s,Ju],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%] *[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}[_nghost-%COMP%] *[_ngcontent-%COMP%]:empty{display:revert!important} .snippyly-menu-panel{box-shadow:0 calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((3rem + 0px) * var(--velt-base-rem-unit)) #0000002d!important;background-color:#fff!important;border-radius:8px!important} .snippyly-menu-panel button{background-color:#fff;padding:0 calc((1rem + 0px) * var(--velt-base-rem-unit))!important;height:40px!important;width:100%!important;font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-menu-panel button:hover{background-color:#f1f1f1}"],changeDetection:0});let n=o;return n})();var vKe={provide:xg,useExisting:li(()=>YO),multi:!0},YO=(()=>{let o=class o extends a3{};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275dir=Xt({type:o,selectors:[["","contenteditable","","veltAutocomplete",""]],inputs:{veltAutocomplete:"veltAutocomplete"},exportAs:["snippylyUserSelectorTrigger"],standalone:!1,features:[V([vKe]),P]});let n=o;return n})();var lc=(()=>{let o=class o extends Ot{set parentLocalUIState(e){try{e&&(this.localUIStateSignal=e,this.isLocalUIStateOwner=!1)}catch{}}get elementRef(){try{return this.hostElementRef}catch{return null}}getServiceComponentConfigSignal(){}constructor(){let e=le(Q),t=le(yt),i=le(nn),a=le(Re,{optional:!0}),l=le(T),c=le(k);super(e,t,i,a??void 0,void 0,l,c),this.defaultCondition=fe(!0,{transform:d=>{try{return typeof d=="string"?d==="true"||d==="":d}catch{return!0}}}),this.isLocalUIStateOwner=!1;try{this.hostElementRef=e,this.themeService=t,this.dynamicDataService=l,this.loggingService=c,this.cd=i,this.commentService=a??void 0,this.initializeLocalUIState()}catch(d){this.loggingService=this.loggingService||c,this.loggingService?.catch?.("Error in V2PrimitiveThemedBase constructor:",d)}}initializeLocalUIState(){this.localUIStateSignal=De(this.getDefaultLocalUIState()),this.isLocalUIStateOwner=!0}getConditionalClassesContext(){return{componentConfigSignal:this.componentConfigSignal}}ngOnInit(){try{this.connectToServiceSignalIfStandalone(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef?.nativeElement,this.getConditionalClassesContext()),this.setupA11yAttributes(),this.isLocalUIStateOwner&&this.setupDarkModeSync()}catch(e){this.loggingService.catch("Error in V2PrimitiveThemedBase ngOnInit:",e)}}connectToServiceSignalIfStandalone(){try{let e=this.componentConfigSignal();if(!e||!e?.uiState){let t=this.getServiceComponentConfigSignal();t&&(this.componentConfigSignal=t)}}catch(e){this.loggingService.catch("Error connecting to service signal:",e)}}ngOnDestroy(){try{this.darkModeConfigSyncSubscription&&this.darkModeConfigSyncSubscription.unsubscribe(),super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in V2PrimitiveThemedBase ngOnDestroy:",e)}}setupA11yAttributes(){}setupDarkModeSync(){try{this.darkModeConfigSyncSubscription=this.onDarkModeChange().subscribe(e=>{try{if(this.componentConfigSignal&&typeof this.componentConfigSignal=="function"){let t=this.componentConfigSignal();t&&t.uiState&&t.uiState.darkMode!==e&&this.componentConfigSignal.update(i=>y(h({},i),{uiState:y(h({},i.uiState),{darkMode:e})}))}}catch(t){this.loggingService.catch("Error in darkMode sync subscription:",t)}})}catch(e){this.loggingService.catch("Error in V2PrimitiveThemedBase setupDarkModeSync:",e)}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["app-v2-primitive-themed-base"]],inputs:{defaultCondition:[1,"defaultCondition"],parentLocalUIState:"parentLocalUIState"},standalone:!1,features:[P],decls:0,vars:0,template:function(t,i){},encapsulation:2});let n=o;return n})();function R_e(){return{appState:{},featureState:{shadowDom:!1}}}function eee(){return{data:{position:{top:-1e3,left:-1e3},user:null,selectedWordsCount:0,selectedCharactersCount:0,allowedElementIds:[],contextId:null},uiState:{showAdder:!1,disabled:!1,commentToolEnabled:!0,isPlanExpired:!1,isUserAllowed:!1,enableTextComments:!1,rewriterEnabled:!1,rewriterDefaultUIEnabled:!0,left:0,darkMode:!1,shadowDom:!1,variant:null,MIN_ALLOWED_WORDS_COUNT:3,MIN_ALLOWED_CHARACTERS_COUNT:7,MAX_ALLOWED_CHARACTERS_COUNT:8e3}}}function N_e(){return{darkMode:!1,variant:void 0,shadowDom:!1}}var GU=(()=>{let o=class o{constructor(e,t,i,a,l,c,d){this.loggingService=e,this.commentService=t,this.domService=i,this.rewriterService=a,this.rewriterActionsService=l,this.analyticsService=c,this.authService=d,this.scrollChangeSubscriptions=new Map,this.toolbarRefMap=new Map,this._coreServiceGetter=null}setCoreServiceGetter(e){this._coreServiceGetter=e}get coreService(){return this._coreServiceGetter?.()}setToolbarRef(e,t){this.toolbarRefMap.set(e,t)}onSelection(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onSelection","color: green;");let t=this.coreService?.contextMap?.get(e);if(!t)return;let i=this.domService.getRange();if(i?.commonAncestorContainer){let a=i.getClientRects();if(a.length){let l=a[a.length-1],c=t();t.update(d=>y(h({},d),{data:y(h({},d.data),{position:{top:l.y+l.height+(d.uiState.rewriterEnabled&&d.uiState.rewriterDefaultUIEnabled?16:4),left:l.x+l.width-16}})})),this.onPositionUpdate(e),t.update(d=>y(h({},d),{uiState:y(h({},d.uiState),{showAdder:!0})}))}else this.clearSelection(e)}}catch(t){this.loggingService.catch("Error in TextCommentActionService onSelection:",t)}}subscribeScrollChange(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: subscribeScrollChange","color: green;");let t=this.scrollChangeSubscriptions.get(e);t&&t.unsubscribe();let i=Cn([this.domService.onWindowPointerUp$(),this.domService.getCurrentWindowSize$()]).subscribe(()=>{this.onSelection(e)});this.scrollChangeSubscriptions.set(e,i)}catch(t){this.loggingService.catch("Error in TextCommentActionService subscribeScrollChange:",t)}}createAnnotation(e,t,i){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: createAnnotation","color: green;");let a=this.coreService?.contextMap?.get(e);if(!a)return;if(yield rp(200),a().data.user){let c=this.domService.getRange(),d=c?this.domService.getTargetTextRangeFromSelectionRange(c):void 0;this.domService.clearTextSelection(),setTimeout(()=>{if(t)this.rewriterService.addRewriter(void 0,d,i);else{let m=c?.commonAncestorContainer;m&&m.nodeType===Node.TEXT_NODE&&(m=m.parentElement);let u=this.commentService.getInlineCommentSectionConfig(m);this.commentService.addComment(void 0,d,void 0,void 0,void 0,void 0,void 0,void 0,u)}},100)}}catch(a){this.loggingService.catch("Error in TextCommentActionService createAnnotation:",a)}})}createRewriter(e,t){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: createRewriter","color: green;");let i=this.coreService?.contextMap?.get(e);if(!i)return;let a=i();a.data.selectedWordsCount>=a.uiState.MIN_ALLOWED_WORDS_COUNT&&a.data.selectedCharactersCount>=a.uiState.MIN_ALLOWED_CHARACTERS_COUNT&&a.data.selectedCharactersCount<a.uiState.MAX_ALLOWED_CHARACTERS_COUNT?(this.createAnnotation(e,!0,t),t==="copywriter"?this.analyticsService.trackEvent(Y.Events.Rewriter.REWRITE_BUTTON_CLICKED,{charactersSelected:a.data.selectedCharactersCount,wordsSelected:a.data.selectedWordsCount,isMobileDevice:this.domService.isMobileDevice()}):this.analyticsService.trackEvent(Y.Events.Rewriter.REWRITE_PROMPT_BUTTON_CLICKED,{charactersSelected:a.data.selectedCharactersCount,wordsSelected:a.data.selectedWordsCount,isMobileDevice:this.domService.isMobileDevice()})):a.data.selectedCharactersCount<a.uiState.MIN_ALLOWED_CHARACTERS_COUNT?this.analyticsService.trackEvent(Y.Events.Rewriter.REWRITER_MIN_CHARACTER_NOT_MET,{minCharacterAllowed:a.uiState.MIN_ALLOWED_CHARACTERS_COUNT,charactersSelected:a.data.selectedCharactersCount,isMobileDevice:this.domService.isMobileDevice()}):a.data.selectedCharactersCount>a.uiState.MAX_ALLOWED_CHARACTERS_COUNT&&this.analyticsService.trackEvent(Y.Events.Rewriter.REWRITER_MAX_CHARACTER_NOT_MET,{maxCharacterAllowed:a.uiState.MAX_ALLOWED_CHARACTERS_COUNT,charactersSelected:a.data.selectedCharactersCount,isMobileDevice:this.domService.isMobileDevice()})}catch(i){this.loggingService.catch("Error in TextCommentActionService createRewriter:",i)}})}emitTextSelected(e){try{let t=this.domService.getRange();if(!t)return;let i=t.toString();if(!i?.trim())return;this.rewriterService.emitAndStoreTextSelected(t,i)}catch(t){this.loggingService.catch("Error in TextCommentActionService emitTextSelected:",t)}}clearSelection(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearSelection","color: green;");let t=this.coreService?.contextMap?.get(e);if(!t)return;t.update(a=>y(h({},a),{data:y(h({},a.data),{position:{top:-1e3,left:-1e3}}),uiState:y(h({},a.uiState),{showAdder:!1})})),this.onPositionUpdate(e);let i=this.scrollChangeSubscriptions.get(e);i&&(i.unsubscribe(),this.scrollChangeSubscriptions.delete(e))}catch(t){this.loggingService.catch("Error in TextCommentActionService clearSelection:",t)}}onPositionUpdate(e){try{let t=this.coreService?.contextMap?.get(e);if(!t)return;let l=this.toolbarRefMap.get(e)?.nativeElement.querySelector(".velt-text-comment-toolbar--container")?.getBoundingClientRect(),c=0,d=window.innerWidth;l&&(c=l.width/2,d=window.innerWidth-l.width/2);let m=t().data.position.left;m<c&&(m=c),m>d&&(m=d),t().data.position.left<0&&(m=t().data.position.left),t.update(u=>y(h({},u),{uiState:y(h({},u.uiState),{left:m})}))}catch(t){this.loggingService.catch("Error in TextCommentActionService onPositionUpdate:",t)}}cleanupContext(e){try{let t=this.scrollChangeSubscriptions.get(e);t&&(t.unsubscribe(),this.scrollChangeSubscriptions.delete(e)),this.toolbarRefMap.delete(e)}catch(t){this.loggingService.catch("Error in TextCommentActionService cleanupContext:",t)}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(Re),K(Ue),K(cl),K(Vp),K(ct),K(qe))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var F_e=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m){this.loggingService=e,this.commentService=t,this.authService=i,this.domService=a,this.iamService=l,this.rewriterService=c,this.rewriterActionsService=d,this.actionService=m,this.initialized=!1,this.subscriptions=[],this.globalConfigSignal=De(R_e()),this.contextMap=new Map,this.latestValues={enableTextComments:!1,allowedElementIds:[],commentToolEnabled:!0,disabled:!1,user:null,rewriterEnabled:!1,rewriterDefaultUIEnabled:!0,isUserAllowed:!1,isPlanExpired:!1}}initialize(){try{if(this.initialized)return;this.initialized=!0,this.actionService.setCoreServiceGetter(()=>this),this.setupGlobalSubscriptions()}catch(e){this.loggingService.catch("Error in TextCommentCoreService initialize:",e)}}setupGlobalSubscriptions(){try{this.subscriptions.push(this.commentService.getTextCommentMode$().subscribe(e=>{try{this.latestValues.enableTextComments=e,this.contextMap.forEach(t=>{t.update(i=>y(h({},i),{uiState:y(h({},i.uiState),{enableTextComments:e})}))})}catch(t){this.loggingService.catch("Error in TextCommentCoreService getTextCommentMode$ subscription:",t)}})),this.subscriptions.push(this.commentService.getAllowedElementIds().subscribe(e=>{try{this.latestValues.allowedElementIds=e,this.contextMap.forEach(t=>{t.update(i=>y(h({},i),{data:y(h({},i.data),{allowedElementIds:e})}))})}catch(t){this.loggingService.catch("Error in TextCommentCoreService getAllowedElementIds subscription:",t)}})),this.subscriptions.push(this.commentService.getCommentTool$().subscribe(e=>{try{this.latestValues.commentToolEnabled=e,this.contextMap.forEach(t=>{t.update(i=>y(h({},i),{uiState:y(h({},i.uiState),{commentToolEnabled:e})}))})}catch(t){this.loggingService.catch("Error in TextCommentCoreService getCommentTool$ subscription:",t)}})),this.subscriptions.push(this.iamService.getFeaturesAccessLevel$().subscribe(e=>{try{let t=!!e?.all?.disabled;this.latestValues.disabled=t,this.contextMap.forEach(i=>{i.update(a=>y(h({},a),{uiState:y(h({},a.uiState),{disabled:t})}))})}catch(t){this.loggingService.catch("Error in TextCommentCoreService getFeaturesAccessLevel$ subscription:",t)}})),this.subscriptions.push(this.authService.getUser$().subscribe(e=>{try{this.latestValues.user=e,this.contextMap.forEach(t=>{t.update(i=>y(h({},i),{data:y(h({},i.data),{user:e})}))})}catch(t){this.loggingService.catch("Error in TextCommentCoreService getUser$ subscription:",t)}})),this.subscriptions.push(this.rewriterService.getRewriterEnabled$().subscribe(e=>{try{this.latestValues.rewriterEnabled=e,this.contextMap.forEach(t=>{t.update(i=>y(h({},i),{uiState:y(h({},i.uiState),{rewriterEnabled:e})}))})}catch(t){this.loggingService.catch("Error in TextCommentCoreService getRewriterEnabled$ subscription:",t)}})),this.subscriptions.push(this.rewriterService.getDefaultUIEnabled$().subscribe(e=>{try{this.latestValues.rewriterDefaultUIEnabled=e,this.contextMap.forEach(t=>{t.update(i=>y(h({},i),{uiState:y(h({},i.uiState),{rewriterDefaultUIEnabled:e})}))})}catch(t){this.loggingService.catch("Error in TextCommentCoreService getDefaultUIEnabled$ subscription:",t)}})),this.subscriptions.push(this.iamService.isUserAllowed$().subscribe(e=>{try{this.latestValues.isUserAllowed=e,this.contextMap.forEach(t=>{t.update(i=>y(h({},i),{uiState:y(h({},i.uiState),{isUserAllowed:e})}))})}catch(t){this.loggingService.catch("Error in TextCommentCoreService isUserAllowed$ subscription:",t)}})),this.subscriptions.push(this.authService.isPlanExpired$().subscribe(e=>{try{this.latestValues.isPlanExpired=e,this.contextMap.forEach(t=>{t.update(i=>y(h({},i),{uiState:y(h({},i.uiState),{isPlanExpired:e})}))})}catch(t){this.loggingService.catch("Error in TextCommentCoreService isPlanExpired$ subscription:",t)}})),this.subscriptions.push(this.domService.onSelectionChange$().subscribe(()=>{try{this.contextMap.forEach((e,t)=>{try{this.handleSelectionChange(t)}catch(i){this.loggingService.catch(`Error in TextCommentCoreService handleSelectionChange for context ${t}:`,i)}})}catch(e){this.loggingService.catch("Error in TextCommentCoreService onSelectionChange$ subscription:",e)}})),this.subscriptions.push(xr(document,"pointerup").subscribe(()=>this.emitRewriterTextSelected())),this.subscriptions.push(this.commentService.getTextCommentToolShadowDOM$().subscribe(e=>{try{this.globalConfigSignal.update(t=>y(h({},t),{featureState:y(h({},t.featureState),{shadowDom:e})}))}catch(t){this.loggingService.catch("Error in TextCommentCoreService getTextCommentToolShadowDOM$ subscription:",t)}}))}catch(e){this.loggingService.catch("Error in TextCommentCoreService setupGlobalSubscriptions:",e)}}emitRewriterTextSelected(){try{if(!this.latestValues.rewriterEnabled)return;let e=window.getSelection(),t=e?.toString();if(!t?.trim()||k3())return;let i=e?.getRangeAt(0);if(!i?.commonAncestorContainer)return;this.rewriterService.emitAndStoreTextSelected(i,t)}catch(e){this.loggingService.catch("Error emitting rewriter textSelected event:",e)}}handleSelectionChange(e){try{let t=this.contextMap.get(e);if(!t)return;let i=t();if(i.uiState.enableTextComments&&i.data.user&&!(i.data.user?.isReadOnly||i.data.user?.isAnonymous)&&this.authService.isFeatureAllowed(je.COMMENT)){if(window.getSelection()?.toString()){let a=window.getSelection()?.toString(),l=ZN(a||"").join(" ");t.update(c=>y(h({},c),{data:y(h({},c.data),{selectedWordsCount:l?.split(" ").length||0,selectedCharactersCount:l?.length||0})}))}else t.update(a=>y(h({},a),{data:y(h({},a.data),{selectedWordsCount:0,selectedCharactersCount:0})}));if(window.getSelection()?.toString()&&!k3()){let a=window.getSelection()?.getRangeAt(0);a.commonAncestorContainer&&this.commentService.isElementInsideAllowedElements(a.commonAncestorContainer)&&(wg(a.commonAncestorContainer)?this.actionService.clearSelection(e):(this.actionService.onSelection(e),this.actionService.subscribeScrollChange(e)))}else this.actionService.clearSelection(e)}else this.actionService.clearSelection(e)}catch(t){this.loggingService.catch("Error in TextCommentCoreService handleSelectionChange:",t)}}getOrCreateContextConfig(e){try{let t=this.contextMap.get(e);if(!t){let i=eee(),a={data:y(h({},i.data),{user:this.latestValues.user,allowedElementIds:this.latestValues.allowedElementIds}),uiState:y(h({},i.uiState),{enableTextComments:this.latestValues.enableTextComments,commentToolEnabled:this.latestValues.commentToolEnabled,disabled:this.latestValues.disabled,rewriterEnabled:this.latestValues.rewriterEnabled,rewriterDefaultUIEnabled:this.latestValues.rewriterDefaultUIEnabled,isUserAllowed:this.latestValues.isUserAllowed,isPlanExpired:this.latestValues.isPlanExpired})};t=De(a),this.contextMap.set(e,t)}return t}catch(t){return this.loggingService.catch("Error in TextCommentCoreService getOrCreateContextConfig:",t),De(eee())}}clearContext(e){try{this.contextMap.delete(e)}catch(t){this.loggingService.catch("Error in TextCommentCoreService clearContext:",t)}}destroy(){try{this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.contextMap.clear(),this.initialized=!1}catch(e){this.loggingService.catch("Error in TextCommentCoreService destroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(K(k),K(Re),K(qe),K(Ue),K(Vn),K(cl),K(Vp),K(GU))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var es=(()=>{let o=class o extends lc{constructor(){super(...arguments),this.coreService=le(F_e),this.actionService=le(GU)}getDefaultLocalUIState(){return N_e()}getServiceComponentConfigSignal(){try{return this.coreService.initialize(),this.coreService.getOrCreateContextConfig("default")}catch{return}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["app-text-comment-primitive-themed-base"]],standalone:!1,features:[P],decls:0,vars:0,template:function(t,i){},encapsulation:2});let n=o;return n})();var gKe=["commentAdderRef"],L_e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),uKe=(n,o)=>({condition:n,data:o}),pKe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-text-comment-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function hKe(n,o){if(n&1&&(f(0,"div",3),D(1,"velt-text-comment-tool-internal",4),f(2,"div",null,0),D(4,"velt-text-comment-toolbar-internal",4),S()()),n&2){let r=s(3);v(),g("componentConfigSignal",r.componentConfigSignal)("parentLocalUIState",r.localUIStateSignal),w("data-testid",r.componentId+"-tool"),v(),w("data-testid",r.componentId+"-toolbar-container")("role","toolbar")("aria-label","Text comment tools")("aria-hidden",!r.componentConfigSignal().uiState.showAdder),v(2),g("componentConfigSignal",r.componentConfigSignal)("parentLocalUIState",r.localUIStateSignal)}}function fKe(n,o){if(n&1&&(C(0),p(1,hKe,5,9,"div",2),b()),n&2){let r,e=s(2);v(),g("veltDynamicTemplate",j(4,pKe,e.template,E(1,L_e,e.componentConfigSignal,e.localUIStateSignal),(r=e.localUIStateSignal())==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function CKe(n,o){if(n&1&&p(0,fKe,2,10,"ng-container",1),n&2){let r=s();g("veltIf",E(4,uKe,r.conditionSignal(),E(1,L_e,r.componentConfigSignal,r.localUIStateSignal)))}}var tC=(()=>{let o=class o extends es{constructor(){super(...arguments),this.componentId="velt-text-comment",this.subscriptions=[],this.wireframeService=le(Xe),this.shouldShow=ie(()=>{try{return!0}catch{return!0}})}ngOnInit(){try{this.coreService.initialize(),this.contextId="text-comment-"+Math.random().toString(36).substr(2,9),this.componentConfigSignal=this.coreService.getOrCreateContextConfig(this.contextId),this.componentConfigSignal.update(t=>y(h({},t),{data:y(h({},t.data),{contextId:this.contextId}),uiState:y(h({},t.uiState),{variant:this.variant??null})})),this.localUIStateSignal.update(t=>y(h({},t),{variant:this.variant,shadowDom:this.coreService.globalConfigSignal().featureState.shadowDom}));let e="velt-text-comment-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{try{if(t){let i=document.createElement(t.tagName);i.innerHTML=t.innerHTML,this.template=i}}catch(i){this.loggingService.catch("Error in wireframe subscription:",i)}})),super.ngOnInit()}catch(e){this.loggingService.catch("Error in TextCommentComponent ngOnInit:",e)}}ngAfterViewInit(){try{this.commentAdderRef&&this.actionService.setToolbarRef(this.contextId,this.commentAdderRef)}catch(e){this.loggingService.catch("Error in TextCommentComponent ngAfterViewInit:",e)}}ngOnChanges(e){try{e.variant&&(this.localUIStateSignal.update(t=>y(h({},t),{variant:e.variant.currentValue})),this.componentConfigSignal&&this.componentConfigSignal.update(t=>y(h({},t),{uiState:y(h({},t.uiState),{variant:e.variant.currentValue??null})})))}catch(t){this.loggingService.catch("Error in TextCommentComponent ngOnChanges:",t)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{try{e.unsubscribe()}catch{}}),this.subscriptions=[],this.coreService.clearContext(this.contextId),this.actionService.cleanupContext(this.contextId),super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.hostElementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container"),this.hostElementRef.nativeElement.setAttribute("role","application"),this.hostElementRef.nativeElement.setAttribute("aria-label","Text comment adder"),this.hostElementRef.nativeElement.setAttribute(N.ATTRIBUTES.VELT_ELEMENT,"true")}catch(e){this.loggingService.catch("Error in TextCommentComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-text-comment-internal"]],viewQuery:function(t,i){if(t&1&&pt(gKe,5),t&2){let a;vt(a=mt())&&(i.commentAdderRef=a.first)}},inputs:{variant:"variant"},standalone:!1,features:[V([T]),P,Qe],decls:1,vars:1,consts:[["commentAdderRef",""],[4,"veltIf"],["class","velt-text-comment",4,"veltDynamicTemplate"],[1,"velt-text-comment"],[3,"componentConfigSignal","parentLocalUIState"]],template:function(t,i){t&1&&$(0,CKe,1,7,"ng-container"),t&2&&G(i.componentConfigSignal()?0:-1)},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-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)}[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-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)}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));-webkit-user-select:none;-ms-user-select:none;user-select:none}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert}"],changeDetection:0});let n=o;return n})();var wm=class{constructor(){this.isGroupHeader=!1,this.isGroupMember=!1,this.isNewContact=!1,this.disabled=!1}},KO=class{constructor(){this.appState={user:null,darkMode:!1},this.featureState={customAutocompleteSearch:!1,expandMentionGroups:!1,showMentionGroupsFirst:!1,showMentionGroupsOnly:!1,customGroupsEnabled:!1,paginatedContactList:!1,atHereEnabled:!1,showAtHere:!1},this.data={userContacts:[],organizationGroups:[],userDocumentContacts:[],flattenedItems:[],hereUserContact:{name:"here",email:"",userId:"here",visibility:"here"},atHereDescription:null,autocompleteDataMap:{},selectedAutocompleteData:void 0,newUserContact:void 0,newUserContactError:void 0},this.uiState={variant:void 0,autoCompleteScrollConfig:{itemSize:55,minBufferPx:350,maxBufferPx:600,templateCacheSize:350}},this.trackByFlattenedItem=(o,r)=>{try{return r?.id||o.toString()}catch{return o.toString()}},this.onOptionClick=()=>{}}};function tee(){return{panelOpen:!1,filterText:"",highlightedIndex:-1,autocompleteDisabledPositions:new Set,darkMode:!1,variant:void 0}}var U_e=new bt("AutocompleteLocalUIStateSignal");var DS=(()=>{let o=class o{constructor(e,t,i,a,l,c){this.authService=e,this.contactService=t,this.autocompleteService=i,this.commentService=a,this.themeService=l,this.loggingService=c,this.contextMap=new Map,this.registryMap=new Map,this.serviceSubscriptions=[],this.currentUser=null,this.currentDarkMode=!1,this.currentUserContacts=[],this.currentOrganizationGroups=[],this.currentUserDocumentContacts=[],this.currentAutocompleteDataMap={},this.currentAtHereEnabled=!1,this.currentAtHereLabel="here",this.currentAtHereDescription=null,this.currentCustomAutocompleteSearch=!1,this.currentExpandMentionGroups=!1,this.currentShowMentionGroupsFirst=!1,this.currentShowMentionGroupsOnly=!1,this.currentPaginatedContactList=!1,this.currentAutoCompleteScrollConfig={itemSize:55,minBufferPx:350,maxBufferPx:600,templateCacheSize:350},this.setupSubscriptions()}setupSubscriptions(){try{this.serviceSubscriptions.push(this.authService.getUser$().subscribe(e=>{e&&(this.currentUser=e,this.updateAllContexts(t=>y(h({},t),{appState:y(h({},t.appState),{user:e})})))})),this.serviceSubscriptions.push(this.themeService.getDarkMode$().subscribe(e=>{this.currentDarkMode=e,this.updateAllContexts(t=>y(h({},t),{appState:y(h({},t.appState),{darkMode:e})}))})),this.serviceSubscriptions.push(this.contactService.getUserContacts$().subscribe(e=>{this.currentUserContacts=e?.slice()||[],this.updateAllContexts(t=>y(h({},t),{data:y(h({},t.data),{userContacts:this.buildUserContactsWithHere(this.currentUserContacts)})}))})),this.serviceSubscriptions.push(this.contactService.getOrganizationGroups$().subscribe(e=>{this.currentOrganizationGroups=e||[],this.updateAllContexts(t=>y(h({},t),{data:y(h({},t.data),{organizationGroups:this.currentOrganizationGroups})}))})),this.serviceSubscriptions.push(this.contactService.getUserDocumentContacts$().subscribe(e=>{this.currentUserDocumentContacts=e||[],this.updateAllContexts(t=>y(h({},t),{data:y(h({},t.data),{userDocumentContacts:this.currentUserDocumentContacts})}))})),this.serviceSubscriptions.push(this.autocompleteService.getAutocompleteDataMap$().subscribe(e=>{this.currentAutocompleteDataMap=e||{},this.updateAllContexts(t=>y(h({},t),{data:y(h({},t.data),{autocompleteDataMap:this.currentAutocompleteDataMap})}))})),this.serviceSubscriptions.push(this.contactService.getAtHereEnabled$().subscribe(e=>{this.currentAtHereEnabled=e,this.updateAllContexts(t=>y(h({},t),{featureState:y(h({},t.featureState),{atHereEnabled:e}),data:y(h({},t.data),{userContacts:this.buildUserContactsWithHere(this.currentUserContacts)})}))})),this.serviceSubscriptions.push(this.contactService.getAtHereLabel().subscribe(e=>{this.currentAtHereLabel=e,this.updateAllContexts(t=>y(h({},t),{data:y(h({},t.data),{hereUserContact:y(h({},t.data.hereUserContact),{name:e})})}))})),this.serviceSubscriptions.push(this.contactService.getAtHereDescription().subscribe(e=>{this.currentAtHereDescription=e,this.updateAllContexts(t=>y(h({},t),{data:y(h({},t.data),{atHereDescription:e})}))})),this.serviceSubscriptions.push(this.commentService.getCustomAutocompleteSearch$().subscribe(e=>{this.currentCustomAutocompleteSearch=e,this.updateAllContexts(t=>y(h({},t),{featureState:y(h({},t.featureState),{customAutocompleteSearch:e})}))})),this.serviceSubscriptions.push(this.commentService.getExpandMentionGroups$().subscribe(e=>{this.currentExpandMentionGroups=e,this.updateAllContexts(t=>y(h({},t),{featureState:y(h({},t.featureState),{expandMentionGroups:e})}))})),this.serviceSubscriptions.push(this.commentService.getShowMentionGroupsFirst$().subscribe(e=>{this.currentShowMentionGroupsFirst=e,this.updateAllContexts(t=>y(h({},t),{featureState:y(h({},t.featureState),{showMentionGroupsFirst:e})}))})),this.serviceSubscriptions.push(this.commentService.getShowMentionGroupsOnly$().subscribe(e=>{this.currentShowMentionGroupsOnly=e,this.updateAllContexts(t=>y(h({},t),{featureState:y(h({},t.featureState),{showMentionGroupsOnly:e})}))})),this.serviceSubscriptions.push(this.commentService.getPaginatedContactList$().subscribe(e=>{this.currentPaginatedContactList=e,this.updateAllContexts(t=>y(h({},t),{featureState:y(h({},t.featureState),{paginatedContactList:e})}))})),this.serviceSubscriptions.push(this.commentService.getAutoCompleteScrollConfig$().subscribe(e=>{this.currentAutoCompleteScrollConfig=e,this.updateAllContexts(t=>y(h({},t),{uiState:y(h({},t.uiState),{autoCompleteScrollConfig:e})}))}))}catch(e){this.loggingService.catch("Error in AutocompleteCoreService setupSubscriptions:",e)}}buildUserContactsWithHere(e){try{let t=e?.slice()||[];if(this.currentAtHereEnabled){let i={name:this.currentAtHereLabel,email:"",userId:"here",visibility:"here"};t.find(a=>a?.visibility==="here")||t.unshift(i)}return t}catch(t){return this.loggingService.catch("Error in AutocompleteCoreService buildUserContactsWithHere:",t),e||[]}}getOrCreateContextConfig(e){try{let t=this.contextMap.get(e);if(!t){let i=new KO;i.appState.user=this.currentUser,i.appState.darkMode=this.currentDarkMode,i.data.userContacts=this.buildUserContactsWithHere(this.currentUserContacts),i.data.organizationGroups=this.currentOrganizationGroups,i.data.userDocumentContacts=this.currentUserDocumentContacts,i.data.autocompleteDataMap=this.currentAutocompleteDataMap,i.data.hereUserContact.name=this.currentAtHereLabel,i.data.atHereDescription=this.currentAtHereDescription,i.featureState.customAutocompleteSearch=this.currentCustomAutocompleteSearch,i.featureState.expandMentionGroups=this.currentExpandMentionGroups,i.featureState.showMentionGroupsFirst=this.currentShowMentionGroupsFirst,i.featureState.showMentionGroupsOnly=this.currentShowMentionGroupsOnly,i.featureState.paginatedContactList=this.currentPaginatedContactList,i.featureState.atHereEnabled=this.currentAtHereEnabled,i.uiState.autoCompleteScrollConfig=this.currentAutoCompleteScrollConfig,t=De(i),this.contextMap.set(e,t)}return t}catch(t){return this.loggingService.catch("Error in AutocompleteCoreService getOrCreateContextConfig:",t),De(new KO)}}getContextConfig(e){try{return this.contextMap.get(e)}catch(t){this.loggingService.catch("Error in AutocompleteCoreService getContextConfig:",t);return}}setContextConfig(e,t){try{this.contextMap.set(e,t)}catch(i){this.loggingService.catch("Error in AutocompleteCoreService setContextConfig:",i)}}clearContextConfig(e){try{this.contextMap.delete(e),this.registryMap.delete(e)}catch(t){this.loggingService.catch("Error in AutocompleteCoreService clearContextConfig:",t)}}setRegistry(e,t){try{this.registryMap.set(e,t)}catch(i){this.loggingService.catch("Error in AutocompleteCoreService setRegistry:",i)}}getRegistry(e){try{return this.registryMap.get(e)}catch(t){this.loggingService.catch("Error in AutocompleteCoreService getRegistry:",t);return}}findParentAutocompleteId(e){try{let t=e?.nativeElement;if(!t)return;let i=t.parentElement;for(;i;){let a=i.getAttribute?.("autocomplete-id");if(a)return a;if(i.tagName?.toLowerCase()==="velt-autocomplete-context-wrapper"){let l=i.getAttribute?.("autocomplete-id");if(l)return l}i=i.parentElement}return}catch(t){this.loggingService.catch("Error in AutocompleteCoreService findParentAutocompleteId:",t);return}}updateAllContexts(e){try{this.contextMap.forEach(t=>{let i=t();t.set(e(i))})}catch(t){this.loggingService.catch("Error in AutocompleteCoreService updateAllContexts:",t)}}};o.\u0275fac=function(t){return new(t||o)(K(qe),K(vn),K(Ic),K(Re),K(yt),K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var B_e=(()=>{let o=class o{constructor(e,t,i,a){this.coreService=e,this.contactService=t,this.commentActionsService=i,this.loggingService=a,this.componentId="velt-autocomplete-panel"}filterOptions(e,t,i){try{let l=e().data.selectedAutocompleteData;l&&(l.type==="contact"?this.filterContactOptions(e,t,i):this.filterCustomOptions(e,t))}catch(a){this.loggingService.catch("Error in AutocompleteActionService filterOptions:",a)}}filterContactOptions(e,t,i){try{let a=e(),l=t?.toLowerCase()?.trim()||"",c=new Ms;c.email=l;let d=new RegExp(N.REGEX_EMAIL).test("@"+c?.email),m=a.data.userContacts.slice();a.featureState.customAutocompleteSearch||t&&(m=this.filterContacts(m,c),a.featureState.paginatedContactList&&m.length<3&&this.fetchFilteredUsersFromDb(t).then(()=>{})),a.featureState.atHereEnabled&&a.data.hereUserContact?.name?.includes(l)&&(m?.find(M=>M?.userId==="here")||(m=[a.data.hereUserContact,...m])),i?.length&&(m=m.filter(M=>!i.find(B=>B?.email===M?.email)));let u=t?this.filterGroups(a.data.organizationGroups,t):a.data.organizationGroups,_=m.map(M=>{if(M.visibility==="here"){if(a.data.atHereDescription)M=y(h({},M),{email:a.data.atHereDescription}),M.description=a.data.atHereDescription;else if(a.appState.user&&a.appState.user?.organizationId){let B=a.data.userDocumentContacts?.length||0;M=y(h({},M),{email:`${B} members`}),M.description=`${B} members`}}return{type:"contact",contact:M,disabled:!1}}),I=u.map(M=>({type:"group",group:M})),A=[..._,...I];if(a.featureState.expandMentionGroups)this.buildExpandedGroupItems(e,A,a,c,d);else{let M=A.length?void 0:{type:"contact",contact:c},B=this.createFlattenedItems({allItems:A,newUserContact:M,isExpandedGroups:!1,isCustomGroups:!1,showMentionGroupsOnly:a.featureState.showMentionGroupsOnly,showMentionGroupsFirst:a.featureState.showMentionGroupsFirst});e.update(q=>y(h({},q),{data:y(h({},q.data),{flattenedItems:B,newUserContactError:d?void 0:"Invalid email",newUserContact:M})}))}}catch(a){this.loggingService.catch("Error in AutocompleteActionService filterContactOptions:",a)}}buildExpandedGroupItems(e,t,i,a,l){try{let c=[],d={},m=new Map;t.forEach(M=>{if(M.contact?.userId){let B=It(M.contact.userId);m.set(B,M),d[M.contact.userId]=!1}});let u=new Map;i.data.organizationGroups.forEach(M=>{u.set(M.metadata.clientGroupId,{id:M.metadata.clientGroupId,name:M.metadata.groupName,members:[],userIds:Object.keys(M.users||{})})}),u.forEach(M=>{M.userIds.forEach(B=>{let q=m.get(B);q&&(M.members.push(q),q.contact?.userId&&(d[q.contact.userId]=!0))})}),t.forEach(M=>{M.type==="contact"&&M.contact?.userId&&!d[M.contact.userId]&&c.push(M)});let _=Array.from(u.values()),I=t.length?void 0:{type:"contact",contact:a},A=this.createFlattenedItems({allItems:t,contactsWithoutGroup:c,groups:_,newUserContact:I,isExpandedGroups:!0,isCustomGroups:!1,showMentionGroupsOnly:i.featureState.showMentionGroupsOnly,showMentionGroupsFirst:i.featureState.showMentionGroupsFirst});e.update(M=>y(h({},M),{data:y(h({},M.data),{flattenedItems:A,newUserContactError:l?void 0:"Invalid email",newUserContact:I,contactsWithoutGroup:c,groups:_})}))}catch(c){this.loggingService.catch("Error in AutocompleteActionService buildExpandedGroupItems:",c)}}filterCustomOptions(e,t){try{let i=e(),a=i.data.selectedAutocompleteData,l=i.data.autocompleteDataMap?.[a?.hotkey],c=l?.data?.slice()||[];if(i.featureState.customAutocompleteSearch||(t?c=c.filter(m=>m.name?.toLowerCase()?.includes(t?.toLowerCase())):c=a?.data?.slice()||[]),l?.groups&&l.groups.length>0){let m=[],u=new Map;l.groups?.forEach(A=>{u.set(A.id,{id:A.id,name:A.name,members:[]})}),c.forEach(A=>{let M={type:"custom",custom:A};A.groupId&&u.has(A.groupId)?u.get(A.groupId)?.members.push(M):m.push(M)});let _=Array.from(u.values()).filter(A=>A.members.length>0),I=this.createFlattenedItems({allItems:[],contactsWithoutGroup:m,groups:_,isExpandedGroups:!1,isCustomGroups:!0,showMentionGroupsOnly:i.featureState.showMentionGroupsOnly,showMentionGroupsFirst:i.featureState.showMentionGroupsFirst});e.update(A=>y(h({},A),{featureState:y(h({},A.featureState),{customGroupsEnabled:!0}),data:y(h({},A.data),{flattenedItems:I,contactsWithoutGroup:m,groups:_})}))}else{let m=c.map(_=>({type:"custom",custom:_})),u=this.createFlattenedItems({allItems:m,isExpandedGroups:!1,isCustomGroups:!1,showMentionGroupsOnly:i.featureState.showMentionGroupsOnly,showMentionGroupsFirst:i.featureState.showMentionGroupsFirst});e.update(_=>y(h({},_),{featureState:y(h({},_.featureState),{customGroupsEnabled:!1}),data:y(h({},_.data),{flattenedItems:u})}))}}catch(i){this.loggingService.catch("Error in AutocompleteActionService filterCustomOptions:",i)}}createFlattenedItems(e){try{let{allItems:t,contactsWithoutGroup:i,groups:a,newUserContact:l,isExpandedGroups:c=!1,isCustomGroups:d=!1,showMentionGroupsOnly:m=!1,showMentionGroupsFirst:u=!1}=e,_=[];if(c||d){if(!m&&!u&&i?.forEach((I,A)=>{let M=new wm;M.originalItem=I,M.disabled=!!I.disabled,M.id=d?`velt-option-custom-ungrouped-${A}`:`velt-option-user-${A}`,M.testId=d?`${this.componentId}-custom-ungrouped-${A}`:`${this.componentId}-user-${A}`,_.push(M)}),a?.forEach((I,A)=>{if(I?.members?.length){let M=new wm;M.originalItem={type:"group",group:I},M.isGroupHeader=!0,M.disabled=!0,M.group=I,M.id=d?`velt-option-custom-group-${A}`:`velt-option-group-${A}`,M.testId=d?`${this.componentId}-custom-group-${A}`:`${this.componentId}-group-${A}`,_.push(M),I.members.forEach((B,q)=>{let ae=new wm;ae.originalItem=B,ae.isGroupMember=!0,ae.disabled=B.disabled||!1,ae.id=d?`velt-option-custom-group-${A}-member-${q}`:`velt-option-group-${A}-member-${q}`,ae.testId=d?`${this.componentId}-custom-group-${A}-member-${q}`:`${this.componentId}-group-${A}-member-${q}`,_.push(ae)})}}),!m&&u&&i?.length){let I=new wm;I.originalItem={type:"group"},I.isGroupHeader=!0,I.disabled=!0,I.groupName="Ungrouped",I.id="velt-option-ungrouped",I.testId=`${this.componentId}-ungrouped`,_.push(I),i.forEach((A,M)=>{let B=new wm;B.originalItem=A,B.isGroupMember=!0,B.disabled=A.disabled||!1,B.id=`velt-option-user-${M}`,B.testId=`${this.componentId}-user-${M}`,_.push(B)})}}else t.forEach((I,A)=>{let M=new wm;M.originalItem=I,M.disabled=I.disabled||!1,M.id=`velt-option-${A}`,M.testId=`${this.componentId}-${A}`,_.push(M)});if(l?.contact?.email){let I=new wm;I.originalItem=l,I.isNewContact=!0,I.id="velt-new-contact-option",I.testId=`${this.componentId}-new-contact`,_.push(I)}return _}catch(t){return this.loggingService.catch("Error in AutocompleteActionService createFlattenedItems:",t),[]}}addContact(e){try{let t=e();t.data.newUserContact?.contact&&(this.contactService.addUserContact(t.data.newUserContact.contact),e.update(i=>y(h({},i),{data:y(h({},i.data),{newUserContact:void 0})})))}catch(t){this.loggingService.catch("Error in AutocompleteActionService addContact:",t)}}callbackOnOptionSelected(e){try{this.contactService.onContactSelected(e)}catch(t){this.loggingService.catch("Error in AutocompleteActionService callbackOnOptionSelected:",t)}}triggerAutocompleteSearch(e,t,i){try{let a={event:e,searchText:t,type:i};this.commentActionsService.autocompleteSearch(a)}catch(a){this.loggingService.catch("Error in AutocompleteActionService triggerAutocompleteSearch:",a)}}toggleSelection(e,t){try{let a=e().data.multiSelectItems||[],l=a.findIndex(d=>this.isSameItem(d,t)),c;return l>=0?c=[...a.slice(0,l),...a.slice(l+1)]:c=[...a,t],e.update(d=>y(h({},d),{data:y(h({},d.data),{multiSelectItems:c})})),c}catch(i){return this.loggingService.catch("Error in AutocompleteActionService toggleSelection:",i),[]}}confirmSelection(e){try{let i=e().data.multiSelectItems||[];return e.update(a=>y(h({},a),{data:y(h({},a.data),{multiSelectItems:[]})})),[...i]}catch(t){return this.loggingService.catch("Error in AutocompleteActionService confirmSelection:",t),[]}}isSameItem(e,t){try{return e.type!==t.type?!1:e.type==="contact"&&t.type==="contact"?e.contact?.userId&&t.contact?.userId?e.contact.userId===t.contact.userId:e.contact?.email&&t.contact?.email?e.contact.email===t.contact.email:!1:e.type==="custom"&&t.type==="custom"?e.custom?.id&&t.custom?.id?e.custom.id===t.custom.id:!1:e.type==="group"&&t.type==="group"&&e.group?.metadata?.groupId&&t.group?.metadata?.groupId?e.group.metadata.groupId===t.group.metadata.groupId:!1}catch{return!1}}filterContacts(e,t){try{let i=t.email?.toLowerCase();return e?.filter(a=>a?.email?.includes(i)||a?.name?.toLowerCase()?.includes(i)||a?.organizationName?.toLowerCase()?.includes(i))}catch(i){return this.loggingService.catch("Error in AutocompleteActionService _filterContacts:",i),[]}}filterGroups(e,t){try{return e?.filter(i=>i?.metadata?.groupName?.toLowerCase()?.includes(t?.toLowerCase()))}catch(i){return this.loggingService.catch("Error in AutocompleteActionService _filterGroups:",i),[]}}filterCustomItems(e,t){try{return e?.filter(i=>i.name?.toLowerCase()?.includes(t?.toLowerCase()))||[]}catch(i){return this.loggingService.catch("Error in AutocompleteActionService filterCustomItems:",i),[]}}fetchFilteredUsersFromDb(e){return X(this,null,function*(){try{yield this.contactService.searchUsers(e)}catch(t){this.loggingService.catch("Error in AutocompleteActionService fetchFilteredUsersFromDb:",t)}})}};o.\u0275fac=function(t){return new(t||o)(K(DS),K(vn),K(Rn),K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Tm=(()=>{let o=class o{constructor(e){this.loggingService=e,this.subscribers=new Set}register(e){try{if(this.subscribers.add(e),this.lastPayload)try{e(this.lastPayload)}catch(t){this.loggingService.catch("[AUTOCOMPLETE REGISTRY] Error initializing subscriber:",t)}}catch(t){this.loggingService.catch("[AUTOCOMPLETE REGISTRY] Error in register:",t)}}unregister(e){try{this.subscribers.delete(e)}catch(t){this.loggingService.catch("[AUTOCOMPLETE REGISTRY] Error in unregister:",t)}}broadcast(e){try{this.lastPayload=e,this.subscribers.forEach(t=>{try{t(e)}catch(i){this.loggingService.catch("[AUTOCOMPLETE REGISTRY] Error in subscriber:",i)}})}catch(t){this.loggingService.catch("[AUTOCOMPLETE REGISTRY] Error in broadcast:",t)}}getLastPayload(){try{return this.lastPayload}catch(e){this.loggingService.catch("[AUTOCOMPLETE REGISTRY] Error in getLastPayload:",e);return}}};o.\u0275fac=function(t){return new(t||o)(K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac});let n=o;return n})();var jo=(()=>{let o=class o extends Ot{set parentLocalUIState(e){e&&(this.localUIStateSignal=e,this.isLocalUIStateOwner=!1)}get elementRef(){return this.hostElementRef}constructor(){let e=le(Q),t=le(yt),i=le(nn),a=le(Re,{optional:!0}),l=le(T),c=le(k);super(e,t,i,a??void 0,void 0,l,c),this.autocompleteId=fe(),this.defaultCondition=fe(!0,{transform:d=>{try{return typeof d=="string"?d==="true"||d==="":d}catch{return!0}}}),this._contextData={},this.isLocalUIStateOwner=!1,this.isContextInitialized=!1,this.registryCheckAttempts=0,this.MAX_REGISTRY_CHECK_ATTEMPTS=50,this.onContextPayload=d=>{try{this.isContextInitialized||(this.isContextInitialized=!0),this._autocompleteId=d.autocompleteId,this._contextData=d.contextData||{};let m=this.coreService.getContextConfig(d.autocompleteId);m&&(this.componentConfigSignal.update(u=>h({},u)),this.componentConfigSignal=m,this.cd.markForCheck())}catch(m){this.loggingService.catch("Error in AutocompletePrimitiveThemedComponent onContextPayload:",m)}},this.hostElementRef=e,this.themeService=t,this.dynamicDataService=l,this.loggingService=c,this.coreService=le(DS),this.actionService=le(B_e),this.cd=i,this.commentService=a??void 0,this.registry=le(Tm,{optional:!0})??void 0,this.initializeLocalUIState()}initializeLocalUIState(){try{let e=le(U_e,{optional:!0,skipSelf:!0});e?(this.localUIStateSignal=e,this.isLocalUIStateOwner=!1):(this.localUIStateSignal=De(tee()),this.isLocalUIStateOwner=!0)}catch{this.localUIStateSignal=De(tee()),this.isLocalUIStateOwner=!0}}ngOnInit(){try{super.ngOnInit();let e=this.autocompleteId();if(!e){let i=this.hostElementRef?.nativeElement?.getAttribute?.("autocomplete-id");i&&(e=i)}if(this.componentConfigSignal&&this.componentConfigSignal()&&Object.keys(this.componentConfigSignal()).length>0){this.initializeFromConfigSignal(this.componentConfigSignal),this.setupA11yAttributes(),this.setupDarkModeSync();return}if(e){this._autocompleteId=e,this.initializeFromAutocompleteId(e),this.setupA11yAttributes(),this.setupDarkModeSync();return}let t=this.findNearestParentWrapperRegistry();if(t){this.registry=t,this.registry.register(this.onContextPayload);let i=this.registry.getLastPayload?.();i&&this.onContextPayload(i),this.setupA11yAttributes(),this.setupDarkModeSync();return}if(this.registry){this.registry.register(this.onContextPayload);let i=this.registry.getLastPayload?.();i&&this.onContextPayload(i),this.setupA11yAttributes(),this.setupDarkModeSync();return}this.tryRegisterWithContext(),this.setupA11yAttributes(),this.setupDarkModeSync()}catch(e){this.loggingService.catch("Error in AutocompletePrimitiveThemedComponent ngOnInit:",e)}}ngOnDestroy(){try{this.registryCheckTimer&&(clearTimeout(this.registryCheckTimer),this.registryCheckTimer=void 0),this.registry&&this.registry.unregister(this.onContextPayload),this.darkModeConfigSyncSubscription&&this.darkModeConfigSyncSubscription.unsubscribe(),super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompletePrimitiveThemedComponent ngOnDestroy:",e)}}setupA11yAttributes(){}setupDarkModeSync(){try{this.darkModeConfigSyncSubscription=this.onDarkModeChange().subscribe(e=>{try{if(this.componentConfigSignal&&typeof this.componentConfigSignal=="function"){let t=this.componentConfigSignal();t&&t.appState&&t.appState.darkMode!==e&&this.componentConfigSignal.update(i=>y(h({},i),{appState:y(h({},i.appState),{darkMode:e})}))}}catch(t){this.loggingService.catch("Error in darkMode sync subscription:",t)}})}catch(e){this.loggingService.catch("Error in AutocompletePrimitiveThemedComponent setupDarkModeSync:",e)}}findNearestParentWrapperRegistry(){try{let e=this.hostElementRef?.nativeElement;if(!e)return;let t=e.parentElement;for(;t;){if(t.tagName?.toLowerCase()==="velt-autocomplete-context-wrapper"){let i=t.__veltContext;if(i?.registry instanceof Tm)return i.contextData&&(this._contextData=i.contextData),i.registry;let a=window.ng;if(a?.getComponent){let c=a.getComponent(t);if(c?.registry)return c.registry}let l=t.__ngContext__;if(l&&Array.isArray(l))for(let c=0;c<l.length;c++){let d=l[c];if(d&&typeof d=="object"&&d.registry instanceof Tm)return d.registry}}t=t.parentElement}}catch(e){this.loggingService.catch("[AUTOCOMPLETE PRIMITIVE BASE] Error finding parent wrapper registry:",e)}}tryRegisterWithContext(){try{let e=this.coreService.findParentAutocompleteId(this.hostElementRef);if(!e){this.registryCheckAttempts<this.MAX_REGISTRY_CHECK_ATTEMPTS&&(this.registryCheckAttempts++,this.registryCheckTimer=setTimeout(()=>this.tryRegisterWithContext(),10));return}this.registry=this.coreService.getRegistry(e),this.registry?this.registry.register(this.onContextPayload):this.registryCheckAttempts<this.MAX_REGISTRY_CHECK_ATTEMPTS?(this.registryCheckAttempts++,this.registryCheckTimer=setTimeout(()=>this.tryRegisterWithContext(),10)):this.initializeFromDOM(e)}catch(e){this.loggingService.catch("Error in AutocompletePrimitiveThemedComponent tryRegisterWithContext:",e)}}initializeFromDOM(e){try{this._autocompleteId=e;let t=this.coreService.getContextConfig(e);t&&(this.componentConfigSignal.update(i=>h({},i)),this.componentConfigSignal=t,this.isContextInitialized=!0,this.cd.markForCheck())}catch(t){this.loggingService.catch("Error in AutocompletePrimitiveThemedComponent initializeFromDOM:",t)}}initializeFromAutocompleteId(e){try{this._autocompleteId=e;let t=this.coreService.getOrCreateContextConfig(e);this.componentConfigSignal.update(i=>h({},i)),this.componentConfigSignal=t,this.isContextInitialized=!0,this.cd.markForCheck()}catch(t){this.loggingService.catch("Error in AutocompletePrimitiveThemedComponent initializeFromAutocompleteId:",t)}}initializeFromConfigSignal(e){try{this.isContextInitialized=!0,this.cd.markForCheck()}catch(t){this.loggingService.catch("Error in AutocompletePrimitiveThemedComponent initializeFromConfigSignal:",t)}}getContextValue(e){try{let t=this._contextData[e];if(t!=null)return t;let i=this.hostElementRef?.nativeElement?.getAttribute(e);return i!==null?i:void 0}catch(t){this.loggingService.catch("Error in AutocompletePrimitiveThemedComponent getContextValue:",t);return}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["app-autocomplete-primitive-themed-base"]],inputs:{autocompleteId:[1,"autocompleteId"],defaultCondition:[1,"defaultCondition"],parentLocalUIState:"parentLocalUIState"},standalone:!1,features:[P],decls:0,vars:0,template:function(t,i){},encapsulation:2});let n=o;return n})();var SKe=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),yKe=(n,o)=>({condition:n,data:o}),kKe=n=>({componentConfigSignal:n}),xKe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-autocomplete-chip-tooltip-description-wireframe",variant:r,setIfCondition:e,componentElementRef:t}),IKe=()=>({});function EKe(n,o){n&1&&et(0)}function wKe(n,o){if(n&1&&p(0,EKe,1,0,"ng-container",5),n&2){s(2);let r=Ee(3);g("ngTemplateOutlet",r)}}function TKe(n,o){n&1&&et(0)}function DKe(n,o){if(n&1&&p(0,TKe,1,0,"ng-container",5),n&2){s(2);let r=Ee(5);g("ngTemplateOutlet",r)}}function OKe(n,o){n&1&&et(0)}function AKe(n,o){if(n&1&&p(0,OKe,1,0,"ng-container",5),n&2){s(2);let r=Ee(7);g("ngTemplateOutlet",r)}}function MKe(n,o){if(n&1&&(C(0),$(1,wKe,1,1,"ng-container")(2,DKe,1,1,"ng-container")(3,AKe,1,1,"ng-container"),b()),n&2){let r=s(2);v(),G((r==null?null:r.type)==="contact"?1:(r==null?null:r.type)==="custom"?2:(r==null?null:r.type)==="group"?3:-1)}}function PKe(n,o){if(n&1&&(oe(0),R(1,"translate")),n&2){let r=s(2);we(" ",F(1,1,(r==null||r.contact==null?null:r.contact.email)||(r==null?null:r.email))," ")}}function RKe(n,o){if(n&1&&(oe(0),R(1,"translate")),n&2){let r=s(2);we(" ",F(1,1,r==null||r.custom==null||r.custom.custom==null?null:r.custom.custom.description)," ")}}function NKe(n,o){if(n&1&&(oe(0),R(1,"translate")),n&2){let r,e=s(3),t=s();Qi(" ",(r=t.objectKeys((e==null||e.group==null||e.group.group==null?null:e.group.group.users)||xt(4,IKe)))==null?null:r.length," ",F(1,2,"members")," ")}}function FKe(n,o){if(n&1&&$(0,NKe,2,5),n&2){let r=s(2);G(!(r==null||r.group==null)&&r.group.group?0:-1)}}function LKe(n,o){if(n&1&&(C(0),p(1,MKe,4,1,"ng-container",4)(2,PKe,2,3,"ng-template",null,0,Ve)(4,RKe,2,3,"ng-template",null,1,Ve)(6,FKe,1,1,"ng-template",null,2,Ve),b()),n&2){let r=s(),e=s();v(),g("veltDynamicTemplate",j(3,xKe,e.template,J(1,kKe,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function UKe(n,o){if(n&1&&p(0,LKe,8,9,"ng-container",3),n&2){let r=s();g("veltIf",E(4,yKe,r.conditionSignal(),E(1,SKe,r.componentConfigSignal,r.localUIStateSignal)))}}var OS=(()=>{let o=class o extends jo{set userObject(e){try{if(!e)return;let t=typeof e=="string"?JSON.parse(e):e;this.componentConfigSignal.update(i=>y(h({},i),{type:"contact",contact:t}))}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let i=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);i&&this.componentConfigSignal.update(a=>y(h({},a),{type:"contact",contact:i}))}catch(t){this.loggingService.catch("Error looking up userId:",t)}}constructor(){super(),this.componentId="velt-autocomplete-chip-tooltip-description",this.contactService=le(vn),this.objectKeys=Object.keys,this.componentConfigSignal=De({})}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipDescriptionComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipDescriptionComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-description-internal"]],inputs:{userObject:"userObject",userId:"userId"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[["contacEmailRef",""],["customDescriptionRef",""],["groupDescriptionRef",""],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngTemplateOutlet"]],template:function(t,i){if(t&1&&$(0,UKe,1,7,"ng-container"),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},styles:["[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let n=o;return n})();function jg(n){return n?typeof n=="string"?JSON.parse(n):n:null}function AS(n){return n?{type:"contact",contact:typeof n=="string"?JSON.parse(n):n}:null}function $g(n,o){n&&(n.setAttribute("role","presentation"),n.setAttribute("data-testid",o+"-container"))}var VKe=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),BKe=(n,o)=>({condition:n,data:o}),jKe=n=>({componentConfigSignal:n}),$Ke=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-autocomplete-chip-tooltip-icon-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function GKe(n,o){n&1&&et(0)}function HKe(n,o){if(n&1&&p(0,GKe,1,0,"ng-container",5),n&2){s(2);let r=Ee(3);g("ngTemplateOutlet",r)}}function zKe(n,o){n&1&&et(0)}function WKe(n,o){if(n&1&&p(0,zKe,1,0,"ng-container",5),n&2){s(2);let r=Ee(5);g("ngTemplateOutlet",r)}}function qKe(n,o){n&1&&et(0)}function YKe(n,o){if(n&1&&p(0,qKe,1,0,"ng-container",5),n&2){s(2);let r=Ee(7);g("ngTemplateOutlet",r)}}function KKe(n,o){if(n&1&&(C(0),$(1,HKe,1,1,"ng-container")(2,WKe,1,1,"ng-container")(3,YKe,1,1,"ng-container"),b()),n&2){let r=s(2);v(),G((r==null?null:r.type)==="contact"?1:(r==null?null:r.type)==="custom"?2:(r==null?null:r.type)==="group"?3:-1)}}function ZKe(n,o){if(n&1&&D(0,"snippyly-user-avatar",6),n&2){let r=s(2);g("size",32)("user",r==null?null:r.contact)}}function JKe(n,o){if(n&1&&(D(0,"div",7),R(1,"safeSvg")),n&2){let r=s(3);g("innerHtml",F(1,1,r==null||r.custom==null||r.custom.custom==null||r.custom.custom.icon==null?null:r.custom.custom.icon.svg),Wr)}}function XKe(n,o){if(n&1&&(f(0,"div",8),D(1,"img",9),S()),n&2){let r=s(3);v(),g("src",r==null||r.custom==null||r.custom.custom==null||r.custom.custom.icon==null?null:r.custom.custom.icon.url,bn)}}function QKe(n,o){if(n&1&&($(0,JKe,2,3,"div",7),$(1,XKe,2,1,"div",8)),n&2){let r=s(2);G(!(r==null||r.custom==null||r.custom.custom==null||r.custom.custom.icon==null)&&r.custom.custom.icon.svg?0:-1),v(),G(!(r==null||r.custom==null||r.custom.custom==null||r.custom.custom.icon==null)&&r.custom.custom.icon.url?1:-1)}}function eZe(n,o){n&1&&(f(0,"div",10),se(),f(1,"svg",11),D(2,"path",12),S()())}function tZe(n,o){if(n&1&&(C(0),p(1,KKe,4,1,"ng-container",4)(2,ZKe,1,2,"ng-template",null,0,Ve)(4,QKe,2,2,"ng-template",null,1,Ve)(6,eZe,3,0,"ng-template",null,2,Ve),b()),n&2){let r=s(),e=s();v(),g("veltDynamicTemplate",j(3,$Ke,e.template,J(1,jKe,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function nZe(n,o){if(n&1&&p(0,tZe,8,9,"ng-container",3),n&2){let r=s();g("veltIf",E(4,BKe,r.conditionSignal(),E(1,VKe,r.componentConfigSignal,r.localUIStateSignal)))}}var MS=(()=>{let o=class o extends jo{set userObject(e){try{let t=jg(e);t&&this.componentConfigSignal.update(i=>y(h({},i),{type:"contact",contact:t}))}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let i=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);i&&this.componentConfigSignal.update(a=>y(h({},a),{type:"contact",contact:i}))}catch(t){this.loggingService.catch("Error looking up userId:",t)}}constructor(){super(),this.componentId="velt-autocomplete-chip-tooltip-icon",this.contactService=le(vn),this.componentConfigSignal=De({})}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-icon-internal"]],inputs:{userObject:"userObject",userId:"userId"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[["contactAvatarRef",""],["customIconRef",""],["groupIconRef",""],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngTemplateOutlet"],[1,"comment-dialog-user-avatar",3,"size","user"],[1,"velt-autocomplete-chip-tooltip--icon-svg",3,"innerHtml"],[1,"velt-autocomplete-chip-tooltip--icon-img"],[3,"src"],[1,"velt-autocomplete-chip-tooltip--group-icon","velt-autocomplete-chip-tooltip--icon-svg"],["xmlns","http://www.w3.org/2000/svg","fill","rgb(233, 242, 255)","width","16","height","16","viewBox","0 0 16 16",1,"bi","bi-people-fill"],["d","M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6m-5.784 6A2.24 2.24 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.3 6.3 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1zM4.5 8a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5"]],template:function(t,i){if(t&1&&$(0,nZe,1,7,"ng-container"),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-autocomplete-chip-tooltip--group-icon[_ngcontent-%COMP%]{width:100%;height:100%;padding:var(--velt-spacing-xs);display:flex;align-items:center;justify-content:center;background:linear-gradient(0deg,#ffffff0a,#ffffff0a),linear-gradient(0deg,#3772ff14,#3772ff14);box-sizing:border-box}.velt-autocomplete-chip-tooltip--icon-svg[_ngcontent-%COMP%]{display:flex;width:100%;height:100%;align-items:center;justify-content:center;color:var(--velt-text-0)}.velt-autocomplete-chip-tooltip--icon-img[_ngcontent-%COMP%]{display:flex;width:100%;height:100%;align-items:center;justify-content:center}.velt-autocomplete-chip-tooltip--icon-img[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:16px;height:16px;object-fit:cover}"],changeDetection:0});let n=o;return n})();var rZe=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),oZe=(n,o)=>({condition:n,data:o}),iZe=n=>({componentConfigSignal:n}),aZe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-autocomplete-chip-tooltip-name-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function lZe(n,o){n&1&&et(0)}function cZe(n,o){if(n&1&&p(0,lZe,1,0,"ng-container",5),n&2){s(2);let r=Ee(3);g("ngTemplateOutlet",r)}}function sZe(n,o){n&1&&et(0)}function dZe(n,o){if(n&1&&p(0,sZe,1,0,"ng-container",5),n&2){s(2);let r=Ee(5);g("ngTemplateOutlet",r)}}function vZe(n,o){n&1&&et(0)}function mZe(n,o){if(n&1&&p(0,vZe,1,0,"ng-container",5),n&2){s(2);let r=Ee(7);g("ngTemplateOutlet",r)}}function gZe(n,o){if(n&1&&(C(0),$(1,cZe,1,1,"ng-container")(2,dZe,1,1,"ng-container")(3,mZe,1,1,"ng-container"),b()),n&2){let r=s(2);v(),G((r==null?null:r.type)==="contact"?1:(r==null?null:r.type)==="custom"?2:(r==null?null:r.type)==="group"?3:-1)}}function uZe(n,o){if(n&1&&(oe(0),R(1,"translate")),n&2){let r=s(2);we(" ",F(1,1,r==null||r.contact==null?null:r.contact.name)," ")}}function pZe(n,o){if(n&1&&(oe(0),R(1,"translate")),n&2){let r=s(2);we(" ",F(1,1,r==null||r.custom==null||r.custom.custom==null?null:r.custom.custom.name)," ")}}function hZe(n,o){if(n&1&&(oe(0),R(1,"translate")),n&2){let r=s(2);we(" ",F(1,1,(r==null||r.group==null||r.group.group==null||r.group.group.metadata==null?null:r.group.group.metadata.groupName)||(r==null||r.group==null?null:r.group.text))," ")}}function fZe(n,o){if(n&1&&(C(0),p(1,gZe,4,1,"ng-container",4)(2,uZe,2,3,"ng-template",null,0,Ve)(4,pZe,2,3,"ng-template",null,1,Ve)(6,hZe,2,3,"ng-template",null,2,Ve),b()),n&2){let r=s(),e=s();v(),g("veltDynamicTemplate",j(3,aZe,e.template,J(1,iZe,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function CZe(n,o){if(n&1&&p(0,fZe,8,9,"ng-container",3),n&2){let r=s();g("veltIf",E(4,oZe,r.conditionSignal(),E(1,rZe,r.componentConfigSignal,r.localUIStateSignal)))}}var PS=(()=>{let o=class o extends jo{set userObject(e){try{let t=jg(e);t&&this.componentConfigSignal.update(i=>y(h({},i),{type:"contact",contact:t}))}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let i=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);i&&this.componentConfigSignal.update(a=>y(h({},a),{type:"contact",contact:i}))}catch(t){this.loggingService.catch("Error looking up userId:",t)}}constructor(){super(),this.componentId="velt-autocomplete-chip-tooltip-name",this.contactService=le(vn),this.componentConfigSignal=De({})}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipNameComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-name-internal"]],inputs:{userObject:"userObject",userId:"userId"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[["contactNameRef",""],["customNameRef",""],["groupNameRef",""],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngTemplateOutlet"]],template:function(t,i){if(t&1&&$(0,CZe,1,7,"ng-container"),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},styles:["[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let n=o;return n})();var bZe=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),_Ze=(n,o)=>({condition:n,data:o}),SZe=n=>({componentConfigSignal:n}),yZe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-autocomplete-chip-tooltip-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function kZe(n,o){n&1&&et(0)}function xZe(n,o){if(n&1&&(f(0,"velt-shadow-dom-internal"),p(1,kZe,1,0,"ng-container",2),S()),n&2){s();let r=Ee(4);v(),g("ngTemplateOutlet",r)}}function IZe(n,o){n&1&&et(0)}function EZe(n,o){if(n&1&&p(0,IZe,1,0,"ng-container",2),n&2){s();let r=Ee(4);g("ngTemplateOutlet",r)}}function wZe(n,o){if(n&1&&(f(0,"div",4)(1,"div",5),D(2,"velt-autocomplete-chip-tooltip-icon-internal",6),S(),f(3,"div",7)(4,"div",8),D(5,"velt-autocomplete-chip-tooltip-name-internal",6),S(),f(6,"div",9),D(7,"velt-autocomplete-chip-tooltip-description-internal",6),S()()()),n&2){let r=s(4);v(2),g("componentConfigSignal",r.componentConfigSignal),v(3),g("componentConfigSignal",r.componentConfigSignal),v(2),g("componentConfigSignal",r.componentConfigSignal)}}function TZe(n,o){if(n&1&&p(0,wZe,8,3,"div",3),n&2){let r=s(2),e=s();g("veltDynamicTemplate",j(3,yZe,e.template,J(1,SZe,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function DZe(n,o){if(n&1&&(C(0),$(1,xZe,2,1,"velt-shadow-dom-internal")(2,EZe,1,1,"ng-container"),p(3,TZe,1,9,"ng-template",null,0,Ve),b()),n&2){let r=s(2);v(),G(r.shadowDom&&!r.template||r.template&&r.isExplicitShadowDom?1:2)}}function OZe(n,o){if(n&1&&p(0,DZe,5,1,"ng-container",1),n&2){let r=s();g("veltIf",E(4,_Ze,r.conditionSignal(),E(1,bZe,r.componentConfigSignal,r.localUIStateSignal)))}}var nC=(()=>{let o=class o extends jo{set shadowDom(e){this._shadowDom=e}get shadowDom(){return this._shadowDom}set userObject(e){try{let t=jg(e);t&&this.componentConfigSignal.update(i=>y(h({},i),{type:"contact",contact:t}))}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let i=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);i&&this.componentConfigSignal.update(a=>y(h({},a),{type:"contact",contact:i}))}catch(t){this.loggingService.catch("Error looking up userId:",t)}}constructor(){super(),this.componentId="velt-autocomplete-chip-tooltip",this._shadowDom=!1,this.isExplicitShadowDom=!1,this.contactService=le(vn),this.componentConfigSignal=De({}),this.subscriptions=[],this.wireframeService=le(Xe)}ngOnInit(){try{super.ngOnInit();let e=this.elementRef.nativeElement,t=e.getAttribute("shadow-dom")??e.getAttribute("shadowdom");this.isExplicitShadowDom=t!==null&&t!=="false",this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),this.subscriptions.push(this.wireframeService.getWireframe$("velt-autocomplete-chip-tooltip-wireframe").subscribe(a=>{if(a){let l=document.createElement(a.tagName);l.innerHTML=a.innerHTML,this.template=l}}))}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-internal"]],inputs:{shadowDom:"shadowDom",variant:"variant",userObject:"userObject",userId:"userId"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[["tooltipContainerRef",""],[4,"veltIf"],[4,"ngTemplateOutlet"],["class","velt-autocomplete-chip-tooltip",4,"veltDynamicTemplate"],[1,"velt-autocomplete-chip-tooltip"],[1,"velt-autocomplete-chip-tooltip--icon"],[3,"componentConfigSignal"],[1,"velt-autocomplete-chip-tooltip--content"],[1,"velt-autocomplete-chip-tooltip--name"],[1,"velt-autocomplete-chip-tooltip--description"]],template:function(t,i){if(t&1&&$(0,OZe,1,7,"ng-container"),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-autocomplete-chip-tooltip[_ngcontent-%COMP%]{display:flex;background:var(--velt-background-0);border-radius:var(--velt-border-radius-sm);padding:var(--velt-spacing-md);margin:var(--velt-spacing-xs) 0;box-shadow:0 4px 21px #00000014;gap:var(--velt-spacing-md);max-width:256px;line-height:1.3;align-items:center}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:var(--velt-border-radius-full);overflow:hidden;flex-shrink:0}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%]{display:flex}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon-svg[_ngcontent-%COMP%]{width:100%;height:100%;padding:var(--velt-spacing-xs);display:flex;align-items:center;justify-content:center;background:linear-gradient(0deg,#ffffff0a,#ffffff0a),linear-gradient(0deg,#3772ff14,#3772ff14);box-sizing:border-box}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon-svg[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:100%;height:100%}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--content[_ngcontent-%COMP%]{display:flex;flex-direction:column}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--content[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--name[_ngcontent-%COMP%]{font-size:var(--velt-font-size-sm);font-weight:400;line-height:21px;text-align:left;word-break:break-word;color:var(--velt-text-0)}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--content[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--description[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs);font-weight:400;line-height:17px;letter-spacing:.01em;text-align:left;color:var(--velt-text-5);word-break:break-word}"],changeDetection:0});let n=o;return n})();var MZe=(n,o,r)=>({componentConfigSignal:n,parentLocalUIState:o,selectorItem:r}),PZe=(n,o)=>({condition:n,data:o}),nee=n=>({$implicit:n}),RZe=(n,o)=>({componentConfigSignal:n,userContact:o}),ree=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-autocomplete-option-description-wireframe",variant:r,setIfCondition:e,componentElementRef:t}),NZe=(n,o)=>({componentConfigSignal:n,custom:o}),FZe=(n,o)=>({componentConfigSignal:n,group:o}),j_e=()=>({});function LZe(n,o){n&1&&et(0)}function UZe(n,o){if(n&1&&p(0,LZe,1,0,"ng-container",4),n&2){s();let r=Ee(5),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,nee,e.selectorItem==null?null:e.selectorItem.contact))}}function VZe(n,o){n&1&&et(0)}function BZe(n,o){if(n&1&&p(0,VZe,1,0,"ng-container",4),n&2){s();let r=Ee(7),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,nee,e.selectorItem==null?null:e.selectorItem.custom))}}function jZe(n,o){n&1&&et(0)}function $Ze(n,o){if(n&1&&p(0,jZe,1,0,"ng-container",4),n&2){s();let r=Ee(9),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,nee,e.selectorItem==null?null:e.selectorItem.group))}}function GZe(n,o){if(n&1&&(f(0,"p",7),oe(1),R(2,"translate"),S()),n&2){let r=s(2).$implicit,e=s(3);pe("velt-autocomplete-option-description--secondary",(r.name==null?null:r.name.length)>0),w("aria-label",e.field?r[e.field]:r.email),v(),we(" ",e.field?r[e.field]:F(2,4,r.email)," ")}}function HZe(n,o){if(n&1&&p(0,GZe,3,6,"p",6),n&2){let r=s().$implicit,e=s(2),t=s();g("veltDynamicTemplate",j(4,ree,t.template,E(1,RZe,t.componentConfigSignal,r),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function zZe(n,o){if(n&1&&$(0,HZe,1,10,"p",5),n&2){let r=o.$implicit,e=s(3);G((e.field?r!=null&&r[e.field]:(r.email==null?null:r.email.length)>0&&(r.name==null?null:r.name.length)>0)?0:-1)}}function WZe(n,o){if(n&1&&(f(0,"p",7),oe(1),R(2,"translate"),S()),n&2){let r=s(2).$implicit;w("aria-label",r.description),v(),we(" ",F(2,2,r.description)," ")}}function qZe(n,o){if(n&1&&p(0,WZe,3,4,"p",8),n&2){let r=s().$implicit,e=s(2),t=s();g("veltDynamicTemplate",j(4,ree,t.template,E(1,NZe,t.componentConfigSignal,r),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function YZe(n,o){if(n&1&&$(0,qZe,1,10,"p",7),n&2){let r=o.$implicit;G((r.description==null?null:r.description.length)>0?0:-1)}}function KZe(n,o){if(n&1&&(f(0,"p",7),oe(1),R(2,"translate"),S()),n&2){let r,e,t=s().$implicit,i=s(3);w("aria-label",((r=i.objectKeys((t==null?null:t.users)||xt(5,j_e)))==null?null:r.length)+" members"),v(),Qi(" ",(e=i.objectKeys((t==null?null:t.users)||xt(6,j_e)))==null?null:e.length," ",F(2,3,"members")," ")}}function ZZe(n,o){if(n&1&&p(0,KZe,3,7,"p",8),n&2){let r=o.$implicit,e=s(2),t=s();g("veltDynamicTemplate",j(4,ree,t.template,E(1,FZe,t.componentConfigSignal,r),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function JZe(n,o){if(n&1&&(C(0),$(1,UZe,1,4,"ng-container")(2,BZe,1,4,"ng-container")(3,$Ze,1,4,"ng-container"),p(4,zZe,1,1,"ng-template",null,0,Ve)(6,YZe,1,1,"ng-template",null,1,Ve)(8,ZZe,1,10,"ng-template",null,2,Ve),b()),n&2){let r=s(2);v(),G((r.selectorItem==null?null:r.selectorItem.type)==="contact"?1:(r.selectorItem==null?null:r.selectorItem.type)==="custom"?2:(r.selectorItem==null?null:r.selectorItem.type)==="group"?3:-1)}}function XZe(n,o){if(n&1&&p(0,JZe,10,1,"ng-container",3),n&2){let r=s();g("veltIf",E(5,PZe,r.conditionSignal(),ze(1,MZe,r.componentConfigSignal,r.localUIStateSignal,r.selectorItem)))}}var RS=(()=>{let o=class o extends jo{set userObject(e){try{let t=AS(e);t&&(this.selectorItem=t)}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let i=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);i&&(this.selectorItem={type:"contact",contact:i})}catch(t){this.loggingService.catch("Error looking up userId:",t)}}constructor(){super(),this.contactService=le(vn),this.objectKeys=Object.keys,this.componentConfigSignal=De({}),this.componentId="velt-autocomplete-option-description"}ngOnInit(){try{super.ngOnInit(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem})}catch(e){this.loggingService.catch("Error in AutocompleteOptionDescriptionComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionDescriptionComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{$g(this.hostElementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in AutocompleteOptionDescriptionComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-description-internal"]],inputs:{selectorItem:"selectorItem",field:"field",userObject:"userObject",userId:"userId"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[["contactEmailRef",""],["customDescriptionRef",""],["groupDescriptionRef",""],[4,"veltIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"line-height-1","velt-autocomplete-option-description",3,"velt-autocomplete-option-description--secondary"],["class","line-height-1 velt-autocomplete-option-description",3,"velt-autocomplete-option-description--secondary",4,"veltDynamicTemplate"],[1,"line-height-1","velt-autocomplete-option-description"],["class","line-height-1 velt-autocomplete-option-description",4,"veltDynamicTemplate"]],template:function(t,i){if(t&1&&$(0,XZe,1,8,"ng-container"),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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);display:block}[_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-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-autocomplete-option-description[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--velt-text-8);font-size:var(--velt-font-size-xs);margin:0;line-height:18px}"],changeDetection:0});let n=o;return n})();var QZe=(n,o,r)=>({componentConfigSignal:n,parentLocalUIState:o,selectorItem:r}),eJe=(n,o)=>({condition:n,data:o}),tJe=n=>({$implicit:n}),nJe=(n,o,r)=>({componentConfigSignal:n,isNewContact:o,userContact:r}),rJe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-autocomplete-option-error-icon-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function oJe(n,o){n&1&&et(0)}function iJe(n,o){if(n&1&&p(0,oJe,1,0,"ng-container",2),n&2){s();let r=Ee(3),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,tJe,e.selectorItem==null?null:e.selectorItem.contact))}}function aJe(n,o){if(n&1&&(f(0,"div",5)(1,"div",6),se(),f(2,"svg",7),D(3,"path",8)(4,"path",9),S()()()),n&2){let r=s(4),e=s();v(),g("title",r.newUserContactError),w("title",r.newUserContactError)("data-testid",e.componentId+"-icon"),v(),w("data-testid",e.componentId+"-svg")}}function lJe(n,o){if(n&1&&(f(0,"div",3),R(1,"translate"),p(2,aJe,5,4,"div",4),S()),n&2){let r=s().$implicit,e=s(2),t=s();w("aria-label",F(1,3,(e==null?null:e.newUserContactError)||"Invalid contact"))("data-testid",t.componentId),v(2),g("veltDynamicTemplate",j(9,rJe,t.template,ze(5,nJe,t.componentConfigSignal,t.isNewContact,r),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function cJe(n,o){if(n&1&&$(0,lJe,3,15,"div",3),n&2){let r=s(2),e=s();G(e.isNewContact&&r.newUserContactError?0:-1)}}function sJe(n,o){if(n&1&&(C(0),$(1,iJe,1,4,"ng-container"),p(2,cJe,1,1,"ng-template",null,0,Ve),b()),n&2){let r=s(2);v(),G((r.selectorItem==null?null:r.selectorItem.type)==="contact"?1:-1)}}function dJe(n,o){if(n&1&&p(0,sJe,4,1,"ng-container",1),n&2){let r=s();g("veltIf",E(5,eJe,r.conditionSignal(),ze(1,QZe,r.componentConfigSignal,r.localUIStateSignal,r.selectorItem)))}}var NS=(()=>{let o=class o extends jo{set userObject(e){try{let t=AS(e);t&&(this.selectorItem=t)}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let i=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);i&&(this.selectorItem={type:"contact",contact:i})}catch(t){this.loggingService.catch("Error looking up userId:",t)}}constructor(){super(),this.contactService=le(vn),this.componentConfigSignal=De({}),this.componentId="velt-autocomplete-error-icon"}ngOnInit(){try{super.ngOnInit(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem,isNewContact:this.isNewContact})}catch(e){this.loggingService.catch("Error in AutocompleteOptionErrorIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionErrorIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{$g(this.hostElementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in AutocompleteOptionErrorIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-error-icon-internal"]],inputs:{selectorItem:"selectorItem",isNewContact:"isNewContact",userObject:"userObject",userId:"userId"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[["errorIconRef",""],[4,"veltIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["role","alert"],["class","velt-autocomplete-option-error-icon",4,"veltDynamicTemplate"],[1,"velt-autocomplete-option-error-icon"],[1,"s-flex",3,"title"],["xmlns","http://www.w3.org/2000/svg","width","16","height","16","fill","currentColor","viewBox","0 0 16 16","aria-hidden","true","focusable","false",1,"bi","bi-exclamation-triangle"],["fill","red","d","M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017.163.163 0 0 1-.054-.06.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"],["fill","red","d","M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"]],template:function(t,i){if(t&1&&$(0,dJe,1,8,"ng-container"),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-autocomplete-option-error-icon[_ngcontent-%COMP%]{margin-inline:var(--velt-spacing-lg)}.velt-autocomplete-option-error-icon[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{background-color:transparent;border:none;padding:0;margin:0;cursor:pointer;outline:none;color:var(--velt-text-1)}"],changeDetection:0});let n=o;return n})();var vJe=(n,o,r)=>({componentConfigSignal:n,parentLocalUIState:o,selectorItem:r}),mJe=(n,o)=>({condition:n,data:o}),gJe=(n,o)=>({componentConfigSignal:n,selectorItem:o}),uJe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-autocomplete-option-icon-wireframe",variant:r,setIfCondition:e,componentElementRef:t}),oee=n=>({$implicit:n});function pJe(n,o){n&1&&et(0)}function hJe(n,o){if(n&1&&p(0,pJe,1,0,"ng-container",6),n&2){s(2);let r=Ee(3),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,oee,e.selectorItem==null?null:e.selectorItem.contact))}}function fJe(n,o){n&1&&et(0)}function CJe(n,o){if(n&1&&p(0,fJe,1,0,"ng-container",6),n&2){s(2);let r=Ee(5),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,oee,e.selectorItem==null?null:e.selectorItem.custom))}}function bJe(n,o){n&1&&et(0)}function _Je(n,o){if(n&1&&p(0,bJe,1,0,"ng-container",6),n&2){s(2);let r=Ee(7),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,oee,e.selectorItem==null?null:e.selectorItem.group))}}function SJe(n,o){if(n&1&&(f(0,"div",5),$(1,hJe,1,4,"ng-container")(2,CJe,1,4,"ng-container")(3,_Je,1,4,"ng-container"),S()),n&2){let r=s(3);w("data-testid",r.componentId)("aria-label","Option icon"),v(),G((r.selectorItem==null?null:r.selectorItem.type)==="contact"?1:(r.selectorItem==null?null:r.selectorItem.type)==="custom"?2:(r.selectorItem==null?null:r.selectorItem.type)==="group"?3:-1)}}function yJe(n,o){if(n&1&&(se(),f(0,"svg",7),D(1,"path",9),S()),n&2){let r=s(4);w("data-testid",r.componentId+"-contact-at")}}function kJe(n,o){if(n&1&&D(0,"snippyly-user-avatar",8),n&2){let r=s().$implicit,e=s(3);g("size",32)("user",r),w("data-testid",e.componentId+"-contact-avatar")}}function xJe(n,o){if(n&1&&$(0,yJe,2,1,":svg:svg",7)(1,kJe,1,3,"snippyly-user-avatar",8),n&2){let r=o.$implicit;G((r==null?null:r.visibility)==="here"?0:1)}}function IJe(n,o){if(n&1&&(D(0,"div",10),R(1,"safeSvg")),n&2){let r=s().$implicit,e=s(3);g("innerHTML",F(1,2,r.icon.svg),Wr),w("data-testid",e.componentId+"-custom-svg")}}function EJe(n,o){if(n&1&&D(0,"img",11),n&2){let r=s().$implicit,e=s(3);g("src",r.icon.url,bn),w("alt",(r==null?null:r.description)||"Custom icon")("data-testid",e.componentId+"-custom-img")}}function wJe(n,o){if(n&1&&($(0,IJe,2,4,"div",10),$(1,EJe,1,3,"img",11)),n&2){let r=o.$implicit;G(!(r==null||r.icon==null)&&r.icon.svg?0:-1),v(),G(!(r==null||r.icon==null)&&r.icon.url?1:-1)}}function TJe(n,o){if(n&1&&(se(),f(0,"svg",12),D(1,"path",13),S()),n&2){let r=s(3);w("data-testid",r.componentId+"-group-icon")}}function DJe(n,o){if(n&1&&(C(0),p(1,SJe,4,3,"div",4)(2,xJe,2,1,"ng-template",null,0,Ve)(4,wJe,2,2,"ng-template",null,1,Ve)(6,TJe,2,1,"ng-template",null,2,Ve),b()),n&2){let r=s(),e=s();v(),g("veltDynamicTemplate",j(4,uJe,e.template,E(1,gJe,e.componentConfigSignal,e.selectorItem),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function OJe(n,o){if(n&1&&p(0,DJe,8,10,"ng-container",3),n&2){let r=s();g("veltIf",E(5,mJe,r.conditionSignal(),ze(1,vJe,r.componentConfigSignal,r.localUIStateSignal,r.selectorItem)))}}var FS=(()=>{let o=class o extends jo{set userObject(e){try{if(!e)return;let t=typeof e=="string"?JSON.parse(e):e;this.selectorItem={type:"contact",contact:t}}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let i=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);i&&(this.selectorItem={type:"contact",contact:i})}catch(t){this.loggingService.catch("Error looking up userId:",t)}}constructor(){super(),this.contactService=le(vn),this.componentConfigSignal=De({}),this.componentId="velt-autocomplete-icon"}ngOnInit(){try{super.ngOnInit(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem})}catch(e){this.loggingService.catch("Error in AutocompleteOptionIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.hostElementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in AutocompleteOptionIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-icon-internal"]],inputs:{selectorItem:"selectorItem",userObject:"userObject",userId:"userId"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[["contactAvatarRef",""],["customAvatarRef",""],["groupAvatarRef",""],[4,"veltIf"],["class","velt-autocomplete-option-icon","role","img",4,"veltDynamicTemplate"],["role","img",1,"velt-autocomplete-option-icon"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["xmlns","http://www.w3.org/2000/svg","width","24","height","24","fill","none","viewBox","0 0 16 16","aria-hidden","true","focusable","false",1,"bi","bi-at"],[3,"size","user"],["fill","currentColor","d","M13.106 7.222c0-2.967-2.249-5.032-5.482-5.032-3.35 0-5.646 2.318-5.646 5.702 0 3.493 2.235 5.708 5.762 5.708.862 0 1.689-.123 2.304-.335v-.862c-.43.199-1.354.328-2.29.328-2.926 0-4.813-1.88-4.813-4.798 0-2.844 1.921-4.881 4.594-4.881 2.735 0 4.608 1.688 4.608 4.156 0 1.682-.554 2.769-1.416 2.769-.492 0-.772-.28-.772-.76V5.206H8.923v.834h-.11c-.266-.595-.881-.964-1.6-.964-1.4 0-2.378 1.162-2.378 2.823 0 1.737.957 2.906 2.379 2.906.8 0 1.415-.39 1.709-1.087h.11c.081.67.703 1.148 1.503 1.148 1.572 0 2.57-1.415 2.57-3.643zm-7.177.704c0-1.197.54-1.907 1.456-1.907.93 0 1.524.738 1.524 1.907S8.308 9.84 7.371 9.84c-.895 0-1.442-.725-1.442-1.914z"],[1,"velt-autocomplete-option-icon--custom-svg",3,"innerHTML"],[1,"velt-autocomplete-option-icon--custom-img",3,"src"],["xmlns","http://www.w3.org/2000/svg","width","16","height","16","fill","currentColor","viewBox","0 0 16 16","aria-hidden","true","focusable","false",1,"bi","bi-people-fill"],["d","M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6m-5.784 6A2.24 2.24 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.3 6.3 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1zM4.5 8a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5"]],template:function(t,i){if(t&1&&$(0,OJe,1,8,"ng-container"),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-autocomplete-option-icon--placeholder[_ngcontent-%COMP%]{z-index:2;opacity:.8}.velt-autocomplete-option-icon[_ngcontent-%COMP%]{min-width:calc((2.25rem + 0px) * var(--velt-base-rem-unit));width:calc((2.25rem + 0px) * var(--velt-base-rem-unit));min-height:calc((2.25rem + 0px) * var(--velt-base-rem-unit));height:calc((2.25rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;background-clip:padding-box;border:solid 2px transparent;display:flex;align-items:center;justify-content:center;position:relative;margin-right:var(--velt-spacing-md)}.velt-autocomplete-option-icon[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:var(--velt-border-radius-full);z-index:2;object-fit:cover}.velt-autocomplete-option-icon[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0;z-index:1;border-radius:inherit;background:inherit}.velt-autocomplete-option-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--velt-text-1)}'],changeDetection:0});let n=o;return n})();var AJe=(n,o,r)=>({componentConfigSignal:n,parentLocalUIState:o,selectorItem:r}),MJe=(n,o)=>({condition:n,data:o}),iee=n=>({$implicit:n}),PJe=(n,o)=>({componentConfigSignal:n,userContact:o}),aee=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-autocomplete-option-name-wireframe",variant:r,setIfCondition:e,componentElementRef:t}),RJe=(n,o)=>({componentConfigSignal:n,custom:o}),NJe=(n,o)=>({componentConfigSignal:n,group:o});function FJe(n,o){n&1&&et(0)}function LJe(n,o){if(n&1&&p(0,FJe,1,0,"ng-container",4),n&2){s();let r=Ee(5),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,iee,e.selectorItem==null?null:e.selectorItem.contact))}}function UJe(n,o){n&1&&et(0)}function VJe(n,o){if(n&1&&p(0,UJe,1,0,"ng-container",4),n&2){s();let r=Ee(7),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,iee,e.selectorItem==null?null:e.selectorItem.custom))}}function BJe(n,o){n&1&&et(0)}function jJe(n,o){if(n&1&&p(0,BJe,1,0,"ng-container",4),n&2){s();let r=Ee(9),e=s(2);g("ngTemplateOutlet",r)("ngTemplateOutletContext",J(2,iee,e.selectorItem==null?null:e.selectorItem.group))}}function $Je(n,o){if(n&1&&(f(0,"p",5),oe(1),R(2,"translate"),S()),n&2){let r=s(2).$implicit,e=s(3);w("data-testid",e.componentId+"-contact-text")("aria-label",r.name||r.email),v(),we(" ",F(2,3,r.name||r.email)," ")}}function GJe(n,o){if(n&1&&p(0,$Je,3,5,"p",7),n&2){let r=s().$implicit,e=s(2),t=s();g("veltDynamicTemplate",j(4,aee,t.template,E(1,PJe,t.componentConfigSignal,r),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function HJe(n,o){n&1&&D(0,"velt-skeleton-loader-internal",6)}function zJe(n,o){if(n&1&&$(0,GJe,1,10,"p",5)(1,HJe,1,0,"velt-skeleton-loader-internal",6),n&2){let r=o.$implicit;G((r.name==null?null:r.name.length)>0||(r==null||r.email==null?null:r.email.length)>0?0:1)}}function WJe(n,o){if(n&1&&(f(0,"p",5),oe(1),R(2,"translate"),S()),n&2){let r=s(2).$implicit,e=s(3);w("data-testid",e.componentId+"-custom-text")("aria-label",r.name),v(),we(" ",F(2,3,r.name)," ")}}function qJe(n,o){if(n&1&&p(0,WJe,3,5,"p",7),n&2){let r=s().$implicit,e=s(2),t=s();g("veltDynamicTemplate",j(4,aee,t.template,E(1,RJe,t.componentConfigSignal,r),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function YJe(n,o){if(n&1&&$(0,qJe,1,10,"p",5),n&2){let r=o.$implicit;G((r.name==null?null:r.name.length)>0?0:-1)}}function KJe(n,o){if(n&1&&(f(0,"p",5),oe(1),R(2,"translate"),S()),n&2){let r=s(2).$implicit,e=s(3);w("data-testid",e.componentId+"-group-text")("aria-label",r==null||r.metadata==null?null:r.metadata.groupName),v(),we(" ",F(2,3,r==null||r.metadata==null?null:r.metadata.groupName)," ")}}function ZJe(n,o){if(n&1&&p(0,KJe,3,5,"p",7),n&2){let r=s().$implicit,e=s(2),t=s();g("veltDynamicTemplate",j(4,aee,t.template,E(1,NJe,t.componentConfigSignal,r),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function JJe(n,o){if(n&1&&$(0,ZJe,1,10,"p",5),n&2){let r=o.$implicit;G((r==null||r.metadata==null||r.metadata.groupName==null?null:r.metadata.groupName.length)>0?0:-1)}}function XJe(n,o){if(n&1&&(C(0),$(1,LJe,1,4,"ng-container")(2,VJe,1,4,"ng-container")(3,jJe,1,4,"ng-container"),p(4,zJe,2,1,"ng-template",null,0,Ve)(6,YJe,1,1,"ng-template",null,1,Ve)(8,JJe,1,1,"ng-template",null,2,Ve),b()),n&2){let r=s(2);v(),G((r.selectorItem==null?null:r.selectorItem.type)==="contact"?1:(r.selectorItem==null?null:r.selectorItem.type)==="custom"?2:(r.selectorItem==null?null:r.selectorItem.type)==="group"?3:-1)}}function QJe(n,o){if(n&1&&p(0,XJe,10,1,"ng-container",3),n&2){let r=s();g("veltIf",E(5,MJe,r.conditionSignal(),ze(1,AJe,r.componentConfigSignal,r.localUIStateSignal,r.selectorItem)))}}var LS=(()=>{let o=class o extends jo{set userObject(e){try{if(!e)return;let t=typeof e=="string"?JSON.parse(e):e;this.selectorItem={type:"contact",contact:t}}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let i=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);i&&(this.selectorItem={type:"contact",contact:i})}catch(t){this.loggingService.catch("Error looking up userId:",t)}}constructor(){super(),this.contactService=le(vn),this.componentConfigSignal=De({}),this.componentId="velt-autocomplete-name"}ngOnInit(){try{super.ngOnInit(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem})}catch(e){this.loggingService.catch("Error in AutocompleteOptionNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionNameComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.hostElementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in AutocompleteOptionNameComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-name-internal"]],inputs:{selectorItem:"selectorItem",userObject:"userObject",userId:"userId"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[["contactNameRef",""],["customNameRef",""],["groupNameRef",""],[4,"veltIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["role","option",1,"line-height-1","velt-autocomplete-option-name"],["height","21px","width","80px","borderRadius","20px"],["class","line-height-1 velt-autocomplete-option-name","role","option",4,"veltDynamicTemplate"]],template:function(t,i){if(t&1&&$(0,QJe,1,8,"ng-container"),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-autocomplete-option-name[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;color:var(--velt-text-1);font-size:var(--velt-font-size-sm);margin:0;line-height:21px;white-space:nowrap}"],changeDetection:0});let n=o;return n})();var eXe=(n,o,r)=>({componentConfigSignal:n,parentLocalUIState:o,selectorItem:r}),tXe=(n,o)=>({condition:n,data:o}),nXe=(n,o,r,e,t,i)=>({componentConfigSignal:n,isNewContact:o,selectorItem:r,multiSelect:e,isSelected:t,readOnly:i}),rXe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-autocomplete-option-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function oXe(n,o){if(n&1&&(f(0,"div",3),D(1,"velt-autocomplete-option-icon-internal",4),f(2,"div",5),D(3,"velt-autocomplete-option-name-internal",4)(4,"velt-autocomplete-option-description-internal",4),S(),D(5,"velt-autocomplete-option-error-icon-internal",6),S()),n&2){let r=s(2),e=s();pe("velt-autocomplete-option--multi-select",e.multiSelect)("velt-autocomplete-option--selected",e.isSelected),w("data-testid",e.componentId)("aria-selected",e.isSelected)("aria-disabled",!!(r!=null&&r.newUserContactError)),v(),g("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),v(),w("data-testid",e.componentId+"-details"),v(),g("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),v(),g("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),v(),g("selectorItem",e.selectorItem)("isNewContact",e.isNewContact)("componentConfigSignal",e.componentConfigSignal)}}function iXe(n,o){n&1&&(f(0,"div",2),se(),f(1,"svg",7),D(2,"path",8),S()())}function aXe(n,o){if(n&1&&(C(0),p(1,oXe,6,17,"div",1),$(2,iXe,3,0,"div",2),b()),n&2){let r=s(),e=s();v(),g("veltDynamicTemplate",j(9,rXe,e.template,yr(2,nXe,e.componentConfigSignal,e.isNewContact,e.selectorItem,e.multiSelect,e.isSelected,e.readOnly),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef)),v(),G(e.multiSelect&&!e.readOnly&&e.isSelected?2:-1)}}function lXe(n,o){if(n&1&&p(0,aXe,3,15,"ng-container",0),n&2){let r=s();g("veltIf",E(5,tXe,r.conditionSignal(),ze(1,eXe,r.componentConfigSignal,r.localUIStateSignal,r.selectorItem)))}}var US=(()=>{let o=class o extends jo{set userObject(e){try{if(!e)return;let t=typeof e=="string"?JSON.parse(e):e;this.selectorItem={type:"contact",contact:t}}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let i=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);i&&(this.selectorItem={type:"contact",contact:i})}catch(t){this.loggingService.catch("Error looking up userId:",t)}}constructor(){super(),this.multiSelect=!1,this.isSelected=!1,this.readOnly=!1,this.contactService=le(vn),this.componentConfigSignal=De({}),this.subscriptions=[],this.wireframeService=le(Xe),this.componentId="velt-autocomplete-option"}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit();let e="velt-autocomplete-option-wireframe";this.dynamicDataService.applyConditionalClasses(this.hostElementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem,isNewContact:this.isNewContact}),this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let i=document.createElement(t.tagName);i.innerHTML=t.innerHTML,this.template=i}}))}catch(e){this.loggingService.catch("Error in AutocompleteOptionComponent OnInit: ",e)}}setupA11yAttributes(){try{let e=this.hostElementRef.nativeElement;e.setAttribute("role","option"),e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("aria-label",this.getOptionLabel())}catch(e){this.loggingService.catch("Error in AutocompleteOptionComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: red;"),super.ngOnDestroy(),this.subscriptions.forEach(e=>e?.unsubscribe())}catch(e){this.loggingService.catch("Error in AutocompleteOptionComponent OnDestroy: ",e)}}getOptionLabel(){try{switch(this.selectorItem?.type){case"contact":return this.getContactLabel();case"custom":return this.selectorItem.custom?.name||"Custom option";case"group":return this.selectorItem.group?.metadata?.groupName||"Group option";default:return"Option"}}catch(e){return this.loggingService.catch("Error in AutocompleteOptionComponent getOptionLabel:",e),"Option"}}getContactLabel(){try{let e=this.selectorItem?.contact,t=e?.name||e?.email||"Contact";return this.isNewContact?`New contact: ${t}`:t}catch(e){return this.loggingService.catch("Error in AutocompleteOptionComponent getContactLabel:",e),"Contact"}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-internal"]],inputs:{selectorItem:"selectorItem",isNewContact:"isNewContact",variant:"variant",multiSelect:"multiSelect",isSelected:"isSelected",readOnly:"readOnly",userObject:"userObject",userId:"userId"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],["class","velt-autocomplete-option--container","role","option",3,"velt-autocomplete-option--multi-select","velt-autocomplete-option--selected",4,"veltDynamicTemplate"],[1,"velt-autocomplete-option--check"],["role","option",1,"velt-autocomplete-option--container"],[3,"selectorItem","componentConfigSignal"],[1,"velt-autocomplete-option--details"],[3,"selectorItem","isNewContact","componentConfigSignal"],["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M11.6667 3.5L5.25 9.91667L2.33333 7","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){if(t&1&&$(0,lXe,1,8,"ng-container"),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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);width:100%;display:flex;align-items:center;min-width:0;overflow:hidden;box-sizing:border-box}[_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-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-autocomplete-option--container[_ngcontent-%COMP%]{display:flex;align-items:center;flex:1;min-width:0}.velt-autocomplete-option--details[_ngcontent-%COMP%]{overflow:hidden;flex-grow:1}.velt-autocomplete-option--check[_ngcontent-%COMP%]{flex-shrink:0;width:24px;height:24px;border-radius:50%;background:var(--velt-accent-transparent, rgba(0, 168, 112, .15));display:flex;align-items:center;justify-content:center;color:var(--velt-accent, #00a870);margin-left:8px}"],changeDetection:0});let n=o;return n})();var Wi=class{constructor(){this.isAudioPermissionOpen=!1,this.toggleAudioPermission=()=>{},this.selectAudioDevice=()=>{},this.audioDevices=[],this.isVideoPermissionOpen=!1,this.toggleVideoPermission=()=>{},this.selectVideoDevice=()=>{},this.videoDevices=[],this.shadowDom=!1,this.isOpen=!1,this.settingsEmbedded=!1,this.closeVideoDropdown=()=>{},this.closeAudioDropdown=()=>{}}};var cXe=n=>({componentConfigSignal:n}),sXe=(n,o)=>({condition:n,data:o}),dXe=n=>({componentConfigSignal:n,type:"audio"}),vXe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-media-source-settings-audio-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function mXe(n,o){if(n&1&&(C(0),f(1,"div",5)(2,"div",6),se(),f(3,"svg",7),D(4,"path",8),S()(),St(),D(5,"velt-media-source-settings-selected-label-internal",9)(6,"velt-media-source-settings-toggle-icon-internal",9),S(),D(7,"velt-media-source-settings-divider-internal",9)(8,"velt-media-source-settings-options-internal",9),b()),n&2){let r=s(4);v(),w("aria-hidden","true"),v(4),g("componentConfigSignal",r.componentConfigSignal)("template",r.template),w("data-testid",r.componentId+"-label"),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template),w("data-testid",r.componentId+"-toggle"),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template),w("data-testid",r.componentId+"-divider"),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template),w("data-testid",r.componentId+"-options")("role","listbox")("aria-label","Audio source options")}}function gXe(n,o){if(n&1){let r=Z();f(0,"div",3),R(1,"translate"),z("clickOutside",function(){L(r);let t=s(2).ngIf;return U(t.closeAudioDropdown())})("click",function(t){L(r);let i=s(2).ngIf;return U(i.toggleAudioPermission(t))}),p(2,mXe,9,15,"ng-container",4),S()}if(n&2){let r=s(2).ngIf,e=s();pe("velt-media-source-settings-audio--active",r.isAudioPermissionOpen),w("data-testid",e.componentId)("role","button")("aria-expanded",r.isAudioPermissionOpen)("aria-haspopup","listbox")("aria-label",F(1,9,"Audio settings"))("tabindex",0),v(2),g("veltDynamicTemplate",j(13,vXe,e.template,J(11,dXe,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function uXe(n,o){if(n&1&&(C(0),p(1,gXe,3,19,"div",2),b()),n&2){let r=s().ngIf;v(),g("ngIf",r.settingsVisible==null?null:r.settingsVisible.audio)}}function pXe(n,o){if(n&1&&(C(0),p(1,uXe,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,sXe,r.conditionSignal(),J(1,cXe,r.componentConfigSignal)))}}var ZO=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-media-source-settings-audio",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsAudioComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsAudioComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsAudioComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-audio-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-media-source-settings-audio","snippylyClickOutside","",3,"velt-media-source-settings-audio--active","clickOutside","click",4,"ngIf"],["snippylyClickOutside","",1,"velt-media-source-settings-audio",3,"clickOutside","click"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-audio-trigger"],[1,"velt-media-source-settings-audio-trigger-icon"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M3.33301 6.66732C3.33301 7.90499 3.82467 9.09198 4.69984 9.96715C5.57501 10.8423 6.762 11.334 7.99967 11.334M7.99967 11.334C9.23735 11.334 10.4243 10.8423 11.2995 9.96715C12.1747 9.09198 12.6663 7.90499 12.6663 6.66732M7.99967 11.334V14.0007M5.33301 14.0007H10.6663M5.99967 3.33398C5.99967 2.80355 6.21039 2.29484 6.58546 1.91977C6.96053 1.5447 7.46924 1.33398 7.99967 1.33398C8.53011 1.33398 9.03882 1.5447 9.41389 1.91977C9.78896 2.29484 9.99967 2.80355 9.99967 3.33398V6.66732C9.99967 7.19775 9.78896 7.70646 9.41389 8.08153C9.03882 8.4566 8.53011 8.66732 7.99967 8.66732C7.46924 8.66732 6.96053 8.4566 6.58546 8.08153C6.21039 7.70646 5.99967 7.19775 5.99967 6.66732V3.33398Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["type","audio",3,"componentConfigSignal","template"]],template:function(t,i){t&1&&p(0,pXe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:[".velt-media-source-settings-audio[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);margin:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-md);display:flex;flex-direction:column;align-items:center;box-sizing:border-box}.velt-media-source-settings-audio[_ngcontent-%COMP%]:hover{background:var(--velt-background-3)}.velt-media-source-settings-audio--active[_ngcontent-%COMP%]{background:var(--velt-background-2)}.velt-media-source-settings-audio-trigger[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--velt-spacing-md);align-items:center;cursor:pointer}.velt-media-source-settings-audio-trigger[_ngcontent-%COMP%] .velt-media-source-settings-audio-trigger-icon[_ngcontent-%COMP%]{padding:1px;color:var(--velt-text-3);display:flex}.velt-media-source-settings-audio-trigger[_ngcontent-%COMP%] .velt-media-source-settings-audio-trigger-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{max-width:none}"],changeDetection:0});let n=o;return n})();var hXe=n=>({componentConfigSignal:n}),fXe=(n,o)=>({condition:n,data:o}),CXe=(n,o,r,e)=>({template:n,componentName:"velt-media-source-settings-divider-wireframe",variant:o,setIfCondition:r,componentElementRef:e});function bXe(n,o){if(n&1&&(C(0),D(1,"div",3),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-divider")("role","separator")("aria-orientation","horizontal")("aria-hidden","true")}}function _Xe(n,o){if(n&1&&(f(0,"div"),p(1,bXe,2,4,"ng-container",2),S()),n&2){let r=s(2).ngIf,e=s();w("data-testid",e.componentId+"-divider-container")("role","presentation"),v(),g("veltDynamicTemplate",Ze(3,CXe,e.template,r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function SXe(n,o){if(n&1&&(C(0),p(1,_Xe,2,8,"div",0),b()),n&2){let r=s().ngIf,e=s();v(),g("ngIf",e.type==="audio"?r.isAudioPermissionOpen:r.isVideoPermissionOpen)}}function yXe(n,o){if(n&1&&(C(0),p(1,SXe,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,fXe,r.conditionSignal(),J(1,hXe,r.componentConfigSignal)))}}var VS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.type="audio",this.componentId="velt-media-source-settings-divider",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsDividerComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsDividerComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsDividerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-divider-internal"]],inputs:{type:"type"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-divider"]],template:function(t,i){t&1&&p(0,yXe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["[_nghost-%COMP%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-media-source-settings-divider[_ngcontent-%COMP%]{width:100%;height:1px;background:var(--velt-background-4);margin-top:var(--velt-spacing-md)}"],changeDetection:0});let n=o;return n})();var kXe=n=>({componentConfigSignal:n}),xXe=(n,o)=>({condition:n,data:o}),IXe=(n,o,r,e)=>({template:n,componentName:"velt-media-source-settings-options-item-icon-wireframe",variant:o,setIfCondition:r,componentElementRef:e});function EXe(n,o){n&1&&(C(0),se(),f(1,"svg",4),D(2,"path",5),S(),b())}function wXe(n,o){if(n&1&&(C(0),f(1,"div",2),p(2,EXe,3,0,"ng-container",3),S(),b()),n&2){let r=s().ngIf,e=s();v(),pe("selected",e.device.deviceId===(e.type==="audio"?r.selectedAudioDevice==null?null:r.selectedAudioDevice.deviceId:r.selectedVideoDevice==null?null:r.selectedVideoDevice.deviceId)),w("data-testid",e.componentId+"-selected-icon")("role","presentation")("aria-hidden","true"),v(),g("veltDynamicTemplate",Ze(6,IXe,e.template,r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function TXe(n,o){if(n&1&&(C(0),p(1,wXe,3,11,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,xXe,r.conditionSignal(),J(1,kXe,r.componentConfigSignal)))}}var JO=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.type="audio",this.componentId="velt-media-source-settings-options-item-icon",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type,device:this.device}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-options-item-icon"]],inputs:{type:"type",device:"device"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[1,"velt-media-source-settings-options--selected-icon"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M3.75 9L7.5 12.75L15 5.25","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){t&1&&p(0,TXe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:[".velt-media-source-settings-options--selected-icon[_ngcontent-%COMP%]{visibility:hidden;color:var(--velt-accent-text);display:flex}.velt-media-source-settings-options--selected-icon.selected[_ngcontent-%COMP%]{visibility:visible}"],changeDetection:0});let n=o;return n})();var DXe=n=>({componentConfigSignal:n}),OXe=(n,o)=>({condition:n,data:o}),AXe=(n,o,r,e)=>({template:n,componentName:"velt-media-source-settings-options-item-label-wireframe",variant:o,setIfCondition:r,componentElementRef:e});function MXe(n,o){if(n&1&&(C(0),f(1,"p"),R(2,"translate"),oe(3),R(4,"translate"),S(),b()),n&2){let r=s(2).ngIf,e=s();v(),pe("velt-media-source-settings-options--label-selected",e.device.deviceId===(e.type==="audio"?r.selectedAudioDevice==null?null:r.selectedAudioDevice.deviceId:r.selectedVideoDevice==null?null:r.selectedVideoDevice.deviceId)),w("data-testid",e.componentId+"-device-label")("role","option")("title",F(2,6,e.device.label)),v(2),we(" ",F(4,8,e.device.label)," ")}}function PXe(n,o){if(n&1&&(C(0),p(1,MXe,5,10,"ng-container",2),b()),n&2){let r=s().ngIf,e=s();v(),g("veltDynamicTemplate",Ze(1,AXe,e.template,r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function RXe(n,o){if(n&1&&(C(0),p(1,PXe,2,6,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,OXe,r.conditionSignal(),J(1,DXe,r.componentConfigSignal)))}}var XO=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.type="audio",this.componentId="velt-media-source-settings-options-item-label",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type,device:this.device}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemLabelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemLabelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemLabelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-options-item-label"]],inputs:{type:"type",device:"device"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,i){t&1&&p(0,RXe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["p[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0}.velt-media-source-settings-options--label-selected[_ngcontent-%COMP%]{color:var(--velt-text-0)}"],changeDetection:0});let n=o;return n})();var NXe=n=>({componentConfigSignal:n}),FXe=(n,o)=>({condition:n,data:o}),LXe=(n,o,r)=>({device:n,type:o,componentConfigSignal:r}),UXe=(n,o,r,e,t)=>({template:n,context:o,cloneTemplate:!0,componentName:"velt-media-source-settings-options-item-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function VXe(n,o){if(n&1&&(C(0),D(1,"velt-media-source-settings-options-item-icon",7)(2,"velt-media-source-settings-options-item-label",7),b()),n&2){let r=s().$implicit,e=s(4);v(),g("device",r)("type",e.type)("componentConfigSignal",e.componentConfigSignal),w("data-testid",e.componentId+"-option-icon-"+r.deviceId),v(),g("device",r)("type",e.type)("componentConfigSignal",e.componentConfigSignal),w("data-testid",e.componentId+"-option-label-"+r.deviceId)}}function BXe(n,o){if(n&1){let r=Z();f(0,"div",5),z("click",function(){let t=L(r).$implicit,i=s(3).ngIf,a=s();return U(a.type==="audio"?i.selectAudioDevice(t):i.selectVideoDevice(t))}),p(1,VXe,3,8,"ng-container",6),S()}if(n&2){let r=o.$implicit,e=s(3).ngIf,t=s();pe("velt-media-source-settings-options--current-selected",r.deviceId===(t.type==="audio"?e.selectedAudioDevice==null?null:e.selectedAudioDevice.deviceId:e.selectedVideoDevice==null?null:e.selectedVideoDevice.deviceId)),w("data-testid",t.componentId+"-option-"+r.deviceId)("role","option"),v(),g("veltDynamicTemplate",j(9,UXe,t.optionTemplate,ze(5,LXe,r,t.type,t.componentConfigSignal),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function jXe(n,o){if(n&1&&(f(0,"div",3),p(1,BXe,2,15,"div",4),S()),n&2){let r=s(2).ngIf,e=s();w("data-testid",e.componentId+"-options")("role","listbox")("aria-orientation","vertical"),v(),g("ngForOf",e.type==="audio"?r.audioDevices:r.videoDevices)}}function $Xe(n,o){if(n&1&&(C(0),p(1,jXe,2,4,"div",2),b()),n&2){let r=s().ngIf,e=s();v(),g("ngIf",e.type==="audio"?r.isAudioPermissionOpen:r.isVideoPermissionOpen)}}function GXe(n,o){if(n&1&&(C(0),p(1,$Xe,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,FXe,r.conditionSignal(),J(1,NXe,r.componentConfigSignal)))}}var BS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.type="audio",this.componentId="velt-media-source-settings-options",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{if(this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes(),!this.optionTemplate){let e=this.template?.querySelector("velt-media-source-settings-options-item-wireframe");Ge(e)||(this.optionTemplate=e)}}catch{}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-options-internal"]],inputs:{type:"type"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-media-source-settings-options",4,"ngIf"],[1,"velt-media-source-settings-options"],["class","velt-media-source-settings-options-item",3,"velt-media-source-settings-options--current-selected","click",4,"ngFor","ngForOf"],[1,"velt-media-source-settings-options-item",3,"click"],[4,"veltDynamicTemplate"],[3,"device","type","componentConfigSignal"]],template:function(t,i){t&1&&p(0,GXe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["[_nghost-%COMP%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-media-source-settings-options[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;align-items:center;max-height:104px;overflow-y:scroll}.velt-media-source-settings-options-item[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--velt-spacing-md);align-items:center;cursor:pointer;padding-block:var(--velt-spacing-sm);border-radius:var(--velt-border-radius-sm);color:var(--velt-text-6)}.velt-media-source-settings-options-item[_ngcontent-%COMP%]:not(.velt-media-source-settings-options--current-selected):hover{background:var(--velt-background-4);color:var(--velt-text-0)}.velt-media-source-settings-options--current-selected[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:50%;color:var(--velt-text-0)}"],changeDetection:0});let n=o;return n})();var HXe=n=>({componentConfigSignal:n}),zXe=(n,o)=>({condition:n,data:o}),WXe=(n,o,r,e)=>({template:n,componentName:"velt-media-source-settings-selected-label-wireframe",variant:o,setIfCondition:r,componentElementRef:e});function qXe(n,o){if(n&1&&(C(0),f(1,"p",3),oe(2),R(3,"translate"),R(4,"translate"),R(5,"translate"),R(6,"translate"),S(),b()),n&2){let r,e=s(3);v(),w("data-testid",e.componentId+"-selected-device-label")("role","status")("aria-live","polite"),v(),we(" ",e.type==="audio"?F(3,4,(r=e.componentConfigSignal().selectedAudioDevice)==null?null:r.label)??F(4,6,"No device found"):F(5,8,(r=e.componentConfigSignal().selectedVideoDevice)==null?null:r.label)??F(6,10,"No device found")," ")}}function YXe(n,o){if(n&1&&(C(0),p(1,qXe,7,12,"ng-container",2),b()),n&2){let r=s().ngIf,e=s();v(),g("veltDynamicTemplate",Ze(1,WXe,e.template,r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function KXe(n,o){if(n&1&&(C(0),p(1,YXe,2,6,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,zXe,r.conditionSignal(),J(1,HXe,r.componentConfigSignal)))}}var jS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.type="audio",this.componentId="velt-media-source-settings-selected-label",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsSelectedLabelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsSelectedLabelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsSelectedLabelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-selected-label-internal"]],inputs:{type:"type"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-label"]],template:function(t,i){t&1&&p(0,KXe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["[_nghost-%COMP%]{flex:1}.velt-media-source-settings-label[_ngcontent-%COMP%]{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0;color:var(--velt-text-3)}"],changeDetection:0});let n=o;return n})();var ZXe=n=>({componentConfigSignal:n}),JXe=(n,o)=>({condition:n,data:o}),XXe=(n,o,r,e)=>({template:n,componentName:"velt-media-source-settings-toggle-icon-close-wireframe",variant:o,setIfCondition:r,componentElementRef:e});function QXe(n,o){if(n&1&&(C(0),se(),f(1,"svg",3),D(2,"path",4),S(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-toggle-icon")("aria-hidden","true")}}function eQe(n,o){if(n&1&&(C(0),p(1,QXe,3,2,"ng-container",2),b()),n&2){let r=s(2).ngIf,e=s();v(),g("veltDynamicTemplate",Ze(1,XXe,e.template,r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function tQe(n,o){if(n&1&&(C(0),p(1,eQe,2,6,"ng-container",0),b()),n&2){let r=s().ngIf,e=s();v(),g("ngIf",e.type==="audio"?!r.isAudioPermissionOpen:!r.isVideoPermissionOpen)}}function nQe(n,o){if(n&1&&(C(0),p(1,tQe,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,JXe,r.conditionSignal(),J(1,ZXe,r.componentConfigSignal)))}}var QO=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.type="audio",this.componentId="velt-media-source-settings-toggle-icon-close",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconCloseComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconCloseComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconCloseComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-toggle-icon-close-internal"]],inputs:{type:"type"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","role","presentation",1,"velt-media-source-settings-toggle-icon"],["d","M4 7L9 12L14 7","fill","currentColor"]],template:function(t,i){t&1&&p(0,nQe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}svg[_ngcontent-%COMP%]{max-width:none;color:var(--velt-text-12)}"],changeDetection:0});let n=o;return n})();var rQe=n=>({componentConfigSignal:n}),oQe=(n,o)=>({condition:n,data:o}),iQe=(n,o,r,e)=>({template:n,componentName:"velt-media-source-settings-toggle-icon-open-wireframe",variant:o,setIfCondition:r,componentElementRef:e});function aQe(n,o){if(n&1&&(C(0),se(),f(1,"svg",3),D(2,"path",4),S(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-toggle-icon-open")("aria-hidden","true")}}function lQe(n,o){if(n&1&&(C(0),p(1,aQe,3,2,"ng-container",2),b()),n&2){let r=s(2).ngIf,e=s();v(),g("veltDynamicTemplate",Ze(1,iQe,e.template,r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function cQe(n,o){if(n&1&&(C(0),p(1,lQe,2,6,"ng-container",0),b()),n&2){let r=s().ngIf,e=s();v(),g("ngIf",e.type==="audio"?r.isAudioPermissionOpen:r.isVideoPermissionOpen)}}function sQe(n,o){if(n&1&&(C(0),p(1,cQe,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,oQe,r.conditionSignal(),J(1,rQe,r.componentConfigSignal)))}}var eA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.type="audio",this.componentId="velt-media-source-settings-toggle-icon-open",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconOpenComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconOpenComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconOpenComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-toggle-icon-open-internal"]],inputs:{type:"type"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","role","presentation",1,"velt-media-source-settings-toggle-icon-open"],["d","M4 12L9 7L14 12","fill","currentColor"]],template:function(t,i){t&1&&p(0,sQe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}svg[_ngcontent-%COMP%]{max-width:none;color:var(--velt-text-12)}"],changeDetection:0});let n=o;return n})();var dQe=n=>({componentConfigSignal:n}),vQe=(n,o)=>({condition:n,data:o}),mQe=(n,o)=>({componentConfigSignal:n,type:o}),gQe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-media-source-settings-toggle-icon-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function uQe(n,o){if(n&1&&(C(0),f(1,"div",3),D(2,"velt-media-source-settings-toggle-icon-open-internal",4)(3,"velt-media-source-settings-toggle-icon-close-internal",4),S(),b()),n&2){let r=s(3);v(),w("data-testid",r.componentId+"-toggle-container")("role","presentation")("aria-hidden","true"),v(),g("componentConfigSignal",r.componentConfigSignal)("type",r.type)("template",r.template),w("data-testid",r.componentId+"-toggle-open"),v(),g("componentConfigSignal",r.componentConfigSignal)("type",r.type)("template",r.template),w("data-testid",r.componentId+"-toggle-close")}}function pQe(n,o){if(n&1&&(C(0),p(1,uQe,4,11,"ng-container",2),b()),n&2){let r=s().ngIf,e=s();v(),g("veltDynamicTemplate",j(4,gQe,e.template,E(1,mQe,e.componentConfigSignal,e.type),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function hQe(n,o){if(n&1&&(C(0),p(1,pQe,2,10,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,vQe,r.conditionSignal(),J(1,dQe,r.componentConfigSignal)))}}var $S=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.type="audio",this.componentId="velt-media-source-settings-toggle-icon",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-toggle-icon-internal"]],inputs:{type:"type"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings--toggle-icon"],[3,"componentConfigSignal","type","template"]],template:function(t,i){t&1&&p(0,hQe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},encapsulation:2,changeDetection:0});let n=o;return n})();var fQe=n=>({componentConfigSignal:n}),CQe=(n,o)=>({condition:n,data:o}),bQe=n=>({componentConfigSignal:n,type:"video"}),_Qe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-media-source-settings-video-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function SQe(n,o){if(n&1&&(C(0),f(1,"div",5)(2,"div",6),se(),f(3,"svg",7),D(4,"path",8)(5,"path",9),S()(),St(),D(6,"velt-media-source-settings-selected-label-internal",10)(7,"velt-media-source-settings-toggle-icon-internal",10),S(),D(8,"velt-media-source-settings-divider-internal",10)(9,"velt-media-source-settings-options-internal",10),b()),n&2){let r=s(4);v(),w("aria-hidden","true"),v(5),g("componentConfigSignal",r.componentConfigSignal)("template",r.template),w("data-testid",r.componentId+"-label"),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template),w("data-testid",r.componentId+"-toggle"),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template),w("data-testid",r.componentId+"-divider"),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template),w("data-testid",r.componentId+"-options")}}function yQe(n,o){if(n&1){let r=Z();f(0,"div",3),R(1,"translate"),z("clickOutside",function(){L(r);let t=s(2).ngIf;return U(t.closeVideoDropdown())})("click",function(t){L(r);let i=s(2).ngIf;return U(i.toggleVideoPermission(t))}),p(2,SQe,10,13,"ng-container",4),S()}if(n&2){let r=s(2).ngIf,e=s();pe("velt-media-source-settings-video--active",r.isVideoPermissionOpen),w("data-testid",e.componentId)("role","button")("aria-expanded",r.isVideoPermissionOpen)("aria-haspopup","listbox")("aria-label",F(1,9,"Video settings"))("tabindex",0),v(2),g("veltDynamicTemplate",j(13,_Qe,e.template,J(11,bQe,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function kQe(n,o){if(n&1&&(C(0),p(1,yQe,3,19,"div",2),b()),n&2){let r=s().ngIf;v(),g("ngIf",r.settingsVisible==null?null:r.settingsVisible.video)}}function xQe(n,o){if(n&1&&(C(0),p(1,kQe,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,CQe,r.conditionSignal(),J(1,fQe,r.componentConfigSignal)))}}var tA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-media-source-settings-video",super.initializeComponentConfigSignal(new Wi)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsVideoComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsVideoComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsVideoComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-video-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-media-source-settings-video","snippylyClickOutside","",3,"velt-media-source-settings-video--active","clickOutside","click",4,"ngIf"],["snippylyClickOutside","",1,"velt-media-source-settings-video",3,"clickOutside","click"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-video-trigger"],[1,"velt-media-source-settings-video-trigger-icon"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M10 6.66675L13.0353 5.14941C13.1369 5.09864 13.2499 5.07467 13.3633 5.07978C13.4768 5.08489 13.5871 5.11891 13.6837 5.17862C13.7804 5.23832 13.8602 5.32173 13.9155 5.42093C13.9709 5.52012 13.9999 5.63182 14 5.74541V10.2547C13.9999 10.3683 13.9709 10.48 13.9155 10.5792C13.8602 10.6784 13.7804 10.7618 13.6837 10.8215C13.5871 10.8812 13.4768 10.9153 13.3633 10.9204C13.2499 10.9255 13.1369 10.9015 13.0353 10.8507L10 9.33341V6.66675Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["d","M2 5.33333C2 4.97971 2.14048 4.64057 2.39052 4.39052C2.64057 4.14048 2.97971 4 3.33333 4H8.66667C9.02029 4 9.35943 4.14048 9.60948 4.39052C9.85952 4.64057 10 4.97971 10 5.33333V10.6667C10 11.0203 9.85952 11.3594 9.60948 11.6095C9.35943 11.8595 9.02029 12 8.66667 12H3.33333C2.97971 12 2.64057 11.8595 2.39052 11.6095C2.14048 11.3594 2 11.0203 2 10.6667V5.33333Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["type","video",3,"componentConfigSignal","template"]],template:function(t,i){t&1&&p(0,xQe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:[".velt-media-source-settings-video[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);margin:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-md);display:flex;flex-direction:column;align-items:center;box-sizing:border-box}.velt-media-source-settings-video[_ngcontent-%COMP%]:hover{background:var(--velt-background-3)}.velt-media-source-settings-video--active[_ngcontent-%COMP%]{background:var(--velt-background-2)}.velt-media-source-settings-video-trigger[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--velt-spacing-md);align-items:center;cursor:pointer}.velt-media-source-settings-video-trigger[_ngcontent-%COMP%] .velt-media-source-settings-video-trigger-icon[_ngcontent-%COMP%]{display:flex;padding:1px;color:var(--velt-text-3)}.velt-media-source-settings-video-trigger[_ngcontent-%COMP%] .velt-media-source-settings-video-trigger-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{max-width:none}"],changeDetection:0});let n=o;return n})();var $_e=n=>({componentConfigSignal:n}),IQe=(n,o)=>({condition:n,data:o}),EQe=(n,o,r,e,t)=>({template:n,context:o,cloneTemplate:!0,componentName:"velt-media-source-settings-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function wQe(n,o){n&1&&et(0)}function TQe(n,o){if(n&1&&(f(0,"velt-shadow-dom-internal"),p(1,wQe,1,0,"ng-container",4),S()),n&2){s();let r=Ee(3);v(),g("ngTemplateOutlet",r)}}function DQe(n,o){if(n&1&&(C(0),f(1,"div",8),D(2,"velt-media-source-settings-audio-internal",9)(3,"velt-media-source-settings-video-internal",9),S(),b()),n&2){let r=s(5);v(),w("role","group")("aria-label","Media settings controls"),v(),g("componentConfigSignal",r.componentConfigSignal),w("data-testid",r.componentId+"-audio")("role","region")("aria-label","Audio settings"),v(),g("componentConfigSignal",r.componentConfigSignal),w("data-testid",r.componentId+"-video")("role","region")("aria-label","Video settings")}}function OQe(n,o){if(n&1&&(f(0,"div",6),R(1,"translate"),p(2,DQe,4,10,"ng-container",7),S()),n&2){let r=s(3).ngIf,e=s();w("data-testid",e.componentId)("role","dialog")("aria-label",F(1,5,"Media source settings"))("aria-modal","true"),v(2),g("veltDynamicTemplate",j(9,EQe,e.template,J(7,$_e,e.componentConfigSignal),r==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function AQe(n,o){if(n&1&&p(0,OQe,3,15,"div",5),n&2){let r=s(2).ngIf;g("ngIf",r.isOpen||r.settingsEmbedded)}}function MQe(n,o){if(n&1&&(C(0),p(1,TQe,2,1,"velt-shadow-dom-internal",3)(2,AQe,1,1,"ng-template",null,0,Ve),b()),n&2){let r=Ee(3),e=s().ngIf,t=s();v(),g("ngIf",e.shadowDom&&!t.template||t.template&&t.isExplicitShadowDom)("ngIfElse",r)}}function PQe(n,o){if(n&1&&(C(0),p(1,MQe,4,2,"ng-container",2),b()),n&2){let r=s();v(),g("veltIf",E(3,IQe,r.conditionSignal(),J(1,$_e,r.componentConfigSignal)))}}var nA=(()=>{let o=class o extends me{set shadowDom(e){this._shadowDom=e}get shadowDom(){return this._shadowDom}constructor(e,t,i,a,l,c){super(a,l,e),this.loggingService=e,this.wireframeService=t,this.devicePermissionService=i,this.elementRef=a,this.dynamicDataService=l,this.recorderService=c,this.isOpen=!1,this.showMicSettings=!0,this.showCamSettings=!0,this.config={},this._shadowDom=!0,this.isExplicitShadowDom=!1,this.devices=[],this.defaultMediaSourceOptions=cv(),this.subscriptions=[],this.veltElement=!0,this.componentConfigSignal=De({toggleAudioPermission:this.toggleAudioPermission.bind(this),selectAudioDevice:this.selectAudioDevice.bind(this),toggleVideoPermission:this.toggleVideoPermission.bind(this),selectVideoDevice:this.selectVideoDevice.bind(this),isAudioPermissionOpen:!1,settingsVisible:{audio:!0,video:!0},selectedAudioDevice:void 0,selectedVideoDevice:void 0,isVideoPermissionOpen:!1,audioDevices:[],videoDevices:[],shadowDom:this.shadowDom,isOpen:this.isOpen,variant:this.variant,settingsEmbedded:!1,closeVideoDropdown:this.closeVideoDropdown.bind(this),closeAudioDropdown:this.closeAudioDropdown.bind(this)}),this.componentId="velt-media-source-settings";try{this.getDevices(),this.subscriptions.push(this.devicePermissionService.getPermissionState$("video").subscribe(d=>{this.getDevices()})),this.subscriptions.push(this.devicePermissionService.getPermissionState$("audio").subscribe(d=>{this.getDevices()})),this.subscriptions.push(this.recorderService.getSettingsEmbedded$().subscribe(d=>{this.componentConfigSignal.update(m=>y(h({},m),{settingsEmbedded:d}))}))}catch(d){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent constructor: ",d)}}ngOnInit(){try{super.ngOnInit();let e=this.elementRef.nativeElement,t=e.getAttribute("shadow-dom")??e.getAttribute("shadowdom");this.isExplicitShadowDom=t!==null&&t!=="false",this.setupA11yAttributes(),this.updateSettingsVisibility(),this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let i="velt-media-source-settings-wireframe";this.variant&&(i+=`---${this.variant}`),this.wireframeService.getWireframe$(i).subscribe(a=>{if(a){let l=document.createElement(a.tagName);l.innerHTML=a.innerHTML,this.template=l}})}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=y(h({},i),{[t]:e[t].currentValue}),i))}),(e.showMicSettings||e.showCamSettings)&&this.updateSettingsVisibility()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnChanges: ",t)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnDestroy: ",e)}}updateSettingsVisibility(){try{this.componentConfigSignal.update(e=>y(h({},e),{settingsVisible:{audio:this.showMicSettings,video:this.showCamSettings}}))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnChanges: ",e)}}getDevices(){return X(this,null,function*(){try{let e=new pr;if(e.getBrowserName()?.toLowerCase()==="safari"||e.getBrowserName()?.toLowerCase()==="firefox")try{let t=yield navigator.mediaDevices.getUserMedia({audio:!0,video:!0});t&&t.getTracks().forEach(i=>i.stop())}catch(t){this.loggingService.catch("Error in MediaSourceSettingsComponent getDevices getUserMedia catch: ",t)}navigator.mediaDevices.enumerateDevices().then(t=>{if(this.devices=t.filter(i=>i.kind==="audioinput"||i.kind==="videoinput"),this.componentConfigSignal.update(i=>y(h({},i),{audioDevices:this.devices.filter(a=>a.kind==="audioinput"&&a.deviceId!==""),videoDevices:this.devices.filter(a=>a.kind==="videoinput"&&a.deviceId!=="")})),this.componentConfigSignal().audioDevices.length>0&&!this.componentConfigSignal().selectedAudioDevice){if(this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId){let i=this.componentConfigSignal().audioDevices.find(a=>a.deviceId===this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId);i&&this.componentConfigSignal.update(a=>y(h({},a),{selectedAudioDevice:i}))}this.componentConfigSignal().selectedAudioDevice||this.componentConfigSignal.update(i=>y(h({},i),{selectedAudioDevice:this.componentConfigSignal().audioDevices[0]}))}if(this.componentConfigSignal().videoDevices.length>0&&!this.componentConfigSignal().selectedVideoDevice){if(this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId){let i=this.componentConfigSignal().videoDevices.find(a=>a.deviceId===this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId);i&&this.componentConfigSignal.update(a=>y(h({},a),{selectedVideoDevice:i}))}this.componentConfigSignal().selectedVideoDevice||this.componentConfigSignal.update(i=>y(h({},i),{selectedVideoDevice:this.componentConfigSignal().videoDevices[0]}))}}).catch(t=>{this.loggingService.catch("Error in MediaSourceSettingsComponent getDevices enumerateDevices catch: ",t)})}catch(e){this.loggingService.catch("Error in MediaSourceSettingsComponent getDevices: ",e)}})}selectAudioDevice(e){try{this.componentConfigSignal.update(t=>y(h({},t),{selectedAudioDevice:e})),this.saveChanges()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectAudioDevice: ",t)}}selectVideoDevice(e){try{this.componentConfigSignal.update(t=>y(h({},t),{selectedVideoDevice:e})),this.saveChanges()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectVideoDevice: ",t)}}saveChanges(){try{let e={};this.componentConfigSignal()?.settingsVisible?.audio&&(e.selectedAudioDevice=this.componentConfigSignal()?.selectedAudioDevice),this.componentConfigSignal()?.settingsVisible?.video&&(e.selectedVideoDevice=this.componentConfigSignal()?.selectedVideoDevice),localStorage.setItem(N.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS,JSON.stringify(e||{})),this.defaultMediaSourceOptions=cv(),this.config.mediaConfig.audio||(this.config.mediaConfig.audio={enabled:!1}),this.config.mediaConfig.audio.deviceId=this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId,this.config.mediaConfig.video||(this.config.mediaConfig.video={enabled:!1}),this.config.mediaConfig.video.deviceId=this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId,this.config.updateMediaConfig(this.config.mediaConfig)}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent saveChanges: ",e)}}toggleAudioPermission(e){try{e.stopPropagation(),this.componentConfigSignal().audioDevices.length>0&&this.componentConfigSignal.update(t=>y(h({},t),{isAudioPermissionOpen:!t.isAudioPermissionOpen}))}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent toggleAudioPermission: ",t)}}toggleVideoPermission(e){try{e.stopPropagation(),this.componentConfigSignal().videoDevices.length>0&&this.componentConfigSignal.update(t=>(t=y(h({},t),{isVideoPermissionOpen:!t.isVideoPermissionOpen}),t))}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent toggleVideoPermission: ",t)}}closeVideoDropdown(){try{this.componentConfigSignal.update(e=>(e=y(h({},e),{isVideoPermissionOpen:!1}),e))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeVideoDropdown: ",e)}}closeAudioDropdown(){try{this.componentConfigSignal.update(e=>(e=y(h({},e),{isAudioPermissionOpen:!1}),e))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeAudioDropdown: ",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Xe),x(xm),x(Q),x(T),x(Un))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-internal"]],hostVars:1,hostBindings:function(t,i){t&2&&w("data-velt-element",i.veltElement)},inputs:{isOpen:"isOpen",showMicSettings:"showMicSettings",showCamSettings:"showCamSettings",config:"config",shadowDom:"shadowDom",variant:"variant"},standalone:!1,features:[V([T]),P,Qe],decls:1,vars:1,consts:[["mediaSourcePermissionRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-media-source-settings-container",4,"ngIf"],[1,"velt-media-source-settings-container"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&p(0,PQe,2,6,"ng-container",1),t&2&&g("ngIf",i.componentConfigSignal())},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}.velt-media-source-settings[_ngcontent-%COMP%]{position:absolute;left:0;bottom:90px;border-radius:var(--velt-border-radius-lg);background:var(--velt-background-1);display:flex;flex-direction:column;width:366px;font-weight:400;font-size:var(--velt-font-size-xs);line-height:18px;overflow:hidden}"],changeDetection:0});let n=o;return n})();var Gn=class{constructor(){this.closeDialog=()=>{},this.startCountdown=()=>{},this.toggleAudio=()=>{},this.toggleVideo=()=>{},this.toggleSettings=()=>{},this.cancelCountdown=()=>{},this.updateMediaConfig=()=>{},this.handleOverlayClick=()=>{},this.countdownStarted=!1,this.isSettingsOpen=!1,this.mediaConfig={audio:{enabled:!1},video:{enabled:!1}},this.mediaState={audio:{enabled:!1},video:{enabled:!1}},this.type="video",this.darkMode=!1,this.shadowDom=!0,this.isExplicitShadowDom=!1}};var RQe=n=>({componentConfigSignal:n}),NQe=(n,o)=>({condition:n,data:o}),FQe=(n,o)=>({componentConfigSignal:n,variant:o}),LQe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-audio-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function UQe(n,o){n&1&&et(0)}function VQe(n,o){if(n&1&&(f(0,"velt-shadow-dom-internal"),p(1,UQe,1,0,"ng-container",5),S()),n&2){s();let r=Ee(3);v(),g("ngTemplateOutlet",r)}}function BQe(n,o){if(n&1&&(C(0),f(1,"div",9)(2,"div",10),D(3,"app-recording-preview-steps-dialog-close-button",11),S(),D(4,"app-recording-preview-steps-dialog-timer",11)(5,"app-recording-preview-steps-dialog-waveform",12),f(6,"div",13),D(7,"velt-recording-preview-steps-dialog-settings-panel-internal",12),f(8,"app-recording-preview-steps-dialog-button-panel",11),D(9,"app-recording-preview-steps-dialog-start-recording",11)(10,"velt-recording-preview-steps-dialog-mic-button-internal",11)(11,"app-recording-preview-steps-dialog-settings",11),S(),D(12,"app-recording-preview-steps-dialog-bottom-panel",11),S()(),b()),n&2){let r=s(5);v(),w("data-testid",r.componentId+"-overlay"),v(),w("data-testid",r.componentId+"-header"),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal),v(),w("data-testid",r.componentId+"-settings")("role","group")("aria-label","Recording settings"),v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant)}}function jQe(n,o){if(n&1){let r=Z();f(0,"div",7,1),R(2,"translate"),z("pointerdown",function(t){return L(r),U(t.stopPropagation())})("pointerup",function(t){return L(r),U(t.stopPropagation())})("click",function(t){L(r);let i=s(3).ngIf;return U(i.handleOverlayClick(t))}),p(3,BQe,13,28,"ng-container",8),S()}if(n&2){let r=s(4);w("data-testid",r.componentId)("role","dialog")("aria-label",F(2,4,"Audio recording preview")),v(3),g("veltDynamicTemplate",j(9,LQe,r.template,E(6,FQe,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function $Qe(n,o){if(n&1&&p(0,jQe,4,15,"div",6),n&2){let r=s(2).ngIf;g("ngIf",r.type==="audio")}}function GQe(n,o){if(n&1&&(C(0),p(1,VQe,2,1,"velt-shadow-dom-internal",4)(2,$Qe,1,1,"ng-template",null,0,Ve),b()),n&2){let r=Ee(3),e=s().ngIf,t=s();v(),g("ngIf",e.shadowDom&&!t.template||t.template&&e.isExplicitShadowDom)("ngIfElse",r)}}function HQe(n,o){if(n&1&&(C(0),p(1,GQe,4,2,"ng-container",3),b()),n&2){let r=s();v(),g("veltIf",E(3,NQe,r.conditionSignal(),J(1,RQe,r.componentConfigSignal)))}}var rA=(()=>{let o=class o extends me{constructor(e,t,i,a){super(i,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=i,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-audio",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-recording-preview-steps-dialog-audio-wireframe";this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let i=document.createElement(t.tagName);i.innerHTML=t.innerHTML,this.template=i}})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogAudioComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogAudioComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogAudioComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Xe),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-audio"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[["audioDialogRef",""],["recordingPreviewDialogRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-recording-preview-audio",3,"pointerdown","pointerup","click",4,"ngIf"],[1,"velt-recording-preview-audio",3,"pointerdown","pointerup","click"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-audio--overlay"],[1,"velt-recording-preview-audio--header"],[3,"componentConfigSignal","template","variant"],[3,"componentConfigSignal"],[1,"velt-recording-preview-audio--settings"]],template:function(t,i){t&1&&p(0,HQe,2,6,"ng-container",2),t&2&&g("ngIf",i.componentConfigSignal())},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%]{width:100%;height:100%}.velt-recording-preview-audio[_ngcontent-%COMP%], .velt-recording-preview-audio--header[_ngcontent-%COMP%]{display:flex}.velt-recording-preview-audio[_ngcontent-%COMP%]{position:relative;width:calc((50rem + 0px) * var(--velt-base-rem-unit));height:calc((30rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}.velt-recording-preview-audio[_ngcontent-%COMP%] .velt-recording-preview-audio--audio-waves[_ngcontent-%COMP%]{transform:scale(1.5);height:100%;z-index:-1}@media screen and (max-width: 768px){.velt-recording-preview-audio[_ngcontent-%COMP%]{width:calc((35rem + 0px) * var(--velt-base-rem-unit));height:calc((25rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}}@media screen and (max-width: 425px){ .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog{width:calc(1 * var(--legacy-velt-viewport-width));max-width:calc(1 * var(--legacy-velt-viewport-width))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-audio{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));max-width:calc(1 * var(--legacy-velt-viewport-width));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-audio video{height:100%}}.velt-recording-preview-audio--overlay[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:var(--velt-spacing-2xl);content:"";position:absolute;border-radius:var(--velt-border-radius-lg);border:1px solid var(--velt-border-2);background:var(--velt-background-0);z-index:1;inset:0}.velt-recording-preview-audio--header[_ngcontent-%COMP%]{justify-content:flex-end;width:100%;gap:var(--velt-spacing-sm);align-items:center}.velt-recording-preview-audio--settings[_ngcontent-%COMP%]{width:366px;display:flex;flex-direction:column;gap:var(--velt-spacing-lg);align-items:center;justify-content:center;position:relative;pointer-events:auto}'],changeDetection:0});let n=o;return n})();var zQe=n=>({componentConfigSignal:n}),WQe=(n,o)=>({condition:n,data:o}),qQe=(n,o)=>({componentConfigSignal:n,variant:o}),YQe=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-close-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function KQe(n,o){if(n&1&&(C(0),f(1,"div",5),se(),f(2,"svg",6),D(3,"path",7),S()(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-icon")}}function ZQe(n,o){if(n&1){let r=Z();f(0,"div",3),R(1,"translate"),z("click",function(){L(r);let t=s(2).ngIf;return U(t.closeDialog())}),p(2,KQe,4,1,"ng-container",4),S()}if(n&2){let r=s(3);w("data-testid",r.componentId)("aria-label",F(1,3,"Cancel recording")),v(2),g("veltDynamicTemplate",j(8,YQe,r.template,E(5,qQe,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function JQe(n,o){if(n&1&&(C(0),p(1,ZQe,3,14,"div",2),b()),n&2){let r=s().ngIf;v(),g("ngIf",r.countdownStarted)}}function XQe(n,o){if(n&1&&(C(0),p(1,JQe,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,WQe,r.conditionSignal(),J(1,zQe,r.componentConfigSignal)))}}var oA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-bottom-panel-close",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCloseComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCloseComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Close recording preview")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCloseComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel-close"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-recording-preview--bottom-panel-close","role","button","tabindex","0",3,"click",4,"ngIf"],["role","button","tabindex","0",1,"velt-recording-preview--bottom-panel-close",3,"click"],[4,"veltDynamicTemplate"],["aria-hidden","true",1,"velt-recording-preview--close"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","role","img","aria-hidden","true"],["d","M12 3.99805L4 11.998M4 3.99805L12 11.998","stroke","currentColor","stroke-width","1.33333","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){t&1&&p(0,XQe,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:[".velt-recording-preview--close[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm);cursor:pointer;display:flex;color:var(--velt-text-12);transition:all .2s ease}.velt-recording-preview--close[_ngcontent-%COMP%]:hover{color:var(--velt-text-10)}"],changeDetection:0});let n=o;return n})();var QQe=n=>({componentConfigSignal:n}),eet=(n,o)=>({condition:n,data:o}),tet=(n,o)=>({componentConfigSignal:n,variant:o}),net=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-countdown-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function ret(n,o){if(n&1&&(f(0,"div",4),oe(1),S()),n&2){let r=s(3).ngIf,e=s();w("data-testid",e.componentId)("aria-label","Recording starts in "+r.countdown+" seconds"),v(),we(" ",r.countdown," ")}}function oet(n,o){if(n&1&&(C(0),p(1,ret,2,3,"div",3),b()),n&2){let r=s(2).ngIf;v(),g("ngIf",r.countdownStarted)}}function iet(n,o){if(n&1&&(C(0),p(1,oet,2,1,"ng-container",2),b()),n&2){let r=s(2);v(),g("veltDynamicTemplate",j(4,net,r.template,E(1,tet,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function aet(n,o){if(n&1&&(C(0),p(1,iet,2,10,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,eet,r.conditionSignal(),J(1,QQe,r.componentConfigSignal)))}}var iA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-bottom-panel-countdown",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCountdownComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCountdownComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCountdownComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel-countdown"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-recording-preview--countdown","role","timer","aria-live","polite",4,"ngIf"],["role","timer","aria-live","polite",1,"velt-recording-preview--countdown"]],template:function(t,i){t&1&&p(0,aet,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:[".velt-recording-preview--countdown[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;font-size:var(--velt-font-size-sm);font-weight:500;color:var(--velt-text-4)}"],changeDetection:0});let n=o;return n})();var cet=n=>({componentConfigSignal:n}),set=(n,o)=>({condition:n,data:o}),lee=(n,o)=>({componentConfigSignal:n,variant:o}),cee=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-icon-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function det(n,o){if(n&1&&(C(0),f(1,"div",5),se(),f(2,"svg",6),D(3,"path",7)(4,"path",8),S()(),b()),n&2){let r=s(5);v(),w("data-testid",r.componentId+"-video")}}function vet(n,o){if(n&1&&(C(0),p(1,det,5,1,"ng-container",4),b()),n&2){let r=s(4);v(),g("veltDynamicTemplate",j(4,cee,r.template,E(1,lee,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function met(n,o){if(n&1&&(C(0),f(1,"div",9),se(),f(2,"svg",6),D(3,"path",10),S()(),b()),n&2){let r=s(5);v(),w("data-testid",r.componentId+"-screen")}}function get(n,o){if(n&1&&(C(0),p(1,met,4,1,"ng-container",4),b()),n&2){let r=s(4);v(),g("veltDynamicTemplate",j(4,cee,r.template,E(1,lee,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function uet(n,o){if(n&1&&(C(0),f(1,"div",11),se(),f(2,"svg",6),D(3,"path",12),S()(),b()),n&2){let r=s(5);v(),w("data-testid",r.componentId+"-audio")}}function pet(n,o){if(n&1&&(C(0),p(1,uet,4,1,"ng-container",4),b()),n&2){let r=s(4);v(),g("veltDynamicTemplate",j(4,cee,r.template,E(1,lee,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function het(n,o){if(n&1&&(C(0)(1,2),f(2,"div"),p(3,vet,2,10,"ng-container",3)(4,get,2,10,"ng-container",3)(5,pet,2,10,"ng-container",3),S(),b()()),n&2){let r=s(2).ngIf,e=s();v(),g("ngSwitch",r.type),v(),pe("velt-recording-preview--recording-started",r.countdownStarted),w("data-testid",e.componentId),v(),g("ngSwitchCase","video"),v(),g("ngSwitchCase","screen"),v(),g("ngSwitchCase","audio")}}function fet(n,o){if(n&1&&(C(0),p(1,het,6,7,"ng-container",0),b()),n&2){let r=s().ngIf,e=s();v(),g("ngIf",!e.type||e.type===r.type)}}function Cet(n,o){if(n&1&&(C(0),p(1,fet,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,set,r.conditionSignal(),J(1,cet,r.componentConfigSignal)))}}var aA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-bottom-panel-icon",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label",`${this.type||""} recording icon`)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel-icon"]],inputs:{type:"type",variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"veltDynamicTemplate"],["role","img","aria-label","Video recording icon | translate",1,"velt-recording-preview--bottom-panel-icon"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M14.6657 10.2226L18.7128 8.19949C18.8483 8.13179 18.9988 8.09983 19.1501 8.10664C19.3014 8.11346 19.4485 8.15882 19.5773 8.23843C19.7062 8.31803 19.8126 8.42924 19.8864 8.56151C19.9602 8.69377 19.9989 8.8427 19.999 8.99415V15.0066C19.9989 15.1581 19.9602 15.307 19.8864 15.4392C19.8126 15.5715 19.7062 15.6827 19.5773 15.7623C19.4485 15.8419 19.3014 15.8873 19.1501 15.8941C18.9988 15.9009 18.8483 15.869 18.7128 15.8013L14.6657 13.7782V10.2226Z","stroke","white","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M3.99902 8.44428C3.99902 7.97279 4.18632 7.5206 4.51972 7.1872C4.85312 6.8538 5.30531 6.6665 5.7768 6.6665H12.8879C13.3594 6.6665 13.8116 6.8538 14.145 7.1872C14.4784 7.5206 14.6657 7.97279 14.6657 8.44428V15.5554C14.6657 16.0269 14.4784 16.4791 14.145 16.8125C13.8116 17.1459 13.3594 17.3332 12.8879 17.3332H5.7768C5.30531 17.3332 4.85312 17.1459 4.51972 16.8125C4.18632 16.4791 3.99902 16.0269 3.99902 15.5554V8.44428Z","stroke","white","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["role","img","aria-label","Screen recording icon | translate",1,"velt-recording-preview--bottom-panel-icon"],["d","M18.5 12.0004V14.1671C18.5 14.3586 18.4239 14.5423 18.2885 14.6778C18.153 14.8132 17.9693 14.8893 17.7778 14.8893H6.22222C6.03068 14.8893 5.84698 14.8132 5.71153 14.6778C5.57609 14.5423 5.5 14.3586 5.5 14.1671V6.94488C5.5 6.75333 5.57609 6.56963 5.71153 6.43419C5.84698 6.29875 6.03068 6.22266 6.22222 6.22266H12.7222M8.38889 17.7782H15.6111M9.83333 14.8893V17.7782M14.1667 14.8893V17.7782M15.6111 6.22266H18.5M18.5 6.22266V9.11155M18.5 6.22266L14.8889 9.83377","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["role","img","aria-label","Audio recording icon | translate",1,"velt-recording-preview--bottom-panel-icon"],["d","M7 10.4291C7 11.7552 7.52678 13.027 8.46447 13.9647C9.40215 14.9023 10.6739 15.4291 12 15.4291M12 15.4291C13.3261 15.4291 14.5979 14.9023 15.5355 13.9647C16.4732 13.027 17 11.7552 17 10.4291M12 15.4291V18.2863M9.14286 18.2863H14.8571M9.85714 6.8577C9.85714 6.28938 10.0829 5.74434 10.4848 5.34247C10.8866 4.94061 11.4317 4.71484 12 4.71484C12.5683 4.71484 13.1134 4.94061 13.5152 5.34247C13.9171 5.74434 14.1429 6.28938 14.1429 6.8577V10.4291C14.1429 10.9975 13.9171 11.5425 13.5152 11.9444C13.1134 12.3462 12.5683 12.572 12 12.572C11.4317 12.572 10.8866 12.3462 10.4848 11.9444C10.0829 11.5425 9.85714 10.9975 9.85714 10.4291V6.8577Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){t&1&&p(0,Cet,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:[".velt-recording-preview--bottom-panel-icon[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);background:var(--velt-accent);border-radius:var(--velt-border-radius-full);display:flex;margin-right:var(--velt-spacing-md);color:var(--velt-accent-foreground)}.velt-recording-preview--recording-started[_ngcontent-%COMP%] .velt-recording-preview--bottom-panel-icon[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm)}"],changeDetection:0});let n=o;return n})();var bet=n=>({componentConfigSignal:n}),_et=(n,o)=>({condition:n,data:o}),yet=(n,o)=>({componentConfigSignal:n,variant:o}),ket=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function xet(n,o){if(n&1&&(f(0,"div",6),oe(1),R(2,"translate"),D(3,"app-recording-preview-steps-dialog-bottom-panel-countdown",4),S()),n&2){let r=s(4);w("data-testid",r.componentId+"-countdown"),v(),we(" ",F(2,5,"Starting recording in")," "),v(2),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant)}}function Iet(n,o){if(n&1&&(C(0),f(1,"div",3),R(2,"translate"),D(3,"app-recording-preview-steps-dialog-bottom-panel-icon",4),p(4,xet,4,7,"div",5),D(5,"app-recording-preview-steps-dialog-bottom-panel-close",4),S(),b()),n&2){let r=s(2).ngIf,e=s();v(),pe("velt-recording-preview--recording-started",r.countdownStarted),w("data-testid",e.componentId)("aria-label",F(2,11,"Recording preview bottom panel")),v(2),g("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),v(),g("ngIf",r.countdownStarted),v(),g("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function Eet(n,o){if(n&1&&(C(0),p(1,Iet,6,13,"ng-container",2),b()),n&2){let r=s(2);v(),g("veltDynamicTemplate",j(4,ket,r.template,E(1,yet,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function wet(n,o){if(n&1&&(C(0),p(1,Eet,2,10,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,_et,r.conditionSignal(),J(1,bet,r.componentConfigSignal)))}}var GS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-bottom-panel",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording controls bottom panel")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-recording-preview--bottom-panel"],[3,"componentConfigSignal","template","variant"],["class","velt-recording-preview--countdown","role","status","aria-live","polite",4,"ngIf"],["role","status","aria-live","polite",1,"velt-recording-preview--countdown"]],template:function(t,i){t&1&&p(0,wet,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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:fixed;bottom:5%}.velt-recording-preview--bottom-panel[_ngcontent-%COMP%]{opacity:0;animation:_ngcontent-%COMP%_showAfterDelay .4s forwards}@keyframes _ngcontent-%COMP%_showAfterDelay{0%{opacity:0}99%{opacity:0}to{opacity:1}}.velt-recording-preview--recording-started[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;padding:var(--velt-spacing-xs) var(--velt-spacing-md) var(--velt-spacing-xs) var(--velt-spacing-xs);border-radius:var(--velt-border-radius-3xl);border:1px solid var(--velt-border-2);background:var(--velt-background-0);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.velt-recording-preview--countdown[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;font-size:var(--velt-font-size-sm);font-weight:500;color:var(--velt-text-4);gap:var(--velt-spacing-xs)}"],changeDetection:0});let n=o;return n})();var Tet=["*"],Det=n=>({componentConfigSignal:n}),Oet=(n,o)=>({condition:n,data:o}),Aet=(n,o)=>({componentConfigSignal:n,variant:o}),Met=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-button-panel-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Pet(n,o){n&1&&(C(0),Gt(1),b())}function Ret(n,o){if(n&1&&(f(0,"div",3),R(1,"translate"),p(2,Pet,2,0,"ng-container",4),S()),n&2){let r=s(3);w("data-testid",r.componentId)("aria-label",F(1,4,"Recording control buttons"))("aria-orientation","horizontal"),v(2),g("veltDynamicTemplate",j(9,Met,r.template,E(6,Aet,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function Net(n,o){if(n&1&&(C(0),p(1,Ret,3,15,"div",2),b()),n&2){let r=s().ngIf;v(),g("ngIf",!r.countdownStarted)}}function Fet(n,o){if(n&1&&(C(0),p(1,Net,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,Oet,r.conditionSignal(),J(1,Det,r.componentConfigSignal)))}}var HS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-button-panel",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogButtonPanelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogButtonPanelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Recording controls")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogButtonPanelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-button-panel"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],ngContentSelectors:Tet,decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-recording-preview-button-panel","role","toolbar",4,"ngIf"],["role","toolbar",1,"velt-recording-preview-button-panel"],[4,"veltDynamicTemplate"]],template:function(t,i){t&1&&(zt(),p(0,Fet,2,6,"ng-container",0)),t&2&&g("ngIf",i.componentConfigSignal())},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}.velt-recording-preview-button-panel[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--velt-spacing-sm);margin-bottom:var(--velt-spacing-lg)}"],changeDetection:0});let n=o;return n})();var Let=n=>({componentConfigSignal:n}),Uet=(n,o)=>({condition:n,data:o}),Vet=(n,o)=>({componentConfigSignal:n,variant:o}),Bet=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-camera-button-off-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function jet(n,o){if(n&1&&(C(0),se(),f(1,"svg",3),D(2,"path",4)(3,"path",5),S(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-icon")}}function $et(n,o){if(n&1&&(C(0),p(1,jet,4,1,"ng-container",2),b()),n&2){let r=s(3);v(),g("veltDynamicTemplate",j(4,Bet,r.template,E(1,Vet,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function Get(n,o){if(n&1&&(C(0),p(1,$et,2,10,"ng-container",0),b()),n&2){let r=s().ngIf;v(),g("ngIf",!(r.mediaConfig.video!=null&&r.mediaConfig.video.enabled))}}function Het(n,o){if(n&1&&(C(0),p(1,Get,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,Uet,r.conditionSignal(),J(1,Let,r.componentConfigSignal)))}}var lA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-camera-button-off",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOffComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOffComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Camera off"),e.setAttribute("aria-pressed","true"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOffComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-camera-button-off-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M20.9375 17.6068C21.1017 17.5503 21.2442 17.444 21.345 17.3027C21.4459 17.1614 21.5 16.9921 21.5 16.8184V11.1818C21.4999 11.0398 21.4636 10.9002 21.3944 10.7762C21.3252 10.6522 21.2255 10.5479 21.1047 10.4733C20.9839 10.3986 20.846 10.3561 20.7042 10.3497C20.5623 10.3433 20.4212 10.3733 20.2942 10.4368L16.5 12.3334V13.1668V10.6667C16.5 10.2246 16.3244 9.80072 16.0118 9.48816C15.6993 9.17559 15.2754 9 14.8333 9H12.3333M16.5 16.5V17.3333C16.5 17.7754 16.3244 18.1993 16.0118 18.5118C15.6993 18.8244 15.2754 19 14.8333 19H8.16667C7.72464 19 7.30072 18.8244 6.98816 18.5118C6.67559 18.1993 6.5 17.7754 6.5 17.3333V10.6667C6.5 10.2246 6.67559 9.80072 6.98816 9.48816C7.30072 9.17559 7.72464 9 8.16667 9H9","stroke","currentColor","stroke-opacity","0.52","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 6.5L21.5 21.5","stroke","#FF7162","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){t&1&&p(0,Het,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let n=o;return n})();var zet=n=>({componentConfigSignal:n}),Wet=(n,o)=>({condition:n,data:o}),qet=(n,o)=>({componentConfigSignal:n,variant:o}),Yet=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-camera-button-on-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Ket(n,o){if(n&1&&(C(0),se(),f(1,"svg",3),D(2,"path",4)(3,"path",5),S(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-icon")}}function Zet(n,o){if(n&1&&(C(0),p(1,Ket,4,1,"ng-container",2),b()),n&2){let r=s(3);v(),g("veltDynamicTemplate",j(4,Yet,r.template,E(1,qet,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function Jet(n,o){if(n&1&&(C(0),p(1,Zet,2,10,"ng-container",0),b()),n&2){let r=s().ngIf;v(),g("ngIf",r.mediaConfig.video==null?null:r.mediaConfig.video.enabled)}}function Xet(n,o){if(n&1&&(C(0),p(1,Jet,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,Wet,r.conditionSignal(),J(1,zet,r.componentConfigSignal)))}}var cA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-camera-button-on",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Camera on"),e.setAttribute("aria-pressed","false"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-camera-button-on-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M16.5 12.3334L20.2942 10.4368C20.4212 10.3733 20.5623 10.3433 20.7042 10.3497C20.846 10.3561 20.9839 10.3986 21.1047 10.4733C21.2255 10.5479 21.3252 10.6522 21.3944 10.7762C21.4636 10.9002 21.4999 11.0398 21.5 11.1818V16.8184C21.4999 16.9604 21.4636 17.1 21.3944 17.224C21.3252 17.348 21.2255 17.4523 21.1047 17.5269C20.9839 17.6016 20.846 17.6441 20.7042 17.6505C20.5623 17.6569 20.4212 17.6269 20.2942 17.5634L16.5 15.6668V12.3334Z","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 10.6667C6.5 10.2246 6.67559 9.80072 6.98816 9.48816C7.30072 9.17559 7.72464 9 8.16667 9H14.8333C15.2754 9 15.6993 9.17559 16.0118 9.48816C16.3244 9.80072 16.5 10.2246 16.5 10.6667V17.3333C16.5 17.7754 16.3244 18.1993 16.0118 18.5118C15.6993 18.8244 15.2754 19 14.8333 19H8.16667C7.72464 19 7.30072 18.8244 6.98816 18.5118C6.67559 18.1993 6.5 17.7754 6.5 17.3333V10.6667Z","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){t&1&&p(0,Xet,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let n=o;return n})();var Qet=n=>({componentConfigSignal:n}),ett=(n,o)=>({condition:n,data:o}),ttt=(n,o)=>({componentConfigSignal:n,variant:o}),ntt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-camera-button-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function rtt(n,o){if(n&1&&(C(0),f(1,"div",6),D(2,"velt-recording-preview-steps-dialog-camera-button-on-internal",7)(3,"velt-recording-preview-steps-dialog-camera-button-off-internal",7),S(),b()),n&2){let r=s(3).ngIf,e=s();v(),pe("velt-recording-preview--icon-button-off",!(r.mediaConfig.video!=null&&r.mediaConfig.video.enabled)),w("data-testid",e.componentId+"-icon-container"),v(),g("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),v(),g("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function ott(n,o){if(n&1){let r=Z();f(0,"app-device-permission-button",3)(1,"div",4),R(2,"translate"),R(3,"translate"),R(4,"translate"),z("click",function(){L(r);let t=s(2).ngIf;return U(t.toggleVideo())}),p(5,rtt,4,9,"ng-container",5),S()()}if(n&2){let r=s(2).ngIf,e=s();g("darkMode",!!r.darkMode),w("data-testid",e.componentId+"-permission-button"),v(),w("data-testid",e.componentId+"-toggle")("aria-label",F(2,6,"Toggle camera")+" "+(r.mediaConfig.video!=null&&r.mediaConfig.video.enabled?F(3,8,"off"):F(4,10,"on")))("aria-pressed",!!(r.mediaConfig.video!=null&&r.mediaConfig.video.enabled)),v(4),g("veltDynamicTemplate",j(15,ntt,e.template,E(12,ttt,e.componentConfigSignal,e.variant),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function itt(n,o){if(n&1&&(C(0),p(1,ott,6,21,"app-device-permission-button",2),b()),n&2){let r=s().ngIf;v(),g("ngIf",r.type==="screen")}}function att(n,o){if(n&1&&(C(0),p(1,itt,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,ett,r.conditionSignal(),J(1,Qet,r.componentConfigSignal)))}}var sA=(()=>{let o=class o extends me{constructor(e,t,i,a){super(i,a,t),this.devicePermissionService=e,this.loggingService=t,this.elementRef=i,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-camera-button",super.initializeComponentConfigSignal(new Gn)}ngOnChanges(e){try{if(e.componentConfigSignal){let t=this.componentConfigSignal();!t?.mediaState?.video?.enabled&&t.type==="video"&&this.devicePermissionService.openDevicePermissionDeniedDialog("video",{darkMode:!1})}}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonComponent ngOnChanges:",t)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),!this.componentConfigSignal()?.mediaState?.video?.enabled&&this.componentConfigSignal().type==="video"&&this.devicePermissionService.openDevicePermissionDeniedDialog("video",{darkMode:!1})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","group"),e.setAttribute("aria-label","Camera control buttons")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(xm),x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-camera-button-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P,Qe],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","video",3,"darkMode",4,"ngIf"],["type","video",3,"darkMode"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--icon-button"],[3,"componentConfigSignal","template","variant"]],template:function(t,i){t&1&&p(0,att,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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-recording-preview--icon-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-3xl);cursor:pointer;border:1.5px solid var(--velt-border-2);background:var(--velt-background-0);color:var(--velt-text-2);transition:all .2s ease}.velt-recording-preview--icon-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);color:var(--velt-text-3)}"],changeDetection:0});let n=o;return n})();var G_e=n=>({componentConfigSignal:n}),ltt=(n,o)=>({condition:n,data:o}),ctt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-mic-button-off-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function stt(n,o){if(n&1&&(C(0),se(),f(1,"svg",3),D(2,"path",4)(3,"path",5),S(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-icon")}}function dtt(n,o){if(n&1&&(C(0),p(1,stt,4,1,"ng-container",2),b()),n&2){let r=s(3);v(),g("veltDynamicTemplate",j(3,ctt,r.template,J(1,G_e,r.componentConfigSignal),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function vtt(n,o){if(n&1&&(C(0),p(1,dtt,2,9,"ng-container",0),b()),n&2){let r=s().ngIf;v(),g("ngIf",!(r.mediaConfig.audio!=null&&r.mediaConfig.audio.enabled))}}function mtt(n,o){if(n&1&&(C(0),p(1,vtt,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,ltt,r.conditionSignal(),J(1,G_e,r.componentConfigSignal)))}}var dA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-mic-button-off",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOffComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOffComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Microphone off"),e.setAttribute("aria-pressed","true"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOffComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-mic-button-off-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M11.5013 8.1665C11.5013 7.50346 11.7647 6.86758 12.2335 6.39874C12.7024 5.9299 13.3383 5.6665 14.0013 5.6665C14.6643 5.6665 15.3002 5.9299 15.7691 6.39874C16.2379 6.86758 16.5013 7.50346 16.5013 8.1665V12.3332C16.5013 12.58 16.4648 12.8254 16.393 13.0615M14.7263 14.7282C14.3527 14.8414 13.9578 14.8655 13.5732 14.7987C13.1885 14.7318 12.8249 14.5758 12.5114 14.3432C12.198 14.1105 11.9433 13.8077 11.7679 13.459C11.5925 13.1102 11.5012 12.7252 11.5013 12.3348V11.5015M8.16797 12.3332C8.16779 13.386 8.45252 14.4192 8.99198 15.3232C9.53144 16.2273 10.3055 16.9685 11.2321 17.4683C12.1587 17.9681 13.2033 18.2078 14.2551 18.162C15.3069 18.1162 16.3267 17.7866 17.2063 17.2082M18.873 15.5415C19.5012 14.5896 19.835 13.4737 19.833 12.3332M10.668 21.4998H17.3346M14.0013 18.1665V21.4998","stroke","currentColor","stroke-opacity","0.52","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 6.5L21.5 21.5","stroke","#FF7162","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){t&1&&p(0,mtt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let n=o;return n})();var H_e=n=>({componentConfigSignal:n}),gtt=(n,o)=>({condition:n,data:o}),utt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-mic-button-on-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function ptt(n,o){if(n&1&&(C(0),se(),f(1,"svg",3),D(2,"path",4),S(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-icon")}}function htt(n,o){if(n&1&&(C(0),p(1,ptt,3,1,"ng-container",2),b()),n&2){let r=s(3);v(),g("veltDynamicTemplate",j(3,utt,r.template,J(1,H_e,r.componentConfigSignal),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function ftt(n,o){if(n&1&&(C(0),p(1,htt,2,9,"ng-container",0),b()),n&2){let r=s().ngIf;v(),g("ngIf",r.mediaConfig.audio==null?null:r.mediaConfig.audio.enabled)}}function Ctt(n,o){if(n&1&&(C(0),p(1,ftt,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,gtt,r.conditionSignal(),J(1,H_e,r.componentConfigSignal)))}}var vA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-mic-button-on",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Microphone on"),e.setAttribute("aria-pressed","false"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-mic-button-on-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M8.16699 12.3332C8.16699 13.8803 8.78157 15.364 9.87554 16.458C10.9695 17.5519 12.4532 18.1665 14.0003 18.1665M14.0003 18.1665C15.5474 18.1665 17.0312 17.5519 18.1251 16.458C19.2191 15.364 19.8337 13.8803 19.8337 12.3332M14.0003 18.1665V21.4998M10.667 21.4998H17.3337M11.5003 8.1665C11.5003 7.50346 11.7637 6.86758 12.2326 6.39874C12.7014 5.9299 13.3373 5.6665 14.0003 5.6665C14.6634 5.6665 15.2993 5.9299 15.7681 6.39874C16.2369 6.86758 16.5003 7.50346 16.5003 8.1665V12.3332C16.5003 12.9962 16.2369 13.6321 15.7681 14.1009C15.2993 14.5698 14.6634 14.8332 14.0003 14.8332C13.3373 14.8332 12.7014 14.5698 12.2326 14.1009C11.7637 13.6321 11.5003 12.9962 11.5003 12.3332V8.1665Z","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){t&1&&p(0,Ctt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let n=o;return n})();var btt=n=>({componentConfigSignal:n}),_tt=(n,o)=>({condition:n,data:o}),Stt=(n,o)=>({componentConfigSignal:n,variant:o}),ytt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-mic-button-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function ktt(n,o){if(n&1&&(C(0),f(1,"div",5),D(2,"velt-recording-preview-steps-dialog-mic-button-on-internal",6)(3,"velt-recording-preview-steps-dialog-mic-button-off-internal",6),S(),b()),n&2){let r=s(2).ngIf,e=s();v(),pe("velt-recording-preview--icon-button-off",!(r.mediaConfig.audio!=null&&r.mediaConfig.audio.enabled)),w("data-testid",e.componentId+"-icon-container"),v(),g("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),v(),g("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function xtt(n,o){if(n&1){let r=Z();C(0),f(1,"app-device-permission-button",2)(2,"div",3),R(3,"translate"),R(4,"translate"),R(5,"translate"),z("click",function(){L(r);let t=s().ngIf;return U(t.toggleAudio())})("keydown.enter",function(){L(r);let t=s().ngIf;return U(t.toggleAudio())})("keydown.space",function(){L(r);let t=s().ngIf;return U(t.toggleAudio())}),p(6,ktt,4,9,"ng-container",4),S()(),b()}if(n&2){let r=s().ngIf,e=s();v(),g("darkMode",!!r.darkMode),w("data-testid",e.componentId+"-permission-button"),v(),w("data-testid",e.componentId+"-toggle")("aria-label",F(3,6,"Toggle microphone")+" "+(r.mediaConfig.audio!=null&&r.mediaConfig.audio.enabled?F(4,8,"off"):F(5,10,"on")))("aria-pressed",!!(r.mediaConfig.audio!=null&&r.mediaConfig.audio.enabled)),v(4),g("veltDynamicTemplate",j(15,ytt,e.template,E(12,Stt,e.componentConfigSignal,e.variant),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function Itt(n,o){if(n&1&&(C(0),p(1,xtt,7,21,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,_tt,r.conditionSignal(),J(1,btt,r.componentConfigSignal)))}}var zS=(()=>{let o=class o extends me{constructor(e,t,i,a){super(i,a,t),this.devicePermissionService=e,this.loggingService=t,this.elementRef=i,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-mic-button",super.initializeComponentConfigSignal(new Gn)}ngOnChanges(e){try{if(e.componentConfigSignal){let t=this.componentConfigSignal();!t?.mediaState?.audio?.enabled&&t.type==="audio"&&this.devicePermissionService.openDevicePermissionDeniedDialog("audio",{darkMode:!1})}}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonComponent ngOnChanges:",t)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),!this.componentConfigSignal()?.mediaState?.audio?.enabled&&this.componentConfigSignal().type==="audio"&&this.devicePermissionService.openDevicePermissionDeniedDialog("audio",{darkMode:!1})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","group"),e.setAttribute("aria-label","Microphone control buttons")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(xm),x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-mic-button-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P,Qe],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","audio",3,"darkMode"],["role","button","tabindex","0",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--icon-button"],[3,"componentConfigSignal","template","variant"]],template:function(t,i){t&1&&p(0,Itt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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}.velt-recording-preview--icon-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-3xl);cursor:pointer;border:1.5px solid var(--velt-border-2);background:var(--velt-background-0);color:var(--velt-text-2);transition:all .2s ease}.velt-recording-preview--icon-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);color:var(--velt-text-3)}"],changeDetection:0});let n=o;return n})();var z_e=n=>({componentConfigSignal:n}),Ett=(n,o)=>({condition:n,data:o}),wtt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-settings-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Ttt(n,o){if(n&1&&(C(0),f(1,"div",5),se(),f(2,"svg",6),D(3,"path",7)(4,"path",8),S()(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-icon-container"),v(),w("data-testid",r.componentId+"-icon")}}function Dtt(n,o){if(n&1){let r=Z();f(0,"div",3),R(1,"translate"),R(2,"translate"),R(3,"translate"),z("click",function(t){L(r);let i=s(2).ngIf;return U(i.toggleSettings(t))})("keydown.enter",function(t){L(r);let i=s(2).ngIf;return U(i.toggleSettings(t))})("keydown.space",function(t){L(r);let i=s(2).ngIf;return U(i.toggleSettings(t))}),p(4,Ttt,5,2,"ng-container",4),S()}if(n&2){let r=s(2).ngIf,e=s();pe("velt-recording-preview--settings-button-open",r.isSettingsOpen),w("data-testid",e.componentId+"-button")("aria-label",(r.isSettingsOpen?F(1,7,"Close"):F(2,9,"Open"))+" "+F(3,11,"recording settings"))("aria-expanded",r.isSettingsOpen)("aria-controls",e.componentId+"-panel"),v(4),g("veltDynamicTemplate",j(15,wtt,e.template,J(13,z_e,e.componentConfigSignal),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function Ott(n,o){if(n&1&&(C(0),p(1,Dtt,5,21,"div",2),b()),n&2){let r=s().ngIf;v(),g("ngIf",!r.countdownStarted)}}function Att(n,o){if(n&1&&(C(0),p(1,Ott,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,Ett,r.conditionSignal(),J(1,z_e,r.componentConfigSignal)))}}var WS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-settings",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording preview settings")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-settings"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"velt-recording-preview--settings-button-open","click","keydown.enter","keydown.space",4,"ngIf"],["role","button","tabindex","0",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--settings-button"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,i){t&1&&p(0,Att,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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}.velt-recording-preview--settings-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-full);cursor:pointer;border:1.5px solid var(--velt-border-2);background:var(--velt-background-0);color:var(--velt-text-2);transition:all .2s ease}.velt-recording-preview--settings-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);color:var(--velt-text-3)}.velt-recording-preview--settings-button-open[_ngcontent-%COMP%]{background:var(--velt-background-0);border-radius:var(--velt-border-radius-full)}.velt-recording-preview--settings-button-open[_ngcontent-%COMP%] .velt-recording-preview--settings-button[_ngcontent-%COMP%]{color:var(--velt-accent);border:1.5px solid var(--velt-accent-transparent);background:var(--velt-accent-transparent)}"],changeDetection:0});let n=o;return n})();var W_e=n=>({componentConfigSignal:n}),Mtt=(n,o)=>({condition:n,data:o}),Ptt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-start-recording-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Rtt(n,o){if(n&1&&(C(0),f(1,"div",4),oe(2),R(3,"translate"),S(),b()),n&2){let r=s(3);v(),w("data-testid",r.componentId+"-label"),v(),we(" ",F(3,2,"Start Recording"))}}function Ntt(n,o){if(n&1){let r=Z();C(0),f(1,"div",2),z("click",function(){L(r);let t=s().ngIf;return U(t.startCountdown())}),p(2,Rtt,4,4,"ng-container",3),S(),b()}if(n&2){let r=s().ngIf,e=s();v(),pe("disabled",r.type==="video"&&(!(r.mediaConfig.video!=null&&r.mediaConfig.video.enabled)||!r.mediaState.video.enabled)||r.type==="audio"&&(!(r.mediaConfig.audio!=null&&r.mediaConfig.audio.enabled)||!r.mediaState.audio.enabled)),w("data-testid",e.componentId+"-button"),v(),g("veltDynamicTemplate",j(6,Ptt,e.template,J(4,W_e,e.componentConfigSignal),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function Ftt(n,o){if(n&1&&(C(0),p(1,Ntt,3,12,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,Mtt,r.conditionSignal(),J(1,W_e,r.componentConfigSignal)))}}var qS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-start-recording",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogStartRecordingComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogStartRecordingComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Start recording")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogStartRecordingComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-start-recording"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-start-button"]],template:function(t,i){t&1&&p(0,Ftt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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}.velt-recording-preview-start-button[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-sm);padding:var(--velt-spacing-lg) var(--velt-spacing-2xl);font-size:var(--velt-font-size-sm);font-weight:600;transition:all .2s ease;cursor:pointer;width:fit-content;border-radius:var(--velt-border-radius-full);background:var(--velt-accent);color:var(--velt-accent-foreground)}.velt-recording-preview-start-button[_ngcontent-%COMP%]:hover{background:var(--velt-accent-hover)}.disabled[_ngcontent-%COMP%]{opacity:.5;pointer-events:none}"],changeDetection:0});let n=o;return n})();var Ltt=n=>({componentConfigSignal:n}),Utt=(n,o)=>({condition:n,data:o}),Vtt=(n,o)=>({componentConfigSignal:n,variant:o}),Btt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-camera-off-message-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function jtt(n,o){if(n&1&&(C(0),f(1,"h1",5),R(2,"translate"),oe(3),R(4,"translate"),S(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId+"-text")("aria-label",F(2,3,"Camera is off")),v(2),Ye(F(4,5,"Camera is off"))}}function $tt(n,o){if(n&1&&(f(0,"div",3),p(1,jtt,5,7,"ng-container",4),S()),n&2){let r=s(3);w("data-testid",r.componentId),v(),g("veltDynamicTemplate",j(5,Btt,r.template,E(2,Vtt,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function Gtt(n,o){if(n&1&&(C(0),p(1,$tt,2,11,"div",2),b()),n&2){let r=s().ngIf;v(),g("ngIf",!r.countdownStarted&&(!(r.mediaConfig.video!=null&&r.mediaConfig.video.enabled)||!r.mediaState.video.enabled))}}function Htt(n,o){if(n&1&&(C(0),p(1,Gtt,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,Utt,r.conditionSignal(),J(1,Ltt,r.componentConfigSignal)))}}var mA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-camera-off-message",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","alert"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-camera-off-message"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","alert","aria-live","polite","aria-atomic","true",4,"ngIf"],["role","alert","aria-live","polite","aria-atomic","true"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-camera-off-message"]],template:function(t,i){t&1&&p(0,Htt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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}.velt-recording-preview-camera-off-message[_ngcontent-%COMP%]{font-size:var(--velt-font-size-lg);color:var(--velt-text-0);margin:0}"],changeDetection:0});let n=o;return n})();var q_e=n=>({componentConfigSignal:n}),ztt=(n,o)=>({condition:n,data:o}),Wtt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-close-button-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function qtt(n,o){if(n&1&&(C(0),f(1,"div",4),se(),f(2,"svg",5),D(3,"path",6),S()(),b()),n&2){let r=s(3);v(),w("data-testid",r.componentId+"-icon-container"),v(),w("data-testid",r.componentId+"-icon")}}function Ytt(n,o){if(n&1){let r=Z();C(0),f(1,"div",2),R(2,"translate"),z("click",function(){L(r);let t=s().ngIf;return U(t.closeDialog())})("keydown.enter",function(){L(r);let t=s().ngIf;return U(t.closeDialog())})("keydown.space",function(){L(r);let t=s().ngIf;return U(t.closeDialog())}),p(3,qtt,4,2,"ng-container",3),S(),b()}if(n&2){let r=s(2);v(),w("data-testid",r.componentId)("aria-label",F(2,3,"Close recording preview")),v(2),g("veltDynamicTemplate",j(7,Wtt,r.template,J(5,q_e,r.componentConfigSignal),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function Ktt(n,o){if(n&1&&(C(0),p(1,Ytt,4,13,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,ztt,r.conditionSignal(),J(1,q_e,r.componentConfigSignal)))}}var YS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-close-button",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCloseButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Close recording preview"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCloseButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-close-button"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--icon-button"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true",1,"velt-cursor-pointer"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z","fill","#fff"]],template:function(t,i){t&1&&p(0,Ktt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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}.velt-recording-preview--icon-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-3xl);cursor:pointer;border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);transition:all .2s ease}.velt-recording-preview--icon-button[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:var(--velt-text-4)}.velt-recording-preview--icon-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-4);background:var(--velt-background-2)}"],changeDetection:0});let n=o;return n})();var Y_e=n=>({componentConfigSignal:n}),Ztt=(n,o)=>({condition:n,data:o}),Jtt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-timer-cancel-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Xtt(n,o){if(n&1&&(C(0),f(1,"div",4),oe(2),R(3,"translate"),S(),b()),n&2){let r=s(3);v(),w("data-testid",r.componentId+"-label"),v(),we(" ",F(3,2,"Cancel")," ")}}function Qtt(n,o){if(n&1){let r=Z();C(0),f(1,"div",2),z("click",function(){L(r);let t=s().ngIf;return U(t.cancelCountdown())})("keydown.enter",function(){L(r);let t=s().ngIf;return U(t.cancelCountdown())})("keydown.space",function(){L(r);let t=s().ngIf;return U(t.cancelCountdown())}),p(2,Xtt,4,4,"ng-container",3),S(),b()}if(n&2){let r=s(2);v(),w("data-testid",r.componentId+"-button"),v(),g("veltDynamicTemplate",j(4,Jtt,r.template,J(2,Y_e,r.componentConfigSignal),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function ent(n,o){if(n&1&&(C(0),p(1,Qtt,3,10,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,Ztt,r.conditionSignal(),J(1,Y_e,r.componentConfigSignal)))}}var gA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-timer-cancel",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCancelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCancelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording countdown cancel controls")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCancelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-timer-cancel"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",1,"velt-recording-preview-timer--cancel-button",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-timer--cancel-button"]],template:function(t,i){t&1&&p(0,ent,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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:absolute;bottom:15%}.velt-recording-preview-timer--cancel-button[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-sm);font-weight:500;font-size:var(--velt-font-size-md);line-height:24px;color:var(--velt-error);text-transform:uppercase;letter-spacing:1.5px;cursor:pointer}.velt-recording-preview-timer--cancel-button[_ngcontent-%COMP%]:hover{color:var(--velt-error-hover)}"],changeDetection:0});let n=o;return n})();var K_e=n=>({componentConfigSignal:n}),tnt=(n,o)=>({condition:n,data:o}),nnt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-timer-countdown-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function rnt(n,o){if(n&1&&(f(0,"h1",4),oe(1),S()),n&2){let r=s(3).ngIf,e=s();w("data-testid",e.componentId+"-value"),v(),we(" ",r.countdown)}}function ont(n,o){if(n&1&&(C(0),p(1,rnt,2,2,"h1",3),b()),n&2){let r=s(2).ngIf;v(),g("ngIf",r.countdown)}}function int(n,o){if(n&1&&(C(0),p(1,ont,2,1,"ng-container",2),b()),n&2){let r=s(2);v(),g("veltDynamicTemplate",j(3,nnt,r.template,J(1,K_e,r.componentConfigSignal),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function ant(n,o){if(n&1&&(C(0),p(1,int,2,9,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,tnt,r.conditionSignal(),J(1,K_e,r.componentConfigSignal)))}}var uA=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-timer-countdown",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCountdownComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCountdownComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","timer"),e.setAttribute("aria-label","Recording countdown timer"),e.setAttribute("aria-live","assertive")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCountdownComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-timer-countdown"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-recording-preview-timer--countdown","role","timer","aria-live","assertive",4,"ngIf"],["role","timer","aria-live","assertive",1,"velt-recording-preview-timer--countdown"]],template:function(t,i){t&1&&p(0,ant,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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:absolute}.velt-recording-preview-timer--countdown[_ngcontent-%COMP%]{font-size:120px;line-height:120px;font-weight:600;color:var(--velt-text-5);margin:0}"],changeDetection:0});let n=o;return n})();var Z_e=n=>({componentConfigSignal:n}),lnt=(n,o)=>({condition:n,data:o}),cnt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-timer-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function snt(n,o){if(n&1&&(C(0),f(1,"div",3),D(2,"app-recording-preview-steps-dialog-timer-countdown",4)(3,"app-recording-preview-steps-dialog-timer-cancel",4),S(),b()),n&2){let r=s(4);v(),w("data-testid",r.componentId),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant)}}function dnt(n,o){if(n&1&&(C(0),p(1,snt,4,7,"ng-container",2),b()),n&2){let r=s(3);v(),g("veltDynamicTemplate",j(3,cnt,r.template,J(1,Z_e,r.componentConfigSignal),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function vnt(n,o){if(n&1&&(C(0),p(1,dnt,2,9,"ng-container",0),b()),n&2){let r=s().ngIf;v(),g("ngIf",r.countdownStarted)}}function mnt(n,o){if(n&1&&(C(0),p(1,vnt,2,1,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,lnt,r.conditionSignal(),J(1,Z_e,r.componentConfigSignal)))}}var KS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-timer",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording countdown section")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-timer"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region","aria-live","polite",1,"velt-recording-preview-dialog-timer"],[3,"componentConfigSignal","template","variant"]],template:function(t,i){t&1&&p(0,mnt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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-recording-preview-dialog-timer[_ngcontent-%COMP%]{position:relative;width:332px;height:332px;display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-lg);border-radius:100%;flex-direction:column;border:2px solid var(--velt-border-transparent);background:var(--velt-background-transparent);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}"],changeDetection:0});let n=o;return n})();var gnt=n=>({componentConfigSignal:n}),unt=(n,o)=>({condition:n,data:o}),pnt=(n,o)=>({componentConfigSignal:n,variant:o}),hnt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-video-player-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function fnt(n,o){if(n&1&&(C(0),D(1,"video",3),b()),n&2){let r=s(2).ngIf,e=s();v(),g("srcObject",r.mediaStream)("volume",0),w("data-testid",e.componentId)}}function Cnt(n,o){if(n&1&&(C(0),p(1,fnt,2,3,"ng-container",2),b()),n&2){let r=s(2);v(),g("veltDynamicTemplate",j(4,hnt,r.template,E(1,pnt,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function bnt(n,o){if(n&1&&(C(0),p(1,Cnt,2,10,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,unt,r.conditionSignal(),J(1,gnt,r.componentConfigSignal)))}}var pA=(()=>{let o=class o extends me{get isScreenStreamAvailable(){return!!this.componentConfigSignal()?.mediaConfig?.screen?.stream}constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-video-player",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoPlayerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoPlayerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Video preview")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoPlayerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-video-player"]],hostVars:2,hostBindings:function(t,i){t&2&&pe("velt-recording-preview-steps-dialog-screen-available",i.isScreenStreamAvailable)},inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["id","player","autoplay","","muted","true","playsinline","","webkit-playsinline","true","x-webkit-airplay","allow","role","application","aria-live","polite",1,"flip","velt-recording-preview-video--player",3,"srcObject","volume"]],template:function(t,i){t&1&&p(0,bnt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},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:block;width:100%;position:relative}.velt-recording-preview-steps-dialog-screen-available[_nghost-%COMP%]{position:absolute;bottom:20px;left:20px}.velt-recording-preview-steps-dialog-screen-available[_nghost-%COMP%] video[_ngcontent-%COMP%]{width:150px;height:150px;object-fit:cover;border-radius:var(--velt-border-radius-full)}video[_ngcontent-%COMP%]{width:100%;z-index:9999}.velt-recording-preview-video--player[_ngcontent-%COMP%]{object-fit:cover}"],changeDetection:0});let n=o;return n})();var _nt=n=>({componentConfigSignal:n}),Snt=(n,o)=>({condition:n,data:o}),ynt=()=>["video","screen"],knt=(n,o)=>({componentConfigSignal:n,variant:o}),xnt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-video-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Int(n,o){n&1&&et(0)}function Ent(n,o){if(n&1&&(f(0,"velt-shadow-dom-internal"),p(1,Int,1,0,"ng-container",5),S()),n&2){s();let r=Ee(3);v(),g("ngTemplateOutlet",r)}}function wnt(n,o){if(n&1&&(C(0),D(1,"app-recording-preview-steps-dialog-video-player",9)(2,"app-recording-preview-steps-dialog-screen-player",9),f(3,"div",10)(4,"div",11),D(5,"app-recording-preview-steps-dialog-waveform",9)(6,"app-recording-preview-steps-dialog-close-button",12),S(),D(7,"app-recording-preview-steps-dialog-timer",12)(8,"app-recording-preview-steps-dialog-camera-off-message",12),f(9,"div",13),D(10,"velt-recording-preview-steps-dialog-settings-panel-internal",9),f(11,"app-recording-preview-steps-dialog-button-panel",12),D(12,"app-recording-preview-steps-dialog-start-recording",12)(13,"velt-recording-preview-steps-dialog-mic-button-internal",12)(14,"velt-recording-preview-steps-dialog-camera-button-internal",12)(15,"app-recording-preview-steps-dialog-settings",12),S(),D(16,"app-recording-preview-steps-dialog-bottom-panel",12),S()(),b()),n&2){let r=s(5);v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal),v(),w("data-testid",r.componentId+"-overlay"),v(),w("data-testid",r.componentId+"-header"),v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),w("data-testid",r.componentId+"-settings"),v(),g("componentConfigSignal",r.componentConfigSignal),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant),v(),g("componentConfigSignal",r.componentConfigSignal)("template",r.template)("variant",r.variant)}}function Tnt(n,o){if(n&1){let r=Z();f(0,"div",7,1),z("pointerdown",function(t){return L(r),U(t.stopPropagation())})("pointerup",function(t){return L(r),U(t.stopPropagation())})("click",function(t){L(r);let i=s(3).ngIf;return U(i.handleOverlayClick(t))}),p(2,wnt,17,34,"ng-container",8),S()}if(n&2){let r=s(4);w("data-testid",r.componentId),v(2),g("veltDynamicTemplate",j(5,xnt,r.template,E(2,knt,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function Dnt(n,o){if(n&1&&p(0,Tnt,3,11,"div",6),n&2){let r=s(2).ngIf;g("ngIf",xt(1,ynt).includes(r.type))}}function Ont(n,o){if(n&1&&(C(0),p(1,Ent,2,1,"velt-shadow-dom-internal",4)(2,Dnt,1,2,"ng-template",null,0,Ve),b()),n&2){let r=Ee(3),e=s().ngIf,t=s();v(),g("ngIf",e.shadowDom&&!t.template||t.template&&e.isExplicitShadowDom)("ngIfElse",r)}}function Ant(n,o){if(n&1&&(C(0),p(1,Ont,4,2,"ng-container",3),b()),n&2){let r=s();v(),g("veltIf",E(3,Snt,r.conditionSignal(),J(1,_nt,r.componentConfigSignal)))}}var hA=(()=>{let o=class o extends me{constructor(e,t,i,a){super(i,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=i,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-video",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-recording-preview-steps-dialog-video-wireframe";super.ngOnInit(),this.setupA11yAttributes(),this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let i=document.createElement(t.tagName);i.innerHTML=t.innerHTML,this.template=i}})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent OnInit: ",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=y(h({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent ngOnChanges: ",t)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Video preview area")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Xe),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-video"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P,Qe],decls:1,vars:1,consts:[["videoDialogRef",""],["recordingPreviewDialogRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["role","dialog","class","velt-recording-preview-video",3,"pointerdown","pointerup","click",4,"ngIf"],["role","dialog",1,"velt-recording-preview-video",3,"pointerdown","pointerup","click"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],["role","region","aria-label","Video controls overlay",1,"velt-recording-preview-video--overlay"],["role","region","aria-label","Video header controls",1,"velt-recording-preview-video--header"],[3,"componentConfigSignal","template","variant"],["role","region","aria-label","Recording settings and controls",1,"velt-recording-preview-video--settings"]],template:function(t,i){t&1&&p(0,Ant,2,6,"ng-container",2),t&2&&g("ngIf",i.componentConfigSignal())},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%]{width:100%;height:100%}.velt-recording-preview-video[_ngcontent-%COMP%], .velt-recording-preview-video--header[_ngcontent-%COMP%]{display:flex}.velt-recording-preview-video[_ngcontent-%COMP%]{position:relative;background:var(--velt-background-0);flex-direction:column;align-items:center;overflow:hidden;border-radius:var(--velt-border-radius-lg);width:calc((50rem + 0px) * var(--velt-base-rem-unit));height:calc((30rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}@media screen and (max-width: 768px){.velt-recording-preview-video[_ngcontent-%COMP%]{width:calc((35rem + 0px) * var(--velt-base-rem-unit));height:calc((25rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}}@media screen and (max-width: 425px){ .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog{width:calc(1 * var(--legacy-velt-viewport-width));max-width:calc(1 * var(--legacy-velt-viewport-width))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-video{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));max-width:calc(1 * var(--legacy-velt-viewport-width));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-video video{height:100%}}.velt-recording-preview-video--overlay[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:space-between;align-items:center;padding:var(--velt-spacing-2xl);content:"";position:absolute;border-radius:var(--velt-border-radius-lg);z-index:1;inset:0}.velt-recording-preview-video--header[_ngcontent-%COMP%]{justify-content:space-between;width:100%;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));align-items:flex-start}.velt-recording-preview-video--settings[_ngcontent-%COMP%]{width:366px;display:flex;flex-direction:column;gap:var(--velt-spacing-lg);align-items:center;justify-content:center;position:relative}'],changeDetection:0});let n=o;return n})();var J_e=n=>({componentConfigSignal:n}),Mnt=(n,o)=>({condition:n,data:o}),Pnt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-settings-panel-wireframe",variant:r,setIfCondition:e,componentElementRef:t,replaceTemplate:!1}),Rnt=()=>["video","screen"];function Nnt(n,o){if(n&1&&(C(0),D(1,"velt-media-source-settings-internal",3),R(2,"translate"),b()),n&2){let r=s(2).ngIf;v(),g("showMicSettings",!0)("shadowDom",r.shadowDom)("showCamSettings",xt(8,Rnt).includes(r.type))("isOpen",r.isSettingsOpen)("config",r),w("aria-label",F(2,6,"Media source settings"))}}function Fnt(n,o){if(n&1&&(C(0),p(1,Nnt,3,9,"ng-container",2),b()),n&2){let r=s(2);v(),g("veltDynamicTemplate",j(3,Pnt,r.template,J(1,J_e,r.componentConfigSignal),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function Lnt(n,o){if(n&1&&(C(0),p(1,Fnt,2,9,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,Mnt,r.conditionSignal(),J(1,J_e,r.componentConfigSignal)))}}var ZS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.componentId="velt-recording-preview-steps-dialog-settings-panel",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsPanelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsPanelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Recording settings panel"),e.setAttribute("aria-modal","true"),e.setAttribute("tabindex","-1"),this.componentConfigSignal().isSettingsOpen?e.setAttribute("aria-hidden","false"):e.setAttribute("aria-hidden","true")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsPanelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-settings-panel-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","group",3,"showMicSettings","shadowDom","showCamSettings","isOpen","config"]],template:function(t,i){t&1&&p(0,Lnt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},encapsulation:2,changeDetection:0});let n=o;return n})();var Unt=n=>({componentConfigSignal:n}),Vnt=(n,o)=>({condition:n,data:o}),Bnt=(n,o)=>({componentConfigSignal:n,variant:o}),jnt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-recording-preview-steps-dialog-waveform-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function $nt(n,o){if(n&1&&(C(0),D(1,"app-audio-waveform",3),b()),n&2){let r=s(2).ngIf,e=s();v(),g("variant",r.type==="audio"?"preview":"preview-mini")("previewStream",e.streamSignal())("muteMic",!(r.mediaConfig.audio!=null&&r.mediaConfig.audio.enabled)),w("data-testid",e.componentId)}}function Gnt(n,o){if(n&1&&(C(0),p(1,$nt,2,4,"ng-container",2),b()),n&2){let r=s(2);v(),g("veltDynamicTemplate",j(4,jnt,r.template,E(1,Bnt,r.componentConfigSignal,r.variant),r.variant,r.setIfCondition.bind(r),r.elementRef))}}function Hnt(n,o){if(n&1&&(C(0),p(1,Gnt,2,10,"ng-container",1),b()),n&2){let r=s();v(),g("veltIf",E(3,Vnt,r.conditionSignal(),J(1,Unt,r.componentConfigSignal)))}}var JS=(()=>{let o=class o extends me{constructor(e,t,i){super(t,i,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=i,this.streamSignal=De(null),this.componentId="velt-recording-preview-steps-dialog-waveform",super.initializeComponentConfigSignal(new Gn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.setupAudioElements()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogWaveformComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.cleanupAudio()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogWaveformComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Audio waveform visualization"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogWaveformComponent setupA11yAttributes:",e)}}setupAudioElements(){return X(this,null,function*(){try{this.audioContext=new AudioContext,this.streamSignal.set(yield navigator.mediaDevices.getUserMedia({audio:!0}))}catch(e){this.loggingService.catch("Error accessing the microphone",e)}})}cleanupAudio(){try{this.audioContext&&(this.audioContext.close(),this.audioContext=null);let e=this.streamSignal();e&&(e.getTracks().forEach(t=>t.stop()),this.streamSignal.set(null))}catch(e){this.loggingService.catch("Error cleaning up audio resources:",e)}}};o.\u0275fac=function(t){return new(t||o)(x(k),x(Q),x(T))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-waveform"]],inputs:{variant:"variant"},standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","img","aria-live","polite",3,"variant","previewStream","muteMic"]],template:function(t,i){t&1&&p(0,Hnt,2,6,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},encapsulation:2,changeDetection:0});let n=o;return n})();var X_e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),znt=(n,o)=>({condition:n,data:o}),Wnt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-text-comment-tool-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function qnt(n,o){n&1&&(f(0,"div",3),se(),f(1,"svg",4)(2,"mask",5),D(3,"path",6),S(),D(4,"path",7)(5,"path",8),S()())}function Ynt(n,o){if(n&1){let r=Z();C(0),f(1,"div",1),R(2,"translate"),z("mousedown",function(t){return L(r),U(t.preventDefault())})("pointerdown",function(t){L(r);let i=s(2);return s().actionService.createAnnotation(i.data.contextId),U(t.stopPropagation())}),p(3,qnt,6,0,"div",2),S(),b()}if(n&2){let r,e=s(2),t=s();v(),gt("top",e.data.position.top,"px")("left",e.data.position.left,"px")("visibility",e.uiState.showAdder?"visible":"hidden"),w("data-testid",t.componentId)("role","button")("aria-label",F(2,12,"Add text comment"))("aria-disabled",!e.uiState.commentToolEnabled)("tabindex",e.uiState.showAdder?0:void 0),v(2),g("veltDynamicTemplate",j(17,Wnt,t.template,E(14,X_e,t.componentConfigSignal,t.localUIStateSignal),(r=t.localUIStateSignal())==null?null:r.variant,t.setIfCondition.bind(t),t.elementRef))}}function Knt(n,o){if(n&1&&p(0,Ynt,4,23,"ng-container",0),n&2){let r=s(2);g("veltIf",E(4,znt,r.conditionSignal(),E(1,X_e,r.componentConfigSignal,r.localUIStateSignal)))}}function Znt(n,o){if(n&1&&$(0,Knt,1,7,"ng-container"),n&2){let r=s();G(r.shouldShow()?0:-1)}}var XS=(()=>{let o=class o extends es{constructor(){super(...arguments),this.componentId="velt-text-comment-tool",this.shouldShow=ie(()=>Jnt(this.defaultCondition(),this.componentConfigSignal()))}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in TextCommentToolComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{Xnt(this.hostElementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in TextCommentToolComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-text-comment-tool-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],[1,"velt-text-comment-tool",3,"mousedown","pointerdown"],["class","velt-text-comment-tool--container",4,"veltDynamicTemplate"],[1,"velt-text-comment-tool--container"],["width","32","height","32","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","true","focusable","false"],["id","path-1-inside-1_2032_23681","fill","white"],["d","M0.352941 18C0.158017 18 -6.90715e-09 17.842 -1.54275e-08 17.6471L-3.93402e-07 9C-6.10673e-07 4.02944 4.02944 -1.76132e-07 9 -3.93402e-07C13.9706 -6.10673e-07 18 4.02944 18 9C18 13.9706 13.9706 18 9 18L0.352941 18Z"],["d","M0.352941 18C0.158017 18 -6.90715e-09 17.842 -1.54275e-08 17.6471L-3.93402e-07 9C-6.10673e-07 4.02944 4.02944 -1.76132e-07 9 -3.93402e-07C13.9706 -6.10673e-07 18 4.02944 18 9C18 13.9706 13.9706 18 9 18L0.352941 18Z","fill","#625DF5"],["d","M0.352941 18C0.158017 18 -6.90715e-09 17.842 -1.54275e-08 17.6471L-3.93402e-07 9C-6.10673e-07 4.02944 4.02944 -1.76132e-07 9 -3.93402e-07C13.9706 -6.10673e-07 18 4.02944 18 9C18 13.9706 13.9706 18 9 18L0.352941 18Z","stroke","white","stroke-width","2","mask","url(#path-1-inside-1_2032_23681)"]],template:function(t,i){if(t&1&&$(0,Znt,1,1),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-text-comment-tool[_ngcontent-%COMP%]{position:fixed;z-index:2147483577;overflow-wrap:break-word;font-size:var(--velt-font-size-xs);text-align:center;visibility:hidden;cursor:pointer}.velt-text-comment-tool[_ngcontent-%COMP%] .velt-text-comment-tool--container[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});let n=o;return n})();function Jnt(n,o){try{return n?o?!o.uiState.disabled&&o.uiState.commentToolEnabled&&!o.uiState.isPlanExpired&&o.uiState.isUserAllowed&&o.uiState.enableTextComments&&!!o.data.user?.userId&&(!o.uiState.rewriterEnabled||!o.uiState.rewriterDefaultUIEnabled):!1:!0}catch{return!1}}function Xnt(n,o){try{n.setAttribute("data-testid",o+"-container"),n.setAttribute("role","button"),n.setAttribute("aria-label","Add text comment")}catch{}}var Q_e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),Qnt=(n,o)=>({condition:n,data:o}),ert=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-text-comment-toolbar-comment-annotation-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function trt(n,o){n&1&&(f(0,"div",3),se(),f(1,"svg",4),D(2,"path",5),S()())}function nrt(n,o){if(n&1){let r=Z();C(0),f(1,"div",1),R(2,"translate"),z("mousedown",function(t){return L(r),U(t.preventDefault())})("pointerdown",function(t){L(r);let i=s(2);return s().actionService.createAnnotation(i.data.contextId),U(t.stopPropagation())}),p(3,trt,3,0,"div",2),S(),b()}if(n&2){let r,e=s(2),t=s();v(),w("data-testid",t.componentId)("role","button")("aria-label",F(2,5,"Add comment annotation"))("tabindex",e.uiState.commentToolEnabled?0:void 0),v(2),g("veltDynamicTemplate",j(10,ert,t.template,E(7,Q_e,t.componentConfigSignal,t.localUIStateSignal),(r=t.localUIStateSignal())==null?null:r.variant,t.setIfCondition.bind(t),t.elementRef))}}function rrt(n,o){if(n&1&&p(0,nrt,4,16,"ng-container",0),n&2){let r=s(2);g("veltIf",E(4,Qnt,r.conditionSignal(),E(1,Q_e,r.componentConfigSignal,r.localUIStateSignal)))}}function ort(n,o){if(n&1&&$(0,rrt,1,7,"ng-container"),n&2){let r=s();G(r.shouldShow()?0:-1)}}var QS=(()=>{let o=class o extends es{constructor(){super(...arguments),this.componentId="velt-text-comment-toolbar-comment-annotation",this.shouldShow=ie(()=>irt(this.defaultCondition(),this.componentConfigSignal()))}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCommentAnnotationComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCommentAnnotationComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{art(this.hostElementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in TextCommentToolbarCommentAnnotationComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-text-comment-toolbar-comment-annotation-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],[3,"mousedown","pointerdown"],["class","velt-cursor-pointer velt-text-comment-toolbar-comment-annotation",4,"veltDynamicTemplate"],[1,"velt-cursor-pointer","velt-text-comment-toolbar-comment-annotation"],["width","32","height","32","viewBox","0 0 32 32","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","true","focusable","false"],["fill-rule","evenodd","clip-rule","evenodd","d","M17.7608 6.03888C21.6888 6.64595 24.7153 9.3481 25.7503 13.1722C26.0832 14.4028 26.0832 16.5981 25.7503 17.8287C24.8136 21.2897 22.3047 23.7986 18.8437 24.7353C18.1546 24.9217 17.6783 24.9695 16.5154 24.9685C14.9367 24.9672 14.1823 24.8254 12.8496 24.2792L12.1364 23.9869L9.93697 24.5342C7.8786 25.0464 7.71866 25.071 7.44436 24.917C6.90064 24.6118 6.90443 24.3818 7.49147 22.0353L8.03021 19.8823L7.73729 19.1677C7.19053 17.8336 7.04867 17.0796 7.04737 15.5005C7.0464 14.3376 7.09415 13.8613 7.28063 13.1722C8.21127 9.73361 10.737 7.1939 14.1308 6.28405C14.9298 6.06985 17.0392 5.92745 17.7608 6.03888ZM14.2233 8.05664C12.9452 8.46912 12.019 9.04056 11.0373 10.0223C9.57907 11.4805 8.85364 13.0991 8.75174 15.1214C8.68947 16.3572 8.85884 17.3544 9.31582 18.4435C9.47381 18.8201 9.65855 19.2624 9.72624 19.4266C9.82922 19.6761 9.78471 19.9865 9.45432 21.3204C9.23688 22.1979 9.06827 22.9251 9.07953 22.9364C9.09079 22.9476 9.81796 22.779 10.6955 22.5616C12.0294 22.2312 12.3398 22.1867 12.5893 22.2897C12.7535 22.3573 13.1958 22.5421 13.5724 22.7001C14.6615 23.1571 15.6587 23.3264 16.8945 23.2642C18.9168 23.1623 20.5354 22.4368 21.9936 20.9786C22.968 20.0042 23.5361 19.0878 23.9685 17.7926C24.2112 17.0656 24.2457 16.7805 24.2457 15.5005C24.2457 14.2204 24.2112 13.9353 23.9685 13.2083C23.5361 11.9132 22.968 10.9967 21.9936 10.0223C20.3414 8.37025 18.566 7.66777 16.2447 7.74769C15.3595 7.77823 14.8403 7.8575 14.2233 8.05664Z","fill","currentColor"]],template:function(t,i){if(t&1&&$(0,ort,1,1),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-text-comment-toolbar-comment-annotation[_ngcontent-%COMP%]{display:flex;color:var(--velt-accent-text)}"],changeDetection:0});let n=o;return n})();function irt(n,o){try{return n?o?o.uiState.commentToolEnabled:!1:!0}catch{return!0}}function art(n,o){try{n.setAttribute("data-testid",o+"-container"),n.setAttribute("role","button"),n.setAttribute("aria-label","Add comment annotation")}catch{}}var e1e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),lrt=(n,o)=>({condition:n,data:o}),crt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-text-comment-toolbar-copywriter-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function srt(n,o){if(n&1&&(f(0,"div",4),oe(1),R(2,"translate"),R(3,"translate"),S()),n&2){let r=s(4);v(),we(" ",r.data.selectedCharactersCount>r.uiState.MAX_ALLOWED_CHARACTERS_COUNT?F(2,1,"Select a shorter text"):F(3,3,"Select a longer text")," ")}}function drt(n,o){if(n&1&&(f(0,"div",3),$(1,srt,4,5,"div",4),se(),f(2,"svg",5)(3,"g",6),D(4,"path",7),S(),f(5,"defs")(6,"clipPath",8),D(7,"rect",9),S()()(),oe(8),R(9,"translate"),S()),n&2){let r=s(3);v(),G(r.data.selectedWordsCount<r.uiState.MIN_ALLOWED_WORDS_COUNT||r.data.selectedCharactersCount<r.uiState.MIN_ALLOWED_CHARACTERS_COUNT||r.data.selectedCharactersCount>r.uiState.MAX_ALLOWED_CHARACTERS_COUNT?1:-1),v(7),we(" ",F(9,2,"Rewrite")," ")}}function vrt(n,o){if(n&1){let r=Z();C(0),f(1,"div",1),R(2,"translate"),z("mousedown",function(t){return L(r),U(t.preventDefault())})("pointerdown",function(t){L(r);let i=s(2);return s().actionService.createRewriter(i.data.contextId,"copywriter"),U(t.stopPropagation())}),p(3,drt,10,4,"div",2),S(),b()}if(n&2){let r,e=s(2),t=s();v(),pe("velt-text-comment-toolbar-copywriter--disabled",e.data.selectedWordsCount<e.uiState.MIN_ALLOWED_WORDS_COUNT||e.data.selectedCharactersCount<e.uiState.MIN_ALLOWED_CHARACTERS_COUNT||e.data.selectedCharactersCount>e.uiState.MAX_ALLOWED_CHARACTERS_COUNT),w("data-testid",t.componentId)("role","button")("aria-label",F(2,8,"Use AI to rewrite selected text"))("tabindex",e.data.selectedWordsCount<e.uiState.MIN_ALLOWED_WORDS_COUNT||e.data.selectedCharactersCount<e.uiState.MIN_ALLOWED_CHARACTERS_COUNT||e.data.selectedCharactersCount>e.uiState.MAX_ALLOWED_CHARACTERS_COUNT?void 0:0)("aria-disabled",e.data.selectedWordsCount<e.uiState.MIN_ALLOWED_WORDS_COUNT||e.data.selectedCharactersCount<e.uiState.MIN_ALLOWED_CHARACTERS_COUNT||e.data.selectedCharactersCount>e.uiState.MAX_ALLOWED_CHARACTERS_COUNT),v(2),g("veltDynamicTemplate",j(13,crt,t.template,E(10,e1e,t.componentConfigSignal,t.localUIStateSignal),(r=t.localUIStateSignal())==null?null:r.variant,t.setIfCondition.bind(t),t.elementRef))}}function mrt(n,o){if(n&1&&p(0,vrt,4,19,"ng-container",0),n&2){let r=s(2);g("veltIf",E(4,lrt,r.conditionSignal(),E(1,e1e,r.componentConfigSignal,r.localUIStateSignal)))}}function grt(n,o){if(n&1&&$(0,mrt,1,7,"ng-container"),n&2){let r=s();G(r.shouldShow()?0:-1)}}var ey=(()=>{let o=class o extends es{constructor(){super(...arguments),this.componentId="velt-text-comment-toolbar-copywriter",this.shouldShow=ie(()=>urt(this.defaultCondition()))}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCopywriterComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCopywriterComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{prt(this.hostElementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in TextCommentToolbarCopywriterComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-text-comment-toolbar-copywriter-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],[3,"mousedown","pointerdown"],["class","velt-text-comment-toolbar-copywriter s-tooltip s-tooltip-light",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar-copywriter","s-tooltip","s-tooltip-light"],["role","tooltip",1,"s-tooltiptext"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","true","focusable","false",1,"velt-text-comment-toolbar-copywriter--svg"],["clip-path","url(#clip0_3311_3365)"],["d","M6.49994 15.9999C6.34193 16.0007 6.18743 15.9533 6.05709 15.8639C5.92676 15.7746 5.8268 15.6476 5.77057 15.4999L4.52557 12.2624C4.50035 12.1972 4.46178 12.1379 4.41232 12.0885C4.36286 12.039 4.30362 12.0004 4.23838 11.9752L0.999941 10.7293C0.852423 10.6727 0.725541 10.5727 0.63604 10.4424C0.546538 10.3122 0.498626 10.1579 0.498626 9.99991C0.498626 9.8419 0.546538 9.68761 0.63604 9.55739C0.725541 9.42717 0.852423 9.32716 0.999941 9.27054L4.23744 8.02554C4.30268 8.00032 4.36193 7.96175 4.41138 7.91229C4.46084 7.86284 4.49941 7.80359 4.52463 7.73835L5.77057 4.49991C5.82718 4.3524 5.9272 4.22551 6.05742 4.13601C6.18764 4.04651 6.34193 3.9986 6.49994 3.9986C6.65795 3.9986 6.81225 4.04651 6.94246 4.13601C7.07268 4.22551 7.1727 4.3524 7.22932 4.49991L8.47432 7.73741C8.49953 7.80265 8.5381 7.8619 8.58756 7.91136C8.63702 7.96081 8.69627 7.99939 8.7615 8.0246L11.9803 9.26304C12.1338 9.31994 12.266 9.42278 12.359 9.55754C12.452 9.6923 12.5012 9.85244 12.4999 10.0162C12.4976 10.1714 12.4486 10.3224 12.3595 10.4495C12.2703 10.5767 12.1451 10.6741 11.9999 10.7293L8.76244 11.9743C8.6972 11.9995 8.63795 12.0381 8.5885 12.0875C8.53904 12.137 8.50047 12.1962 8.47525 12.2615L7.22932 15.4999C7.17308 15.6476 7.07312 15.7746 6.94279 15.8639C6.81245 15.9533 6.65796 16.0007 6.49994 15.9999ZM2.74994 5.49991C2.6573 5.49991 2.56684 5.47184 2.49047 5.4194C2.4141 5.36696 2.35541 5.29262 2.32213 5.20616L1.79525 3.83616C1.78383 3.8062 1.76621 3.77899 1.74354 3.75632C1.72086 3.73364 1.69365 3.71602 1.66369 3.7046L0.293691 3.17773C0.207247 3.14444 0.132915 3.08574 0.0804885 3.00937C0.0280618 2.933 0 2.84255 0 2.74991C0 2.65728 0.0280618 2.56682 0.0804885 2.49045C0.132915 2.41408 0.207247 2.35539 0.293691 2.3221L1.66369 1.79523C1.69362 1.78375 1.72081 1.76611 1.74347 1.74345C1.76614 1.72078 1.78378 1.6936 1.79525 1.66366L2.31744 0.305851C2.34689 0.225914 2.39757 0.155514 2.46402 0.102216C2.53048 0.0489189 2.6102 0.0147393 2.69463 0.00335107C2.79599 -0.00897073 2.89856 0.0128976 2.98608 0.0654883C3.0736 0.118079 3.14105 0.198382 3.17775 0.293664L3.70463 1.66366C3.7161 1.6936 3.73374 1.72078 3.75641 1.74345C3.77908 1.76611 3.80626 1.78375 3.83619 1.79523L5.20619 2.3221C5.29263 2.35539 5.36697 2.41408 5.41939 2.49045C5.47182 2.56682 5.49988 2.65728 5.49988 2.74991C5.49988 2.84255 5.47182 2.933 5.41939 3.00937C5.36697 3.08574 5.29263 3.14444 5.20619 3.17773L3.83619 3.7046C3.80623 3.71602 3.77902 3.73364 3.75635 3.75632C3.73367 3.77899 3.71605 3.8062 3.70463 3.83616L3.17775 5.20616C3.14447 5.29262 3.08578 5.36696 3.00941 5.4194C2.93304 5.47184 2.84258 5.49991 2.74994 5.49991ZM12.4999 7.99991C12.3989 7.99988 12.3002 7.96923 12.2169 7.91199C12.1336 7.85475 12.0696 7.77362 12.0334 7.67929L11.3196 5.82398C11.3071 5.79128 11.2878 5.76159 11.263 5.73683C11.2383 5.71207 11.2086 5.69278 11.1759 5.68023L9.32057 4.96648C9.22631 4.93016 9.14526 4.86614 9.0881 4.78286C9.03094 4.69957 9.00034 4.60093 9.00034 4.49991C9.00034 4.3989 9.03094 4.30026 9.0881 4.21697C9.14526 4.13369 9.22631 4.06967 9.32057 4.03335L11.1759 3.3196C11.2086 3.30705 11.2383 3.28776 11.263 3.263C11.2878 3.23823 11.3071 3.20854 11.3196 3.17585L12.0281 1.33366C12.0604 1.24655 12.1158 1.16983 12.1882 1.11167C12.2607 1.0535 12.3476 1.01607 12.4396 1.00335C12.5502 0.989962 12.6621 1.0139 12.7576 1.07136C12.8531 1.12883 12.9266 1.21652 12.9665 1.32054L13.6803 3.17585C13.6928 3.20854 13.7121 3.23823 13.7369 3.263C13.7616 3.28776 13.7913 3.30705 13.824 3.3196L15.6793 4.03335C15.7736 4.06967 15.8546 4.13369 15.9118 4.21697C15.9689 4.30026 15.9995 4.3989 15.9995 4.49991C15.9995 4.60093 15.9689 4.69957 15.9118 4.78286C15.8546 4.86614 15.7736 4.93016 15.6793 4.96648L13.824 5.68023C13.7913 5.69278 13.7616 5.71207 13.7369 5.73683C13.7121 5.76159 13.6928 5.79128 13.6803 5.82398L12.9665 7.67929C12.9302 7.77362 12.8663 7.85475 12.783 7.91199C12.6997 7.96923 12.601 7.99988 12.4999 7.99991Z","fill","currentColor"],["id","clip0_3311_3365"],["width","16","height","16","fill","currentColor"]],template:function(t,i){if(t&1&&$(0,grt,1,1),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-text-comment-toolbar-copywriter[_ngcontent-%COMP%]{background:var(--velt-background-2);border-radius:var(--velt-border-radius-full);padding:var(--velt-spacing-2xs) var(--velt-spacing-md);cursor:pointer;color:var(--velt-text-4);display:flex;align-items:center;gap:var(--velt-spacing-sm);font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:normal}.velt-text-comment-toolbar-copywriter[_ngcontent-%COMP%] .velt-text-comment-toolbar-copywriter--svg[_ngcontent-%COMP%]{color:var(--velt-accent-text);padding:var(--velt-spacing-xs)}.velt-text-comment-toolbar-copywriter.velt-text-comment-toolbar-copywriter--disabled[_ngcontent-%COMP%]{cursor:not-allowed;color:var(--velt-gray)}"],changeDetection:0});let n=o;return n})();function urt(n){try{return!0}catch{return!0}}function prt(n,o){try{n.setAttribute("data-testid",o+"-container"),n.setAttribute("role","button"),n.setAttribute("aria-label","Rewrite text with copywriter")}catch{}}var t1e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),hrt=(n,o)=>({condition:n,data:o}),frt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-text-comment-toolbar-generic-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Crt(n,o){if(n&1&&(f(0,"div",4),oe(1),R(2,"translate"),R(3,"translate"),S()),n&2){let r=s(4);v(),we(" ",r.data.selectedCharactersCount>r.uiState.MAX_ALLOWED_CHARACTERS_COUNT?F(2,1,"Select a shorter text"):F(3,3,"Select a longer text")," ")}}function brt(n,o){if(n&1&&(f(0,"div",3),$(1,Crt,4,5,"div",4),se(),f(2,"svg",5),D(3,"path",6)(4,"path",7)(5,"path",8)(6,"path",9)(7,"path",10)(8,"path",11)(9,"path",12)(10,"path",13),S(),oe(11),R(12,"translate"),S()),n&2){let r=s(3);v(),G(r.data.selectedWordsCount<r.uiState.MIN_ALLOWED_WORDS_COUNT||r.data.selectedCharactersCount<r.uiState.MIN_ALLOWED_CHARACTERS_COUNT||r.data.selectedCharactersCount>r.uiState.MAX_ALLOWED_CHARACTERS_COUNT?1:-1),v(10),we(" ",F(12,2,"Ask ChatGPT")," ")}}function _rt(n,o){if(n&1){let r=Z();C(0),f(1,"div",1),R(2,"translate"),z("mousedown",function(t){return L(r),U(t.preventDefault())})("pointerdown",function(t){L(r);let i=s(2);return s().actionService.createRewriter(i.data.contextId,"generic"),U(t.stopPropagation())}),p(3,brt,13,4,"div",2),S(),b()}if(n&2){let r,e=s(2),t=s();v(),pe("velt-text-comment-toolbar-generic--disabled",e.data.selectedWordsCount<e.uiState.MIN_ALLOWED_WORDS_COUNT||e.data.selectedCharactersCount<e.uiState.MIN_ALLOWED_CHARACTERS_COUNT||e.data.selectedCharactersCount>e.uiState.MAX_ALLOWED_CHARACTERS_COUNT),w("data-testid",t.componentId)("role","button")("aria-label",F(2,6,"Ask ChatGPT to rewrite text")),v(2),g("veltDynamicTemplate",j(11,frt,t.template,E(8,t1e,t.componentConfigSignal,t.localUIStateSignal),(r=t.localUIStateSignal())==null?null:r.variant,t.setIfCondition.bind(t),t.elementRef))}}function Srt(n,o){if(n&1&&p(0,_rt,4,17,"ng-container",0),n&2){let r=s(2);g("veltIf",E(4,hrt,r.conditionSignal(),E(1,t1e,r.componentConfigSignal,r.localUIStateSignal)))}}function yrt(n,o){if(n&1&&$(0,Srt,1,7,"ng-container"),n&2){let r=s();G(r.shouldShow()?0:-1)}}var ty=(()=>{let o=class o extends es{constructor(){super(...arguments),this.componentId="velt-text-comment-toolbar-generic",this.shouldShow=ie(()=>krt(this.defaultCondition()))}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in TextCommentToolbarGenericComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarGenericComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{xrt(this.hostElementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in TextCommentToolbarGenericComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-text-comment-toolbar-generic-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],[3,"mousedown","pointerdown"],["class","velt-text-comment-toolbar-generic s-tooltip s-tooltip-light",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar-generic","s-tooltip","s-tooltip-light"],["role","tooltip",1,"s-tooltiptext"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","role","presentation","aria-hidden","true","focusable","false",1,"velt-text-comment-toolbar-generic--svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M20 6H4C2.89543 6 2 6.89543 2 8V16C2 17.1046 2.89543 18 4 18H20C21.1046 18 22 17.1046 22 16V8C22 6.89543 21.1046 6 20 6ZM4 4C1.79086 4 0 5.79086 0 8V16C0 18.2091 1.79086 20 4 20H20C22.2091 20 24 18.2091 24 16V8C24 5.79086 22.2091 4 20 4H4Z","fill","currentColor"],["d","M16 10C16 9.44772 16.4477 9 17 9H19C19.5523 9 20 9.44772 20 10C20 10.5523 19.5523 11 19 11H17C16.4477 11 16 10.5523 16 10Z","fill","currentColor"],["d","M4 14C4 13.4477 4.44772 13 5 13C5.55228 13 6 13.4477 6 14C6 14.5523 5.55228 15 5 15C4.44772 15 4 14.5523 4 14Z","fill","currentColor"],["d","M8 14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14C16 14.5523 15.5523 15 15 15H9C8.44772 15 8 14.5523 8 14Z","fill","currentColor"],["d","M19 13C18.4477 13 18 13.4477 18 14C18 14.5523 18.4477 15 19 15C19.5523 15 20 14.5523 20 14C20 13.4477 19.5523 13 19 13Z","fill","currentColor"],["d","M13 9C12.4477 9 12 9.44772 12 10C12 10.5523 12.4477 11 13 11C13.5523 11 14 10.5523 14 10C14 9.44772 13.5523 9 13 9Z","fill","currentColor"],["d","M8 10C8 9.44772 8.44772 9 9 9C9.55228 9 10 9.44772 10 10C10 10.5523 9.55228 11 9 11C8.44772 11 8 10.5523 8 10Z","fill","currentColor"],["d","M5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9Z","fill","currentColor"]],template:function(t,i){if(t&1&&$(0,yrt,1,1),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-text-comment-toolbar-generic[_ngcontent-%COMP%]{background:var(--velt-background-2);border-radius:var(--velt-border-radius-full);padding:var(--velt-spacing-2xs) var(--velt-spacing-md);cursor:pointer;color:var(--velt-text-4);display:flex;align-items:center;gap:var(--velt-spacing-sm);font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:normal}.velt-text-comment-toolbar-generic[_ngcontent-%COMP%] .velt-text-comment-toolbar-generic--svg[_ngcontent-%COMP%]{color:var(--velt-accent-text)}.velt-text-comment-toolbar-generic.velt-text-comment-toolbar-generic--disabled[_ngcontent-%COMP%]{cursor:not-allowed;color:var(--velt-gray)}"],changeDetection:0});let n=o;return n})();function krt(n){try{return!0}catch{return!0}}function xrt(n,o){try{n.setAttribute("data-testid",o+"-container"),n.setAttribute("role","button"),n.setAttribute("aria-label","Ask ChatGPT to rewrite text")}catch{}}var n1e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),Irt=(n,o)=>({condition:n,data:o}),Ert=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-text-comment-toolbar-divider-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function wrt(n,o){if(n&1&&(f(0,"div",2),se(),f(1,"svg",3),D(2,"rect",4),S()()),n&2){let r=s(4);w("data-testid",r.componentId)("role","separator")("aria-orientation","vertical")}}function Trt(n,o){if(n&1&&(C(0),p(1,wrt,3,3,"div",1),b()),n&2){let r,e=s(3);v(),g("veltDynamicTemplate",j(4,Ert,e.template,E(1,n1e,e.componentConfigSignal,e.localUIStateSignal),(r=e.localUIStateSignal())==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function Drt(n,o){if(n&1&&p(0,Trt,2,10,"ng-container",0),n&2){let r=s(2);g("veltIf",E(4,Irt,r.conditionSignal(),E(1,n1e,r.componentConfigSignal,r.localUIStateSignal)))}}function Ort(n,o){if(n&1&&$(0,Drt,1,7,"ng-container"),n&2){let r=s();G(r.shouldShow()?0:-1)}}var ny=(()=>{let o=class o extends es{constructor(){super(...arguments),this.componentId="velt-text-comment-toolbar-divider",this.shouldShow=ie(()=>Art(this.defaultCondition(),this.componentConfigSignal()))}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{Mrt(this.hostElementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-text-comment-toolbar-divider-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],["class","velt-text-comment-toolbar-divider",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar-divider"],["width","1","height","16","viewBox","0 0 1 16","fill","none","xmlns","http://www.w3.org/2000/svg","role","presentation","aria-hidden","true","focusable","false"],["x","1","y","0.5","width","15","height","0.999999","rx","0.5","transform","rotate(90 1 0.5)","fill","currentColor"]],template:function(t,i){if(t&1&&$(0,Ort,1,1),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-text-comment-toolbar-divider[_ngcontent-%COMP%]{display:flex;color:var(--velt-border-4)}"],changeDetection:0});let n=o;return n})();function Art(n,o){try{return n?o?o.uiState.commentToolEnabled:!1:!0}catch{return!0}}function Mrt(n,o){try{n.setAttribute("data-testid",o+"-container"),n.setAttribute("role","separator"),n.setAttribute("aria-orientation","vertical")}catch{}}var r1e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),Prt=(n,o)=>({condition:n,data:o}),Rrt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-text-comment-toolbar-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Nrt(n,o){if(n&1&&(f(0,"div",3),D(1,"velt-text-comment-toolbar-comment-annotation-internal",4)(2,"velt-text-comment-toolbar-divider-internal",4)(3,"velt-text-comment-toolbar-copywriter-internal",4)(4,"velt-text-comment-toolbar-generic-internal",4),S()),n&2){let r=s(4);v(),g("componentConfigSignal",r.componentConfigSignal)("parentLocalUIState",r.localUIStateSignal),v(),g("componentConfigSignal",r.componentConfigSignal)("parentLocalUIState",r.localUIStateSignal),v(),g("componentConfigSignal",r.componentConfigSignal)("parentLocalUIState",r.localUIStateSignal),v(),g("componentConfigSignal",r.componentConfigSignal)("parentLocalUIState",r.localUIStateSignal)}}function Frt(n,o){if(n&1){let r=Z();C(0),f(1,"div",1),R(2,"translate"),z("click",function(t){return L(r),U(t.stopPropagation())})("mousedown",function(t){return L(r),t.preventDefault(),U(t.stopPropagation())})("pointerdown",function(t){return L(r),U(t.stopPropagation())})("pointerup",function(t){return L(r),U(t.stopPropagation())}),p(3,Nrt,5,8,"div",2),S(),b()}if(n&2){let r,e=s(2),t=s();v(),gt("top",e.data.position.top,"px")("left",e.uiState.left,"px")("visibility",e.uiState.showAdder?"visible":"hidden"),w("data-testid",t.componentId)("role","toolbar")("aria-label",F(2,11,"Text comment tools"))("aria-hidden",!e.uiState.showAdder),v(2),g("veltDynamicTemplate",j(16,Rrt,t.template,E(13,r1e,t.componentConfigSignal,t.localUIStateSignal),(r=t.localUIStateSignal())==null?null:r.variant,t.setIfCondition.bind(t),t.elementRef))}}function Lrt(n,o){if(n&1&&p(0,Frt,4,22,"ng-container",0),n&2){let r=s(2);g("veltIf",E(4,Prt,r.conditionSignal(),E(1,r1e,r.componentConfigSignal,r.localUIStateSignal)))}}function Urt(n,o){if(n&1&&$(0,Lrt,1,7,"ng-container"),n&2){let r=s();G(r.shouldShow()?0:-1)}}var ry=(()=>{let o=class o extends es{constructor(){super(...arguments),this.componentId="velt-text-comment-toolbar",this.shouldShow=ie(()=>Vrt(this.defaultCondition(),this.componentConfigSignal()))}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in TextCommentToolbarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{Brt(this.hostElementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in TextCommentToolbarComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-text-comment-toolbar-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],[1,"velt-text-comment-toolbar",3,"click","mousedown","pointerdown","pointerup"],["class","velt-text-comment-toolbar--container",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar--container"],[3,"componentConfigSignal","parentLocalUIState"]],template:function(t,i){if(t&1&&$(0,Urt,1,1),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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-text-comment-toolbar[_ngcontent-%COMP%]{position:fixed;z-index:99999;transform:translate(-50%)}.velt-text-comment-toolbar--container[_ngcontent-%COMP%]{width:max-content;display:flex;align-items:center;padding:var(--velt-spacing-xs) var(--velt-spacing-sm);gap:var(--velt-spacing-sm);background:var(--velt-background-0);border:var(--velt-border-4);box-shadow:0 8px 16px #8f95b226;border-radius:var(--velt-border-radius-full);color:var(--velt-text-0)}"],changeDetection:0});let n=o;return n})();function Vrt(n,o){try{return n?o?!o.uiState.disabled&&!o.uiState.isPlanExpired&&o.uiState.isUserAllowed&&o.uiState.enableTextComments&&!!o.data.user?.userId&&o.uiState.rewriterEnabled&&o.uiState.rewriterDefaultUIEnabled:!1:!0}catch{return!1}}function Brt(n,o){try{n.setAttribute("data-testid",o+"-container"),n.setAttribute("role","toolbar"),n.setAttribute("aria-label","Text comment tools")}catch{}}function see(){return{appState:{user:null},featureState:{customStatusesShown:!1,groupMatchedComments:!1,resolvedCommentsOnDom:!1,readOnly:!1}}}function dee(){return{data:{annotation:null,annotations:[],unresolvedAnnotationsCount:0,unreadCount:0},uiState:{commentPinSelected:!1,selectedAnnotationsMap:{},selectedAnnotationsLocationMap:{},darkMode:!1}}}function o1e(){return{darkMode:!1,shadowDom:!0,commentBubbleTargetPinHover:!1,openDialog:!0,readOnly:!1,showAvatar:!0,commentCountType:Eg.TOTAL}}var HU=(()=>{let o=class o{constructor(){this.authService=le(qe),this.commentService=le(Re),this.domService=le(Ue),this.docService=le(st),this.loggingService=le(k),this.globalConfigSignal=De(see()),this.contextMap=new Map,this.annotationSubscriptions=new Map,this.subscriptions=[],this.initialized=!1}initialize(){try{if(this.initialized)return;this.initialized=!0,this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.globalConfigSignal.update(t=>y(h({},t),{appState:y(h({},t.appState),{user:e??null})}))})),this.subscriptions.push(this.commentService.getCustomStatusesShown$().subscribe(e=>{this.globalConfigSignal.update(t=>y(h({},t),{featureState:y(h({},t.featureState),{customStatusesShown:e})}))})),this.subscriptions.push(this.commentService.getGroupMatchedComments$().subscribe(e=>{this.globalConfigSignal.update(t=>y(h({},t),{featureState:y(h({},t.featureState),{groupMatchedComments:e})}))})),this.subscriptions.push(this.commentService.getResolvedCommentsOnDom$().subscribe(e=>{this.globalConfigSignal.update(t=>y(h({},t),{featureState:y(h({},t.featureState),{resolvedCommentsOnDom:e})}))})),this.subscriptions.push(this.commentService.getReadOnly$().subscribe(e=>{this.globalConfigSignal.update(t=>y(h({},t),{featureState:y(h({},t.featureState),{readOnly:e})}))})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(e=>{this.contextMap.forEach((t,i)=>{try{let a=t(),l=a.data.annotation?.annotationId||"",c=e?.[l]||0;a.data.unreadCount!==c&&t.update(d=>y(h({},d),{data:y(h({},d.data),{unreadCount:c})}))}catch(a){this.loggingService.catch("Error updating unread count for context "+i+":",a)}})})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(e=>{this.contextMap.forEach((t,i)=>{try{let a=t();a.uiState.selectedAnnotationsMap!==e&&(t.update(l=>y(h({},l),{uiState:y(h({},l.uiState),{selectedAnnotationsMap:e})})),this.checkCommentPinSelected(i,a.data.componentId||""))}catch(a){this.loggingService.catch("Error updating selectedAnnotationsMap for context "+i+":",a)}})})),this.subscriptions.push(this.domService.getSelectedAnnotationsLocationMap$().subscribe(e=>{this.contextMap.forEach((t,i)=>{try{let a=t();a.uiState.selectedAnnotationsLocationMap!==e&&(t.update(l=>y(h({},l),{uiState:y(h({},l.uiState),{selectedAnnotationsLocationMap:e})})),this.checkCommentPinSelected(i,a.data.componentId||""))}catch(a){this.loggingService.catch("Error updating selectedAnnotationsLocationMap for context "+i+":",a)}})}))}catch(e){this.loggingService.catch("Error in CommentBubbleCoreService initialize:",e)}}getOrCreateContextConfig(e){try{let t=this.contextMap.get(e);return t||(t=De(dee()),this.contextMap.set(e,t)),t}catch(t){return this.loggingService.catch("Error in CommentBubbleCoreService getOrCreateContextConfig:",t),De(dee())}}getContextConfig(e){try{return this.contextMap.get(e)}catch(t){this.loggingService.catch("Error in CommentBubbleCoreService getContextConfig:",t);return}}clearContext(e){try{let t=this.contextMap.get(e);if(t){let a=t().data.annotations;a?.length&&this.commentService.removeBubbleCommentAnnotationIds(a.map(l=>l?.annotationId).filter(Boolean))}this.contextMap.delete(e);let i=this.annotationSubscriptions.get(e);i&&(i.unsubscribe(),this.annotationSubscriptions.delete(e))}catch(t){this.loggingService.catch("Error in CommentBubbleCoreService clearContext:",t)}}fetchAnnotation(e,t,i){try{let a=this.annotationSubscriptions.get(e);a&&(a.unsubscribe(),this.annotationSubscriptions.delete(e));let l=this.getOrCreateContextConfig(e),c=l().data.annotations;c?.length&&this.commentService.removeBubbleCommentAnnotationIds(c.map(_=>_?.annotationId).filter(Boolean));let d;if((t.folderId||t.clientDocumentId)&&(d=t.locationId),!!!(t.targetElementId||t.context||t.annotationId||t.folderId||t.documentId||d)){l.update(_=>y(h({},_),{data:y(h({},_.data),{annotation:null,annotations:[],unresolvedAnnotationsCount:0})}));return}let u=this.commentService.getCommentAnnotationsForCommentComponent({type:"bubble",annotationId:t.annotationId,targetElementId:t.targetElementId,context:t.context,contextOptions:t.contextOptions,element:t.element,folderId:t.folderId,documentId:t.documentId,clientDocumentId:t.clientDocumentId,locationId:d}).pipe(ye(_=>this.domService.getSelectedAnnotationsMap$().pipe(ge(()=>_))),ye(_=>this.commentService.getResolvedCommentsOnDom$().pipe(ge(I=>({commentAnnotations:_,resolvedCommentsOnDom:I}))))).subscribe({next:({commentAnnotations:_,resolvedCommentsOnDom:I})=>{try{let M=this.globalConfigSignal().featureState.groupMatchedComments,B=I||M?_?.slice():_?.filter(Te=>Te.status.type!=="terminal"),q=null,ae=!1;if(B?.length&&M&&(ae=B.length>1||!B[0]?.isDraft),ae){q=new pS,q.annotationId=t.multiThreadAnnotationId,q.isTemporary=!0,q.from=B?.[0]?.from,q.metadata=B?.[0]?.metadata;let Te,Oe=t.locationId;Oe&&(Te=this.docService.getLocationByClientLocationId(Oe),Te||(Te={id:Oe}));let Me;Te&&(Me=this.docService.genarateLocationId(Te)),Te&&Me&&(q.location=Te,q.locationId=Me),t.context&&(q.context=t.context),t.targetElementId&&(q.targetElementId=t.targetElementId),q.commentAnnotationsMap={},q.commentAnnotations={};for(let Be of B||[])Be.annotationId&&(q.commentAnnotationsMap[Be.annotationId]=Be,q.commentAnnotations[Be.annotationId]=!0)}let _e=B?.length?B[B.length-1]:null;q&&(_e=q);let re=B?.filter(Te=>Te.status.type!=="terminal")?.length||0;l.update(Te=>y(h({},Te),{data:y(h({},Te.data),{annotation:_e,annotations:B||[],unresolvedAnnotationsCount:re})}));let be=l(),Ie=be.uiState.selectedAnnotationsMap;!I&&be.data.annotation?.status?.type==="terminal"&&!Ie[be.data.annotation?.annotationId]&&l.update(Te=>y(h({},Te),{data:y(h({},Te.data),{annotation:null})}));let Ce=_?.map(Te=>Te?.annotationId).filter(Boolean)||[];this.commentService.addBubbleCommentAnnotationIds(Ce),this.checkCommentPinSelected(e,t.componentId),i&&i(l()),setTimeout(()=>{this.commentService.addBubbleCommentAnnotationIds(Ce)},100)}catch(A){this.loggingService.catch("Error in CommentBubbleCoreService fetchAnnotation subscribe handler:",A)}},error:_=>{this.loggingService.catch("Error in CommentBubbleCoreService fetchAnnotation subscription:",_)}});this.annotationSubscriptions.set(e,u)}catch(a){this.loggingService.catch("Error in CommentBubbleCoreService fetchAnnotation:",a)}}checkCommentPinSelected(e,t){try{let i=this.contextMap.get(e);if(!i)return;let a=i(),l=a.uiState.selectedAnnotationsMap,c=a.data.annotation,d=a.uiState.selectedAnnotationsLocationMap;if(!c)return;let m=!!l[c.annotationId];if(m){let u;if((a.data.folderId||a.data.clientDocumentId||a.data.locationId||a.data.context)&&(u=this.commentService.generateComponentIdFromObject({folderId:a.data.folderId,clientDocumentId:a.data.clientDocumentId,locationId:a.data.locationId,context:a.data.context})),c.isDraft){let _=d?.[c.annotationId];u&&_?m=_===u:c?.sourceId&&(m=c.sourceId===t,m&&this.domService.setSelectedAnnotationLocation(c.annotationId,t))}else{let _=d?.[c.annotationId];_&&(m=_===t,!m&&u&&(m=_===u))}}m!==a.uiState.commentPinSelected&&i.update(u=>y(h({},u),{uiState:y(h({},u.uiState),{commentPinSelected:m})}))}catch(i){this.loggingService.catch("Error in CommentBubbleCoreService checkCommentPinSelected:",i)}}destroy(){try{this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.annotationSubscriptions.forEach(e=>e.unsubscribe()),this.annotationSubscriptions.clear(),this.contextMap.clear(),this.globalConfigSignal.set(see()),this.initialized=!1}catch(e){this.loggingService.catch("Error in CommentBubbleCoreService destroy:",e)}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var i1e=(()=>{let o=class o{constructor(e,t,i,a,l){this.commentService=e,this.commentActionsService=t,this.domService=i,this.loggingService=a,this.coreService=l}togglePinSelection(e,t,i){try{let a=this.coreService.getContextConfig(e),l=i||a?.()?.data?.annotation;if(this.emitCommentBubbleClick(l),l)if((this.domService.getSelectedAnnotationsMap()||{})[l.annotationId])document.querySelector(`[${N.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${l.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):this.domService.toggleAnnotationSelection(l,t);else{let d=document.querySelector(`[${N.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(d||(d=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),d){let m=d.getAttribute(N.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(m){let u=document.getElementById(`comment-pin-container-${m}`)||document.querySelector(`[data-velt-id='${m}']`);u&&(u.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.domService.toggleAnnotationSelection(l,t)}}catch(a){this.loggingService.catch("Error in CommentBubbleActionService togglePinSelection:",a)}}emitCommentBubbleClick(e){try{e&&this.commentActionsService.onCommentBubbleClick(e).catch(t=>{this.loggingService.catch("Error in CommentBubbleActionService emitCommentBubbleClick onCommentBubbleClick:",t)})}catch(t){this.loggingService.catch("Error in CommentBubbleActionService emitCommentBubbleClick:",t)}}saveComment(e,t){try{let a=this.coreService.getContextConfig(e)?.()?.data?.annotation;a&&this.commentService.saveComment(a,t)}catch(i){this.loggingService.catch("Error in CommentBubbleActionService saveComment:",i)}}onAddComment(e,t,i,a){try{this.coreService.globalConfigSignal().featureState.groupMatchedComments&&t?.annotation?.isDraft&&((this.domService.getSelectedAnnotationsMap()||{})[i]||this.domService.toggleAnnotationSelection({annotationId:i,type:"multiThread"},a))}catch(l){this.loggingService.catch("Error in CommentBubbleActionService onAddComment:",l)}}destroy(){}};o.\u0275fac=function(t){return new(t||o)(K(Re),K(Rn),K(Ue),K(k),K(HU))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var jp=(()=>{let o=class o extends lc{constructor(){super(...arguments),this.coreService=le(HU),this.actionService=le(i1e)}getDefaultLocalUIState(){return o1e()}getServiceComponentConfigSignal(){try{this.coreService.initialize();let t=this.hostElementRef?.nativeElement?.getAttribute?.("annotation-id")?.trim();return t?this.coreService.getOrCreateContextConfig(t):this.coreService.getOrCreateContextConfig("default")}catch{return}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["app-comment-bubble-primitive-themed-base"]],standalone:!1,features:[P],decls:0,vars:0,template:function(t,i){},encapsulation:2});let n=o;return n})();var a1e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),$rt=(n,o)=>({condition:n,data:o}),Grt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-comment-bubble-avatar-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Hrt(n,o){if(n&1&&D(0,"snippyly-user-avatar",2),n&2){let r=s(4),e=s();g("user",r.data.annotation.from),w("data-testid",e.componentId+"-user")}}function zrt(n,o){if(n&1&&(C(0),$(1,Hrt,1,2,"snippyly-user-avatar",2),b()),n&2){let r=s(3);v(),G(!(r.data==null||r.data.annotation==null)&&r.data.annotation.from?1:-1)}}function Wrt(n,o){if(n&1&&(C(0),p(1,zrt,2,1,"ng-container",1),b()),n&2){let r,e=s(3);v(),g("veltDynamicTemplate",j(4,Grt,e.template,E(1,a1e,e.componentConfigSignal,e.localUIStateSignal),(r=e.localUIStateSignal())==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function qrt(n,o){if(n&1&&p(0,Wrt,2,10,"ng-container",0),n&2){let r=s(2);g("veltIf",E(4,$rt,r.conditionSignal(),E(1,a1e,r.componentConfigSignal,r.localUIStateSignal)))}}function Yrt(n,o){if(n&1&&$(0,qrt,1,7,"ng-container"),n&2){let r=s();G(r.shouldShow()?0:-1)}}var oy=(()=>{let o=class o extends jp{constructor(){super(...arguments),this.componentId="velt-comment-bubble-avatar",this.shouldShow=ie(()=>{try{if(!this.defaultCondition())return!0;let e=this.localUIStateSignal(),t=this.componentConfigSignal();return!!e?.showAvatar&&!!t?.data?.annotation?.from}catch{return!0}})}ngOnInit(){try{super.ngOnInit(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,parentLocalUIState:this.localUIStateSignal})}catch(e){this.loggingService.catch("Error in CommentBubbleAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentBubbleAvatarComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.hostElementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Comment author avatar")}catch(e){this.loggingService.catch("Error in CommentBubbleAvatarComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-comment-bubble-avatar-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],[4,"veltDynamicTemplate"],["part","user-avatar",3,"user"]],template:function(t,i){if(t&1&&$(0,Yrt,1,1),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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)}"],changeDetection:0});let n=o;return n})();var l1e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),Krt=(n,o)=>({condition:n,data:o}),Zrt=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-comment-bubble-comments-count-wireframe",variant:r,setIfCondition:e,componentElementRef:t});function Jrt(n,o){if(n&1&&oe(0),n&2){let r=s(5);we(" ",r.data.unresolvedAnnotationsCount||0," ")}}function Xrt(n,o){if(n&1&&$(0,Jrt,1,1),n&2){let r=s(4);G(r.data!=null&&r.data.unresolvedAnnotationsCount?0:-1)}}function Qrt(n,o){if(n&1&&oe(0),n&2){let r=s(6);we(" ",r.data.annotation.comments.length||0," ")}}function eot(n,o){if(n&1&&$(0,Qrt,1,1),n&2){let r=s(5);G(!(r.data==null||r.data.annotation==null||r.data.annotation.comments==null)&&r.data.annotation.comments.length?0:-1)}}function tot(n,o){if(n&1&&oe(0),n&2){let r=s(6);we(" ",r.data.unreadCount||0," ")}}function not(n,o){if(n&1&&$(0,tot,1,1),n&2){let r=s(5);G(r.data!=null&&r.data.unreadCount?0:-1)}}function rot(n,o){if(n&1&&$(0,eot,1,1)(1,not,1,1),n&2){let r=s(5);G(r.localUIStateSignal().commentCountType==="total"?0:1)}}function oot(n,o){if(n&1&&(C(0),$(1,Xrt,1,1)(2,rot,2,1),b()),n&2){let r=s(3);v(),G((r.data==null||r.data.annotation==null?null:r.data.annotation.type)==="multiThread"?1:2)}}function iot(n,o){if(n&1&&(C(0),p(1,oot,3,1,"ng-container",1),b()),n&2){let r,e=s(3);v(),g("veltDynamicTemplate",j(4,Zrt,e.template,E(1,l1e,e.componentConfigSignal,e.localUIStateSignal),(r=e.localUIStateSignal())==null?null:r.variant,e.setIfCondition.bind(e),e.elementRef))}}function aot(n,o){if(n&1&&p(0,iot,2,10,"ng-container",0),n&2){let r=s(2);g("veltIf",E(4,Krt,r.conditionSignal(),E(1,l1e,r.componentConfigSignal,r.localUIStateSignal)))}}function lot(n,o){if(n&1&&$(0,aot,1,7,"ng-container"),n&2){let r=s();G(r.shouldShow()?0:-1)}}var iy=(()=>{let o=class o extends jp{constructor(){super(...arguments),this.componentId="velt-comment-bubble-count",this.shouldShow=ie(()=>{try{return this.defaultCondition(),!0}catch{return!0}})}ngOnInit(){try{super.ngOnInit(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,parentLocalUIState:this.localUIStateSignal})}catch(e){this.loggingService.catch("Error in CommentBubbleCommentsCountComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentBubbleCommentsCountComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.hostElementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true")}catch(e){this.loggingService.catch("Error in CommentBubbleCommentsCountComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-comment-bubble-comments-count-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,i){if(t&1&&$(0,lot,1,1),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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-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)}"],changeDetection:0});let n=o;return n})();var c1e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),cot=(n,o)=>({condition:n,data:o}),sot=(n,o,r,e,t)=>({template:n,context:o,componentName:"velt-comment-bubble-wireframe",variant:r,setIfCondition:e,componentElementRef:t}),dot=(n,o,r)=>({"velt-comment-pin--status-default":n,"velt-comment-pin--status-ongoing":o,"velt-comment-pin--status-terminal":r});function vot(n,o){n&1&&et(0)}function mot(n,o){if(n&1&&(f(0,"velt-shadow-dom-internal"),p(1,vot,1,0,"ng-container",1),S()),n&2){s(2);let r=Ee(2);v(),g("ngTemplateOutlet",r)}}function got(n,o){n&1&&et(0)}function uot(n,o){if(n&1&&p(0,got,1,0,"ng-container",1),n&2){s(2);let r=Ee(2);g("ngTemplateOutlet",r)}}function pot(n,o){if(n&1&&$(0,mot,2,1,"velt-shadow-dom-internal")(1,uot,1,1,"ng-container"),n&2){let r=s();G(!r.template&&o.shadowDom||r.template&&r.isExplicitShadowDom?0:1)}}function hot(n,o){if(n&1&&(C(0),f(1,"div",7)(2,"div",8),se(),f(3,"svg",9),D(4,"path",10),S(),St(),D(5,"velt-comment-bubble-unread-icon-internal",11),S(),D(6,"velt-comment-bubble-comments-count-internal",12),R(7,"translate"),S(),D(8,"velt-comment-bubble-avatar-internal",13),R(9,"translate"),b()),n&2){let r=s(3),e=s(2);v(),gt("--velt-internal-comment-pin-bg-color",(r.data.annotation==null||r.data.annotation.status==null?null:r.data.annotation.status.color)||"var(--velt-accent, #625DF5)"),g("ngClass",ze(21,dot,!e.customStatusesShown()&&(r.data.annotation==null||r.data.annotation.status==null?null:r.data.annotation.status.type)==="default",!e.customStatusesShown()&&(r.data.annotation==null||r.data.annotation.status==null?null:r.data.annotation.status.type)==="ongoing",!e.customStatusesShown()&&(r.data.annotation==null||r.data.annotation.status==null?null:r.data.annotation.status.type)==="terminal")),w("data-testid",e.componentId+"-count-container"),v(2),w("data-testid",e.componentId+"-count-icon")("aria-label","Comment bubble containing "+((r.data==null||r.data.annotation==null||r.data.annotation.comments==null?null:r.data.annotation.comments.length)||"0")+" comments"),v(2),g("componentConfigSignal",e.componentConfigSignal)("parentLocalUIState",e.localUIStateSignal),w("data-testid",e.componentId+"-unread-icon"),v(),g("componentConfigSignal",e.componentConfigSignal)("parentLocalUIState",e.localUIStateSignal),w("data-testid",e.componentId+"-count")("aria-label",((r.data==null||r.data.annotation==null||r.data.annotation.comments==null?null:r.data.annotation.comments.length)||"0")+" "+F(7,17,"comments in this thread")),v(2),g("componentConfigSignal",e.componentConfigSignal)("parentLocalUIState",e.localUIStateSignal),w("data-testid",e.componentId+"-avatar")("aria-label",F(9,19,"Avatar for comment author"))}}function fot(n,o){if(n&1){let r=Z();f(0,"velt-comment-dialog-portal-internal",4),z("togglePinSelection",function(t){return L(r),s(4).togglePinSelection(t),U(t.stopPropagation())})("saveComment",function(t){L(r);let i=s(4);return U(i.saveComment(t))})("addComment",function(t){L(r);let i=s(4);return U(i.onAddComment(t))}),f(1,"div",5),z("click",function(t){return L(r),U(t.stopPropagation())})("pointerup",function(t){return L(r),s(4).togglePinSelection(),U(t.stopPropagation())}),p(2,hot,10,25,"ng-container",6),S()()}if(n&2){let r,e=s(2),t=s(2);g("annotation",e.data.annotation)("context",e.data.context)("commentPinType","bubble")("commentPinSelected",e.uiState.commentPinSelected)("commentBubbleTargetPinHover",t.localUIStateSignal().commentBubbleTargetPinHover)("targetElement",void 0)("readOnly",t.localUIStateSignal().readOnly||t.coreService.globalConfigSignal().featureState.readOnly)("openDialog",t.localUIStateSignal().openDialog)("commentBubbleElementRef",t.elementRef)("user",t.coreService.globalConfigSignal().appState.user),w("data-testid",t.componentId+"-dialog-portal"),v(),pe("velt-comment-bubble-hover",t.localUIStateSignal().commentBubbleTargetPinHover)("velt-comment-bubble-open",!!e.uiState.selectedAnnotationsMap[e.data.annotation==null?null:e.data.annotation.annotationId]),w("data-velt-comment-bubble-comments-count",(e.data==null||e.data.annotation==null||e.data.annotation.comments==null?null:e.data.annotation.comments.length)||"0")("data-testid",t.componentId),v(),g("veltDynamicTemplate",j(21,sot,t.template,E(18,c1e,t.componentConfigSignal,t.localUIStateSignal),(r=t.localUIStateSignal())==null?null:r.variant,t.setIfCondition.bind(t),t.elementRef))}}function Cot(n,o){if(n&1&&(C(0),$(1,fot,3,27,"velt-comment-dialog-portal-internal",3),b()),n&2){let r=s();v(),G(r.data!=null&&r.data.annotation?1:-1)}}function bot(n,o){if(n&1&&p(0,Cot,2,1,"ng-container",2),n&2){let r=s(2);g("veltIf",E(4,cot,r.conditionSignal(),E(1,c1e,r.componentConfigSignal,r.localUIStateSignal)))}}function _ot(n,o){if(n&1&&$(0,bot,1,7,"ng-container"),n&2){let r,e=s();G((r=e.componentConfigSignal())?0:-1,r)}}var ay=(()=>{let o=class o extends jp{constructor(){super(...arguments),this.componentId="velt-comment-bubble",this.docService=le(st),this.wireframeService=le(Xe),this.uniqueComponentId="velt-comment-bubble-"+at(),this.multiThreadAnnotationId=`temp_${this.uniqueComponentId}`,this.subscriptions=[],this.isExplicitShadowDom=!1,this.veltElement=!0,this.shouldShow=ie(()=>{try{return!0}catch{return!0}}),this.customStatusesShown=ie(()=>{try{return this.coreService.globalConfigSignal().featureState.customStatusesShown}catch{return!1}})}set _targetCommentElementId(e){try{this.targetElementId=e}catch{}}set _variant(e){try{this.localUIStateSignal.update(t=>y(h({},t),{variant:e}))}catch{}}set _commentCountType(e){try{this.localUIStateSignal.update(t=>y(h({},t),{commentCountType:e}))}catch{}}set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.isExplicitShadowDom=!!t,this.localUIStateSignal.update(i=>y(h({},i),{shadowDom:!!t}))}catch{}}set _darkModeInput(e){try{if(e!=null){let t=e;typeof e=="string"&&(t=e!=="false"),this.darkMode=!!t}}catch{}}set commentBubbleTargetPinHoverInput(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.localUIStateSignal.update(i=>y(h({},i),{commentBubbleTargetPinHover:!!t}))}catch(t){this.loggingService.catch("Error in CommentBubbleComponent commentBubbleTargetPinHover setter:",t)}}set showAvatarInput(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.localUIStateSignal.update(i=>y(h({},i),{showAvatar:!!t}))}catch(t){this.loggingService.catch("Error in CommentBubbleComponent showAvatar setter:",t)}}set avatar(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.localUIStateSignal.update(i=>y(h({},i),{showAvatar:!!t}))}catch(t){this.loggingService.catch("Error in CommentBubbleComponent avatar setter:",t)}}set _openDialog(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.localUIStateSignal.update(i=>y(h({},i),{openDialog:!!t}))}catch(t){this.loggingService.catch("Error in CommentBubbleComponent openDialog setter:",t)}}set readOnly(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.localUIStateSignal.update(i=>y(h({},i),{readOnly:!!t}))}catch{}}set _folderId(e){try{this.coreService.getOrCreateContextConfig(this.uniqueComponentId).update(i=>y(h({},i),{data:y(h({},i.data),{folderId:e,veltFolderId:e?Nr(e):void 0})})),this.triggerAnnotationFetch()}catch{}}set _clientDocumentId(e){try{let t=this.coreService.getOrCreateContextConfig(this.uniqueComponentId),i=this.docService;t.update(a=>y(h({},a),{data:y(h({},a.data),{clientDocumentId:e,documentId:e?i?.generateDocumentId(e):void 0})})),this.triggerAnnotationFetch()}catch{}}set _locationId(e){try{this.coreService.getOrCreateContextConfig(this.uniqueComponentId).update(i=>y(h({},i),{data:y(h({},i.data),{locationId:e})})),this.triggerAnnotationFetch()}catch{}}set _context(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.coreService.getOrCreateContextConfig(this.uniqueComponentId).update(a=>y(h({},a),{data:y(h({},a.data),{context:t})}))}catch{}}set _contextOptions(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.coreService.getOrCreateContextConfig(this.uniqueComponentId).update(a=>y(h({},a),{data:y(h({},a.data),{contextOptions:t})}))}catch{}}ngOnInit(){try{this.coreService.initialize(),this.componentConfigSignal=this.coreService.getOrCreateContextConfig(this.uniqueComponentId),this.componentConfigSignal.update(a=>y(h({},a),{data:y(h({},a.data),{componentId:this.componentId})})),super.ngOnInit();let e="velt-comment-bubble-wireframe",t=this.localUIStateSignal()?.variant;t&&(e+=`---${t}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(a=>{try{if(a){let l=document.createElement(a.tagName);l.innerHTML=a.innerHTML,this.template=l,this.cd.markForCheck()}}catch(l){this.loggingService.catch("Error in CommentBubbleComponent wireframe subscription:",l)}}));let i=this.componentConfigSignal()?.data;(this.targetElementId||this.annotationId||i?.context||i?.folderId||i?.documentId||i?.locationId)&&this.triggerAnnotationFetch()}catch(e){this.loggingService.catch("Error in CommentBubbleComponent ngOnInit:",e)}}ngOnChanges(e){try{if(e?.annotationId&&this.annotationId&&this.triggerAnnotationFetch(),(e?._context||e?.context)&&this.triggerAnnotationFetch(),(e?._targetCommentElementId||e?.targetElementId)&&this.triggerAnnotationFetch(),e?._darkModeInput){let t=e._darkModeInput.currentValue;t!==null&&(t!="false"?this.hostElementRef.nativeElement.setAttribute("dark",""):this.hostElementRef.nativeElement.removeAttribute("dark"))}}catch(t){this.loggingService.catch("Error in CommentBubbleComponent ngOnChanges:",t)}}triggerAnnotationFetch(){try{let e=this.coreService.getOrCreateContextConfig(this.uniqueComponentId)();this.coreService.fetchAnnotation(this.uniqueComponentId,{annotationId:this.annotationId,targetElementId:this.targetElementId,context:e?.data?.context,contextOptions:e?.data?.contextOptions,element:this.hostElementRef.nativeElement,folderId:e?.data?.folderId,documentId:e?.data?.documentId,clientDocumentId:e?.data?.clientDocumentId,locationId:e?.data?.locationId,componentId:this.componentId,multiThreadAnnotationId:this.multiThreadAnnotationId},t=>{try{this.veltAnnotationId=t?.data?.annotation?.annotationId,this.veltAnnotationIds=t?.data?.annotations?.map(i=>i?.annotationId).join(",")}catch{}})}catch(e){this.loggingService.catch("Error in CommentBubbleComponent triggerAnnotationFetch:",e)}}togglePinSelection(e){try{if(!this.localUIStateSignal().openDialog){this.actionService.emitCommentBubbleClick(e||this.componentConfigSignal()?.data?.annotation);return}this.actionService.togglePinSelection(this.uniqueComponentId,this.componentId,e)}catch(t){this.loggingService.catch("Error in CommentBubbleComponent togglePinSelection:",t)}}saveComment(e){try{this.actionService.saveComment(this.uniqueComponentId,e)}catch(t){this.loggingService.catch("Error in CommentBubbleComponent saveComment:",t)}}onAddComment(e){try{this.actionService.onAddComment(this.uniqueComponentId,e,this.multiThreadAnnotationId,this.componentId)}catch(t){this.loggingService.catch("Error in CommentBubbleComponent onAddComment:",t)}}setupA11yAttributes(){try{this.hostElementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentBubbleComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>e?.unsubscribe()),this.subscriptions=[],this.coreService.clearContext(this.uniqueComponentId),super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentBubbleComponent ngOnDestroy:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-bubble"]],hostVars:3,hostBindings:function(t,i){t&2&&w("data-velt-annotation-id",i.veltAnnotationId)("data-velt-annotation-ids",i.veltAnnotationIds)("data-velt-element",i.veltElement)},inputs:{annotationId:"annotationId",targetElementId:"targetElementId",_targetCommentElementId:[0,"targetCommentElementId","_targetCommentElementId"],_variant:[0,"variant","_variant"],_commentCountType:[0,"commentCountType","_commentCountType"],_shadowDom:[0,"shadowDom","_shadowDom"],_darkModeInput:[0,"darkMode","_darkModeInput"],commentBubbleTargetPinHoverInput:[0,"commentBubbleTargetPinHover","commentBubbleTargetPinHoverInput"],showAvatarInput:[0,"showAvatar","showAvatarInput"],avatar:"avatar",_openDialog:[0,"openDialog","_openDialog"],readOnly:"readOnly",_folderId:[0,"folderId","_folderId"],_clientDocumentId:[0,"documentId","_clientDocumentId"],_locationId:[0,"locationId","_locationId"],_context:[0,"context","_context"],_contextOptions:[0,"contextOptions","_contextOptions"]},standalone:!1,features:[V([T]),P,Qe],decls:3,vars:1,consts:[["commentBubbleRefRef",""],[4,"ngTemplateOutlet"],[4,"veltIf"],[3,"annotation","context","commentPinType","commentPinSelected","commentBubbleTargetPinHover","targetElement","readOnly","openDialog","commentBubbleElementRef","user"],[3,"togglePinSelection","saveComment","addComment","annotation","context","commentPinType","commentPinSelected","commentBubbleTargetPinHover","targetElement","readOnly","openDialog","commentBubbleElementRef","user"],["part","container","slot","comment-bubble",1,"comment-bubble-container","velt-comment-bubble",3,"click","pointerup"],[4,"veltDynamicTemplate"],["part","count-container",1,"comment-count-container","velt-comment-bubble--count-container",3,"ngClass"],[1,"velt-comment-bubble--count-icon-wrapper"],["width","32","height","26","viewBox","0 0 32 26","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill","currentColor","stroke","currentColor","part","count-icon-path","d","M18 1H10C5.02944 1 1 5.02944 1 10V16C1 20.9706 5.02944 25 10 25H26H28.1315C29.7289 25 30.6817 23.2197 29.7956 21.8906L27.5038 18.453C27.1753 17.9602 27 17.3812 27 16.7889V10C27 5.02944 22.9706 1 18 1Z"],[3,"componentConfigSignal","parentLocalUIState"],["aria-hidden","true","role","status",1,"comment-count","velt-comment-bubble--count",3,"componentConfigSignal","parentLocalUIState"],["aria-hidden","true","role","img",3,"componentConfigSignal","parentLocalUIState"]],template:function(t,i){if(t&1&&($(0,pot,2,1),p(1,_ot,1,1,"ng-template",null,0,Ve)),t&2){let a;G((a=i.localUIStateSignal())?0:-1,a)}},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:inline-flex;--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-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-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)}.comment-bubble-container[_ngcontent-%COMP%]{display:flex;align-items:center;gap:0;cursor:pointer}.comment-bubble-container.custom-content[_ngcontent-%COMP%]{display:unset;gap:unset}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.625rem;display:flex;justify-content:center;align-items:center;padding-top:1px}.comment-count-container[_ngcontent-%COMP%]{align-items:center;box-sizing:border-box;display:flex;justify-content:left;position:relative;height:calc((1.625rem + 0px) * var(--velt-base-rem-unit));width:calc((2rem + 0px) * var(--velt-base-rem-unit))}.comment-count-container[_ngcontent-%COMP%] .velt-comment-bubble--count-icon-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center}.comment-count-container[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--velt-internal-comment-pin-bg-color)}.comment-count-container[_ngcontent-%COMP%] svg.velt-comment-pin--status-default[_ngcontent-%COMP%]{color:var(--velt-accent, var(--velt-internal-comment-pin-bg-color))}.comment-count-container[_ngcontent-%COMP%] svg.velt-comment-pin--status-ongoing[_ngcontent-%COMP%]{color:var(--velt-warning, var(--velt-internal-comment-pin-bg-color))}.comment-count-container[_ngcontent-%COMP%] svg.velt-comment-pin--status-terminal[_ngcontent-%COMP%]{color:var(--velt-success, var(--velt-internal-comment-pin-bg-color))}.comment-count[_ngcontent-%COMP%]{font-size:var(--velt-font-size-2xs);font-weight:600;left:2px;line-height:20px;position:absolute;right:var(--velt-spacing-xs);text-align:center;color:var(--velt-accent-foreground)}"],changeDetection:0});let n=o;return n})();var s1e=(n,o)=>({componentConfigSignal:n,parentLocalUIState:o}),Sot=(n,o)=>({condition:n,data:o}),yot=(n,o,r,e)=>({template:n,context:o,componentName:"velt-comment-bubble-unread-icon-wireframe",setIfCondition:r,componentElementRef:e});function kot(n,o){if(n&1&&(C(0),se(),f(1,"svg",2),R(2,"translate"),R(3,"translate"),D(4,"circle",3),S(),b()),n&2){let r=s(3),e=s();v(),w("data-testid",e.componentId+"-icon")("aria-label",F(2,2,"Comment bubble with")+" "+r.data.unreadCount+" "+F(3,4,"unread comments"))}}function xot(n,o){if(n&1&&(C(0),p(1,kot,5,6,"ng-container",1),b()),n&2){let r=s(3);v(),g("veltDynamicTemplate",Ze(4,yot,r.template,E(1,s1e,r.componentConfigSignal,r.localUIStateSignal),r.setIfCondition.bind(r),r.elementRef))}}function Iot(n,o){if(n&1&&p(0,xot,2,9,"ng-container",0),n&2){let r=s(2);g("veltIf",E(4,Sot,r.conditionSignal(),E(1,s1e,r.componentConfigSignal,r.localUIStateSignal)))}}function Eot(n,o){if(n&1&&$(0,Iot,1,7,"ng-container"),n&2){let r=s();G(r.shouldShow()?0:-1)}}var ly=(()=>{let o=class o extends jp{constructor(){super(...arguments),this.componentId="velt-comment-bubble-unread-icon",this.shouldShow=ie(()=>{try{return this.defaultCondition()?(this.componentConfigSignal()?.data?.unreadCount??0)>0:!0}catch{return!1}})}ngOnInit(){try{super.ngOnInit(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,parentLocalUIState:this.localUIStateSignal})}catch(e){this.loggingService.catch("Error in CommentBubbleUnreadIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentBubbleUnreadIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.hostElementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Unread comments indicator")}catch(e){this.loggingService.catch("Error in CommentBubbleUnreadIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=(()=>{let e;return function(i){return(e||(e=ve(o)))(i||o)}})(),o.\u0275cmp=O({type:o,selectors:[["velt-comment-bubble-unread-icon-internal"]],standalone:!1,features:[V([T]),P],decls:1,vars:1,consts:[[4,"veltIf"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","false",1,"velt-comment-bubble--unread-icon"],["cx","14.25","cy","3.75","r","3","fill","#FF7162"]],template:function(t,i){if(t&1&&$(0,Eot,1,1),t&2){let a;G((a=i.componentConfigSignal())?0:-1,a)}},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-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);display:flex;position:absolute;top:0;right:2px}[_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-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-comment-bubble--unread-icon[_ngcontent-%COMP%]{width:18px;height:18px;pointer-events:none}"],changeDetection:0});let n=o;return n})();function vee(){return{sidebarMode:!1,inboxMode:!1,dialogMode:!0,inlineCommentMode:!1,inlineCommentSectionMode:!1,focusedThreadMode:!1,isFocusedThreadEnabled:!1,pageModeComposer:!1,darkMode:!1,variant:"dialog",disabled:!1,commentPinSelected:!1,fullExpanded:!1,commentDialogSelected:!1,readOnly:!1,dialogShadowDOM:!0,locationVersion:"",composerPosition:"bottom",dialogOpenedInSidebar:!1,expandOnSelection:!0,commentPinType:"pin",containerComponentId:"",dialogInstanceId:at(),editComment:null,editCommentIndex:null,composerInOpenState:!1,assignToMenuOpened:!1,composerContent:"",composerContentHTML:"",selectedFiles:[],invalidSelectedFiles:[],selectedAttachments:[],localRecordedData:[],attachmentsToDelete:[],selectedVisibility:"public",selectedVisibilityUsers:[]}}var zU=new bt("LocalUIStateSignal"),Dm=class{constructor(){this.appState={user:new ia,isUserAdmin:!1,isKnownUser:!1,repliesUniqueUsers:[]},this.featureState={inlineCommentMode:!1,inlineCommentSectionMode:!1,sidebarMode:!1,dialogMode:!0,focusedThreadMode:!1,isFocusedThreadEnabled:!1,pageModeComposer:!1,inboxMode:!1,fullExpanded:!1,canResolveAnnotation:!1,canUnresolveAnnotation:!1,dialogSelectedByKnownUser:!1,resolveStatusAccessAdminOnly:!1,enableResolve:!1,isPlanExpired:!1,moderatorMode:!1,enableAutoCategorize:!1,suggestionMode:!1,commentAcceptedStatus:N.CommentAcceptStatus,commentRejectedStatus:N.CommentRejectStatus,enableSignInButton:!1,enableUpgradeButton:!1,enableGhostCommentsMessage:!1,replyAvatars:!1,userMentions:!0,anonymousEmail:!0,recordingSummaryEnabled:!1,enableAttachment:!0,enableAttachmentDownload:!0,allowedFileTypes:[],allowedRecordings:["audio","video","screen"],screenSharingSupported:!0,enterKeyToSubmit:!0,deleteOnBackspace:!0,enableReactions:!0,isInsidePdfViewer:!1,sidebarButtonOnCommentDialogVisible:!1,enableAssignment:!0,enableNotifications:!0,enableEdit:!0,enableDelete:!0,enablePrivateMode:!1,deleteThreadWithFirstComment:!0,seenByUsers:!0,enableStatus:!0,enablePriority:!1,visibilityOptions:!1,isPrivateCommentsEnabled:!1,privateModeEnabled:!1,privateModeType:null,privateModeUserIds:null,dialogSelection:!0,multiThread:!1,assignToType:"dropdown"},this.data={annotation:new Pr,ghostComment:null,assignTo:void 0,isAssignedCheckbox:!1,selectedUserContacts:[],currentDialogView:{}},this.uiState={darkMode:!1,variant:"dialog",disabled:!1,commentDialogSelected:!1,commentPinSelected:!1,readOnly:!1,dialogShadowDOM:!0,composerPosition:"bottom",dialogOpenedInSidebar:!1,containerComponentId:void 0,locationVersion:void 0,isPrivateComment:!1,sidebarButtonOnCommentDialogVisible:!1,showGhostCommentMessage:!1,showReplies:!1,collapsedComments:!1,showAllComments:!0,multiThreadAnnotationId:void 0,maxReplyAvatars:3,showSuggestionModeActions:!1,uploadingAttachments:!1,playVideoInFullScreen:!0,commentDialogUniqueId:void 0,reactionToolOpenIndex:-1,openDropdownIndexValue:-1,hasReactionsByCommentId:{}},this.unreadCommentsMap=null,this.unreadIndicatorMode=f0.MINIMAL,this.context={},this.trackById=o=>{try{return o?.commentId?.toString()||""}catch{return""}},this.trackByAttachmentId=o=>{try{return o?.attachmentId?.toString()||""}catch{return""}},this.trackByRecorderId=o=>{try{return o?.id?.toString()||""}catch{return""}},this.trackByStatusId=o=>{try{return o?.id?.toString()||""}catch{return""}},this.trackByPriorityId=o=>{try{return o?.id?.toString()||""}catch{return""}},this.trackByCustomChipId=o=>{try{return o?.id?.toString()||""}catch{return""}},this.trackByViewUserId=o=>{try{return o?.user?.userId?.toString()||""}catch{return""}},this.scrollToBottom=new Le,this.messageScrollOffset=0,this.setMessageScrollOffset=o=>{try{let r=o?.target;r&&(this.messageScrollOffset=r.scrollTop)}catch{}}}};var cy=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A){this.commentService=e,this.authService=t,this.iamService=i,this.usersService=a,this.loggingService=l,this.recorderService=c,this.customFilterService=d,this.viewsService=m,this.contactService=u,this.themeService=_,this.docService=I,this.domService=A,this.contextMap=new Map,this.annotationSubscriptions=new Map,this.registryMap=new Map,this.localUIStateRegistry=new Map,this.localAnonymousEmailOverrides=new Map,this.serviceSubscriptions=[],this.currentUser=new ia,this.currentIsUserAdmin=!1,this.currentResolveStatusAccessAdminOnly=!1,this.currentEnableResolve=!0,this.currentIsPlanExpired=!1,this.currentSidebarButtonOnCommentDialogVisible=!1,this.currentModeratorMode=!1,this.currentEnableSignInButton=!1,this.currentEnableUpgradeButton=!1,this.currentSuggestionMode=!1,this.currentEnableAutoCategorize=!1,this.currentEnableGhostCommentsMessage=!1,this.currentReadOnly=!1,this.currentMaxReplyAvatars=3,this.currentReplyAvatars=!1,this.currentEnableAttachment=!0,this.currentEnableAttachmentDownload=!0,this.currentEnableFormatOptions=!1,this.currentFormatConfig=null,this.currentAllowedFileTypes=[],this.currentAllowedRecordings=["audio","video","screen"],this.currentScreenSharingSupported=!!navigator?.mediaDevices?.getDisplayMedia,this.currentUserMentions=!0,this.currentAnonymousEmail=!0,this.currentDeleteOnBackspace=!0,this.currentEnterKeyToSubmit=!0,this.currentDialogShadowDOM=!0,this.currentRecordingSummaryEnabled=!1,this.currentEnableReactions=!0,this.currentEnableStatus=!1,this.currentCustomStatusesShown=!1,this.currentStatusOptions=[],this.currentEnablePriority=!0,this.currentPriorityOptions=[],this.currentEnableVisibilityOptions=!1,this.currentIsPrivateCommentsEnabled=!1,this.currentPrivateModeEnabled=!1,this.currentPrivateModeType=null,this.currentPrivateModeUserIds=null,this.currentDeleteThreadWithFirstComment=!0,this.currentCustomChipData=null,this.currentUnreadCommentsMap=null,this.currentUnreadIndicatorMode=void 0,this.currentSeenByUsers=!0,this.currentCommentViews=null,this.currentUserContactsBySnippylyId=null,this.currentDarkMode=!1,this.ghostCommentSubscription=null,this.currentGhostCommentAnnotationMap=null,this.currentCommentplaceholder=void 0,this.currentReplyplaceholder=void 0,this.currentEditplaceholder=void 0,this.currentEditcommentplaceholder=void 0,this.currentEditreplyplaceholder=void 0,this.currentAtHereLabel=void 0,this.currentShortUserName=!1,this.currentAttachmentNameInMessage=!1,this.currentShowAllComments=!0,this.currentPlayVideoInFullScreen=void 0,this.currentShowScreenSizeInfo=!1,this.currentInlineCommentMode=!1,this.currentFullExpanded=!1,this.currentShowCommentIndex=!1,this.currentIsPrivateCommentAllowed=!1,this.currentLinkCallback=!1,this.currentDialogOpenedInSidebar=!1,this.currentAddCommentMode=!1,this.currentAssignToType="dropdown",this.editDraftsMap=De(new Map),this.serviceSubscriptions.push(this.usersService.getUserById$().subscribe(()=>{this.contextMap.forEach(M=>{this.updateComputedProperties(M)})})),this.serviceSubscriptions.push(this.authService.getUser$().subscribe(M=>{M&&(this.currentUser=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{appState:y(h({},q.appState),{user:M})})),this.updateComputedProperties(B)}))})),this.serviceSubscriptions.push(this.iamService.isUserAdmin$().subscribe(M=>{this.currentIsUserAdmin=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{appState:y(h({},q.appState),{isUserAdmin:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getResolveStatusAccessAdminOnly$().subscribe(M=>{this.currentResolveStatusAccessAdminOnly=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{resolveStatusAccessAdminOnly:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableResolve$().subscribe(M=>{this.currentEnableResolve=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableResolve:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.authService.isPlanExpired$().subscribe(M=>{this.currentIsPlanExpired=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{isPlanExpired:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getSidebarButtonOnCommentDialogVisibility$().subscribe(M=>{this.currentSidebarButtonOnCommentDialogVisible=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{sidebarButtonOnCommentDialogVisible:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.themeService.getDarkMode$().subscribe(M=>{this.currentDarkMode=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{darkMode:M})}))})})),this.serviceSubscriptions.push(this.commentService.getModeratorMode$().subscribe(M=>{this.currentModeratorMode=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{moderatorMode:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getSignInButton$().subscribe(M=>{this.currentEnableSignInButton=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableSignInButton:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getUpgradeButton$().subscribe(M=>{this.currentEnableUpgradeButton=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableUpgradeButton:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getSuggestionMode$().subscribe(M=>{this.currentSuggestionMode=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{suggestionMode:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableAutoCategorize$().subscribe(M=>{this.currentEnableAutoCategorize=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableAutoCategorize:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableGhostCommentsMessage$().subscribe(M=>{this.currentEnableGhostCommentsMessage=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableGhostCommentsMessage:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getReadOnly$().subscribe(M=>{this.currentReadOnly=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{readOnly:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getMaxReplyAvatars$().subscribe(M=>{this.currentMaxReplyAvatars=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{maxReplyAvatars:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getReplyAvatars$().subscribe(M=>{this.currentReplyAvatars=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{replyAvatars:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableAttachment$().subscribe(M=>{this.currentEnableAttachment=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableAttachment:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableAttachmentDownload$().subscribe(M=>{this.currentEnableAttachmentDownload=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableAttachmentDownload:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableFormatOptions$().subscribe(M=>{this.currentEnableFormatOptions=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableFormatOptions:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getFormatConfig$().subscribe(M=>{this.currentFormatConfig=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{formatConfig:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableReactions$().subscribe(M=>{this.currentEnableReactions=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableReactions:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableStatus$().subscribe(M=>{this.currentEnableStatus=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enableStatus:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getCustomStatusesShown$().subscribe(M=>{this.currentCustomStatusesShown=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{customStatusesShown:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.customFilterService.customStatusMap$.subscribe(M=>{let B=M?Object.values(M):[];this.currentStatusOptions=B,this.contextMap.forEach(q=>{let ae=q();q.set(y(h({},ae),{featureState:y(h({},ae.featureState),{statusOptions:B})})),this.updateComputedProperties(q)})})),this.serviceSubscriptions.push(this.commentService.getEnablePriority$().subscribe(M=>{this.currentEnablePriority=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enablePriority:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableVisibilityOptions$().subscribe(M=>{this.currentEnableVisibilityOptions=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{visibilityOptions:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.authService.getIsPrivateCommentsEnabled$().subscribe(M=>{this.currentIsPrivateCommentsEnabled=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{isPrivateCommentsEnabled:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getPrivateModeConfig$().subscribe(M=>{let B=M!==null,q=M?.type??null,ae=M?.userIds??null;this.currentPrivateModeType=q,this.currentPrivateModeUserIds=ae,this.currentPrivateModeEnabled!==B&&(this.currentPrivateModeEnabled=B),this.updatePrivateModeEnabledInAllContexts()})),this.serviceSubscriptions.push(this.commentService.getPrivateCommentMode$().subscribe(M=>{M&&!this.currentPrivateModeEnabled?(this.currentPrivateModeEnabled=!0,this.currentPrivateModeType="organizationPrivate",this.updatePrivateModeEnabledInAllContexts()):!M&&!this.commentService.getPrivateModeConfig()&&(this.currentPrivateModeEnabled=!1,this.currentPrivateModeType=null,this.updatePrivateModeEnabledInAllContexts())})),this.serviceSubscriptions.push(this.customFilterService.customPriorityMap$.subscribe(M=>{let B=M?Object.values(M):[];this.currentPriorityOptions=B,this.contextMap.forEach(q=>{let ae=q();q.set(y(h({},ae),{featureState:y(h({},ae.featureState),{priorityOptions:B})})),this.updateComputedProperties(q)})})),this.serviceSubscriptions.push(this.commentService.getDeleteThreadWithFirstComment$().subscribe(M=>{this.currentDeleteThreadWithFirstComment=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{deleteThreadWithFirstComment:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getCustomChipDropdownData$().subscribe(M=>{this.currentCustomChipData=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{data:y(h({},q.data),{customChipData:M,selectedCustomChipSet:q.data.selectedCustomChipSet||new Set})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getAllowedFileTypes$().subscribe(M=>{this.currentAllowedFileTypes=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{allowedFileTypes:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getAllowedRecordings$().subscribe(M=>{this.currentAllowedRecordings=M||[],this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{allowedRecordings:M||[]})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getUserMentions$().subscribe(M=>{this.currentUserMentions=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{userMentions:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnableAnonymousEmail$().subscribe(M=>{this.currentAnonymousEmail=M,this.contextMap.forEach((B,q)=>{if(this.localAnonymousEmailOverrides.has(q))return;let ae=B();B.set(y(h({},ae),{featureState:y(h({},ae.featureState),{anonymousEmail:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getAssignToType$().subscribe(M=>{this.currentAssignToType=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{assignToType:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getDeleteOnBackspace$().subscribe(M=>{this.currentDeleteOnBackspace=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{deleteOnBackspace:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getEnterKeyToSubmit$().subscribe(M=>{this.currentEnterKeyToSubmit=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{enterKeyToSubmit:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getDialogShadowDOM$().subscribe(M=>{this.currentDialogShadowDOM=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{dialogShadowDOM:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getComposerMode$().subscribe(M=>{this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{composerMode:M||"default"})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getRecordingSummaryEnabled$().subscribe(M=>{this.currentRecordingSummaryEnabled=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{recordingSummaryEnabled:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(M=>{this.currentUnreadCommentsMap=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{unreadCommentsMap:M})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getUnreadIndicatorMode$().subscribe(M=>{this.currentUnreadIndicatorMode=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{unreadIndicatorMode:M})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.recorderService.onInitRecording().subscribe(M=>{this.contextMap.forEach((B,q)=>{let ae=B();(M?.panelId===ae.uiState?.commentDialogUniqueId||M?.commentAnnotationId===q||!M)&&(B.set(y(h({},ae),{uiState:y(h({},ae.uiState),{recorderInitConfig:M})})),this.updateComputedProperties(B),M?.commentAnnotationId&&M?.commentAnnotationId===q&&!ae.featureState?.sidebarMode&&this.domService.setRecordingInProgress(M.commentAnnotationId,!0))})})),this.ghostCommentSubscription=this.commentService.getGhostCommentAnnotationMap$().subscribe(M=>{this.currentGhostCommentAnnotationMap=M||null,this.contextMap.forEach((B,q)=>{let ae=B(),_e=M?M[q]:null;B.set(y(h({},ae),{data:y(h({},ae.data),{ghostComment:_e||null})})),this.updateComputedProperties(B)})}),this.ghostCommentSubscription&&this.serviceSubscriptions.push(this.ghostCommentSubscription),this.serviceSubscriptions.push(this.commentService.getSeenByUsers$().subscribe(M=>{this.currentSeenByUsers=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{seenByUsers:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.viewsService.getCommentFeatureViews$().subscribe(M=>{this.currentCommentViews=M,this.contextMap.forEach(B=>{this.computeCurrentDialogView(B)})})),this.serviceSubscriptions.push(this.contactService.getUserContactsBySnippylyId$().subscribe(M=>{this.currentUserContactsBySnippylyId=M,this.contextMap.forEach(B=>{this.computeCurrentDialogView(B)})})),this.serviceSubscriptions.push(this.commentService.getCommentplaceholder$().subscribe(M=>{this.currentCommentplaceholder=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{commentplaceholder:M}))})})),this.serviceSubscriptions.push(this.commentService.getReplyplaceholder$().subscribe(M=>{this.currentReplyplaceholder=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{replyplaceholder:M}))})})),this.serviceSubscriptions.push(this.commentService.getEditplaceholder$().subscribe(M=>{this.currentEditplaceholder=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{editplaceholder:M}))})})),this.serviceSubscriptions.push(this.commentService.getEditcommentplaceholder$().subscribe(M=>{this.currentEditcommentplaceholder=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{editcommentplaceholder:M}))})})),this.serviceSubscriptions.push(this.commentService.getEditreplyplaceholder$().subscribe(M=>{this.currentEditreplyplaceholder=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{editreplyplaceholder:M}))})})),this.serviceSubscriptions.push(this.contactService.getAtHereLabel().subscribe(M=>{this.currentAtHereLabel=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{atHereLabel:M})}))})})),this.serviceSubscriptions.push(this.commentService.getShortUserName$().subscribe(M=>{this.currentShortUserName=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{shortUserName:M})}))})})),this.serviceSubscriptions.push(this.commentService.getAttachmentNameInMessage$().subscribe(M=>{this.currentAttachmentNameInMessage=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{attachmentNameInMessage:M})}))})})),this.serviceSubscriptions.push(this.commentService.getCollapsedComments$().subscribe(M=>{this.currentShowAllComments=!M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{showAllComments:!M,collapsedComments:M})}))})})),this.serviceSubscriptions.push(this.recorderService.getPlayVideoInFullScreen$().subscribe(M=>{this.currentPlayVideoInFullScreen=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{playVideoInFullScreen:M})}))})})),this.serviceSubscriptions.push(this.commentService.getShowScreenSizeInfo$().subscribe(M=>{this.currentShowScreenSizeInfo=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{showScreenSizeInfo:M})}))})})),this.serviceSubscriptions.push(this.commentService.getInlineCommentMode$().subscribe(M=>{this.currentInlineCommentMode=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{inlineCommentMode:M})}))})})),this.serviceSubscriptions.push(this.commentService.getFullExpanded$().subscribe(M=>{this.currentFullExpanded=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{fullExpanded:M})})),this.updateComputedProperties(B)})})),this.serviceSubscriptions.push(this.commentService.getShowCommentIndex().subscribe(M=>{this.currentShowCommentIndex=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{showCommentIndex:M})}))})})),this.serviceSubscriptions.push(this.commentService.isPrivateCommentAllowed$().subscribe(M=>{this.currentIsPrivateCommentAllowed=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{isPrivateCommentAllowed:M})}))})})),this.serviceSubscriptions.push(this.commentService.getLinkCallback$().subscribe(M=>{this.currentLinkCallback=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{featureState:y(h({},q.featureState),{linkCallback:M})}))})})),this.serviceSubscriptions.push(this.commentService.addCommentModeChange().subscribe(M=>{this.currentAddCommentMode=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{addCommentMode:M})}))})})),this.serviceSubscriptions.push(this.domService.getDialogOpenedInSidebar().subscribe(M=>{this.currentDialogOpenedInSidebar=M,this.contextMap.forEach(B=>{let q=B();B.set(y(h({},q),{uiState:y(h({},q.uiState),{dialogOpenedInSidebar:M})}))})})),this.serviceSubscriptions.push(this.recorderService.onRecordingAttributeRemovedFromBody$().subscribe(()=>{this.contextMap.forEach(M=>{let B=M();M.set(y(h({},B),{uiState:y(h({},B.uiState),{recordingAttributeRemovedTimestamp:Date.now()})}))})}))}setRegistry(e,t){try{this.registryMap.set(e,t)}catch(i){this.loggingService.catch("Error in CommentDialogCoreService setRegistry:",i)}}getRegistry(e){try{return this.registryMap.get(e)}catch(t){this.loggingService.catch("Error in CommentDialogCoreService getRegistry:",t);return}}clearRegistry(e){try{this.registryMap.delete(e)}catch(t){this.loggingService.catch("Error in CommentDialogCoreService clearRegistry:",t)}}createDefaultComponentConfig(){try{let e=new Dm,t=new Pr;return e.appState={user:this.currentUser,isUserAdmin:this.currentIsUserAdmin,isKnownUser:!1},e.data={annotation:t,customChipData:this.currentCustomChipData,selectedCustomChipSet:new Set,customList:t.customList||[],currentDialogView:{}},e.featureState={inlineCommentMode:this.currentInlineCommentMode,inlineCommentSectionMode:!1,canResolveAnnotation:!1,resolveStatusAccessAdminOnly:this.currentResolveStatusAccessAdminOnly,sidebarMode:!1,enableResolve:this.currentEnableResolve,dialogSelectedByKnownUser:!1,isPlanExpired:this.currentIsPlanExpired,dialogMode:!0,moderatorMode:this.currentModeratorMode,enableAutoCategorize:this.currentEnableAutoCategorize,suggestionMode:this.currentSuggestionMode,commentAcceptedStatus:N.CommentAcceptStatus,commentRejectedStatus:N.CommentRejectStatus,enableSignInButton:this.currentEnableSignInButton,enableUpgradeButton:this.currentEnableUpgradeButton,enableGhostCommentsMessage:this.currentEnableGhostCommentsMessage,replyAvatars:this.currentReplyAvatars,userMentions:this.currentUserMentions,anonymousEmail:this.currentAnonymousEmail,recordingSummaryEnabled:this.currentRecordingSummaryEnabled,enableAttachment:this.currentEnableAttachment,enableAttachmentDownload:this.currentEnableAttachmentDownload,enableFormatOptions:this.currentEnableFormatOptions,formatConfig:this.currentFormatConfig??void 0,allowedFileTypes:this.currentAllowedFileTypes,allowedRecordings:this.currentAllowedRecordings,screenSharingSupported:this.currentScreenSharingSupported,enterKeyToSubmit:this.currentEnterKeyToSubmit,deleteOnBackspace:this.currentDeleteOnBackspace,enableReactions:this.currentEnableReactions,enableStatus:this.currentEnableStatus,customStatusesShown:this.currentCustomStatusesShown,statusOptions:this.currentStatusOptions,enablePriority:this.currentEnablePriority,priorityOptions:this.currentPriorityOptions,visibilityOptions:this.currentEnableVisibilityOptions,isPrivateCommentsEnabled:this.currentIsPrivateCommentsEnabled,privateModeEnabled:this.currentPrivateModeEnabled,privateModeType:this.currentPrivateModeType,privateModeUserIds:this.currentPrivateModeUserIds,deleteThreadWithFirstComment:this.currentDeleteThreadWithFirstComment,fullExpanded:this.currentFullExpanded,seenByUsers:this.currentSeenByUsers,isPrivateCommentAllowed:this.currentIsPrivateCommentAllowed,linkCallback:this.currentLinkCallback,assignToType:this.currentAssignToType,messageTruncation:!1,messageTruncationLines:4},e.uiState={darkMode:this.currentDarkMode,variant:"dialog",disabled:!1,isPrivateComment:!1,commentDialogSelected:!1,commentPinSelected:!1,sidebarButtonOnCommentDialogVisible:this.currentSidebarButtonOnCommentDialogVisible,readOnly:this.currentReadOnly,maxReplyAvatars:this.currentMaxReplyAvatars,uploadingAttachments:!1,dialogShadowDOM:this.currentDialogShadowDOM,commentDialogUniqueId:at(),composerMode:"default",showReplies:!1,collapsedComments:!1,showAllComments:this.currentShowAllComments,shortUserName:this.currentShortUserName,attachmentNameInMessage:this.currentAttachmentNameInMessage,showScreenSizeInfo:this.currentShowScreenSizeInfo,showCommentIndex:this.currentShowCommentIndex,playVideoInFullScreen:this.currentPlayVideoInFullScreen,addCommentMode:this.currentAddCommentMode,dialogOpenedInSidebar:this.currentDialogOpenedInSidebar,atHereLabel:this.currentAtHereLabel},e.unreadCommentsMap=this.currentUnreadCommentsMap,e.unreadIndicatorMode=this.currentUnreadIndicatorMode,e.commentplaceholder=this.currentCommentplaceholder,e.replyplaceholder=this.currentReplyplaceholder,e.editplaceholder=this.currentEditplaceholder,e.editcommentplaceholder=this.currentEditcommentplaceholder,e.editreplyplaceholder=this.currentEditreplyplaceholder,e}catch(e){return this.loggingService.catch("Error in CommentDialogCoreService createDefaultComponentConfig:",e),new Dm}}getDefaultBase(){try{let e=this.createDefaultComponentConfig();return{appState:{user:e.appState.user,isUserAdmin:e.appState.isUserAdmin,isKnownUser:e.appState.isKnownUser,repliesUniqueUsers:e.appState.repliesUniqueUsers},data:{annotation:e.data.annotation,customChipData:e.data.customChipData,selectedCustomChipSet:e.data.selectedCustomChipSet,customList:e.data.customList},featureState:{inlineCommentMode:e.featureState.inlineCommentMode,inlineCommentSectionMode:e.featureState.inlineCommentSectionMode,canResolveAnnotation:e.featureState.canResolveAnnotation,canUnresolveAnnotation:e.featureState.canUnresolveAnnotation,resolveStatusAccessAdminOnly:e.featureState.resolveStatusAccessAdminOnly,sidebarMode:e.featureState.sidebarMode,enableResolve:e.featureState.enableResolve,dialogSelectedByKnownUser:e.featureState.dialogSelectedByKnownUser,isPlanExpired:e.featureState.isPlanExpired,moderatorMode:e.featureState.moderatorMode,enableAutoCategorize:e.featureState.enableAutoCategorize,suggestionMode:e.featureState.suggestionMode,commentAcceptedStatus:e.featureState.commentAcceptedStatus,commentRejectedStatus:e.featureState.commentRejectedStatus,enableSignInButton:e.featureState.enableSignInButton,enableUpgradeButton:e.featureState.enableUpgradeButton,enableGhostCommentsMessage:e.featureState.enableGhostCommentsMessage,replyAvatars:e.featureState.replyAvatars,userMentions:e.featureState.userMentions,anonymousEmail:e.featureState.anonymousEmail,recordingSummaryEnabled:e.featureState.recordingSummaryEnabled,enableAttachment:e.featureState.enableAttachment,enableFormatOptions:e.featureState.enableFormatOptions,formatConfig:e.featureState.formatConfig,allowedFileTypes:e.featureState.allowedFileTypes,allowedRecordings:e.featureState.allowedRecordings,screenSharingSupported:e.featureState.screenSharingSupported,enterKeyToSubmit:e.featureState.enterKeyToSubmit,deleteOnBackspace:e.featureState.deleteOnBackspace,enableReactions:e.featureState.enableReactions,enableStatus:e.featureState.enableStatus,customStatusesShown:e.featureState.customStatusesShown,statusOptions:e.featureState.statusOptions,enablePriority:e.featureState.enablePriority,priorityOptions:e.featureState.priorityOptions,deleteThreadWithFirstComment:e.featureState.deleteThreadWithFirstComment,seenByUsers:e.featureState.seenByUsers,fullExpanded:e.featureState.fullExpanded,isPrivateCommentAllowed:e.featureState.isPrivateCommentAllowed,linkCallback:e.featureState.linkCallback,assignToType:e.featureState.assignToType,messageTruncation:e.featureState.messageTruncation,messageTruncationLines:e.featureState.messageTruncationLines},uiState:{darkMode:e.uiState?.darkMode,variant:e.uiState?.variant,disabled:e.uiState?.disabled,isPrivateComment:e.uiState?.isPrivateComment,dialogShadowDOM:e.uiState?.dialogShadowDOM,composerMode:e.uiState?.composerMode??"default",showAllComments:e.uiState?.showAllComments,collapsedComments:e.uiState?.collapsedComments,shortUserName:e.uiState?.shortUserName,attachmentNameInMessage:e.uiState?.attachmentNameInMessage,showScreenSizeInfo:e.uiState?.showScreenSizeInfo,showCommentIndex:e.uiState?.showCommentIndex,playVideoInFullScreen:e.uiState?.playVideoInFullScreen,addCommentMode:e.uiState?.addCommentMode,dialogOpenedInSidebar:e.uiState?.dialogOpenedInSidebar,atHereLabel:e.uiState?.atHereLabel},unreadCommentsMap:e.unreadCommentsMap,unreadIndicatorMode:e.unreadIndicatorMode,commentplaceholder:e.commentplaceholder,replyplaceholder:e.replyplaceholder}}catch(e){return this.loggingService.catch("Error in CommentDialogCoreService getDefaultBase:",e),{}}}getOrCreateContextConfig(e){try{if(!this.contextMap.has(e)){let t=this.createDefaultComponentConfig();this.currentGhostCommentAnnotationMap&&this.currentGhostCommentAnnotationMap[e]&&(t.data=y(h({},t.data),{ghostComment:this.currentGhostCommentAnnotationMap[e]}));let i=De(t);this.contextMap.set(e,i),this.updateComputedProperties(i),this.fetchAndUpdateAnnotation(e)}return this.contextMap.get(e)}catch(t){return this.loggingService.catch("Error in CommentDialogCoreService getOrCreateContextConfig:",t),De(new Dm)}}getContextConfig(e){try{return this.contextMap.get(e)}catch(t){this.loggingService.catch("Error in CommentDialogCoreService getContextConfig:",t);return}}setLocalAnonymousEmail(e,t){try{this.localAnonymousEmailOverrides.set(e,t);let i=this.contextMap.get(e);if(i){let a=i();i.set(y(h({},a),{featureState:y(h({},a.featureState),{anonymousEmail:t})})),this.updateComputedProperties(i)}}catch(i){this.loggingService.catch("Error in CommentDialogCoreService setLocalAnonymousEmail:",i)}}clearLocalAnonymousEmail(e){try{this.localAnonymousEmailOverrides.delete(e);let t=this.contextMap.get(e);if(t){let i=t();t.set(y(h({},i),{featureState:y(h({},i.featureState),{anonymousEmail:this.currentAnonymousEmail})})),this.updateComputedProperties(t)}}catch(t){this.loggingService.catch("Error in CommentDialogCoreService clearLocalAnonymousEmail:",t)}}registerLocalUIState(e,t){this.localUIStateRegistry.set(e,t)}unregisterLocalUIState(e){this.localUIStateRegistry.delete(e)}getLocalUIState(e){return this.localUIStateRegistry.get(e)}editDraftKey(e,t){return`${e}:${t}`}getEditDraft(e,t){try{return!e||t===void 0||t===null?null:this.editDraftsMap().get(this.editDraftKey(e,t))??null}catch(i){return this.loggingService.catch("Error in getEditDraft:",i),null}}setEditDraft(e,t,i){try{let a=this.editDraftKey(e,t);this.editDraftsMap.update(l=>{let c=l.get(a);if(c&&c.composerContent===i.composerContent&&c.composerContentHTML===i.composerContentHTML)return l;let d=new Map(l);return d.set(a,i),d})}catch(a){this.loggingService.catch("Error in setEditDraft:",a)}}clearEditDraft(e,t){try{let i=this.editDraftKey(e,t);this.editDraftsMap.update(a=>{if(!a.has(i))return a;let l=new Map(a);return l.delete(i),l})}catch(i){this.loggingService.catch("Error in clearEditDraft:",i)}}setContextConfig(e,t){try{this.contextMap.set(e,t);let i=t(),a=this.getDefaultBase(),l=h(h({},a),i);this.localAnonymousEmailOverrides.has(e)&&(l.featureState=y(h({},l.featureState),{anonymousEmail:this.localAnonymousEmailOverrides.get(e)})),t.set(l),this.updateComputedProperties(t)}catch(i){this.loggingService.catch("Error in CommentDialogCoreService setContextConfig:",i)}}clearContext(e){try{this.contextMap.delete(e),this.localAnonymousEmailOverrides.delete(e);let t=this.annotationSubscriptions.get(e);t&&(t.unsubscribe(),this.annotationSubscriptions.delete(e))}catch(t){this.loggingService.catch("Error in CommentDialogCoreService clearContext:",t)}}generateTempAnnotationId(e){try{let t=e||at();return`${o.TEMP_ID_PREFIX}${t}`}catch(t){return this.loggingService.catch("Error in CommentDialogCoreService generateTempAnnotationId:",t),"TEMP_ANNOTATION_ID"}}isTempAnnotationId(e){try{return e?.startsWith(o.TEMP_ID_PREFIX)||!1}catch(t){return this.loggingService.catch("Error in CommentDialogCoreService isTempAnnotationId:",t),!1}}registerTempContext(e,t){try{if(!this.isTempAnnotationId(e)){this.loggingService.warn(`[registerTempContext] ID "${e}" is not a valid temp ID`);return}this.contextMap.set(e,t);let i=t(),a=this.getDefaultBase(),l=y(h(h({},a),i),{data:y(h(h({},a.data),i.data),{annotation:i.data?.annotation||a.data?.annotation}),appState:h(h({},a.appState),i.appState),featureState:y(h(h({},a.featureState),i.featureState),{allowedRecordings:a.featureState?.allowedRecordings,enableAttachment:a.featureState?.enableAttachment,enableReactions:a.featureState?.enableReactions,allowedFileTypes:a.featureState?.allowedFileTypes,screenSharingSupported:a.featureState?.screenSharingSupported,userMentions:a.featureState?.userMentions,anonymousEmail:a.featureState?.anonymousEmail,enterKeyToSubmit:a.featureState?.enterKeyToSubmit,deleteOnBackspace:a.featureState?.deleteOnBackspace,recordingSummaryEnabled:a.featureState?.recordingSummaryEnabled,enableResolve:a.featureState?.enableResolve,enableStatus:a.featureState?.enableStatus,enablePriority:a.featureState?.enablePriority,statusOptions:a.featureState?.statusOptions,priorityOptions:a.featureState?.priorityOptions,assignToType:a.featureState?.assignToType}),uiState:h(h({},a.uiState),i.uiState)});t.set(l),this.updateComputedProperties(t)}catch(i){this.loggingService.catch("Error in CommentDialogCoreService registerTempContext:",i)}}clearTempContext(e){try{this.isTempAnnotationId(e)&&this.contextMap.has(e)&&(this.contextMap.delete(e),this.registryMap.delete(e))}catch(t){this.loggingService.catch("Error in CommentDialogCoreService clearTempContext:",t)}}computeNewCommentPlaceholder(e,t,i,a){try{if(t)return t;if(e?.placeholder)return e.placeholder;let l=e?.featureState?.userMentions===!0,c=(e?.data?.annotation?.comments?.length||0)>0,d=i||e?.replyplaceholder,m=a||e?.commentplaceholder;return c&&d?d:!c&&m?m:l?c?"Reply or add others with @":"Comment or add others with @":c?"Write a reply...":"Write a comment..."}catch(l){return this.loggingService.catch("Error in CommentDialogCoreService computeNewCommentPlaceholder:",l),"Write a comment..."}}computeEditCommentPlaceholder(e,t,i,a=!1,l,c,d){try{if(t)return t;if(e?.placeholder)return e.placeholder;let m=l||e?.editcommentplaceholder,u=c||e?.editreplyplaceholder,_;if(typeof d=="number"?_=d>0:_=(e?.data?.annotation?.comments?.length||0)>0,_&&u)return u;if(!_&&m)return m;let I=i||e?.editplaceholder;return I||(a?_?"Edit your reply...":"Edit your comment...":"Edit comment...")}catch(m){return this.loggingService.catch("Error in CommentDialogCoreService computeEditCommentPlaceholder:",m),"Edit comment..."}}recomputeDerivedProperties(e){try{let t=this.getContextConfig(e);t&&this.updateComputedProperties(t)}catch(t){this.loggingService.catch("Error in CommentDialogCoreService recomputeDerivedProperties:",t)}}ngOnDestroy(){try{this.serviceSubscriptions.forEach(e=>{e&&!e.closed&&e.unsubscribe()}),this.serviceSubscriptions=[],this.ghostCommentSubscription=null,this.annotationSubscriptions.forEach(e=>{e&&!e.closed&&e.unsubscribe()}),this.annotationSubscriptions.clear()}catch(e){this.loggingService.catch("Error in CommentDialogCoreService ngOnDestroy:",e)}}fetchAndUpdateAnnotation(e,t){try{if(this.annotationSubscriptions.has(e))t&&t();else{let i=this.commentService.getCommentAnnotationByAnnotationId(e).subscribe({next:a=>{if(a){let l=this.getContextConfig(e);if(l){let c=l(),d=y(h({},a),{annotationId:e});l.update(m=>y(h({},m),{data:y(h({},m.data),{annotation:d})})),this.updateComputedProperties(l),this.computeCurrentDialogView(l)}t&&t()}},error:a=>{},complete:()=>{}});this.annotationSubscriptions.set(e,i)}}catch{}}updateContextConfig(e,t){try{let i=this.getContextConfig(e);if(i){let a=i();i.set(h(h({},a),t))}}catch(i){this.loggingService.catch("Error in CommentDialogCoreService updateContextConfig:",i)}}updatePrivateModeEnabledInAllContexts(){this.contextMap.forEach(e=>{let t=e();e.set(y(h({},t),{featureState:y(h({},t.featureState),{privateModeEnabled:this.currentPrivateModeEnabled,privateModeType:this.currentPrivateModeType,privateModeUserIds:this.currentPrivateModeUserIds})})),this.updateComputedProperties(e)})}updateComputedProperties(e){try{let t=e(),i=this.computeIsKnownUser(t),a=this.computeDialogSelectedByKnownUser(t,i),l=this.computeIsPrivateComment(t),c=this.computeCanResolveAnnotation(t,a),d=this.computeCanUnresolveAnnotation(t,a),m=this.computeShowGhostCommentMessage(t),u=this.computeRepliesUniqueUsers(t),_=this.computeShowSuggestionModeActions(t,a),I=this.computeHasReactionsByCommentId(t),A=this.computeUnreadStatus(t),M=!1,B={};t.appState.isKnownUser!==i&&(M=!0,B.appState=y(h({},t.appState),{isKnownUser:i})),t.featureState.dialogSelectedByKnownUser!==a&&(M=!0,B.featureState=y(h(h({},t.featureState),B.featureState),{dialogSelectedByKnownUser:a})),t.featureState.canResolveAnnotation!==c&&(M=!0,B.featureState=y(h(h({},t.featureState),B.featureState),{canResolveAnnotation:c})),t.featureState.canUnresolveAnnotation!==d&&(M=!0,B.featureState=y(h(h({},t.featureState),B.featureState),{canUnresolveAnnotation:d})),t.uiState.isPrivateComment!==l&&(M=!0,B.uiState=y(h(h({},t.uiState),B.uiState),{isPrivateComment:l})),t.uiState.showGhostCommentMessage!==m&&(M=!0,B.uiState=y(h(h({},t.uiState),B.uiState),{showGhostCommentMessage:m}));let q=(t.appState.repliesUniqueUsers||[]).map(be=>be?.userId).sort().join(","),ae=(u||[]).map(be=>be?.userId).sort().join(",");q!==ae&&(M=!0,B.appState=y(h(h({},t.appState),B.appState),{repliesUniqueUsers:u})),t.uiState.showSuggestionModeActions!==_&&(M=!0,B.uiState=y(h(h({},t.uiState),B.uiState),{showSuggestionModeActions:_}));let _e=JSON.stringify(t.uiState.hasReactionsByCommentId||{}),re=JSON.stringify(I||{});_e!==re&&(M=!0,B.uiState=y(h(h({},t.uiState),B.uiState),{hasReactionsByCommentId:I})),t.uiState.unread!==A&&(M=!0,B.uiState=y(h(h({},t.uiState),B.uiState),{unread:A})),M&&e.update(be=>y(h(h({},be),B),{appState:h(h({},be.appState),B.appState),featureState:h(h({},be.featureState),B.featureState),uiState:h(h({},be.uiState),B.uiState)}))}catch(t){this.loggingService.catch("Error in CommentDialogCoreService updateComputedProperties:",t)}}computeIsKnownUser(e){try{let t=e.appState?.user;return!!(t&&!t.isReadOnly&&!t.isAnonymous)}catch(t){return this.loggingService.catch("Error in CommentDialogCoreService computeIsKnownUser:",t),!1}}computeDialogSelectedByKnownUser(e,t){try{return t&&!!e.appState?.user}catch(i){return this.loggingService.catch("Error in CommentDialogCoreService computeDialogSelectedByKnownUser:",i),!1}}computeCanResolveAnnotation(e,t){try{let i=e.data?.annotation,a=e.featureState,l=e.uiState;return!!(i&&!l?.disabled&&a?.enableResolve&&t&&i?.status?.type!=="terminal"&&!a?.isPlanExpired)}catch(i){return this.loggingService.catch("Error in CommentDialogCoreService computeCanResolveAnnotation:",i),!1}}computeCanUnresolveAnnotation(e,t){try{let i=e.data?.annotation,a=e.featureState,l=e.uiState;return!!(i&&!l?.disabled&&a?.enableResolve&&t&&i?.status?.type==="terminal"&&!a?.isPlanExpired)}catch(i){return this.loggingService.catch("Error in CommentDialogCoreService computeCanUnresolveAnnotation:",i),!1}}computeIsPrivateComment(e){try{return e.data?.annotation?.iam?.accessMode===Di.PRIVATE}catch(t){return this.loggingService.catch("Error in CommentDialogCoreService computeIsPrivateComment:",t),!1}}computeShowGhostCommentMessage(e){try{let t=e.data?.ghostComment,i=e.featureState?.enableGhostCommentsMessage,a=e.data?.annotation,l=e.featureState?.commentAcceptedStatus,c=e.featureState?.commentRejectedStatus;return!!(t&&i&&![l?.id,c?.id].includes(a?.status?.id))}catch(t){return this.loggingService.catch("Error in CommentDialogCoreService computeShowGhostCommentMessage:",t),!1}}computeRepliesUniqueUsers(e){try{let t=e.data?.annotation;if(!t?.comments||t.comments.length<=1)return[];let i=t.comments.slice(1).map(c=>c?.from).filter(c=>c);return this.getUniqueUsers(i).map(c=>c?.userId&&this.usersService.getUserById(c.userId)||c).filter(c=>c)}catch(t){return this.loggingService.catch("Error in CommentDialogCoreService computeRepliesUniqueUsers:",t),[]}}getUniqueUsers(e){try{let t=new Map;return e.forEach(i=>{i?.userId&&!t.has(i.userId)&&t.set(i.userId,i)}),Array.from(t.values())}catch(t){return this.loggingService.catch("Error in CommentDialogCoreService getUniqueUsers:",t),[]}}computeShowSuggestionModeActions(e,t){try{let i=e.data?.annotation;if(i?.type==="suggestion"&&!!i?.suggestion&&i.suggestion.status==="pending"&&t)return!0;let l=e.featureState?.suggestionMode,c=!!i?.comments?.length,d=i?.status?.type!=="terminal";return!!(l&&t&&d&&c)}catch(i){return this.loggingService.catch("Error in CommentDialogCoreService computeShowSuggestionModeActions:",i),!1}}computeHasReactionsByCommentId(e){try{let t={},i=e.data?.annotation;return i?.comments&&Array.isArray(i.comments)&&i.comments.forEach(a=>{a?.commentId&&(t[a.commentId]=a?.reactionAnnotationIds?.length>0)}),t}catch(t){return this.loggingService.catch("Error in CommentDialogCoreService computeHasReactionsByCommentId:",t),{}}}computeUnreadStatus(e){try{let t=e.data?.annotation,i=e.appState?.user;return!t||!i?.userSnippylyId?void 0:!t?.viewedByUserIds?.includes(i.userSnippylyId)}catch(t){this.loggingService.catch("Error in CommentDialogCoreService computeUnreadStatus:",t);return}}computeCurrentDialogView(e){try{let t=e(),i=t.data?.annotation,a=i?.annotationId,l=t.appState?.user?.userId,c=i?.from?.userId,d={};if(a&&this.currentCommentViews){let _=this.currentCommentViews?.[a]?.comments;Object.keys(_||{}).forEach(I=>{let A=[],M=0;Object.keys(_[I]?.views||{}).forEach(B=>{let q={};q.user=this.currentUserContactsBySnippylyId?.[B],q.viewedAt=_[I]?.views?.[B]?.timestamp,q.user?.userId!==l&&q.user?.userId!==c&&(A.push(q),(q.user?.email||q.user?.name)&&M++)}),d[I]={count:M,views:A}})}let m=JSON.stringify(t.data?.currentDialogView||{}),u=JSON.stringify(d);m!==u&&e.update(_=>y(h({},_),{data:y(h({},_.data),{currentDialogView:d})}))}catch(t){this.loggingService.catch("Error in CommentDialogCoreService computeCurrentDialogView:",t)}}findParentAnnotationId(e,t=20){try{let i=e.nativeElement.parentElement,a=0;for(;i&&a<t;){if(i.tagName?.toLowerCase()==="velt-comment-dialog-context-wrapper"){let c=i.getAttribute("annotation-id");if(c)return c;let d=i.__veltContext;if(d?.annotationId)return d.annotationId;let m=i.__ngContext__;if(m&&Array.isArray(m))for(let u=0;u<m.length;u++){let _=m[u];if(_&&typeof _=="object"&&_.annotationId)return _.annotationId}}i=i.parentElement,a++}return""}catch(i){return this.loggingService.catch("Error in CommentDialogCoreService findParentAnnotationId:",i),""}}};o.TEMP_ID_PREFIX="TEMP_COMPOSER_",o.\u0275fac=function(t){return new(t||o)(K(Re),K(qe),K(Vn),K(An),K(k),K(Un),K(go),K(Ml),K(vn),K(yt),K(st),K(Ue))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();function WU(n,o){return n?{commentPinSelected:!0,textClicked:!!o}:{commentPinSelected:!1,textClicked:!1}}function qU(n,o,r){return n!=null&&n===o&&!!r}var wot=["overlay"],Tot=()=>["snippyly-overlay-panel","velt-overlay-panel"];function Dot(n,o){if(n&1&&D(0,"span",8),n&2){let r,e=s().ngIf;pe("index-3-digit",(e.commentPinAnnotation==null||e.commentPinAnnotation.annotationNumber==null||(r=e.commentPinAnnotation.annotationNumber.toString())==null?null:r.length)===3),w("data-comment-annotation-number","#"+(e.commentPinAnnotation==null?null:e.commentPinAnnotation.annotationNumber))}}function Oot(n,o){if(n&1){let r=Z();C(0),f(1,"velt-multi-thread-comment-dialog-internal",10),z("saveComment",function(t){L(r);let i=s(3);return U(i.saveComment(t))})("pointerUp",function(t){L(r);let i=s(3);return U(i.togglePinSelection(t))}),S(),b()}if(n&2){let r=s(2).ngIf;v(),g("multiThreadAnnotationId",r.commentPinAnnotation.annotationId)("annotation",r.commentPinAnnotation)("user",r.user)("commentPinSelected",r.commentPinSelected)}}function Aot(n,o){if(n&1){let r=Z();f(0,"velt-comment-dialog-internal",11),z("saveComment",function(t){L(r);let i=s(3);return U(i.saveComment(t))}),S()}if(n&2){let r=s(2).ngIf;g("annotation",r.commentPinAnnotation)("user",r.user)("commentPinSelected",r.commentPinSelected)("inlineCommentMode",r.inlineCommentMode)("isInsidePdfViewer",r.isInsidePdfViewer)}}function Mot(n,o){if(n&1&&p(0,Oot,2,4,"ng-container",9)(1,Aot,1,5,"ng-template",null,2,Ve),n&2){let r=Ee(2),e=s().ngIf;g("ngIf",(e==null||e.commentPinAnnotation==null?null:e.commentPinAnnotation.type)==="multiThread")("ngIfElse",r)}}function Pot(n,o){if(n&1){let r=Z();f(0,"snippyly-comment-bottom-sheet",12),z("saveComment",function(t){L(r);let i=s(2);return U(i.saveComment(t))}),S()}if(n&2){let r=s().ngIf;g("annotation",r.commentPinAnnotation)("user",r.user)("isInsidePdfViewer",r.isInsidePdfViewer)}}function Rot(n,o){if(n&1){let r=Z();C(0),f(1,"snippyly-comment-text",4,0),z("pointerover",function(t){return L(r),s().onPointerOver(t),U(t.stopPropagation())})("pointerout",function(){L(r);let t=s();return U(t.onPointerOut())})("pointerdown",function(t){return L(r),U(t.stopPropagation())})("pointerup",function(t){return L(r),s().togglePinSelection(),U(t.stopPropagation())})("touchend",function(t){return L(r),t.stopPropagation(),U(t.preventDefault())})("click",function(t){return L(r),t.stopPropagation(),U(t.preventDefault())}),S(),p(3,Dot,1,3,"span",5)(4,Mot,3,2,"ng-template",6,1,Ve)(6,Pot,1,3,"snippyly-comment-bottom-sheet",7),b()}if(n&2){let r=o.ngIf,e=Ee(2),t=s();v(),pe("inline-comment-mode",r.inlineCommentMode&&!r.isInsidePdfViewer)("selected",r.commentPinHover||r.commentPinSelected),v(2),g("ngIf",r.last&&r.showCommentIndex&&(r.commentPinAnnotation==null?null:r.commentPinAnnotation.annotationNumber)),v(),g("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",(!r.mobileMode||!r.isPhone)&&!r.inboxMode&&!r.streamMode&&(!r.inlineCommentMode||r.isInsidePdfViewer)&&r.floatingCommentsEnabled&&(r.textClicked&&r.commentPinSelected||r.commentPinHover&&!r.commentPinSelected))("cdkConnectedOverlayOffsetY",r.overlayOriginY==="top"?-8:2)("cdkConnectedOverlayPanelClass",xt(15,Tot))("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",t.positions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0),v(2),g("ngIf",(r==null?null:r.user)&&r.mobileMode&&r.isPhone&&!r.sidebarVisible&&(!r.inlineCommentMode||r.isInsidePdfViewer)&&!r.inboxMode&&!r.streamMode&&r.floatingCommentsEnabled&&r.textClicked&&r.commentPinSelected)}}var YU=(()=>{let o=class o{onEnter(e){this.onKeyupEnter&&this.onKeyupEnter()}constructor(e,t,i,a,l,c,d,m){this.analyticsService=e,this.authService=t,this.breakpointObserver=i,this.domService=a,this.commentService=l,this.loggingService=c,this.recorderService=d,this.elementRef=m,this.subscriptions=[],this.selectedAnnotationsMap={},this.customScrollableParentEventsListenersSubscriptions=[],this.isDialogOnHoverEnabled=!1,this.componentConfigSignal=De({inlineCommentMode:!1,isInsidePdfViewer:!1,commentPinHover:!1,commentPinSelected:!1,first:!1,last:!1,showCommentIndex:!1,commentPinAnnotation:null,isPhone:!1,mobileMode:!1,streamMode:!1,inboxMode:!1,textClicked:!1,floatingCommentsEnabled:!0,sidebarVisible:!1,user:null,overlayOriginX:"start",overlayOriginY:"top"}),this.positions=N.OVERLAY_POSITIONS.map(u=>new qr({originX:u.originX,originY:u.originY},{overlayX:u.overlayX,overlayY:u.overlayY})),this.veltElement=!0,this.componentId="velt-comment-text-portal",this.subscriptions.push(this.authService.getUser$().subscribe(u=>{this.componentConfigSignal.update(_=>(_=y(h({},_),{user:u}),_))},u=>{this.catchError("Error in CommentTextPortalComponent getUser$ subscription: ",u)})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(u=>{this.componentConfigSignal.update(_=>(_=y(h({},_),{sidebarVisible:u}),_))},u=>{this.catchError("Error in CommentTextPortalComponent getSidebarVisibility$ subscription: ",u)})),this.subscriptions.push(this.commentService.showFloatingComments$().subscribe(u=>{this.componentConfigSignal.update(_=>(_=y(h({},_),{floatingCommentsEnabled:u}),_))},u=>{this.catchError("Error in CommentTextPortalComponent showFloatingComments$ subscription: ",u)})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(u=>{this.componentConfigSignal.update(_=>(_=y(h({},_),{showCommentIndex:u}),_))},u=>{this.catchError("Error in CommentTextPortalComponent getShowCommentIndex subscription: ",u)})),this.subscriptions.push(this.commentService.getEnableDialogOnHover$().subscribe(u=>{this.isDialogOnHoverEnabled=u},u=>{this.catchError("Error in CommentPinComponent getEnableDialogOnHover subscription: ",u)})),this.subscriptions.push(this.breakpointObserver.observe(to.XSmall).subscribe(u=>{let _=!1;u.matches?_=!0:_=!1,this.componentConfigSignal.update(I=>(I=y(h({},I),{isPhone:_}),I))},u=>{this.catchError("Error in CommentTextPortalComponent breakpointObserver subscription: ",u)}))}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentTextPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentTextPortalComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{let e=this.element.childNodes[0];this.element.childNodes[1].childNodes[0].appendChild(e),this.componentConfigSignal.update(i=>{let a=u1(this.element,N.ATTRIBUTES.VELT_PDF_VIEWER);return i=y(h({},i),{isInsidePdfViewer:a}),i}),this.subscriptions.push(this.overlay?.positionChange?.subscribe(i=>{this.componentConfigSignal.update(a=>(a=y(h({},a),{overlayOriginX:i.connectionPair.originX,overlayOriginY:i.connectionPair.originY}),a))},i=>{this.catchError("Error in CommentTextPortalComponent positionChange subscription: ",i)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(i=>{this.selectedAnnotationsMap=i,this.checkPinSelection()},i=>{this.catchError("Error in CommentTextPortalComponent getSelectedAnnotationsMap$ subscription: ",i)})),this.subscriptions.push(this.commentService.getStreamMode$().subscribe(i=>{this.componentConfigSignal.update(a=>(a=y(h({},a),{streamMode:i}),a))},i=>{this.catchError("Error in CommentTextPortalComponent getStreamMode$ subscription: ",i)})),this.subscriptions.push(this.commentService.getInboxMode$().subscribe(i=>{this.componentConfigSignal.update(a=>(a=y(h({},a),{inboxMode:i}),a))},i=>{this.catchError("Error in CommentTextPortalComponent getInboxMode subscription: ",i)})),this.subscriptions.push(this.commentService.getMobileMode$().subscribe(i=>{this.componentConfigSignal.update(a=>(a=y(h({},a),{mobileMode:i}),a))},i=>{this.catchError("Error in CommentTextPortalComponent getMobileMode$ subscription: ",i)})),this.subscriptions.push(this.commentService.getInlineCommentMode$().subscribe(i=>{this.componentConfigSignal.update(a=>(a=y(h({},a),{inlineCommentMode:i}),a))},i=>{this.catchError("Error in CommentTextPortalComponent getInlineCommentMode$ subscription: ",i)})),this.subscriptions.push(this.recorderService.onInitRecording().subscribe(i=>{this.recorderInitConfig=i},i=>{this.catchError("Error in CommentTextPortalComponent onInitRecording subscription: ",i)}))}catch(e){this.catchError("Error in CommentTextPortalComponent AfterViewInit: ",e)}}setFirst(e){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{first:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setFirst: ",t)}}setLast(e){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{last:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setLast: ",t)}}setCommentPinAnnotation(e){try{this.componentConfigSignal.update(t=>(t=y(h({},t),{commentPinAnnotation:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setCommentPinAnnotation: ",t)}}setElement(e){try{this.element=e,this.element?this.customScrollableParents=lm(this.element):this.customScrollableParents=[],this.addCustomScrollableParentsEventListeners()}catch(t){this.catchError("Error in CommentTextPortalComponent setElement: ",t)}}checkPinSelection(){try{let e=!!this.selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation?.annotationId];this.componentConfigSignal.update(t=>{let i=WU(e,t.last);return h(h({},t),i)}),qU(sessionStorage.getItem(N.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID),this.componentConfigSignal().commentPinAnnotation.annotationId,this.componentConfigSignal().last)&&(this.componentConfigSignal.update(t=>(t=y(h({},t),{textClicked:!0}),t)),sessionStorage.removeItem(N.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID))}catch(e){this.catchError("Error in CommentTextPortalComponent checkPinSelection: ",e)}}onPointerOver(e){try{if(this.componentConfigSignal().commentPinHover)return;e.buttons?this.componentConfigSignal().commentPinHover&&this.componentConfigSignal.update(t=>(t=y(h({},t),{commentPinHover:!1}),t)):!this.componentConfigSignal().commentPinHover&&this.isDialogOnHoverEnabled&&this.componentConfigSignal.update(t=>(t=y(h({},t),{commentPinHover:!0}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent onPointerOver: ",t)}}onPointerOut(){this.componentConfigSignal.update(e=>(e=y(h({},e),{commentPinHover:!1}),e))}togglePinSelection(e){try{if(this.recorderInitConfig?.isCommentRecording||this.componentConfigSignal().textClicked&&!e)return;let t=e||this.componentConfigSignal().commentPinAnnotation;if(this.selectedAnnotationsMap[t.annotationId])e||(document.querySelector(`[${N.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t?.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):(this.componentConfigSignal.update(a=>(a=y(h({},a),{textClicked:!0}),a)),this.domService.toggleAnnotationSelection(t)));else{let i=document.querySelector(`[${N.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(i||(i=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),i){let a=i.getAttribute(N.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(a){let l=document.getElementById(`comment-pin-container-${a}`)||document.querySelector(`[data-velt-id='${a}']`);l&&(l.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.componentConfigSignal.update(a=>(a=y(h({},a),{textClicked:!0}),a)),this.domService.toggleAnnotationSelection(t)}}catch(t){this.catchError("Error in CommentTextPortalComponent togglePinSelection: ",t)}}saveComment(e){try{this.commentService.saveComment(this.componentConfigSignal().commentPinAnnotation,e)}catch(t){this.catchError("Error in CommentTextPortalComponent saveComment: ",t)}}updateOverlayPosition(){try{this.loggingService.log("updateOverlayPosition",this.componentConfigSignal().commentPinAnnotation?.annotationId),this.overlay&&this.overlay?.overlayRef?.updatePosition()}catch(e){this.catchError("Error in CommentTextPortalComponent updateOverlayPosition: ",e)}}addCustomScrollableParentsEventListeners(){try{this.removeCustomScrollableParentsEventListeners(),this.customScrollableParents?.length&&this.customScrollableParents?.forEach(e=>{this.customScrollableParentEventsListenersSubscriptions.push(xr(e,"scroll").subscribe(t=>{this.updateOverlayPosition()},t=>{this.catchError("Error in CommentTextPortalComponent addCustomScrollableParentsEventListeners scroll subscription: ",t)}))})}catch(e){this.catchError("Error in CommentTextPortalComponent addCustomScrollableParentsEventListeners: ",e)}}removeCustomScrollableParentsEventListeners(){try{this.customScrollableParentEventsListenersSubscriptions.map(e=>{e.unsubscribe()}),this.customScrollableParentEventsListenersSubscriptions=[]}catch(e){this.catchError("Error in CommentTextPortalComponent removeCustomScrollableParentsEventListeners: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.removeCustomScrollableParentsEventListeners(),this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in CommentTextPortalComponent unsubscribe: ",e)}}catchError(e,t,i){try{this.loggingService.catch(e,t,y(h({},i||{}),{annotationId:this.componentConfigSignal()?.commentPinAnnotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(x(ct),x(qe),x(Zo),x(Ue),x(Re),x(k),x(Un),x(Q))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-text-portal"]],viewQuery:function(t,i){if(t&1&&pt(wot,5),t&2){let a;vt(a=mt())&&(i.overlay=a.first)}},hostVars:1,hostBindings:function(t,i){t&1&&z("keyup.enter",function(l){return i.onEnter(l)},og),t&2&&w("data-velt-element",i.veltElement)},standalone:!1,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],["commentDialogRef",""],[4,"ngIf"],["cdkOverlayOrigin","","data-velt-comment-disabled","true",1,"comment-text-highlight",3,"pointerover","pointerout","pointerdown","pointerup","touchend","click"],["class","comment-annotation-number",3,"index-3-digit",4,"ngIf"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayOffsetY","cdkConnectedOverlayPanelClass","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayLockPosition","cdkConnectedOverlayPositions","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose"],[3,"annotation","user","isInsidePdfViewer","saveComment",4,"ngIf"],[1,"comment-annotation-number"],[4,"ngIf","ngIfElse"],[3,"saveComment","pointerUp","multiThreadAnnotationId","annotation","user","commentPinSelected"],[3,"saveComment","annotation","user","commentPinSelected","inlineCommentMode","isInsidePdfViewer"],[3,"saveComment","annotation","user","isInsidePdfViewer"]],template:function(t,i){t&1&&p(0,Rot,7,16,"ng-container",3),t&2&&g("ngIf",i.componentConfigSignal())},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}*[_ngcontent-%COMP%]{box-sizing:border-box;margin:0;padding:0;height:inherit;width:inherit;text-align:inherit;line-height:inherit;font-size:inherit;text-transform:inherit;float:inherit;-webkit-text-fill-color:initial}*[_ngcontent-%COMP%]:empty{display:revert}[_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-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);font-family:inherit}.comment-text-highlight[_ngcontent-%COMP%]{cursor:pointer} snippyly-text-highlight.snippyly-text-highlight{color:var(--velt-black)} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:var(--velt-warning-hover);background-color:var(--velt-warning-transparent);border-bottom:1px solid var(--velt-warning-hover)} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{color:var(--velt-black);background-color:var(--velt-warning)} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.inline-comment-mode{background-color:inherit} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.inline-comment-mode.selected{background-color:inherit}.comment-annotation-number[_ngcontent-%COMP%]{border-radius:50%;border:1px solid var(--velt-gray);width:20px;height:20px;font-size:calc((.7rem + 0px) * var(--velt-base-rem-unit));display:inline-flex;justify-content:center;align-items:center;box-sizing:content-box;background:var(--velt-white);color:var(--velt-black);position:relative}.comment-annotation-number.index-3-digit[_ngcontent-%COMP%]{width:32px;height:32px}.comment-annotation-number[_ngcontent-%COMP%]:after{content:attr(data-comment-annotation-number);position:absolute;font-weight:400;letter-spacing:normal;word-spacing:normal}"],changeDetection:0});let n=o;return n})();var KU=(()=>{let o=class o{constructor(e,t,i,a,l,c,d){this.docService=e,this.domService=t,this.commentService=i,this.componentFactoryResolver=a,this.injector=l,this.appRef=c,this.loggingService=d,this.commentsTextById={},this.commonAncestorElementObservers=new Map,this.commonAncestorElementObserverCounts=new Map,this.inlineCommentMode=!1;try{this.commentService.getInlineCommentMode$().subscribe(m=>{this.inlineCommentMode=m})}catch(m){this.loggingService.catch("Error in CommentPinPortalService constructor: ",m)}}updateTextCommentAnnotations(e){try{this.checkToRemoveTextCommentAnnotations(e),e.forEach(t=>{this.updateTextCommentAnnotation(t)})}catch(t){this.loggingService.catch("Error in CommentPinPortalService updateTextCommentAnnotations: ",t)}}updateTextCommentAnnotation(e){let t=this.commentsTextById[e.annotationId];if(t)if(vr(t?.annotation?.targetTextRange,e?.targetTextRange)){let i=!1;t?.texts?.length?t.texts.forEach(a=>{document.body.contains(a?.textNode)||(i=!0)}):i=!0,i?(this.removeTextCommentAnnotation(e),this.getCommonAncestorContainer(e)):(t.texts.forEach(a=>{a.portalRef&&a.portalRef.instance.setCommentPinAnnotation(e)}),t.annotation=e)}else this.removeTextCommentAnnotation(e),this.getCommonAncestorContainer(e);else this.getCommonAncestorContainer(e)}getCommonAncestorContainer(e){try{let t=this.domService.getElementFromTargetTextRange(e?.targetTextRange);if(t&&this.domService.isElementVisible(t)){let i=t?.nodeType===Node.ELEMENT_NODE?t:t?.parentElement;this.commentsTextById[e.annotationId]={texts:[],annotation:e,commonAncestorContainer:t,commonAncestorElement:i,commonAncestorText:i?.textContent},this.setTextCommentPortal(e),this.observeCommonAncestorElementChanges(e)}else this.setGhostComment(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService getCommonAncestorContainer: ",t)}}setTextCommentPortal(e){try{let t=this.commentsTextById[e.annotationId];if(t){let i=this.domService.getElementFromTargetTextRange(e?.targetTextRange);if(e?.locationId&&this.docService.getLocation()?.locationId!==e?.locationId){let d=this.docService.getElementMapWithLocation();d[e?.locationId]&&(i=d[e?.locationId]?.element)}let a=i?np(e.targetTextRange?.text,i,e.targetTextRange?.occurrence):[],l=!1;if(a?.forEach(c=>{c?.textNode?.parentElement?.closest("script")&&(l=!0)}),!l){let c=new Range;try{c.setStart(a[0].textNode,a[0].startOffset||0),c.setEnd(a[a.length-1].textNode,a[a.length-1].endOffset||0)}catch{}if(c.toString()===e.targetTextRange?.text){let d=TS(c),m=[],u=d?.find(_=>!_?.textContent);if(u&&u?.remove(),d=d?.filter(_=>_?.textContent),d&&d.length){let _=-1,I=-1;if(d.forEach((A,M)=>{this.textHighlighterClass?this.domService.addClassToElement(A,this.textHighlighterClass):this.domService.addClassToElement(A,A.tagName?.toLowerCase()),A.setAttribute(N.ATTRIBUTES.VELT_ID,e.annotationId);let B=A.childNodes[0],q=new Vi(YU),ae=new Bi(A,this.appRef,this.injector),_e=ae.attach(q);_e.instance.setCommentPinAnnotation(e),_e.instance.setElement(A),_e.instance.onKeyupEnter=()=>{this.onCommonAncestorElementChange(e)},_<0&&(_=M),I=M,m.push({host:ae,portal:q,portalRef:_e,element:A,textNode:B})}),_>=0&&m[_]?.portalRef&&m[_].portalRef.instance.setFirst(!0),I>=0&&m[I]?.portalRef&&m[I].portalRef.instance.setLast(!0),t.texts=m,this.inlineCommentMode&&!document.querySelector(`${N.TAGS.VELT_INLINE_COMMENT}[${N.ATTRIBUTES.VELT_INLINE_COMMENT_ID}="${e.annotationId}"]`)){let M=t.texts?.filter(q=>!!q?.element)?.map(q=>q?.element),B=M?.length?M[M.length-1]:null;if(B&&!u1(B,N.ATTRIBUTES.VELT_PDF_VIEWER)){let ae=B?.parentElement;if(ae){let _e=document.createElement(N.TAGS.VELT_INLINE_COMMENT);_e.setAttribute(N.ATTRIBUTES.VELT_INLINE_COMMENT_ID,e.annotationId),ae.insertAdjacentElement("afterend",_e),t.inlineCommentElement=_e}}}}this.removeGhostComment(e)}else this.setGhostComment(e)}}else this.setGhostComment(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService setTextCommentPortal: ",t)}}checkToRemoveTextCommentAnnotations(e){try{let t=e.map(a=>a.annotationId),i=!1;if(Object.keys(this.commentsTextById).forEach(a=>{t.includes(a)||(this.commentsTextById[a]?.annotation?.targetTextRange&&(i=!0),this.removeTextCommentAnnotation(this.commentsTextById[a].annotation))}),i){let a=[];Object.keys(this.commentsTextById).forEach(l=>{this.commentsTextById[l]?.annotation?.targetTextRange&&(a.push(this.commentsTextById[l]?.annotation),this.removeTextCommentAnnotation(this.commentsTextById[l]?.annotation))}),a?.length&&a.forEach(l=>{this.updateTextCommentAnnotation(l)})}}catch(t){this.loggingService.catch("Error in CommentPinPortalService checkToRemoveTextCommentAnnotations: ",t)}}removeTextCommentAnnotation(e){try{let t=this.commentsTextById[e.annotationId];if(t.texts.forEach(i=>{i?.host&&i.host.detach(),i?.element&&i?.textNode&&i.element.replaceWith(i.textNode),i.textNode&&i.textNode.parentNode?.normalize()}),t.texts?.length){let i=document.querySelectorAll(`${N.TAGS.SNIPPYLY_TEXT_HIGHLIGHT}[data-velt-id="${e?.annotationId}"]`);i?.length&&i.forEach(a=>{let l=a?.parentNode;if(a?.textContent){let c=document.createTextNode(a.textContent);a.replaceWith(c)}l&&l.normalize()})}t?.inlineCommentElement&&t?.inlineCommentElement?.remove(),this.checkToUnsubscribeCommonAncestorElementChanges(e),delete this.commentsTextById[e.annotationId]}catch(t){this.loggingService.catch("Error in CommentPinPortalService removeTextCommentAnnotation: ",t)}}observeCommonAncestorElementChanges(e){try{let t=this.commentsTextById[e.annotationId];if(t.commonAncestorElement){let i=this.commonAncestorElementObservers.get(t.commonAncestorElement);if(i)i.annotations.find(a=>a.annotationId===e.annotationId)||i.annotations.push(e);else{let a=new MutationObserver(l=>{let c="";if(KN(t?.commonAncestorElement).forEach(m=>{m?.parentElement?.closest(".comment-annotation-number")||(c+=m.textContent)}),t?.commonAncestorText!==c&&l.filter(m=>[Node.ELEMENT_NODE,Node.TEXT_NODE].includes(m.target.nodeType)).filter(m=>m.target?.parentElement&&(m?.target?.parentElement?.classList?.contains("comment-text-highlight")||!fo(m.target?.parentElement))).length){this.commonAncestorElementObservers.get(t.commonAncestorElement)?.annotations?.forEach(A=>{this.onCommonAncestorElementChange(A)});let{count:u,lastUpdated:_}=this.commonAncestorElementObserverCounts.get(t.commonAncestorElement)||{count:0,lastUpdated:0},I=Date.now();this.commonAncestorElementObserverCounts.set(t.commonAncestorElement,{count:I-_<100?u+1:1,lastUpdated:Date.now()}),u>5&&(a.disconnect(),this.loggingService.catch("Failed to detect text changes."))}});a.observe(t.commonAncestorElement,{characterData:!0,subtree:!0}),i={observer:a,annotations:[e]}}this.commonAncestorElementObservers.set(t.commonAncestorElement,i)}}catch(t){this.loggingService.catch("Error in CommentPinPortalService observeCommonAncestorElementChanges: ",t)}}onCommonAncestorElementChange(e){try{let t=this.commentsTextById[e.annotationId];if(t.texts?.length){let i="";t.texts.forEach(u=>i+=u.textNode?.textContent);let a=t.texts[0].textNode,l=[];document.querySelectorAll(`${N.TAGS.SNIPPYLY_TEXT_HIGHLIGHT}[data-velt-id="${e?.annotationId}"]`)?.forEach(u=>{l.push(u)});let c=!1;if(l?.length!==t?.texts?.length&&(c=!0),l?.length){let u="";l.forEach(_=>{u+=_?.textContent||""}),u&&(i=u,c&&this.removeTextCommentAnnotation(e))}let d=C0(t.commonAncestorContainer,0,a,0,i)+1,m={};m.commonAncestorContainer=e.targetTextRange?.commonAncestorContainer,m.text=i,m.occurrence=d,vr(e.targetTextRange,m)||(t.annotation.targetTextRange=m,this.updateAnnotationToFirebase(t.annotation))}else this.setTextCommentPortal(t.annotation)}catch(t){this.loggingService.catch("Error in CommentPinPortalService onCommonAncestorElementChange: ",t)}}updateAnnotationToFirebase(e){try{this.commentService.updateComment(e,!1,!0)}catch(t){this.loggingService.catch("Error in CommentPinPortalService updateAnnotationToFirebase: ",t)}}checkToUnsubscribeCommonAncestorElementChanges(e){try{let t=this.commentsTextById[e.annotationId];if(t.commonAncestorElement){let i=this.commonAncestorElementObservers.get(t.commonAncestorElement);i&&(i.annotations=i?.annotations.filter(a=>a.annotationId!==e.annotationId),i.annotations.length||this.unsubscribeCommonAncestorElementChanges(e))}}catch(t){this.loggingService.catch("Error in CommentPinPortalService checkToUnsubscribeCommonAncestorElementChanges: ",t)}}setGhostComment(e){try{e.ghostComment={},this.commentService.setGhostCommentMessage(e),this.commentService.addAnnotationToGhostCommentAnnotationMap(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService setGhostComment: ",t)}}removeGhostComment(e){try{delete e.ghostComment,this.commentService.removeAnnotationFromGhostCommentAnnotationMap(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService removeGhostComment: ",t)}}onAcceptComment(e){try{let t=this.commentsTextById[e.annotationId];if(t?.texts?.length){let i=t.texts.length-1,a=t.texts[i].textNode;if(a&&a.parentNode){let l=e.comments?.length?e.comments[0]:null,c=g1(l?.replaceContentHtml)?null:l?.replaceContentHtml,d=l?.replaceContentText||l?.commentText||"";if(g1(c)&&!l?.replaceContentText&&(c=l?.commentHtml||""),e?.selectAllContent&&e?.targetElementId){let m=nl(e.targetElementId,["id","data-id"]);m&&(m.innerHTML=this.domService.sanitizeHtml(g1(c)?d||"":c||""))}else{if(c&&c!==d){let m=document.createElement("span");m.innerHTML=this.domService.sanitizeHtml(c||d||""),a.parentNode.replaceChild(m,a),t.texts[i].textNode=m}else t.texts[i].textNode.textContent=d||"";for(let m=0;m<i;m++){let u=t.texts[m].textNode;u&&(u.textContent="")}}this.removeTextCommentAnnotation(e),this.domService.resetSelectedAnnotationsMap()}}}catch(t){this.loggingService.catch("Error in CommentPinPortalService onAcceptComment: ",t)}}unsubscribeCommonAncestorElementChanges(e){try{let t=this.commentsTextById[e.annotationId];this.commonAncestorElementObservers.get(t.commonAncestorElement)?.observer?.disconnect(),this.commonAncestorElementObservers.delete(t.commonAncestorElement)}catch(t){this.loggingService.catch("Error in CommentPinPortalService unsubscribeCommonAncestorElementChanges: ",t)}}};o.\u0275fac=function(t){return new(t||o)(K(st),K(Ue),K(Re),K(Qo),K(Dt),K(Ir),K(k))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ZU=(()=>{let o=class o{constructor(e,t,i,a,l,c,d,m,u,_,I,A,M,B,q,ae,_e){this.commentActionsService=e,this.commentService=t,this.domService=i,this.coreService=a,this.customFilterService=l,this.loggingService=c,this.analyticsService=d,this.commentTextPortalService=m,this.recorderService=u,this.domSanitizer=_,this.viewsService=I,this.contactService=A,this.authService=M,this.docService=B,this.targetRegistry=q,this.suggestionActions=ae,this.commonDbService=_e}get timestamp(){return this.commonDbService.getServerTimestamp()}deleteComment(e,t,i){try{let a=this.coreService.getContextConfig(e);if(!a)return;let l=a(),c=t;t||(c=l.data?.annotation?.comments?.length?l.data?.annotation?.comments[0]:null),this.commentActionsService.deleteComment({annotationId:e,commentId:c?.commentId,skipDeleteThreadConfirmation:i}),c?.commentId&&this.clearEditDraftFromSession(e,c.commentId)}catch(a){this.loggingService.catch("Error in CommentDialogActionService deleteComment:",a)}}changeCommentStatus(e,t){try{let i=this.coreService.getContextConfig(e);if(!i)return;i().data?.annotation&&this.commentActionsService.updateStatus({annotationId:e,status:t.status})}catch(i){this.loggingService.catch("Error in CommentDialogActionService changeCommentStatus:",i)}}changeStatus(e,t){try{this.changeCommentStatus(e,t)}catch(i){this.loggingService.catch("Error in CommentDialogActionService changeStatus:",i)}}openAllComments(e){try{if(!this.coreService.getContextConfig(e))return;this.commentService.onSidebarButtonOnCommentDialogClick(),this.commentService.setSidebarVisibility(!0),(document.querySelector(N.TAGS.VELT_COMMENTS_SIDEBAR)||document.querySelector(N.TAGS.SNIPPYLY_COMMENTS_SIDEBAR))?.hasAttribute(N.ATTRIBUTES.EMBED_MODE)&&this.commentService.openSidebar()}catch(t){this.loggingService.catch("Error in CommentDialogActionService openAllComments:",t)}}copyLink(e){return X(this,null,function*(){try{return this.coreService.getContextConfig(e)?!!(yield this.commentActionsService.copyLink({annotationId:e})):!1}catch(t){return this.loggingService.catch("Error in CommentDialogActionService copyLink:",t),!1}})}approveComment(e){try{let t=this.coreService.getContextConfig(e);if(!t)return;t().data?.annotation&&this.commentActionsService.approveCommentAnnotation({annotationId:e})}catch(t){this.loggingService.catch("Error in CommentDialogActionService approveComment:",t)}}closeAssignToMenu(e,t){try{let i=t?this.coreService.getLocalUIState(t):void 0;i&&i.update(a=>y(h({},a),{assignToMenuOpened:!1}))}catch(i){this.loggingService.catch("Error in CommentDialogActionService closeAssignToMenu:",i)}}assignCommentToUser(e,t,i){try{let a=this.coreService.getContextConfig(e);if(!a)return;a().data?.annotation&&(this.commentActionsService.assignUser({annotationId:e,assignedTo:t}),this.closeAssignToMenu(e,i))}catch(a){this.loggingService.catch("Error in CommentDialogActionService assignCommentToUser:",a)}}closeDialog(){try{this.domService.resetSelectedAnnotationsMap()}catch(e){this.loggingService.catch("Error in CommentDialogActionService closeDialog:",e)}}toggleHideReply(e){try{let t=this.coreService.getContextConfig(e);if(!t)return;t.update(i=>(i.uiState.showReplies=!1,i.uiState.collapsedComments=!0,i))}catch(t){this.loggingService.catch("Error in CommentDialogActionService toggleHideReply:",t)}}toggleFormatToolbar(e){try{let t=this.coreService.getContextConfig(e);if(!t)return;t.update(i=>y(h({},i),{uiState:y(h({},i.uiState),{formatToolbarOpen:!i.uiState?.formatToolbarOpen})}))}catch(t){this.loggingService.catch("Error in CommentDialogActionService toggleFormatToolbar:",t)}}showReplyComposer(e){try{let t=this.coreService.getContextConfig(e);if(!t)return;t.update(i=>y(h({},i),{uiState:y(h({},i.uiState),{showReplyComposer:!0})})),setTimeout(()=>this.focusOnComposerInput(e),100)}catch(t){this.loggingService.catch("Error in CommentDialogActionService showReplyComposer:",t)}}onMoreRepliesClick(e){try{let t=this.coreService.getContextConfig(e);if(!t)return;let i=t();this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_MORE_REPLY_OPTION_CLICKED,{annotationId:e,commentType:this.commentService.getCommentType(i.data?.annotation),uiLocation:i.featureState?.sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),t.update(a=>(a.uiState.showAllComments=!a.uiState.showAllComments,a))}catch(t){this.loggingService.catch("Error in CommentDialogActionService onMoreRepliesClick:",t)}}navigateToComment(e){try{let t=this.coreService.getContextConfig(e);if(!t)return null;let a=t().data?.annotation;return a?(this.commentService.onCommentNavigationButtonClick(a),a):null}catch(t){return this.loggingService.catch("Error in CommentDialogActionService navigateToComment:",t),null}}onInboxModeChange(e,t){try{if(t){let i=this.coreService.getContextConfig(e);if(!i)return;i.update(a=>y(h({},a),{uiState:y(h({},a.uiState),{showAllComments:!0})}))}}catch(i){this.loggingService.catch("Error in CommentDialogActionService onInboxModeChange:",i)}}onSignInClick(){try{this.commentService.onSignInClick()}catch(e){this.loggingService.catch("Error in CommentDialogActionService onSignInClick:",e)}}onUpgradeClick(){try{this.commentService.onUpgradeClick()}catch(e){this.loggingService.catch("Error in CommentDialogActionService onUpgradeClick:",e)}}resolveComment(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: resolveComment","color: green;");try{let i=this.coreService.getContextConfig(e);if(!i)return;i().data?.annotation&&this.commentActionsService.updateStatus({annotationId:e,status:this.customFilterService.resolvedStatus})}catch(i){this.loggingService.catch("Error in CommentDialogActionService resolveComment:",i)}}unresolveComment(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: unresolveComment","color: green;");try{let i=this.coreService.getContextConfig(e);if(!i)return;i().data?.annotation&&this.commentActionsService.updateStatus({annotationId:e,status:this.customFilterService.defaultStatus})}catch(i){this.loggingService.catch("Error in CommentDialogActionService unresolveComment:",i)}}toggleShowReplies(e){try{let t=this.coreService.getContextConfig(e);if(!t)return{openFocusedThread:!1,annotation:null};let i=t(),a=i.data?.annotation;if(a){if(this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_MORE_REPLY_OPTION_CLICKED,{annotationId:a.annotationId,commentType:this.commentService.getCommentType(a),uiLocation:i.featureState?.sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),i.featureState?.isFocusedThreadEnabled&&i.featureState?.openAnnotationInFocusMode)return{openFocusedThread:!0,annotation:a};if(t.update(l=>{let c=!l.uiState.showReplies;return y(h({},l),{uiState:y(h({},l.uiState),{showReplies:c,collapsedComments:!1,commentDialogSelected:c})})}),this.coreService.recomputeDerivedProperties(e),!i.uiState?.commentPinSelected)if(i.featureState?.sidebarMode)this.domService.toggleAnnotationSelection(a,i.uiState?.containerComponentId,"sidebarShowReplies");else{let l=a.multiThreadAnnotationId||i.uiState?.multiThreadAnnotationId;this.domService.toggleAnnotationSelection(a,i.uiState?.containerComponentId,void 0,void 0,l)}}return{openFocusedThread:!1,annotation:null}}catch(t){return this.loggingService.catch("Error in CommentDialogActionService toggleShowReplies:",t),{openFocusedThread:!1,annotation:null}}}acceptCommentAnnotation(e){try{let t=this.coreService.getContextConfig(e);if(!t)return;let i=t(),a=i.data?.annotation;if(!a)return;this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_ACCEPT_BUTTON_CLICKED,{annotationId:a.annotationId,commentType:this.commentService.getCommentType(a),uiLocation:i.featureState?.sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.commentTextPortalService.onAcceptComment(a),this.commentActionsService.acceptCommentAnnotation({annotationId:a.annotationId})}catch(t){this.loggingService.catch("Error in CommentDialogActionService acceptCommentAnnotation:",t)}}acceptSuggestion(e){return X(this,null,function*(){try{let t=this.coreService.getContextConfig(e);if(!t)return;let i=t().data?.annotation;if(!i||i.type!=="suggestion"||!i.suggestion||i.suggestion.status!=="pending")return;let a=this.authService.getUser();if(!a)return;let l=i.suggestion.targetId;if(!this.targetRegistry.getNode(l)){i.suggestion.status="stale",i.suggestion.resolvedBy=a,i.suggestion.resolvedAt=this.timestamp,i.status=N.CommentRejectStatus,this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_ACCEPT_BUTTON_CLICKED,{annotationId:e,commentType:"suggestion",suggestionOutcome:"stale",targetId:l}),this.commentService.updateComment(i),this.suggestionActions.projectAndTrigger(Il.SUGGESTION_STALE,i);return}let d=this.targetRegistry.getGetter(l),m=!1;if(d)try{let u=d();m=!vr(u,i.suggestion.oldValue)}catch{m=!1}i.suggestion.status="approved",i.suggestion.driftDetected=m,i.suggestion.resolvedBy=a,i.suggestion.resolvedAt=this.timestamp,i.status=N.CommentAcceptStatus,this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_ACCEPT_BUTTON_CLICKED,{annotationId:e,commentType:"suggestion",suggestionOutcome:"approved",targetId:l,driftDetected:m}),this.commentService.updateComment(i),this.suggestionActions.projectAndTrigger(Il.SUGGESTION_APPROVED,i)}catch(t){this.loggingService.catch("Error in CommentDialogActionService acceptSuggestion:",t)}})}rejectSuggestion(e,t){return X(this,null,function*(){try{let i=this.coreService.getContextConfig(e);if(!i)return;let a=i().data?.annotation;if(!a||a.type!=="suggestion"||!a.suggestion||a.suggestion.status!=="pending")return;let l=this.authService.getUser();if(!l)return;a.suggestion.status="rejected",a.suggestion.rejectReason=t??null,a.suggestion.resolvedBy=l,a.suggestion.resolvedAt=this.timestamp,a.status=N.CommentRejectStatus,this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_REJECT_BUTTON_CLICKED,{annotationId:e,commentType:"suggestion",suggestionOutcome:"rejected",targetId:a.suggestion.targetId}),this.commentService.updateComment(a),this.suggestionActions.projectAndTrigger(Il.SUGGESTION_REJECTED,a)}catch(i){this.loggingService.catch("Error in CommentDialogActionService rejectSuggestion:",i)}})}rejectCommentAnnotation(e){try{let t=this.coreService.getContextConfig(e);if(!t)return;let i=t(),a=i.data?.annotation;if(!a)return;this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_REJECT_BUTTON_CLICKED,{annotationId:a.annotationId,commentType:this.commentService.getCommentType(a),uiLocation:i.featureState?.sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.commentActionsService.rejectCommentAnnotation({annotationId:a.annotationId})}catch(t){this.loggingService.catch("Error in CommentDialogActionService rejectCommentAnnotation:",t)}}deleteAttachment(e,t,i,a){try{let l=this.coreService.getContextConfig(e);if(!l)return;let c=l(),d=a?this.coreService.getLocalUIState(a):void 0,m=d?.()?.editComment,u=null;if(i?u=m?.attachments?.[t]:u=d?.()?.selectedAttachments?.[t],u?.attachmentId){let _=m?c.uiState?.editCommentTextArea?.nativeElement:c.uiState?.newCommentTextArea?.nativeElement;_&&this.removeAttachmentTag(e,u.attachmentId,_,a)}if(i&&d){let _=d()?.editComment;if(_?.attachments){let I=[..._.attachments],A=I.splice(t,1);d.update(M=>y(h({},M),{editComment:y(h({},M.editComment),{attachments:I}),attachmentsToDelete:[...M.attachmentsToDelete||[],...A]}))}}else if(d){let I=d()?.selectedFiles?.[t];if(I?.url)try{URL.revokeObjectURL(I.url)}catch{}d.update(A=>{let M=A.selectedFiles?[...A.selectedFiles.slice(0,t),...A.selectedFiles.slice(t+1)]:[],B=A.selectedAttachments?[...A.selectedAttachments.slice(0,t),...A.selectedAttachments.slice(t+1)]:[];return y(h({},A),{selectedFiles:M,selectedAttachments:B})})}!i&&u&&this.deleteAttachments(e,[u]),this.checkGetAnnotationDraftAttribute(e,a)}catch(l){this.loggingService.catch("Error in CommentDialogActionService deleteAttachment:",l)}}removeInvalidFile(e,t,i){try{let a=i?this.coreService.getLocalUIState(i):void 0;if(!a){this.loggingService.catch(`Cannot remove invalid file: No localUI found for dialog ${i}`,new Error("LocalUI not found"));return}let l=a();if(l?.invalidSelectedFiles&&l.invalidSelectedFiles.length>t){let c=[...l.invalidSelectedFiles.slice(0,t),...l.invalidSelectedFiles.slice(t+1)];this.loggingService.log(`Invalid file removed at index ${t} for annotation ${e}. Remaining: ${c.length}`),a.update(d=>y(h({},d),{invalidSelectedFiles:c}))}else this.loggingService.catch(`Cannot remove invalid file: Index ${t} out of bounds for annotation ${e}`,new Error("Index out of bounds"))}catch(a){this.loggingService.catch("Error in CommentDialogActionService removeInvalidFile:",a)}}setAssignTo(e,t){try{let i=this.coreService.getContextConfig(e);if(!i)return;i.update(a=>{let l=a.featureState?.assignToType==="checkbox"?!0:a.data?.isAssignedCheckbox;return y(h({},a),{data:y(h({},a.data),{assignTo:t,isAssignedCheckbox:l})})})}catch(i){this.loggingService.catch("Error in CommentDialogActionService setAssignTo:",i)}}toggleAssignToCheckbox(e){try{let t=this.coreService.getContextConfig(e);if(!t)return;t.update(i=>y(h({},i),{data:y(h({},i.data),{isAssignedCheckbox:!i.data?.isAssignedCheckbox})}))}catch(t){this.loggingService.catch("Error in CommentDialogActionService toggleAssignToCheckbox:",t)}}onDeleteRecorderAnnotation(e,t,i){try{let a=this.coreService.getContextConfig(e);if(!a)return;let l=i?this.coreService.getLocalUIState(i):void 0;l&&l.update(u=>y(h({},u),{localRecordedData:(u.localRecordedData||[]).filter(_=>_.id!==t.annotationId)}));let c=l?.()?.editComment,m=a().data?.annotation;c?.commentId&&m?.annotationId&&this.commentActionsService.deleteRecording({annotationId:m.annotationId,commentId:c.commentId,recorderId:t.annotationId})}catch(a){this.loggingService.catch("Error in CommentDialogActionService onDeleteRecorderAnnotation:",a)}}onRecordedData(e,t,i){try{let a=i?this.coreService.getLocalUIState(i):void 0;a&&a.update(l=>y(h({},l),{localRecordedData:[...l.localRecordedData||[],t]})),this.domService.setRecordingInProgress(e,!1),this.checkGetAnnotationDraftAttribute(e,i)}catch(a){this.loggingService.catch("Error in CommentDialogActionService onRecordedData:",a)}}addFiles(e,t,i){return X(this,null,function*(){try{let a=this.coreService.getContextConfig(e);if(!a){this.loggingService.catch(`Cannot add files: No config found for annotation ${e}`,new Error("Config not found"));return}let l=a(),c=l.data?.annotation;if(!c){this.loggingService.catch(`Cannot add files: No annotation found for ${e}`,new Error("Annotation not found"));return}this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_ATTACHMENT_BUTTON_CLICKED,{annotationId:c.annotationId,commentThreadId:void 0,commentType:this.commentService.getCommentType(c),uiLocation:l.featureState?.sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()});let d=i?this.coreService.getLocalUIState(i):void 0;if(t.length)for(let u=0;u<t.length;u++){let _=t[u],I=URL.createObjectURL(_),A=this.domSanitizer.bypassSecurityTrustUrl(I),M=this.commentActionsService.validateFile(_);if(M.valid){let B=_?.type;d&&d.update(q=>y(h({},q),{selectedFiles:[...q.selectedFiles||[],{file:_,url:_?.type?.includes("svg")?A:I,fileType:B}]}))}else d&&d.update(B=>y(h({},B),{invalidSelectedFiles:[...B.invalidSelectedFiles||[],{file:_,url:I,errorMessage:M?.maxAllowedSizeInMB?`Size > ${M?.maxAllowedSizeInMB}MB`:"Size > 15MB"}]})),this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_ATTACHMENT_SIZE_EXCEEDED,{annotationId:c.annotationId,commentThreadId:void 0,commentType:this.commentService.getCommentType(c),uiLocation:l.featureState?.sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode(),attachmentSize:_.size,attachmentType:_.type})}a.update(u=>y(h({},u),{uiState:y(h({},u.uiState),{uploadingAttachments:!0})}));let m=yield this.uploadFiles(e,i);d&&d.update(u=>y(h({},u),{selectedAttachments:[...u.selectedAttachments||[],...m]})),a.update(u=>y(h({},u),{uiState:y(h({},u.uiState),{uploadingAttachments:!1})})),this.checkGetAnnotationDraftAttribute(e,i)}catch(a){this.loggingService.catch("Error in CommentDialogActionService addFiles:",a);let l=this.coreService.getContextConfig(e);l&&l.update(c=>y(h({},c),{uiState:y(h({},c.uiState),{uploadingAttachments:!1})}))}})}uploadFiles(e,t){return X(this,null,function*(){try{let i=this.coreService.getContextConfig(e);if(!i)return[];let a=i(),l=a.data?.annotation,c=t?this.coreService.getLocalUIState(t):void 0,d=c?.()?.selectedFiles||[];if(!l||!d.length)return[];let m=[],u=(_,I)=>{c&&c.update(A=>y(h({},A),{selectedFiles:A.selectedFiles?.map((M,B)=>B===_?h(h({},M),I):M)}))};for(let _=0;_<d.length;_++){let I=d[_];if(!I.uploaded&&!I.uploading){u(_,{uploading:!0});let A=I.file;try{let[M]=yield this.commentActionsService.addAttachment({annotationId:l.annotationId,files:[A]},"internal"),B=M?.attachment;if(B){this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_ATTACHMENT_ADDED,{annotationId:l.annotationId,commentThreadId:void 0,commentType:this.commentService.getCommentType(l),uiLocation:a.featureState?.sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode(),attachmentId:B.attachmentId,attachmentSize:B.size,attachmentType:B.type}),m.push(B);let q=i(),ae=q.uiState?.editCommentTextArea?.nativeElement||q.uiState?.newCommentTextArea?.nativeElement;ae&&q.uiState?.attachmentNameInMessage&&setTimeout(()=>{this.focusOnComposerInput(e,!0),this.insertAttachmentTag(e,ae,B,t)},100)}u(_,{uploaded:!0,uploading:!1})}catch(M){this.loggingService.catch("Error uploading individual file:",M),u(_,{uploading:!1})}}}return m}catch(i){return this.loggingService.catch("Error in CommentDialogActionService uploadFiles:",i),[]}})}startRecording(e,t,i){try{let a=this.coreService.getContextConfig(e);if(!a){this.loggingService.catch(`Cannot start recording: No config found for annotation ${e}`,new Error("Config not found"));return}let l=a(),c=l.data?.annotation;if(!c){this.loggingService.catch(`Cannot start recording: No annotation found for ${e}`,new Error("Annotation not found"));return}this.analyticsService.trackEvent(Y.Events.Comments.COMMENT_RECORDING_TOOL_CLICKED,{annotationId:c.annotationId,commentThreadId:void 0,commentType:this.commentService.getCommentType(c),uiLocation:l.featureState?.sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode(),recorderType:t});let d=c?.metadata?.clientDocumentId,m=l.uiState?.commentDialogUniqueId,u=l.uiState?.darkMode,_=l.uiState?.dialogShadowDOM;this.recorderService.initRecording(t,i??m,!0,u,_,c.annotationId,d),setTimeout(()=>{this.checkGetAnnotationDraftAttribute(e,i)},100)}catch(a){this.loggingService.catch("Error in CommentDialogActionService startRecording:",a)}}checkGetAnnotationDraftAttribute(e,t){try{let i=this.coreService.getContextConfig(e);if(!i)return;let a=i(),c=(t?this.coreService.getLocalUIState(t):void 0)?.(),d=c?.composerContent,m=d&&d!==`
|
|
517
517
|
`&&d.trim()!=="",u=c?.selectedAttachments,_=c?.localRecordedData,I=a.uiState?.recorderInitConfig,M=!!(m||u?.length||_?.length||I&&(I?.panelId===t||I?.commentAnnotationId===e))?e:null;a.uiState?.getAnnotationDraftAttribute!==M&&i.update(B=>y(h({},B),{uiState:y(h({},B.uiState),{getAnnotationDraftAttribute:M})}))}catch(i){this.loggingService.catch("Error in CommentDialogActionService checkGetAnnotationDraftAttribute:",i)}}saveDraftComment(e,t){return X(this,null,function*(){try{let i=this.commentService.getDraftMode(),a=this.coreService.getContextConfig(e);if(!a)return;let l=a(),d=(t?this.coreService.getLocalUIState(t):void 0)?.(),m=!!d?.editComment,u=!!l.uiState?.getAnnotationDraftAttribute,_=d?.composerContent,I=!!(_&&_!==`
|