import{a0 as h,a1 as d,a2 as p,I as E,y as g,a3 as r,r as s,e as y}from"./app-k0jcl5PQ.js";import{A as e}from"./DjpUaGGv.chunk.js";var a=(o=>(o.Search="search",o.MultiSearch="multi_search",o.Filter="filter",o.Abandon="abandon",o.Clickthrough="clickthrough",o))(a||{});const c=class c extends h{get name(){return"BrazeAnalyticsClient"}constructor(i){super(i),this.ready=!d.needsConsent(i==null?void 0:i.consent)}initialize(i){if(!d.needsConsent(i.consent)){this.setup();return}this.listenTo(p.SHELL,"cookie:consent:accepted",this.onConsent)}onConsent(i){i!=null&&i.analytics&&this.setup()}setup(){this.client=E.getInstance(g.BrazeClient,this),this.ready=!0}shouldLog(i){if(!this.ready||!i)return!1;const t=c.eventWhitelist[i.type];return typeof t=="function"?t(i):!1}logEvent(i){this.ready&&this.client.logAnalyticsEvent(i)}log(i){var n,l;if(!this.client)return;const t=i.data;if(e.isPageViewEvent(i)){this.logEvent({eventType:r.PageEvent.PageView,additionalData:{is_addressable:t.isAddressable,action_context:(n=t.appLink)==null?void 0:n.action,url:t.url}}),e.isPostSearchPageViewEvent(i)&&this.logSearchEvent(i);return}if(e.isStreamEvent(i)){this.logEvent({eventType:r.ProductEvent.Stream,additionalData:{id:t==null?void 0:t.id,entity:i.actionContext.entity,name:t==null?void 0:t.name}});return}if(e.isExploreTopicsEvent(i)){this.logEvent({eventType:r.ProductEvent.ExploreTopics,additionalData:{id:t==null?void 0:t.id,name:t==null?void 0:t.name,presentation_id:t==null?void 0:t.presentationId,presentation_name:t==null?void 0:t.presentationName}});return}if(e.isSearch(i)){this.logSearchEvent(i);return}if(e.isSearchClickThrough(i)){this.logEvent({eventType:r.ProductEvent.SearchClickthrough,additionalData:{query:(l=t==null?void 0:t.search)==null?void 0:l.query}});return}if(e.isBookACallEvent(i)){this.logEvent({eventType:r.ProductEvent.ClickBookACall});return}if(e.isShareEvent(i)){this.logEvent({eventType:r.ProductEvent.Share,additionalData:{id:t==null?void 0:t.id,entity:i.actionContext.entity,name:t==null?void 0:t.name}});return}if(e.isResourceDownloadEvent(i)){this.logEvent({eventType:r.ProductEvent.DownloadResource,additionalData:{id:t==null?void 0:t.id,name:t==null?void 0:t.name,video_name:t==null?void 0:t.videoName}});return}if(e.isInviteEvent(i)){this.logEvent({eventType:r.ProductEvent.Invite,additionalData:{user_count:t==null?void 0:t.emailCount}});return}if(e.isPlayerDevicesCtaEvent(i)){this.logEvent({eventType:r.ProductEvent.PlayerDeviceCta,additionalData:{descriptor:i.actionContext.descriptor,can_user_manage_integrations:t==null?void 0:t.canUserManageIntegrations,context:t==null?void 0:t.context}});return}if(e.isIntegrationsEvent(i)){this.logEvent({eventType:r.ProductEvent.SettingsIntegrations,additionalData:{descriptor:i.actionContext.descriptor,id:t==null?void 0:t.id,status:t==null?void 0:t.status}});return}}isType(i){return i===c.type}logSearchEvent(i){const t=i.data,n={};"query"in t&&(n.query=t.query),this.logEvent({eventType:r.ProductEvent.Search,actionType:this.getSearchActionType(i),additionalData:n})}getSearchActionType(i){if(i.type===s.Filter)return a.Filter;const t=i.data;if(i.type===s.PageView){const n=t==null?void 0:t.appLink;return(n==null?void 0:n.application)===y.SEARCH?null:e.isSearchResultClickthrough(n)?a.Clickthrough:a.Abandon}return t.consecutiveSearchCount>1?a.MultiSearch:a.Search}static get eventWhitelist(){return{[s.SendEmail]:e.isInviteEvent,[s.Download]:e.isResourceDownloadEvent,[s.Share]:e.isShareEvent,[s.Stream]:e.isStreamEvent,[s.Click]:e.isSupportedClickEvent,[s.PageView]:e.isPageViewEvent,[s.Search]:e.isSearch,[s.Filter]:e.isSearch}}};c.type="BrazeAnalyticsClient";let u=c;export{u as BrazeAnalyticsClient};
//# sourceMappingURL=C30MZ4TG.chunk.js.map
