"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var api_protos_exports = {};
__export(api_protos_exports, {
  sttErrorEventSchema: () => sttErrorEventSchema,
  sttFinalTranscriptEventSchema: () => sttFinalTranscriptEventSchema,
  sttInterimTranscriptEventSchema: () => sttInterimTranscriptEventSchema,
  sttKnownServerEventSchema: () => sttKnownServerEventSchema,
  sttPreflightTranscriptEventSchema: () => sttPreflightTranscriptEventSchema,
  sttServerEventSchema: () => sttServerEventSchema,
  sttSessionClosedEventSchema: () => sttSessionClosedEventSchema,
  sttSessionCreatedEventSchema: () => sttSessionCreatedEventSchema,
  sttSessionFinalizedEventSchema: () => sttSessionFinalizedEventSchema,
  sttUnknownServerEventSchema: () => sttUnknownServerEventSchema,
  sttWordSchema: () => sttWordSchema,
  ttsCharTimestampSchema: () => ttsCharTimestampSchema,
  ttsClientEventSchema: () => ttsClientEventSchema,
  ttsDoneEventSchema: () => ttsDoneEventSchema,
  ttsErrorEventSchema: () => ttsErrorEventSchema,
  ttsGenerationConfigSchema: () => ttsGenerationConfigSchema,
  ttsInputTranscriptEventSchema: () => ttsInputTranscriptEventSchema,
  ttsKnownServerEventSchema: () => ttsKnownServerEventSchema,
  ttsOutputAlignmentEventSchema: () => ttsOutputAlignmentEventSchema,
  ttsOutputAudioEventSchema: () => ttsOutputAudioEventSchema,
  ttsServerEventSchema: () => ttsServerEventSchema,
  ttsSessionCloseEventSchema: () => ttsSessionCloseEventSchema,
  ttsSessionClosedEventSchema: () => ttsSessionClosedEventSchema,
  ttsSessionCreateEventSchema: () => ttsSessionCreateEventSchema,
  ttsSessionCreatedEventSchema: () => ttsSessionCreatedEventSchema,
  ttsSessionFlushEventSchema: () => ttsSessionFlushEventSchema,
  ttsUnknownServerEventSchema: () => ttsUnknownServerEventSchema,
  ttsWordTimestampSchema: () => ttsWordTimestampSchema
});
module.exports = __toCommonJS(api_protos_exports);
var import_zod = require("zod");
const ttsSessionCreateEventSchema = import_zod.z.object({
  type: import_zod.z.literal("session.create"),
  sample_rate: import_zod.z.string(),
  encoding: import_zod.z.string(),
  model: import_zod.z.string().optional(),
  voice: import_zod.z.string().optional(),
  language: import_zod.z.string().optional(),
  extra: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()),
  transcript: import_zod.z.string().optional()
});
const ttsGenerationConfigSchema = import_zod.z.object({
  voice: import_zod.z.string().optional(),
  language: import_zod.z.string().optional(),
  model: import_zod.z.string().optional()
});
const ttsInputTranscriptEventSchema = import_zod.z.object({
  type: import_zod.z.literal("input_transcript"),
  transcript: import_zod.z.string(),
  generation_config: ttsGenerationConfigSchema.optional(),
  extra: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional()
});
const ttsSessionFlushEventSchema = import_zod.z.object({
  type: import_zod.z.literal("session.flush")
});
const ttsSessionCloseEventSchema = import_zod.z.object({
  type: import_zod.z.literal("session.close")
});
const ttsSessionCreatedEventSchema = import_zod.z.object({
  type: import_zod.z.literal("session.created"),
  session_id: import_zod.z.string()
});
const ttsOutputAudioEventSchema = import_zod.z.object({
  type: import_zod.z.literal("output_audio"),
  audio: import_zod.z.string(),
  session_id: import_zod.z.string()
});
const ttsDoneEventSchema = import_zod.z.object({
  type: import_zod.z.literal("done"),
  session_id: import_zod.z.string()
});
const ttsSessionClosedEventSchema = import_zod.z.object({
  type: import_zod.z.literal("session.closed"),
  session_id: import_zod.z.string()
});
const ttsErrorEventSchema = import_zod.z.object({
  type: import_zod.z.literal("error"),
  message: import_zod.z.string().optional(),
  session_id: import_zod.z.string().optional()
});
const ttsWordTimestampSchema = import_zod.z.object({
  word: import_zod.z.string(),
  start: import_zod.z.number(),
  end: import_zod.z.number()
});
const ttsCharTimestampSchema = import_zod.z.object({
  char: import_zod.z.string(),
  start: import_zod.z.number(),
  end: import_zod.z.number()
});
const ttsOutputAlignmentEventSchema = import_zod.z.object({
  type: import_zod.z.literal("output_alignment"),
  session_id: import_zod.z.string().optional(),
  words: import_zod.z.array(ttsWordTimestampSchema).optional(),
  chars: import_zod.z.array(ttsCharTimestampSchema).optional()
});
const ttsClientEventSchema = import_zod.z.discriminatedUnion("type", [
  ttsSessionCreateEventSchema,
  ttsInputTranscriptEventSchema,
  ttsSessionFlushEventSchema,
  ttsSessionCloseEventSchema
]);
const ttsKnownServerEventSchema = import_zod.z.discriminatedUnion("type", [
  ttsSessionCreatedEventSchema,
  ttsOutputAudioEventSchema,
  ttsOutputAlignmentEventSchema,
  ttsDoneEventSchema,
  ttsSessionClosedEventSchema,
  ttsErrorEventSchema
]);
const knownTtsServerEventTypes = /* @__PURE__ */ new Set([
  "session.created",
  "output_audio",
  "output_alignment",
  "done",
  "session.closed",
  "error"
]);
const ttsUnknownServerEventSchema = import_zod.z.object({
  type: import_zod.z.string().refine((type) => !knownTtsServerEventTypes.has(type))
}).passthrough();
const ttsServerEventSchema = import_zod.z.union([
  ttsKnownServerEventSchema,
  ttsUnknownServerEventSchema
]);
const sttWordSchema = import_zod.z.object({
  word: import_zod.z.string().optional().default(""),
  start: import_zod.z.number().optional().default(0),
  end: import_zod.z.number().optional().default(0),
  confidence: import_zod.z.number().optional().default(0),
  speaker_id: import_zod.z.string().nullable().optional(),
  extra: import_zod.z.unknown().nullable().optional()
});
const sttWordsSchema = import_zod.z.preprocess((words) => words ?? [], import_zod.z.array(sttWordSchema));
const sttInterimTranscriptEventSchema = import_zod.z.object({
  type: import_zod.z.literal("interim_transcript"),
  session_id: import_zod.z.string().optional(),
  transcript: import_zod.z.string().optional().default(""),
  language: import_zod.z.string().optional().default(""),
  start: import_zod.z.number().optional().default(0),
  duration: import_zod.z.number().optional().default(0),
  confidence: import_zod.z.number().optional().default(1),
  words: sttWordsSchema,
  speaker_id: import_zod.z.string().nullable().optional(),
  extra: import_zod.z.unknown().nullable().optional()
});
const sttFinalTranscriptEventSchema = import_zod.z.object({
  type: import_zod.z.literal("final_transcript"),
  session_id: import_zod.z.string().optional(),
  transcript: import_zod.z.string().optional().default(""),
  language: import_zod.z.string().optional().default(""),
  start: import_zod.z.number().optional().default(0),
  duration: import_zod.z.number().optional().default(0),
  confidence: import_zod.z.number().optional().default(1),
  words: sttWordsSchema,
  speaker_id: import_zod.z.string().nullable().optional(),
  extra: import_zod.z.unknown().nullable().optional()
});
const sttPreflightTranscriptEventSchema = sttInterimTranscriptEventSchema.extend({
  type: import_zod.z.literal("preflight_transcript")
});
const sttSessionCreatedEventSchema = import_zod.z.object({
  type: import_zod.z.literal("session.created"),
  session_id: import_zod.z.string().optional()
});
const sttSessionFinalizedEventSchema = import_zod.z.object({
  type: import_zod.z.literal("session.finalized")
});
const sttSessionClosedEventSchema = import_zod.z.object({
  type: import_zod.z.literal("session.closed")
});
const sttErrorEventSchema = import_zod.z.object({
  type: import_zod.z.literal("error"),
  message: import_zod.z.string().optional(),
  code: import_zod.z.number().optional()
});
const sttKnownServerEventSchema = import_zod.z.discriminatedUnion("type", [
  sttSessionCreatedEventSchema,
  sttSessionFinalizedEventSchema,
  sttSessionClosedEventSchema,
  sttInterimTranscriptEventSchema,
  sttFinalTranscriptEventSchema,
  sttPreflightTranscriptEventSchema,
  sttErrorEventSchema
]);
const knownSttServerEventTypes = /* @__PURE__ */ new Set([
  "session.created",
  "session.finalized",
  "session.closed",
  "interim_transcript",
  "final_transcript",
  "preflight_transcript",
  "error"
]);
const sttUnknownServerEventSchema = import_zod.z.object({
  type: import_zod.z.string().refine((type) => !knownSttServerEventTypes.has(type))
}).passthrough();
const sttServerEventSchema = import_zod.z.union([
  sttKnownServerEventSchema,
  sttUnknownServerEventSchema
]);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  sttErrorEventSchema,
  sttFinalTranscriptEventSchema,
  sttInterimTranscriptEventSchema,
  sttKnownServerEventSchema,
  sttPreflightTranscriptEventSchema,
  sttServerEventSchema,
  sttSessionClosedEventSchema,
  sttSessionCreatedEventSchema,
  sttSessionFinalizedEventSchema,
  sttUnknownServerEventSchema,
  sttWordSchema,
  ttsCharTimestampSchema,
  ttsClientEventSchema,
  ttsDoneEventSchema,
  ttsErrorEventSchema,
  ttsGenerationConfigSchema,
  ttsInputTranscriptEventSchema,
  ttsKnownServerEventSchema,
  ttsOutputAlignmentEventSchema,
  ttsOutputAudioEventSchema,
  ttsServerEventSchema,
  ttsSessionCloseEventSchema,
  ttsSessionClosedEventSchema,
  ttsSessionCreateEventSchema,
  ttsSessionCreatedEventSchema,
  ttsSessionFlushEventSchema,
  ttsUnknownServerEventSchema,
  ttsWordTimestampSchema
});
//# sourceMappingURL=api_protos.cjs.map