import*as SDK from"../sdk/sdk.js";export class BackgroundServiceModel extends SDK.SDKModel.SDKModel{constructor(e){super(e),this._backgroundServiceAgent=e.backgroundServiceAgent(),e.registerBackgroundServiceDispatcher(this),this._events=new Map}enable(e){this._events.set(e,[]),this._backgroundServiceAgent.invoke_startObserving({service:e})}setRecording(e,t){this._backgroundServiceAgent.invoke_setRecording({shouldRecord:e,service:t})}clearEvents(e){this._events.set(e,[]),this._backgroundServiceAgent.invoke_clearEvents({service:e})}getEvents(e){return this._events.get(e)||[]}recordingStateChanged({isRecording:e,service:t}){this.dispatchEventToListeners(Events.RecordingStateChanged,{isRecording:e,serviceName:t})}backgroundServiceEventReceived({backgroundServiceEvent:e}){this._events.get(e.service).push(e),this.dispatchEventToListeners(Events.BackgroundServiceEventReceived,e)}}SDK.SDKModel.SDKModel.register(BackgroundServiceModel,SDK.SDKModel.Capability.Browser,!1);export var Events;!function(e){e.RecordingStateChanged="RecordingStateChanged",e.BackgroundServiceEventReceived="BackgroundServiceEventReceived"}(Events||(Events={}));