"use strict";class VoiceTranscriptionWorklet extends AudioWorkletProcessor{constructor(s){super(),this.options=s,this.startTime=void 0,this.stopped=!1,this.buffer=[],this.sharedProcessConnection=void 0,this.registerListeners()}registerListeners(){this.port.onmessage=s=>{switch(s.data){case"vscode:startVoiceTranscription":{this.sharedProcessConnection=s.ports[0],this.sharedProcessConnection.onmessage=t=>{this.stopped||typeof t.data=="string"&&this.port.postMessage(t.data)},this.sharedProcessConnection.start();break}case"vscode:stopVoiceTranscription":{this.stopped=!0,this.sharedProcessConnection?.close(),this.sharedProcessConnection=void 0;break}}}}process(s){this.startTime===void 0&&(this.startTime=Date.now());const t=s[0][0];if(!(t instanceof Float32Array))return!this.stopped;if(this.buffer.push(t.slice(0)),Date.now()-this.startTime>this.options.processorOptions.bufferTimespan&&this.sharedProcessConnection){const e=this.buffer;this.buffer=[],this.sharedProcessConnection.postMessage(e),this.startTime=Date.now()}return!this.stopped}}registerProcessor("voice-transcription-worklet",VoiceTranscriptionWorklet);

//# sourceMappingURL=https://sqlopsbuilds.blob.core.windows.net/sourcemaps/2456f20f53a71b39191908aea4f3e7b3aec8e0b1/core/vs/workbench/services/voiceRecognition/electron-sandbox/voiceTranscriptionWorklet.js.map
