{"version":3,"file":"client.cjs","names":["HttpClient","WebSocketClient","LiveV2Session"],"sources":["../../../src/v2/live/client.ts"],"sourcesContent":["import { InternalGladiaClientOptions } from '../../internal_types.js'\nimport { HttpClient } from '../../network/httpClient.js'\nimport { WebSocketClient } from '../../network/wsClient.js'\nimport type { LiveV2InitRequest } from './generated-types.js'\nimport { LiveV2Session } from './session.js'\n\n/**\n * Client used to interact with Gladia Live Speech-To-Text API.\n */\nexport class LiveV2Client {\n  private httpClient: HttpClient\n  private webSocketClient: WebSocketClient\n\n  constructor(options: InternalGladiaClientOptions) {\n    const httpBaseUrl = new URL(options.apiUrl)\n    httpBaseUrl.protocol = httpBaseUrl.protocol.replace(/^ws/, 'http')\n    this.httpClient = new HttpClient({\n      baseUrl: httpBaseUrl,\n      headers: options.httpHeaders,\n      ...(options.region ? { queryParams: { region: options.region } } : {}),\n      retry: options.httpRetry,\n      timeout: options.httpTimeout,\n    })\n\n    const wsBaseUrl = new URL(options.apiUrl)\n    wsBaseUrl.protocol = wsBaseUrl.protocol.replace(/^http/, 'ws')\n    this.webSocketClient = new WebSocketClient({\n      baseUrl: wsBaseUrl,\n      retry: options.wsRetry,\n      timeout: options.wsTimeout,\n    })\n  }\n\n  startSession(options: LiveV2InitRequest): LiveV2Session {\n    return new LiveV2Session({\n      options,\n      httpClient: this.httpClient,\n      webSocketClient: this.webSocketClient,\n    })\n  }\n}\n"],"mappings":";;;;;;;;AASA,IAAa,eAAb,MAA0B;CACxB,AAAQ;CACR,AAAQ;CAER,YAAY,SAAsC;EAChD,MAAM,cAAc,IAAI,IAAI,QAAQ,OAAO;AAC3C,cAAY,WAAW,YAAY,SAAS,QAAQ,OAAO,OAAO;AAClE,OAAK,aAAa,IAAIA,8BAAW;GAC/B,SAAS;GACT,SAAS,QAAQ;GACjB,GAAI,QAAQ,SAAS,EAAE,aAAa,EAAE,QAAQ,QAAQ,QAAQ,EAAE,GAAG,EAAE;GACrE,OAAO,QAAQ;GACf,SAAS,QAAQ;GAClB,CAAC;EAEF,MAAM,YAAY,IAAI,IAAI,QAAQ,OAAO;AACzC,YAAU,WAAW,UAAU,SAAS,QAAQ,SAAS,KAAK;AAC9D,OAAK,kBAAkB,IAAIC,iCAAgB;GACzC,SAAS;GACT,OAAO,QAAQ;GACf,SAAS,QAAQ;GAClB,CAAC;;CAGJ,aAAa,SAA2C;AACtD,SAAO,IAAIC,8BAAc;GACvB;GACA,YAAY,KAAK;GACjB,iBAAiB,KAAK;GACvB,CAAC"}