UNPKG

@veltdev/sdk

Version:

Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.

1 lines 347 kB
import{g as ur,t as br}from"./chunk-BACKCNIG.js";import"./chunk-JFNRCHYR.js";import{l as zt}from"./chunk-U4YN7DB7.js";import{a as fr}from"./chunk-ZATQYC4Y.js";import"./chunk-3HGEDPEP.js";import"./chunk-JDLRIKAZ.js";import{A as L,B as E,y as pr}from"./chunk-3J52NZMN.js";import"./chunk-4ACOV475.js";import{b as ae}from"./chunk-WTYACTR5.js";import{a as kr}from"./chunk-6E3N35RF.js";import{a as jt}from"./chunk-UJRDSNTY.js";import{I as Yt,da as w,ea as pt,ga as hr}from"./chunk-KU45CEXD.js";import{$ as le,$g as Jt,Ab as Pt,Bb as Ft,Bi as cr,Ca as Lt,Ci as gr,Df as dt,E as nt,Ee as F,Ef as qt,Fa as d,Gi as mr,Ii as sr,Kb as Rt,L as Ye,M as It,Nb as j,Nh as Xt,Ob as te,Od as Bt,Of as yt,Pa as Je,Pb as re,Pc as Ht,Rb as Gt,S as At,T as it,Ta as Et,Ua as C,Va as Dt,Vh as Qt,Ya as S,Yd as $t,Zh as Zt,_a as h,_b as I,a as O,aa as wt,ac as Ut,b as R,ba as Tt,bc as $,bi as st,ca as G,cc as u,da as oe,db as T,dc as N,di as W,eb as Ot,ec as A,ei as er,fb as y,fc as Nt,fh as M,g as pe,gb as x,ha as ne,hi as tr,i as St,ia as ie,ib as Mt,ja as z,jb as je,jh as Ke,ka as lt,kb as Be,kc as Z,kh as xt,l as We,lb as c,lc as ee,li as rr,mb as s,mi as ht,nb as p,ni as ar,ob as _,qa as qe,qh as ct,qi as or,r as ue,rh as Xe,sb as k,sh as gt,si as Qe,tb as f,uh as Kt,ui as nr,v as de,vb as ge,vc as U,vi as ir,wa as vt,wh as mt,xb as me,xc as Vt,xf as Wt,xi as lr,yi as vr,zb as l,zi as dr}from"./chunk-GR3NESUB.js";var ve=(function(t){return t.DATE_HEADER="date-header",t.ACTIVITY="activity",t.SHOW_MORE="show-more",t})(ve||{}),Ze="all",se="All Activity",yr={comment:"Comments",recorder:"Recorder",crdt:"CRDT",reaction:"Reactions"},q=(function(t){return t.DELETE=".delete",t.STATUS_CHANGE=".status_change",t.PRIORITY_CHANGE=".priority_change",t.ASSIGN=".assign",t.ACCESS_MODE_CHANGE=".access_mode_change",t.SUBSCRIBE=".subscribe",t.UNSUBSCRIBE=".unsubscribe",t.UPDATE=".update",t.EDIT=".edit",t.ACCEPT=".accept",t.REJECT=".reject",t.SUGGESTION_ACCEPT=".suggestion_accept",t.SUGGESTION_REJECT=".suggestion_reject",t.REACTION_ADD=".reaction_add",t.REACTION_DELETE=".reaction_delete",t.ADD=".add",t})(q||{}),ut=class{constructor(){this.appState={user:null,darkMode:!1},this.featureState={isEnabled:!0},this.data={allActivities:null,filteredActivities:null,groupedActivities:[],virtualScrollItems:[],activeFilter:Ze,availableFilters:[]},this.uiState={isOpen:!1,expandedGroups:new Set,defaultVisibleCount:5,filterDropdownOpen:!1}}};function Ct(){return{darkMode:!1,variant:void 0}}var xr=new Tt("ActivityLogLocalUIStateSignal");var be=(()=>{let a=class a{constructor(e,o,n,i,m,g,v,b,B,J,$e,Ar,wr,Tr){this.activityResolverService=e,this.activityUtilsService=o,this.authService=n,this.commentAnnotationsResolverService=i,this.reactionAnnotationsResolverService=m,this.recorderAnnotationsResolverService=g,this.commonDbService=v,this.commonDbUtilsService=b,this.configService=B,this.docService=J,this.functions=$e,this.loggingService=Ar,this.usersService=wr,this.userPermissionService=Tr,this.endpointsService=oe(tr),this.isActivityFeatureEnabled$=new We(!1),this.isActivityFeatureImmutable$=new We(!1),this.allActivities$=new We(null),this.subscriptions=new Map,this.fetchedEntityIds=new Set;try{this.initializeService()}catch(Lr){this.loggingService.catch("Error in ActivityService constructor:",Lr)}}setActivityFeatureConfig(e){try{this.isActivityFeatureEnabled$.next(e?.isEnabled??!1),this.isActivityFeatureImmutable$.next(e?.immutable??!1)}catch(o){this.loggingService.catch("Error in setActivityFeatureConfig: ",o)}}getIsActivityFeatureEnabled(){return this.isActivityFeatureEnabled$.value}getIsActivityFeatureImmutable(){return this.isActivityFeatureImmutable$.value}getIsActivityFeatureEnabled$(){return this.isActivityFeatureEnabled$.asObservable().pipe(Ye(Ke))}initializeService(){try{this.authSubscription=this.getIsActivityFeatureEnabled$().pipe(Ye(),nt(e=>e===!0)).subscribe(()=>{this.subscriptions.size>0&&!this.triggerListenerSubscription&&this.rebuildTriggerListener()},e=>{this.loggingService.catch("Error in ActivityService feature flag subscription:",e)})}catch(e){this.loggingService.catch("Error in ActivityService initializeService:",e)}}subscribe(e){let o=yt(),n=new We(null);try{let i={id:o,config:e??{},activities$:n};this.subscriptions.set(o,i),this.getIsActivityFeatureEnabled()&&this.rebuildTriggerListener(),this.allActivities$.getValue()!==null&&this.distributeActivitiesToSubscription(i)}catch(i){this.loggingService.catch("Error in ActivityService subscribe:",i)}return{getActivities$:()=>n.asObservable(),unsubscribe:()=>{try{this.subscriptions.delete(o),n.complete(),this.getIsActivityFeatureEnabled()&&this.rebuildTriggerListener()}catch(i){this.loggingService.catch("Error in ActivityService unsubscribe:",i)}}}}getActivities$(){return this.allActivities$.asObservable().pipe(Ye(Ke))}getActivitiesForDocument$(e){return this.allActivities$.pipe(de(o=>o===null?null:o.filter(n=>n.metadata?.documentId===e)),Ye(Ke))}getActivitiesForEntity$(e){return this.allActivities$.pipe(de(o=>o===null?null:o.filter(n=>n.targetEntityId===e)),Ye(Ke))}fetchActivitiesForEntity(e){return pe(this,null,function*(){try{if(!this.getIsActivityFeatureEnabled())return;let{targetEntityId:o,documentId:n,organizationId:i}=e;if(!o||!n||this.fetchedEntityIds.has(o))return;this.fetchedEntityIds.add(o);let m=this.authService.getUser();if(!m?.userId){this.fetchedEntityIds.delete(o);return}let g=i||this.docService.getOrganizationConfig()?.clientOrganizationId;if(!g){this.fetchedEntityIds.delete(o);return}let v=mt(this.functions,gt({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService.getApiProxyDomain()})),b=yield ct({methodName:"getActivitiesForEntity",data:{type:"getActivitiesForEntity",organizationId:g,documentId:n,targetEntityId:String(o),isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable()},getSdkProxy:v,userId:m.userId});if(b?.activities?.length){let B=b.activities;this.appendActivities(B),this.rehydrateActivities(B)}}catch(o){this.fetchedEntityIds.delete(e.targetEntityId),this.loggingService.catch("Error in ActivityService fetchActivitiesForEntity:",o)}})}createActivity(e){return pe(this,null,function*(){try{if(!this.getIsActivityFeatureEnabled())return;let o=this.authService.getUser();if(!o?.userId){this.loggingService.warn("ActivityService createActivity: No user available");return}let n=this.docService.getBaseMetadata("activity");if(!n?.apiKey||!n?.organizationId){this.loggingService.warn("ActivityService createActivity: Missing metadata or organizationId");return}let i=this.getIsActivityFeatureImmutable(),m=yt(),g={id:m,featureType:e.featureType,actionType:e.actionType,eventType:e.eventType,actionUser:o,timestamp:this.commonDbService.getServerTimestamp(),metadata:n,targetEntityId:e.targetEntityId!=null?String(e.targetEntityId):void 0,targetSubEntityId:e.targetSubEntityId!=null?String(e.targetSubEntityId):void 0,changes:e.changes,entityData:e.entityData,entityTargetData:e.entityTargetData,actionIcon:e.actionIcon,displayMessageTemplate:e.displayMessageTemplate,displayMessageTemplateData:e.displayMessageTemplateData,immutable:i};this.appendActivities([g]);let{strippedActivity:v,activityResolverData:b}=yield this.activityUtilsService.stripActivityPII(g);b&&this.activityResolverService.activityDataProviderAvailable()&&this.activityResolverService.saveActivity({activity:{[b.id]:b},event:$t.ACTIVITY_SAVE});let B=v;if(this.activityResolverService.activityDataProviderAvailable())try{B=this.applyVeltDbFieldFilter(v)}catch(J){this.loggingService.catch("Error in ActivityService createActivity field filter:",J),B=v}try{yield this.sendActivityToBackend(B)}catch{let J=this.allActivities$.getValue()??[];this.allActivities$.next(J.filter($e=>$e.id!==m)),this.subscriptions.forEach($e=>this.distributeActivitiesToSubscription($e))}}catch(o){this.loggingService.catch("Error in ActivityService createActivity:",o)}})}applyVeltDbFieldFilter(e){return Kt(e,Wt)}rebuildTriggerListener(){try{if(this.triggerListenerSubscription&&(this.triggerListenerSubscription.unsubscribe(),this.triggerListenerSubscription=void 0),this.subscriptions.size===0)return;let e=this.getCombinedSubscriptionScope();this.triggerListenerSubscription=this.getLastActivityTimestamps$(e).pipe(At(null),It(),de(([o,n])=>{if(!n)return;if(n.length===0){this.allActivities$.getValue()===null&&!this.emptyStateTimeoutId&&(this.emptyStateTimeoutId=setTimeout(()=>{this.emptyStateTimeoutId=void 0,this.allActivities$.getValue()===null&&(this.allActivities$.next([]),this.subscriptions.forEach(v=>this.distributeActivitiesToSubscription(v)))},5e3));return}this.emptyStateTimeoutId&&(clearTimeout(this.emptyStateTimeoutId),this.emptyStateTimeoutId=void 0);let i=new Map;o?.forEach(v=>i.set(v.documentId,v.timestamp));let m=[],g=[];if(n.forEach(v=>{let b=i.get(v.documentId);b===void 0?m.push(v.documentId):b!==v.timestamp&&g.push({documentId:v.documentId,previousTimestamp:b})}),m.length>0){let v=this.getStartAtTimestamp(e.maxDays);this.fetchActivitiesForDocuments(m,e.organizationId,void 0,v)}g.length>0&&this.fetchActivitiesForDocuments(g.map(v=>v.documentId),e.organizationId,g)})).subscribe(()=>{},o=>this.loggingService.catch("Error in ActivityService trigger listener:",o))}catch(e){this.loggingService.catch("Error in ActivityService rebuildTriggerListener:",e)}}getLastActivityTimestamps$(e){try{return this.authService.getUser$().pipe(nt(o=>!!o),it(o=>this.docService.getOrganizationConfig$().pipe(nt(n=>!!n),de(n=>{let m=(e.organizationId?qt(e.organizationId):void 0)||n?.organizationId||o?.organizationId;return{user:o,organizationId:m}}))),it(({user:o,organizationId:n})=>{if(!o||!n)return ue(null);if(e.type===ce.CURRENT_DOCUMENT)return this.docService.getDocumentPaths$().pipe(it(m=>{let g=m?.clientDocumentId;if(!g&&!e.documentIds?.length)return this.resetCurrentDocumentSubscriptions(),ue(null);let v=new Set(e.documentIds??[]);g&&v.add(g);let b=Array.from(v).slice(0,30).map(B=>dt(B));return b.length===1?this.buildTriggerQuery(n,[Qe("metadata.documentId","==",b[0])],e.maxDays):this.buildTriggerQuery(n,[Qe("metadata.documentId","in",b)],e.maxDays)}));let i=[];if(e.type===ce.DOCUMENTS&&e.documentIds?.length){e.documentIds.length>30&&this.loggingService.catch("Error in ActivityService getLastActivityTimestamps$: Subscription includes more than 30 document IDs. Only the first 30 will be monitored.",new Error("Subscription includes more than 30 document IDs. Only the first 30 will be monitored."),void 0,!0);let m=e.documentIds.slice(0,30).map(g=>dt(g));i.push(Qe("metadata.documentId","in",m))}return this.buildTriggerQuery(n,i,e.maxDays)}))}catch(o){return this.loggingService.catch("Error in ActivityService getLastActivityTimestamps$:",o),ue(null)}}buildTriggerQuery(e,o,n=bt){try{let i=this.getStartAtTimestamp(n);o.push(Qe("timestamp",">=",i));let g=[o.length>1?ar(...o):o[0],or("timestamp","desc")];return this.commonDbService.dbListener({feature:"allLastActivityTimestamp",properties:{organizationId:e,isCollection:!0,useQuery:!0,firestoreQuery:g}}).pipe(de(v=>v?.data),de(v=>{if(!v)return[];let b=[];return Object.keys(v).forEach(B=>{let J=this.commonDbService.shouldUseFirestore()?v[B]?.timestamp??0:v[B];b.push({documentId:B,timestamp:J})}),b}))}catch(i){return this.loggingService.catch("Error in ActivityService buildTriggerQuery:",i),ue([])}}fetchActivitiesForDocuments(e,o,n,i){return pe(this,null,function*(){try{if(!e.length)return;let m=this.authService.getUser();if(!m?.userId)return;let g=o||this.docService.getOrganizationConfig()?.clientOrganizationId;if(!g)return;let v=mt(this.functions,gt({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService.getApiProxyDomain()})),b={type:"getActivitiesForDocuments",organizationId:g,documentIds:e,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable()};i&&(b.startAtTimestamp=i),n?.length&&(b.documentTimestamps=n.map(J=>({documentId:J.documentId,timestamp:J.previousTimestamp})));let B=yield ct({methodName:"getActivitiesForDocuments",data:b,getSdkProxy:v,userId:m.userId});if(B?.activities?.length){let J=B.activities;this.appendActivities(J),this.rehydrateActivities(J)}else this.allActivities$.getValue()===null&&(this.allActivities$.next([]),this.subscriptions.forEach(J=>this.distributeActivitiesToSubscription(J)))}catch(m){this.loggingService.catch("Error in ActivityService fetchActivitiesForDocuments:",m)}})}sendActivityToBackend(e){return pe(this,null,function*(){try{let o=this.authService.getUser();if(!o?.userId)return;let n=mt(this.functions,gt({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService.getApiProxyDomain()}));yield ct({methodName:"createActivity",data:{type:"createActivity",activityData:e},getSdkProxy:n,userId:o.userId})}catch(o){throw this.loggingService.catch("Error in ActivityService sendActivityToBackend:",o),o}})}rehydrateActivities(e){try{let o=this.usersService.userDataProviderAvailable(),n=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),i=this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable(),m=this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable(),g=this.activityResolverService.activityDataProviderAvailable(),v=Promise.resolve();o&&(v=v.then(()=>this.commonDbUtilsService.formatResponse({feature:"allActivities",data:e,shouldAwait:!0,forceResolve:!0})).then(()=>{this.resolveAndUpdateActivities(e,"user")})),n&&(v=v.then(()=>this.commonDbUtilsService.formatResponse({feature:"allActivities",data:e,shouldCommentAnnotationsResolverAwait:!0})).then(()=>{this.resolveAndUpdateActivities(e,"comment")})),i&&(v=v.then(()=>this.commonDbUtilsService.formatResponse({feature:"allActivities",data:e,shouldReactionResolverAwait:!0})).then(()=>{this.resolveAndUpdateActivities(e,"reaction")})),m&&(v=v.then(()=>this.commonDbUtilsService.formatResponse({feature:"allActivities",data:e,shouldRecorderResolverAwait:!0})).then(()=>{this.resolveAndUpdateActivities(e,"recorder")})),g&&(v=v.then(()=>this.commonDbUtilsService.formatResponse({feature:"allActivities",data:e,shouldActivityResolverAwait:!0})).then(()=>{this.resolveAndUpdateActivities(e,"activity")}))}catch(o){this.loggingService.catch("Error in ActivityService rehydrateActivities:",o)}}resolveAndUpdateActivities(e,o){try{let n=this.allActivities$.getValue()??[],i=new Map(n.map(b=>[b.id,b])),m=e.map(b=>i.get(b.id)??b),g=JSON.parse(JSON.stringify(m)),v;switch(o){case"user":v=this.commonDbUtilsService.mergeUsersWithData({feature:"allActivities",data:g});break;case"comment":v=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allActivities",data:g});break;case"reaction":v=this.commonDbUtilsService.mergeReactionAnnotationsWithData({feature:"allActivities",data:g});break;case"recorder":v=this.commonDbUtilsService.mergeRecorderAnnotationsWithData({feature:"allActivities",data:g});break;case"activity":v=this.commonDbUtilsService.mergeActivityResolverWithData({feature:"allActivities",data:g});break}v?.length&&this.appendActivities(v)}catch(n){this.loggingService.catch("Error in ActivityService resolveAndUpdateActivities:",n)}}appendActivities(e){try{let o=this.allActivities$.getValue()??[],n=new Map;e.forEach(b=>{b.id&&n.set(b.id,b)});let i=o.map(b=>n.get(b.id)??b),m=new Set(o.map(b=>b.id)),v=[...e.filter(b=>!m.has(b.id)),...i].sort((b,B)=>(B.timestamp??0)-(b.timestamp??0));if(v.forEach(b=>{b.displayMessage=this.activityUtilsService.getActivityDisplayMessage(b)}),this.activitiesEqual(o,v))return;this.allActivities$.next(v),this.subscriptions.forEach(b=>{this.distributeActivitiesToSubscription(b)})}catch(o){this.loggingService.catch("Error in ActivityService appendActivities:",o)}}distributeActivitiesToSubscription(e){try{let o=this.allActivities$.getValue();if(o===null)return;let n=e.config,i;if(n.currentDocumentOnly){let g=this.docService.getDocumentPaths()?.documentId;i=g?o.filter(v=>v.metadata?.documentId===g):[]}else if(n.documentIds?.length){let g=new Set(n.documentIds.map(v=>dt(v)));i=o.filter(v=>v.metadata?.documentId&&g.has(v.metadata.documentId))}else i=o;if(n.featureTypes?.length){let g=new Set(n.featureTypes);i=i.filter(v=>g.has(v.featureType))}else if(n.excludeFeatureTypes?.length){let g=new Set(n.excludeFeatureTypes);i=i.filter(v=>!g.has(v.featureType))}if(n.actionTypes?.length){let g=new Set(n.actionTypes);i=i.filter(v=>g.has(v.actionType))}else if(n.excludeActionTypes?.length){let g=new Set(n.excludeActionTypes);i=i.filter(v=>!g.has(v.actionType))}if(n.userIds?.length){let g=new Set(n.userIds);i=i.filter(v=>v.actionUser?.userId&&g.has(v.actionUser.userId))}else if(n.excludeUserIds?.length){let g=new Set(n.excludeUserIds);i=i.filter(v=>!v.actionUser?.userId||!g.has(v.actionUser.userId))}let m=e.activities$.getValue();if(m!==null&&this.activitiesEqual(m,i))return;e.activities$.next(i)}catch(o){this.loggingService.catch("Error in ActivityService distributeActivitiesToSubscription:",o)}}resetCurrentDocumentSubscriptions(){try{this.subscriptions.forEach(e=>{e.config.currentDocumentOnly&&e.activities$.getValue()!==null&&e.activities$.next(null)})}catch(e){this.loggingService.catch("Error in ActivityService resetCurrentDocumentSubscriptions:",e)}}activitiesEqual(e,o){try{if(e.length!==o.length)return!1;for(let n=0;n<e.length;n++)if(e[n].id!==o[n].id)return!1;return JSON.stringify(e)===JSON.stringify(o)}catch(n){return this.loggingService.catch("Error in ActivityService activitiesEqual:",n),!1}}getCombinedSubscriptionScope(){try{let e=!1,o=!1,n,i=new Set,m=bt;this.subscriptions.forEach(v=>{let b=v.config;b.organizationId&&(n=b.organizationId),b.currentDocumentOnly?o=!0:b.documentIds?.length?b.documentIds.forEach(B=>i.add(B)):e=!0,b.maxDays&&b.maxDays>m&&(m=b.maxDays)});let g={organizationId:n,maxDays:m};return e?O({type:ce.ORG_WIDE},g):o&&i.size>0?O({type:ce.CURRENT_DOCUMENT,documentIds:Array.from(i)},g):o?O({type:ce.CURRENT_DOCUMENT},g):i.size>0?O({type:ce.DOCUMENTS,documentIds:Array.from(i)},g):O({type:ce.ORG_WIDE},g)}catch(e){return this.loggingService.catch("Error in ActivityService getCombinedSubscriptionScope:",e),{type:ce.ORG_WIDE,organizationId:void 0,maxDays:bt}}}getStartAtTimestamp(e){try{let o=new Date,n=e>0?e:bt;return o.setDate(o.getDate()-n),o.getTime()}catch(o){return this.loggingService.catch("Error in ActivityService getStartAtTimestamp:",o),0}}cleanup(){try{this.triggerListenerSubscription?.unsubscribe(),this.triggerListenerSubscription=void 0,this.emptyStateTimeoutId&&(clearTimeout(this.emptyStateTimeoutId),this.emptyStateTimeoutId=void 0),this.subscriptions.forEach(e=>e.activities$.complete()),this.subscriptions.clear(),this.allActivities$.next(null),this.fetchedEntityIds.clear()}catch(e){this.loggingService.catch("Error in ActivityService cleanup:",e)}}destroy(){try{this.cleanup(),this.authSubscription?.unsubscribe()}catch(e){this.loggingService.catch("Error in ActivityService destroy:",e)}}};a.\u0275fac=function(o){return new(o||a)(G(cr),G(gr),G(ht),G(nr),G(ir),G(lr),G(sr),G(mr),G(er),G(vr),G(Bt),G(W),G(dr),G(fr))},a.\u0275prov=le({token:a,factory:a.\u0275fac,providedIn:"root"});let t=a;return t})(),ce=(function(t){return t.ORG_WIDE="orgWide",t.DOCUMENTS="documents",t.CURRENT_DOCUMENT="currentDocument",t})(ce||{}),bt=30;var ze=(()=>{let a=class a{constructor(e,o,n,i){this.activityService=e,this.authService=o,this.themeService=n,this.loggingService=i,this.configSignal=qe(new ut),this.activitySubscription=null,this.globalSubscriptions=[],this.instanceSubscriptions=[],this.timeRefreshTimer=null,this.initialized=!1,this._registry=null,this.setupGlobalSubscriptions()}initialize(e){try{if(this.initialized)return;this.initialized=!0,this.subscribeToActivities(e),this.startTimeRefreshTimer()}catch(o){this.loggingService.catch("Error in ActivityLogCoreService initialize:",o)}}getConfigSignal(){return this.configSignal}loadActivities(e){try{this.runPipeline(e)}catch(o){this.loggingService.catch("Error in ActivityLogCoreService loadActivities:",o)}}setFilter(e){try{let o=this.configSignal();if(o.data.allActivities===null){this.configSignal.update(g=>R(O({},g),{data:R(O({},g.data),{activeFilter:e})}));return}let n=this.filterActivities(o.data.allActivities,e),i=this.groupByDate(n),m=this.buildVirtualScrollItems(i,o.uiState.expandedGroups,o.uiState.defaultVisibleCount);this.configSignal.update(g=>R(O({},g),{data:R(O({},g.data),{activeFilter:e,filteredActivities:n,groupedActivities:i,virtualScrollItems:m})}))}catch(o){this.loggingService.catch("Error in ActivityLogCoreService setFilter:",o)}}toggleGroupExpansion(e){try{let o=this.configSignal(),n=new Set(o.uiState.expandedGroups);n.has(e)?n.delete(e):n.add(e);let i=this.buildVirtualScrollItems(o.data.groupedActivities,n,o.uiState.defaultVisibleCount);this.configSignal.update(m=>R(O({},m),{uiState:R(O({},m.uiState),{expandedGroups:n}),data:R(O({},m.data),{virtualScrollItems:i})}))}catch(o){this.loggingService.catch("Error in ActivityLogCoreService toggleGroupExpansion:",o)}}toggleFilterDropdown(){try{this.configSignal.update(e=>R(O({},e),{uiState:R(O({},e.uiState),{filterDropdownOpen:!e.uiState.filterDropdownOpen})}))}catch(e){this.loggingService.catch("Error in ActivityLogCoreService toggleFilterDropdown:",e)}}closeFilterDropdown(){try{this.configSignal().uiState.filterDropdownOpen&&this.configSignal.update(o=>R(O({},o),{uiState:R(O({},o.uiState),{filterDropdownOpen:!1})}))}catch(e){this.loggingService.catch("Error in ActivityLogCoreService closeFilterDropdown:",e)}}openPanel(){try{this.configSignal.update(e=>R(O({},e),{uiState:R(O({},e.uiState),{isOpen:!0})}))}catch(e){this.loggingService.catch("Error in ActivityLogCoreService openPanel:",e)}}closePanel(){try{this.configSignal.update(e=>R(O({},e),{uiState:R(O({},e.uiState),{isOpen:!1,filterDropdownOpen:!1})}))}catch(e){this.loggingService.catch("Error in ActivityLogCoreService closePanel:",e)}}setRegistry(e){this._registry=e}getRegistry(){return this._registry}clearRegistry(){this._registry=null}destroy(){try{this.activitySubscription&&(this.activitySubscription.unsubscribe(),this.activitySubscription=null),this.instanceSubscriptions.forEach(e=>e.unsubscribe()),this.instanceSubscriptions=[],this.timeRefreshTimer&&(clearInterval(this.timeRefreshTimer),this.timeRefreshTimer=null),this.initialized=!1}catch(e){this.loggingService.catch("Error in ActivityLogCoreService destroy:",e)}}setupGlobalSubscriptions(){try{this.globalSubscriptions.push(this.authService.getUser$().subscribe(e=>{try{e&&this.configSignal.update(o=>R(O({},o),{appState:R(O({},o.appState),{user:e})}))}catch(o){this.loggingService.catch("Error in user subscription:",o)}})),this.globalSubscriptions.push(this.themeService.getDarkMode$().subscribe(e=>{try{this.configSignal.update(o=>R(O({},o),{appState:R(O({},o.appState),{darkMode:e})}))}catch(o){this.loggingService.catch("Error in dark mode subscription:",o)}})),this.globalSubscriptions.push(this.activityService.getIsActivityFeatureEnabled$().subscribe(e=>{try{this.configSignal.update(o=>R(O({},o),{featureState:R(O({},o.featureState),{isEnabled:e})}))}catch(o){this.loggingService.catch("Error in feature enabled subscription:",o)}}))}catch(e){this.loggingService.catch("Error in ActivityLogCoreService setupGlobalSubscriptions:",e)}}subscribeToActivities(e){try{this.activitySubscription=this.activityService.subscribe(e),this.instanceSubscriptions.push(this.activitySubscription.getActivities$().subscribe(o=>{try{this.runPipeline(o)}catch(n){this.loggingService.catch("Error in activities subscription callback:",n)}}))}catch(o){this.loggingService.catch("Error in ActivityLogCoreService subscribeToActivities:",o)}}runPipeline(e){try{let o=this.configSignal();if(e===null){this.configSignal.update(b=>R(O({},b),{data:R(O({},b.data),{allActivities:null,filteredActivities:null,groupedActivities:[],virtualScrollItems:[]})}));return}let n=this.buildAvailableFilters(e),i=n.some(b=>b.value===o.data.activeFilter)?o.data.activeFilter:Ze,m=this.filterActivities(e,i),g=this.groupByDate(m),v=this.buildVirtualScrollItems(g,o.uiState.expandedGroups,o.uiState.defaultVisibleCount);this.configSignal.update(b=>R(O({},b),{data:R(O({},b.data),{allActivities:e,availableFilters:n,activeFilter:i,filteredActivities:m,groupedActivities:g,virtualScrollItems:v})}))}catch(o){this.loggingService.catch("Error in ActivityLogCoreService runPipeline:",o)}}filterActivities(e,o){try{return e?o===Ze?e:e.filter(n=>n.featureType===o):[]}catch(n){return this.loggingService.catch("Error in ActivityLogCoreService filterActivities:",n),[]}}groupByDate(e){try{if(!e||e.length===0)return[];let o=[...e].sort((m,g)=>(g.timestamp||0)-(m.timestamp||0)),n=new Map;for(let m of o){let g=this.getDateKey(m.timestamp),v=n.get(g);v?v.push(m):n.set(g,[m])}let i=[];return n.forEach((m,g)=>{i.push({dateKey:g,displayLabel:this.formatDateLabel(g),activities:m,totalCount:m.length})}),i}catch(o){return this.loggingService.catch("Error in ActivityLogCoreService groupByDate:",o),[]}}getDateKey(e){try{let o=new Date(e),n=o.getFullYear(),i=String(o.getMonth()+1).padStart(2,"0"),m=String(o.getDate()).padStart(2,"0");return`${n}-${i}-${m}`}catch{return"0000-00-00"}}formatDateLabel(e){try{let o=e.split("-"),n=new Date(Number(o[0]),Number(o[1])-1,Number(o[2])),i=new Date,m=new Date(i.getFullYear(),i.getMonth(),i.getDate()),g=new Date(m);g.setDate(g.getDate()-1);let v=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(v.getTime()===m.getTime())return"TODAY";if(v.getTime()===g.getTime())return"YESTERDAY";let b=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],B=n.getDate(),J=b[n.getMonth()];return n.getFullYear()===i.getFullYear()?`${B} ${J}`:`${B} ${J} ${n.getFullYear()}`}catch(o){return this.loggingService.catch("Error in ActivityLogCoreService formatDateLabel:",o),e}}buildVirtualScrollItems(e,o,n){try{let i=[];for(let m of e){i.push({type:ve.DATE_HEADER,dateGroup:m});let v=o.has(m.dateKey)?m.activities:m.activities.slice(0,n);for(let b of v)i.push({type:ve.ACTIVITY,activity:b,dateGroup:m});m.totalCount>n&&i.push({type:ve.SHOW_MORE,dateGroup:m})}return i}catch(i){return this.loggingService.catch("Error in ActivityLogCoreService buildVirtualScrollItems:",i),[]}}buildAvailableFilters(e){try{if(!e||e.length===0)return[];let o=new Set;for(let i of e)i.featureType&&o.add(i.featureType);if(o.size<=1)return[];let n=[{label:se,value:Ze}];for(let i of o)n.push({label:yr[i]||i.charAt(0).toUpperCase()+i.slice(1),value:i});return n}catch(o){return this.loggingService.catch("Error in ActivityLogCoreService buildAvailableFilters:",o),[]}}startTimeRefreshTimer(){try{this.timeRefreshTimer=setInterval(()=>{try{let e=this.configSignal();e.data.allActivities&&e.data.allActivities.length>0&&this.runPipeline(e.data.allActivities)}catch(e){this.loggingService.catch("Error in time refresh timer:",e)}},6e4)}catch(e){this.loggingService.catch("Error in ActivityLogCoreService startTimeRefreshTimer:",e)}}};a.\u0275fac=function(o){return new(o||a)(G(be),G(ht),G(pt),G(W))},a.\u0275prov=le({token:a,factory:a.\u0275fac,providedIn:"root"});let t=a;return t})();var _r=(()=>{let a=class a{constructor(e,o,n){this.coreService=e,this.loggingService=o,this.domService=n}closePanel(){try{this.coreService.closePanel()}catch(e){this.loggingService.catch("Error in ActivityLogActionService closePanel:",e)}}openPanel(){try{this.coreService.openPanel()}catch(e){this.loggingService.catch("Error in ActivityLogActionService openPanel:",e)}}changeFilter(e){try{this.coreService.setFilter(e),this.coreService.closeFilterDropdown()}catch(o){this.loggingService.catch("Error in ActivityLogActionService changeFilter:",o)}}toggleGroup(e){try{this.coreService.toggleGroupExpansion(e)}catch(o){this.loggingService.catch("Error in ActivityLogActionService toggleGroup:",o)}}toggleFilterDropdown(){try{this.coreService.toggleFilterDropdown()}catch(e){this.loggingService.catch("Error in ActivityLogActionService toggleFilterDropdown:",e)}}closeFilterDropdown(){try{this.coreService.closeFilterDropdown()}catch(e){this.loggingService.catch("Error in ActivityLogActionService closeFilterDropdown:",e)}}navigateToActivity(e){try{if(!e||e.featureType!=="comment")return;let o=e.targetEntityId;if(!o)return;let n=e.entityData,i=O({annotationId:o},n||{});i.annotationId=o,i.targetTextRange&&sessionStorage.setItem(F.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,o),this.domService.toggleAnnotationSelection(i,void 0,void 0,!0),setTimeout(()=>{try{let m=null;(i.targetElement||i.areaAnnotationId)&&(m=document.getElementById(`comment-pin-container-${o}`)),m||(m=document.querySelector(`[${F.ATTRIBUTES.ANNOTATION_ID}="${o}"]`)),m&&m.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})}catch(m){this.loggingService.catch("Error scrolling to annotation:",m)}},100)}catch(o){this.loggingService.catch("Error in ActivityLogActionService navigateToActivity:",o)}}};a.\u0275fac=function(o){return new(o||a)(G(ze),G(W),G(rr))},a.\u0275prov=le({token:a,factory:a.\u0275fac,providedIn:"root"});let t=a;return t})();var he=(()=>{let a=class a{constructor(e){this.loggingService=e,this.subscribers=new Set}register(e){try{if(this.subscribers.add(e),this.lastPayload)try{e(this.lastPayload)}catch(o){this.loggingService.catch("[ACTIVITY LOG REGISTRY] Error initializing subscriber:",o)}}catch(o){this.loggingService.catch("[ACTIVITY LOG REGISTRY] Error in register:",o)}}unregister(e){try{this.subscribers.delete(e)}catch(o){this.loggingService.catch("[ACTIVITY LOG REGISTRY] Error in unregister:",o)}}broadcast(e){try{this.lastPayload=e,this.subscribers.forEach(o=>{try{o(e)}catch(n){this.loggingService.catch("[ACTIVITY LOG REGISTRY] Error in subscriber:",n)}})}catch(o){this.loggingService.catch("[ACTIVITY LOG REGISTRY] Error in broadcast:",o)}}getLastPayload(){try{return this.lastPayload}catch(e){this.loggingService.catch("[ACTIVITY LOG REGISTRY] Error in getLastPayload:",e);return}}};a.\u0275fac=function(o){return new(o||a)(G(W))},a.\u0275prov=le({token:a,factory:a.\u0275fac});let t=a;return t})();var D=(()=>{let a=class a extends hr{set parentLocalUIState(e){try{e&&(this.localUIStateSignal=e,this.isLocalUIStateOwner=!1)}catch(o){this.loggingService?.catch("Error in ActivityLogPrimitiveThemedComponent parentLocalUIState setter:",o)}}get elementRef(){return this.hostElementRef}constructor(){let e=oe(vt),o=oe(pt),n=oe(Vt),i=oe(w),m=oe(W);super(e,o,n,void 0,void 0,i,m),this.defaultCondition=U(!0,{transform:g=>{try{return typeof g=="string"?g==="true"||g==="":g}catch{return!0}}}),this.isLocalUIStateOwner=!1,this._contextData={},this.onContextPayload=g=>{try{this._contextData=g.contextData||{};let v=this.coreService.getConfigSignal();v&&(this.componentConfigSignal=v,this.cd.markForCheck())}catch(v){this.loggingService.catch("Error in ActivityLogPrimitiveThemedComponent onContextPayload:",v)}},this.hostElementRef=e,this.themeService=o,this.dynamicDataService=i,this.loggingService=m,this.coreService=oe(ze),this.actionService=oe(_r),this.cd=n,this.initializeLocalUIState()}initializeLocalUIState(){try{let e=oe(xr,{optional:!0,skipSelf:!0});e?(this.localUIStateSignal=e,this.isLocalUIStateOwner=!1):(this.localUIStateSignal=qe(Ct()),this.isLocalUIStateOwner=!0)}catch{this.localUIStateSignal=qe(Ct()),this.isLocalUIStateOwner=!0}}ngOnInit(){try{super.ngOnInit(),this.initializeConfig(),this.setupA11yAttributes(),this.setupDarkModeSync()}catch(e){this.loggingService.catch("Error in ActivityLogPrimitiveThemedComponent ngOnInit:",e)}}initializeConfig(){try{if(this.componentConfigSignal&&this.componentConfigSignal()&&this.componentConfigSignal().data)return;let e=this.findNearestParentWrapperRegistry();if(e){this._contextRegistry=e,this._contextRegistry.register(this.onContextPayload);return}let o=this.coreService.getConfigSignal();o&&(this.componentConfigSignal=o,this.cd.markForCheck())}catch(e){this.loggingService.catch("Error in ActivityLogPrimitiveThemedComponent initializeConfig:",e)}}findNearestParentWrapperRegistry(){try{let o=this.hostElementRef.nativeElement.parentElement;for(;o;){let n=o.__veltActivityLogContext;if(n?.registry instanceof he)return n.registry;o=o.parentElement}}catch(e){this.loggingService.catch("Error finding parent wrapper registry:",e)}}ngOnDestroy(){try{this._contextRegistry&&(this._contextRegistry.unregister(this.onContextPayload),this._contextRegistry=void 0),this.darkModeConfigSyncSubscription&&this.darkModeConfigSyncSubscription.unsubscribe(),super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in ActivityLogPrimitiveThemedComponent ngOnDestroy:",e)}}setupA11yAttributes(){}setupDarkModeSync(){try{this.darkModeConfigSyncSubscription=this.onDarkModeChange().subscribe(e=>{try{if(this.componentConfigSignal&&typeof this.componentConfigSignal=="function"){let o=this.componentConfigSignal();o&&o.appState&&o.appState.darkMode!==e&&this.componentConfigSignal.update(n=>R(O({},n),{appState:R(O({},n.appState),{darkMode:e})}))}}catch(o){this.loggingService.catch("Error in darkMode sync subscription:",o)}})}catch(e){this.loggingService.catch("Error in ActivityLogPrimitiveThemedComponent setupDarkModeSync:",e)}}};a.\u0275fac=function(o){return new(o||a)},a.\u0275cmp=C({type:a,selectors:[["app-activity-log-primitive-themed-base"]],inputs:{defaultCondition:[1,"defaultCondition"],parentLocalUIState:"parentLocalUIState"},standalone:!1,features:[S],decls:0,vars:0,template:function(o,n){},encapsulation:2});let t=a;return t})();var Mr=(t,a)=>({componentConfigSignal:t,parentLocalUIState:a}),Pr=(t,a)=>({condition:t,data:a}),Fr=t=>({componentConfigSignal:t}),Rr=(t,a,r,e)=>({template:t,context:a,componentName:"velt-activity-log-header-title-wireframe",setIfCondition:r,componentElementRef:e});function Gr(t,a){if(t&1&&(s(0,"h2",2),j(1),Z(2,"translate"),p()),t&2){let r=l(3);T("data-testid",r.componentId),d(),re(" ",ee(2,2,"Activity Log")," ")}}function Ur(t,a){if(t&1&&(k(0),h(1,Gr,3,4,"h2",1),f()),t&2){let r=l(2);d(),c("veltDynamicTemplate",A(3,Rr,r.template,$(1,Fr,r.componentConfigSignal),r.setIfCondition.bind(r),r.elementRef))}}function Nr(t,a){if(t&1&&h(0,Ur,2,8,"ng-container",0),t&2){let r=l();c("veltIf",u(4,Pr,r.conditionSignal(),u(1,Mr,r.componentConfigSignal,r.localUIStateSignal)))}}var ke=(()=>{let a=class a extends D{constructor(){super(),this.componentId="velt-activity-log-header-title"}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in ActivityLogHeaderTitleComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in ActivityLogHeaderTitleComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.hostElementRef.nativeElement;e.setAttribute("role","heading"),e.setAttribute("aria-level","2"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in ActivityLogHeaderTitleComponent setupA11yAttributes:",e)}}};a.\u0275fac=function(o){return new(o||a)},a.\u0275cmp=C({type:a,selectors:[["velt-activity-log-header-title-internal"]],standalone:!1,features:[I([w]),S],decls:1,vars:1,consts:[[4,"veltIf"],["class","velt-activity-log-header-title--text",4,"veltDynamicTemplate"],[1,"velt-activity-log-header-title--text"]],template:function(o,n){if(o&1&&y(0,Nr,1,7,"ng-container"),o&2){let i;x((i=n.componentConfigSignal())?0:-1,i)}},dependencies:[L,E,ae],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);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-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-activity-log-header-title--text[_ngcontent-%COMP%]{font-size:var(--velt-font-size-lg);font-weight:var(--velt-font-weight-500);color:var(--velt-text-0, black);margin:0;line-height:1.2;white-space:nowrap}"],changeDetection:0});let t=a;return t})();function kt(t){try{let a=t();if(!a)return se;let r=a.data.activeFilter;return a.data.availableFilters.find(o=>o.value===r)?.label||se}catch{return se}}var Hr=(t,a)=>({componentConfigSignal:t,parentLocalUIState:a}),Yr=(t,a)=>({condition:t,data:a}),jr=t=>({componentConfigSignal:t}),Br=(t,a,r,e)=>({template:t,context:a,componentName:"velt-activity-log-header-filter-trigger-label-wireframe",setIfCondition:r,componentElementRef:e});function zr(t,a){if(t&1&&(s(0,"span",2),j(1),Z(2,"translate"),p()),t&2){let r=l(3);T("data-testid",r.componentId),d(),re(" ",ee(2,2,r.getActiveFilterLabel())," ")}}function $r(t,a){if(t&1&&(k(0),h(1,zr,3,4,"span",1),f()),t&2){let r=l(2);d(),c("veltDynamicTemplate",A(3,Br,r.template,$(1,jr,r.componentConfigSignal),r.setIfCondition.bind(r),r.elementRef))}}function Wr(t,a){if(t&1&&h(0,$r,2,8,"ng-container",0),t&2){let r=l();c("veltIf",u(4,Yr,r.conditionSignal(),u(1,Hr,r.componentConfigSignal,r.localUIStateSignal)))}}var fe=(()=>{let a=class a extends D{constructor(){super(),this.componentId="velt-activity-log-header-filter-trigger-label"}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in ActivityLogHeaderFilterTriggerLabelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in ActivityLogHeaderFilterTriggerLabelComponent ngOnDestroy:",e)}}getActiveFilterLabel(){return kt(this.componentConfigSignal)}setupA11yAttributes(){try{this.hostElementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in ActivityLogHeaderFilterTriggerLabelComponent setupA11yAttributes:",e)}}};a.\u0275fac=function(o){return new(o||a)},a.\u0275cmp=C({type:a,selectors:[["velt-activity-log-header-filter-trigger-label-internal"]],standalone:!1,features:[I([w]),S],decls:1,vars:1,consts:[[4,"veltIf"],["class","velt-activity-log-header-filter-trigger-label--text",4,"veltDynamicTemplate"],[1,"velt-activity-log-header-filter-trigger-label--text"]],template:function(o,n){if(o&1&&y(0,Wr,1,7,"ng-container"),o&2){let i;x((i=n.componentConfigSignal())?0:-1,i)}},dependencies:[L,E,ae],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);display:flex;align-items:center}[_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(--ve