{"version":3,"file":"mock-transcription-model.mjs","names":[],"sources":["../../../../../../../ai/src/mock/mock-transcription-model.ts"],"sourcesContent":["import type { Usage } from \"../contracts/result/usage.type\";\nimport type {\n  AudioInput,\n  TranscribeOptions,\n  TranscriptionModelContract,\n  TranscriptionModelPricing,\n  TranscriptionResponse,\n  TranscriptionSegment,\n} from \"../contracts/transcription-model.contract\";\n\n/** One scripted response for a {@link MockTranscriptionModel}. */\nexport type MockTranscriptionResponse = {\n  text?: string;\n  segments?: TranscriptionSegment[];\n  durationSeconds?: number;\n  usage?: Usage;\n  error?: Error;\n  delay?: number;\n};\n\n/** One recorded `transcribe()` invocation, for test assertions. */\nexport type MockTranscriptionCall = { audio: AudioInput; options: TranscribeOptions | undefined };\n\n/** Deterministic {@link TranscriptionModelContract} double for tests — no HTTP. */\nexport class MockTranscriptionModel implements TranscriptionModelContract {\n  public readonly provider = \"mock\";\n  public readonly calls: MockTranscriptionCall[] = [];\n\n  private callIndex = 0;\n\n  public constructor(\n    public readonly name: string,\n    private readonly responses: MockTranscriptionResponse[],\n    public readonly pricing?: TranscriptionModelPricing,\n  ) {}\n\n  public async transcribe(\n    audio: AudioInput,\n    options?: TranscribeOptions,\n  ): Promise<TranscriptionResponse> {\n    this.calls.push({ audio, options });\n\n    const response = this.responses[Math.min(this.callIndex, this.responses.length - 1)] ?? {};\n    this.callIndex += 1;\n\n    if (response.delay) {\n      await new Promise((resolve) => setTimeout(resolve, response.delay));\n    }\n    if (response.error) {\n      throw response.error;\n    }\n\n    return {\n      text: response.text ?? \"mock transcript\",\n      ...(response.segments ? { segments: response.segments } : {}),\n      ...(response.durationSeconds !== undefined\n        ? { durationSeconds: response.durationSeconds }\n        : {}),\n      usage: response.usage ?? { input: 0, output: 0, total: 0 },\n    };\n  }\n}\n"],"mappings":";;AAwBA,IAAa,yBAAb,MAA0E;CAMxE,AAAO,YACL,AAAgB,MAChB,AAAiB,WACjB,AAAgB,SAChB;EAHgB;EACC;EACD;kBARS;eACsB,CAAC;mBAE9B;CAMjB;CAEH,MAAa,WACX,OACA,SACgC;EAChC,KAAK,MAAM,KAAK;GAAE;GAAO;EAAQ,CAAC;EAElC,MAAM,WAAW,KAAK,UAAU,KAAK,IAAI,KAAK,WAAW,KAAK,UAAU,SAAS,CAAC,MAAM,CAAC;EACzF,KAAK,aAAa;EAElB,IAAI,SAAS,OACX,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,SAAS,KAAK,CAAC;EAEpE,IAAI,SAAS,OACX,MAAM,SAAS;EAGjB,OAAO;GACL,MAAM,SAAS,QAAQ;GACvB,GAAI,SAAS,WAAW,EAAE,UAAU,SAAS,SAAS,IAAI,CAAC;GAC3D,GAAI,SAAS,oBAAoB,SAC7B,EAAE,iBAAiB,SAAS,gBAAgB,IAC5C,CAAC;GACL,OAAO,SAAS,SAAS;IAAE,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAC3D;CACF;AACF"}