@volley/recognition-client-sdk 0.1.287 → 0.1.294

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,126 +1,7 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
8
- var external_exports = {};
9
- __export(external_exports, {
10
- BRAND: () => BRAND,
11
- DIRTY: () => DIRTY,
12
- EMPTY_PATH: () => EMPTY_PATH,
13
- INVALID: () => INVALID,
14
- NEVER: () => NEVER,
15
- OK: () => OK,
16
- ParseStatus: () => ParseStatus,
17
- Schema: () => ZodType,
18
- ZodAny: () => ZodAny,
19
- ZodArray: () => ZodArray,
20
- ZodBigInt: () => ZodBigInt,
21
- ZodBoolean: () => ZodBoolean,
22
- ZodBranded: () => ZodBranded,
23
- ZodCatch: () => ZodCatch,
24
- ZodDate: () => ZodDate,
25
- ZodDefault: () => ZodDefault,
26
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
27
- ZodEffects: () => ZodEffects,
28
- ZodEnum: () => ZodEnum,
29
- ZodError: () => ZodError,
30
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
31
- ZodFunction: () => ZodFunction,
32
- ZodIntersection: () => ZodIntersection,
33
- ZodIssueCode: () => ZodIssueCode,
34
- ZodLazy: () => ZodLazy,
35
- ZodLiteral: () => ZodLiteral,
36
- ZodMap: () => ZodMap,
37
- ZodNaN: () => ZodNaN,
38
- ZodNativeEnum: () => ZodNativeEnum,
39
- ZodNever: () => ZodNever,
40
- ZodNull: () => ZodNull,
41
- ZodNullable: () => ZodNullable,
42
- ZodNumber: () => ZodNumber,
43
- ZodObject: () => ZodObject,
44
- ZodOptional: () => ZodOptional,
45
- ZodParsedType: () => ZodParsedType,
46
- ZodPipeline: () => ZodPipeline,
47
- ZodPromise: () => ZodPromise,
48
- ZodReadonly: () => ZodReadonly,
49
- ZodRecord: () => ZodRecord,
50
- ZodSchema: () => ZodType,
51
- ZodSet: () => ZodSet,
52
- ZodString: () => ZodString,
53
- ZodSymbol: () => ZodSymbol,
54
- ZodTransformer: () => ZodEffects,
55
- ZodTuple: () => ZodTuple,
56
- ZodType: () => ZodType,
57
- ZodUndefined: () => ZodUndefined,
58
- ZodUnion: () => ZodUnion,
59
- ZodUnknown: () => ZodUnknown,
60
- ZodVoid: () => ZodVoid,
61
- addIssueToContext: () => addIssueToContext,
62
- any: () => anyType,
63
- array: () => arrayType,
64
- bigint: () => bigIntType,
65
- boolean: () => booleanType,
66
- coerce: () => coerce,
67
- custom: () => custom,
68
- date: () => dateType,
69
- datetimeRegex: () => datetimeRegex,
70
- defaultErrorMap: () => en_default,
71
- discriminatedUnion: () => discriminatedUnionType,
72
- effect: () => effectsType,
73
- enum: () => enumType,
74
- function: () => functionType,
75
- getErrorMap: () => getErrorMap,
76
- getParsedType: () => getParsedType,
77
- instanceof: () => instanceOfType,
78
- intersection: () => intersectionType,
79
- isAborted: () => isAborted,
80
- isAsync: () => isAsync,
81
- isDirty: () => isDirty,
82
- isValid: () => isValid,
83
- late: () => late,
84
- lazy: () => lazyType,
85
- literal: () => literalType,
86
- makeIssue: () => makeIssue,
87
- map: () => mapType,
88
- nan: () => nanType,
89
- nativeEnum: () => nativeEnumType,
90
- never: () => neverType,
91
- null: () => nullType,
92
- nullable: () => nullableType,
93
- number: () => numberType,
94
- object: () => objectType,
95
- objectUtil: () => objectUtil,
96
- oboolean: () => oboolean,
97
- onumber: () => onumber,
98
- optional: () => optionalType,
99
- ostring: () => ostring,
100
- pipeline: () => pipelineType,
101
- preprocess: () => preprocessType,
102
- promise: () => promiseType,
103
- quotelessJson: () => quotelessJson,
104
- record: () => recordType,
105
- set: () => setType,
106
- setErrorMap: () => setErrorMap,
107
- strictObject: () => strictObjectType,
108
- string: () => stringType,
109
- symbol: () => symbolType,
110
- transformer: () => effectsType,
111
- tuple: () => tupleType,
112
- undefined: () => undefinedType,
113
- union: () => unionType,
114
- unknown: () => unknownType,
115
- util: () => util,
116
- void: () => voidType
117
- });
118
-
119
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
1
+ // ../../node_modules/.pnpm/zod@3.22.5/node_modules/zod/lib/index.mjs
120
2
  var util;
121
3
  (function(util2) {
122
- util2.assertEqual = (_) => {
123
- };
4
+ util2.assertEqual = (val) => val;
124
5
  function assertIs(_arg) {
125
6
  }
126
7
  util2.assertIs = assertIs;
@@ -164,7 +45,7 @@ var util;
164
45
  }
165
46
  return void 0;
166
47
  };
167
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
48
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
168
49
  function joinValues(array, separator = " | ") {
169
50
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
170
51
  }
@@ -216,7 +97,7 @@ var getParsedType = (data) => {
216
97
  case "string":
217
98
  return ZodParsedType.string;
218
99
  case "number":
219
- return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
100
+ return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
220
101
  case "boolean":
221
102
  return ZodParsedType.boolean;
222
103
  case "function":
@@ -249,8 +130,6 @@ var getParsedType = (data) => {
249
130
  return ZodParsedType.unknown;
250
131
  }
251
132
  };
252
-
253
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
254
133
  var ZodIssueCode = util.arrayToEnum([
255
134
  "invalid_type",
256
135
  "invalid_literal",
@@ -273,10 +152,7 @@ var quotelessJson = (obj) => {
273
152
  const json = JSON.stringify(obj, null, 2);
274
153
  return json.replace(/"([^"]+)":/g, "$1:");
275
154
  };
276
- var ZodError = class _ZodError extends Error {
277
- get errors() {
278
- return this.issues;
279
- }
155
+ var ZodError = class extends Error {
280
156
  constructor(issues) {
281
157
  super();
282
158
  this.issues = [];
@@ -295,6 +171,9 @@ var ZodError = class _ZodError extends Error {
295
171
  this.name = "ZodError";
296
172
  this.issues = issues;
297
173
  }
174
+ get errors() {
175
+ return this.issues;
176
+ }
298
177
  format(_mapper) {
299
178
  const mapper = _mapper || function(issue) {
300
179
  return issue.message;
@@ -331,11 +210,6 @@ var ZodError = class _ZodError extends Error {
331
210
  processError(this);
332
211
  return fieldErrors;
333
212
  }
334
- static assert(value) {
335
- if (!(value instanceof _ZodError)) {
336
- throw new Error(`Not a ZodError: ${value}`);
337
- }
338
- }
339
213
  toString() {
340
214
  return this.message;
341
215
  }
@@ -350,9 +224,8 @@ var ZodError = class _ZodError extends Error {
350
224
  const formErrors = [];
351
225
  for (const sub of this.issues) {
352
226
  if (sub.path.length > 0) {
353
- const firstEl = sub.path[0];
354
- fieldErrors[firstEl] = fieldErrors[firstEl] || [];
355
- fieldErrors[firstEl].push(mapper(sub));
227
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
228
+ fieldErrors[sub.path[0]].push(mapper(sub));
356
229
  } else {
357
230
  formErrors.push(mapper(sub));
358
231
  }
@@ -367,8 +240,6 @@ ZodError.create = (issues) => {
367
240
  const error = new ZodError(issues);
368
241
  return error;
369
242
  };
370
-
371
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
372
243
  var errorMap = (issue, _ctx) => {
373
244
  let message;
374
245
  switch (issue.code) {
@@ -430,8 +301,6 @@ var errorMap = (issue, _ctx) => {
430
301
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
431
302
  else if (issue.type === "number")
432
303
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
433
- else if (issue.type === "bigint")
434
- message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
435
304
  else if (issue.type === "date")
436
305
  message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
437
306
  else
@@ -469,18 +338,13 @@ var errorMap = (issue, _ctx) => {
469
338
  }
470
339
  return { message };
471
340
  };
472
- var en_default = errorMap;
473
-
474
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
475
- var overrideErrorMap = en_default;
341
+ var overrideErrorMap = errorMap;
476
342
  function setErrorMap(map) {
477
343
  overrideErrorMap = map;
478
344
  }
479
345
  function getErrorMap() {
480
346
  return overrideErrorMap;
481
347
  }
482
-
483
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
484
348
  var makeIssue = (params) => {
485
349
  const { data, path, errorMaps, issueData } = params;
486
350
  const fullPath = [...path, ...issueData.path || []];
@@ -488,13 +352,6 @@ var makeIssue = (params) => {
488
352
  ...issueData,
489
353
  path: fullPath
490
354
  };
491
- if (issueData.message !== void 0) {
492
- return {
493
- ...issueData,
494
- path: fullPath,
495
- message: issueData.message
496
- };
497
- }
498
355
  let errorMessage = "";
499
356
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
500
357
  for (const map of maps) {
@@ -503,24 +360,20 @@ var makeIssue = (params) => {
503
360
  return {
504
361
  ...issueData,
505
362
  path: fullPath,
506
- message: errorMessage
363
+ message: issueData.message || errorMessage
507
364
  };
508
365
  };
509
366
  var EMPTY_PATH = [];
510
367
  function addIssueToContext(ctx, issueData) {
511
- const overrideMap = getErrorMap();
512
368
  const issue = makeIssue({
513
369
  issueData,
514
370
  data: ctx.data,
515
371
  path: ctx.path,
516
372
  errorMaps: [
517
373
  ctx.common.contextualErrorMap,
518
- // contextual error map is first priority
519
374
  ctx.schemaErrorMap,
520
- // then schema-bound map if available
521
- overrideMap,
522
- // then global override map
523
- overrideMap === en_default ? void 0 : en_default
375
+ getErrorMap(),
376
+ errorMap
524
377
  // then global default map
525
378
  ].filter((x) => !!x)
526
379
  });
@@ -552,11 +405,9 @@ var ParseStatus = class _ParseStatus {
552
405
  static async mergeObjectAsync(status, pairs) {
553
406
  const syncPairs = [];
554
407
  for (const pair of pairs) {
555
- const key = await pair.key;
556
- const value = await pair.value;
557
408
  syncPairs.push({
558
- key,
559
- value
409
+ key: await pair.key,
410
+ value: await pair.value
560
411
  });
561
412
  }
562
413
  return _ParseStatus.mergeObjectSync(status, syncPairs);
@@ -589,15 +440,11 @@ var isAborted = (x) => x.status === "aborted";
589
440
  var isDirty = (x) => x.status === "dirty";
590
441
  var isValid = (x) => x.status === "valid";
591
442
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
592
-
593
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
594
443
  var errorUtil;
595
444
  (function(errorUtil2) {
596
445
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
597
- errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
446
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
598
447
  })(errorUtil || (errorUtil = {}));
599
-
600
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
601
448
  var ParseInputLazyPath = class {
602
449
  constructor(parent, value, path, key) {
603
450
  this._cachedPath = [];
@@ -608,7 +455,7 @@ var ParseInputLazyPath = class {
608
455
  }
609
456
  get path() {
610
457
  if (!this._cachedPath.length) {
611
- if (Array.isArray(this._key)) {
458
+ if (this._key instanceof Array) {
612
459
  this._cachedPath.push(...this._path, ...this._key);
613
460
  } else {
614
461
  this._cachedPath.push(...this._path, this._key);
@@ -646,20 +493,44 @@ function processCreateParams(params) {
646
493
  if (errorMap2)
647
494
  return { errorMap: errorMap2, description };
648
495
  const customMap = (iss, ctx) => {
649
- const { message } = params;
650
- if (iss.code === "invalid_enum_value") {
651
- return { message: message ?? ctx.defaultError };
652
- }
653
- if (typeof ctx.data === "undefined") {
654
- return { message: message ?? required_error ?? ctx.defaultError };
655
- }
656
496
  if (iss.code !== "invalid_type")
657
497
  return { message: ctx.defaultError };
658
- return { message: message ?? invalid_type_error ?? ctx.defaultError };
498
+ if (typeof ctx.data === "undefined") {
499
+ return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
500
+ }
501
+ return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
659
502
  };
660
503
  return { errorMap: customMap, description };
661
504
  }
662
505
  var ZodType = class {
506
+ constructor(def) {
507
+ this.spa = this.safeParseAsync;
508
+ this._def = def;
509
+ this.parse = this.parse.bind(this);
510
+ this.safeParse = this.safeParse.bind(this);
511
+ this.parseAsync = this.parseAsync.bind(this);
512
+ this.safeParseAsync = this.safeParseAsync.bind(this);
513
+ this.spa = this.spa.bind(this);
514
+ this.refine = this.refine.bind(this);
515
+ this.refinement = this.refinement.bind(this);
516
+ this.superRefine = this.superRefine.bind(this);
517
+ this.optional = this.optional.bind(this);
518
+ this.nullable = this.nullable.bind(this);
519
+ this.nullish = this.nullish.bind(this);
520
+ this.array = this.array.bind(this);
521
+ this.promise = this.promise.bind(this);
522
+ this.or = this.or.bind(this);
523
+ this.and = this.and.bind(this);
524
+ this.transform = this.transform.bind(this);
525
+ this.brand = this.brand.bind(this);
526
+ this.default = this.default.bind(this);
527
+ this.catch = this.catch.bind(this);
528
+ this.describe = this.describe.bind(this);
529
+ this.pipe = this.pipe.bind(this);
530
+ this.readonly = this.readonly.bind(this);
531
+ this.isNullable = this.isNullable.bind(this);
532
+ this.isOptional = this.isOptional.bind(this);
533
+ }
663
534
  get description() {
664
535
  return this._def.description;
665
536
  }
@@ -707,13 +578,14 @@ var ZodType = class {
707
578
  throw result.error;
708
579
  }
709
580
  safeParse(data, params) {
581
+ var _a;
710
582
  const ctx = {
711
583
  common: {
712
584
  issues: [],
713
- async: params?.async ?? false,
714
- contextualErrorMap: params?.errorMap
585
+ async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
586
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
715
587
  },
716
- path: params?.path || [],
588
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
717
589
  schemaErrorMap: this._def.errorMap,
718
590
  parent: null,
719
591
  data,
@@ -722,42 +594,6 @@ var ZodType = class {
722
594
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
723
595
  return handleResult(ctx, result);
724
596
  }
725
- "~validate"(data) {
726
- const ctx = {
727
- common: {
728
- issues: [],
729
- async: !!this["~standard"].async
730
- },
731
- path: [],
732
- schemaErrorMap: this._def.errorMap,
733
- parent: null,
734
- data,
735
- parsedType: getParsedType(data)
736
- };
737
- if (!this["~standard"].async) {
738
- try {
739
- const result = this._parseSync({ data, path: [], parent: ctx });
740
- return isValid(result) ? {
741
- value: result.value
742
- } : {
743
- issues: ctx.common.issues
744
- };
745
- } catch (err) {
746
- if (err?.message?.toLowerCase()?.includes("encountered")) {
747
- this["~standard"].async = true;
748
- }
749
- ctx.common = {
750
- issues: [],
751
- async: true
752
- };
753
- }
754
- }
755
- return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
756
- value: result.value
757
- } : {
758
- issues: ctx.common.issues
759
- });
760
- }
761
597
  async parseAsync(data, params) {
762
598
  const result = await this.safeParseAsync(data, params);
763
599
  if (result.success)
@@ -768,10 +604,10 @@ var ZodType = class {
768
604
  const ctx = {
769
605
  common: {
770
606
  issues: [],
771
- contextualErrorMap: params?.errorMap,
607
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
772
608
  async: true
773
609
  },
774
- path: params?.path || [],
610
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
775
611
  schemaErrorMap: this._def.errorMap,
776
612
  parent: null,
777
613
  data,
@@ -835,39 +671,6 @@ var ZodType = class {
835
671
  superRefine(refinement) {
836
672
  return this._refinement(refinement);
837
673
  }
838
- constructor(def) {
839
- this.spa = this.safeParseAsync;
840
- this._def = def;
841
- this.parse = this.parse.bind(this);
842
- this.safeParse = this.safeParse.bind(this);
843
- this.parseAsync = this.parseAsync.bind(this);
844
- this.safeParseAsync = this.safeParseAsync.bind(this);
845
- this.spa = this.spa.bind(this);
846
- this.refine = this.refine.bind(this);
847
- this.refinement = this.refinement.bind(this);
848
- this.superRefine = this.superRefine.bind(this);
849
- this.optional = this.optional.bind(this);
850
- this.nullable = this.nullable.bind(this);
851
- this.nullish = this.nullish.bind(this);
852
- this.array = this.array.bind(this);
853
- this.promise = this.promise.bind(this);
854
- this.or = this.or.bind(this);
855
- this.and = this.and.bind(this);
856
- this.transform = this.transform.bind(this);
857
- this.brand = this.brand.bind(this);
858
- this.default = this.default.bind(this);
859
- this.catch = this.catch.bind(this);
860
- this.describe = this.describe.bind(this);
861
- this.pipe = this.pipe.bind(this);
862
- this.readonly = this.readonly.bind(this);
863
- this.isNullable = this.isNullable.bind(this);
864
- this.isOptional = this.isOptional.bind(this);
865
- this["~standard"] = {
866
- version: 1,
867
- vendor: "zod",
868
- validate: (data) => this["~validate"](data)
869
- };
870
- }
871
674
  optional() {
872
675
  return ZodOptional.create(this, this._def);
873
676
  }
@@ -878,7 +681,7 @@ var ZodType = class {
878
681
  return this.nullable().optional();
879
682
  }
880
683
  array() {
881
- return ZodArray.create(this);
684
+ return ZodArray.create(this, this._def);
882
685
  }
883
686
  promise() {
884
687
  return ZodPromise.create(this, this._def);
@@ -943,45 +746,35 @@ var ZodType = class {
943
746
  }
944
747
  };
945
748
  var cuidRegex = /^c[^\s-]{8,}$/i;
946
- var cuid2Regex = /^[0-9a-z]+$/;
947
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
749
+ var cuid2Regex = /^[a-z][a-z0-9]*$/;
750
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
948
751
  var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
949
- var nanoidRegex = /^[a-z0-9_-]{21}$/i;
950
- var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
951
- var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
952
- var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
752
+ var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
953
753
  var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
954
754
  var emojiRegex;
955
- var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
956
- var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
957
- var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
958
- var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
959
- var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
960
- var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
961
- var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
962
- var dateRegex = new RegExp(`^${dateRegexSource}$`);
963
- function timeRegexSource(args) {
964
- let secondsRegexSource = `[0-5]\\d`;
755
+ var ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
756
+ var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
757
+ var datetimeRegex = (args) => {
965
758
  if (args.precision) {
966
- secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
967
- } else if (args.precision == null) {
968
- secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
759
+ if (args.offset) {
760
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
761
+ } else {
762
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
763
+ }
764
+ } else if (args.precision === 0) {
765
+ if (args.offset) {
766
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
767
+ } else {
768
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
769
+ }
770
+ } else {
771
+ if (args.offset) {
772
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
773
+ } else {
774
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
775
+ }
969
776
  }
970
- const secondsQuantifier = args.precision ? "+" : "?";
971
- return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
972
- }
973
- function timeRegex(args) {
974
- return new RegExp(`^${timeRegexSource(args)}$`);
975
- }
976
- function datetimeRegex(args) {
977
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
978
- const opts = [];
979
- opts.push(args.local ? `Z?` : `Z`);
980
- if (args.offset)
981
- opts.push(`([+-]\\d{2}:?\\d{2})`);
982
- regex = `${regex}(${opts.join("|")})`;
983
- return new RegExp(`^${regex}$`);
984
- }
777
+ };
985
778
  function isValidIP(ip, version) {
986
779
  if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
987
780
  return true;
@@ -991,37 +784,6 @@ function isValidIP(ip, version) {
991
784
  }
992
785
  return false;
993
786
  }
994
- function isValidJWT(jwt, alg) {
995
- if (!jwtRegex.test(jwt))
996
- return false;
997
- try {
998
- const [header] = jwt.split(".");
999
- if (!header)
1000
- return false;
1001
- const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
1002
- const decoded = JSON.parse(atob(base64));
1003
- if (typeof decoded !== "object" || decoded === null)
1004
- return false;
1005
- if ("typ" in decoded && decoded?.typ !== "JWT")
1006
- return false;
1007
- if (!decoded.alg)
1008
- return false;
1009
- if (alg && decoded.alg !== alg)
1010
- return false;
1011
- return true;
1012
- } catch {
1013
- return false;
1014
- }
1015
- }
1016
- function isValidCidr(ip, version) {
1017
- if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
1018
- return true;
1019
- }
1020
- if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
1021
- return true;
1022
- }
1023
- return false;
1024
- }
1025
787
  var ZodString = class _ZodString extends ZodType {
1026
788
  _parse(input) {
1027
789
  if (this._def.coerce) {
@@ -1030,11 +792,15 @@ var ZodString = class _ZodString extends ZodType {
1030
792
  const parsedType = this._getType(input);
1031
793
  if (parsedType !== ZodParsedType.string) {
1032
794
  const ctx2 = this._getOrReturnCtx(input);
1033
- addIssueToContext(ctx2, {
1034
- code: ZodIssueCode.invalid_type,
1035
- expected: ZodParsedType.string,
1036
- received: ctx2.parsedType
1037
- });
795
+ addIssueToContext(
796
+ ctx2,
797
+ {
798
+ code: ZodIssueCode.invalid_type,
799
+ expected: ZodParsedType.string,
800
+ received: ctx2.parsedType
801
+ }
802
+ //
803
+ );
1038
804
  return INVALID;
1039
805
  }
1040
806
  const status = new ParseStatus();
@@ -1125,16 +891,6 @@ var ZodString = class _ZodString extends ZodType {
1125
891
  });
1126
892
  status.dirty();
1127
893
  }
1128
- } else if (check.kind === "nanoid") {
1129
- if (!nanoidRegex.test(input.data)) {
1130
- ctx = this._getOrReturnCtx(input, ctx);
1131
- addIssueToContext(ctx, {
1132
- validation: "nanoid",
1133
- code: ZodIssueCode.invalid_string,
1134
- message: check.message
1135
- });
1136
- status.dirty();
1137
- }
1138
894
  } else if (check.kind === "cuid") {
1139
895
  if (!cuidRegex.test(input.data)) {
1140
896
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1168,7 +924,7 @@ var ZodString = class _ZodString extends ZodType {
1168
924
  } else if (check.kind === "url") {
1169
925
  try {
1170
926
  new URL(input.data);
1171
- } catch {
927
+ } catch (_a) {
1172
928
  ctx = this._getOrReturnCtx(input, ctx);
1173
929
  addIssueToContext(ctx, {
1174
930
  validation: "url",
@@ -1236,38 +992,6 @@ var ZodString = class _ZodString extends ZodType {
1236
992
  });
1237
993
  status.dirty();
1238
994
  }
1239
- } else if (check.kind === "date") {
1240
- const regex = dateRegex;
1241
- if (!regex.test(input.data)) {
1242
- ctx = this._getOrReturnCtx(input, ctx);
1243
- addIssueToContext(ctx, {
1244
- code: ZodIssueCode.invalid_string,
1245
- validation: "date",
1246
- message: check.message
1247
- });
1248
- status.dirty();
1249
- }
1250
- } else if (check.kind === "time") {
1251
- const regex = timeRegex(check);
1252
- if (!regex.test(input.data)) {
1253
- ctx = this._getOrReturnCtx(input, ctx);
1254
- addIssueToContext(ctx, {
1255
- code: ZodIssueCode.invalid_string,
1256
- validation: "time",
1257
- message: check.message
1258
- });
1259
- status.dirty();
1260
- }
1261
- } else if (check.kind === "duration") {
1262
- if (!durationRegex.test(input.data)) {
1263
- ctx = this._getOrReturnCtx(input, ctx);
1264
- addIssueToContext(ctx, {
1265
- validation: "duration",
1266
- code: ZodIssueCode.invalid_string,
1267
- message: check.message
1268
- });
1269
- status.dirty();
1270
- }
1271
995
  } else if (check.kind === "ip") {
1272
996
  if (!isValidIP(input.data, check.version)) {
1273
997
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1278,46 +1002,6 @@ var ZodString = class _ZodString extends ZodType {
1278
1002
  });
1279
1003
  status.dirty();
1280
1004
  }
1281
- } else if (check.kind === "jwt") {
1282
- if (!isValidJWT(input.data, check.alg)) {
1283
- ctx = this._getOrReturnCtx(input, ctx);
1284
- addIssueToContext(ctx, {
1285
- validation: "jwt",
1286
- code: ZodIssueCode.invalid_string,
1287
- message: check.message
1288
- });
1289
- status.dirty();
1290
- }
1291
- } else if (check.kind === "cidr") {
1292
- if (!isValidCidr(input.data, check.version)) {
1293
- ctx = this._getOrReturnCtx(input, ctx);
1294
- addIssueToContext(ctx, {
1295
- validation: "cidr",
1296
- code: ZodIssueCode.invalid_string,
1297
- message: check.message
1298
- });
1299
- status.dirty();
1300
- }
1301
- } else if (check.kind === "base64") {
1302
- if (!base64Regex.test(input.data)) {
1303
- ctx = this._getOrReturnCtx(input, ctx);
1304
- addIssueToContext(ctx, {
1305
- validation: "base64",
1306
- code: ZodIssueCode.invalid_string,
1307
- message: check.message
1308
- });
1309
- status.dirty();
1310
- }
1311
- } else if (check.kind === "base64url") {
1312
- if (!base64urlRegex.test(input.data)) {
1313
- ctx = this._getOrReturnCtx(input, ctx);
1314
- addIssueToContext(ctx, {
1315
- validation: "base64url",
1316
- code: ZodIssueCode.invalid_string,
1317
- message: check.message
1318
- });
1319
- status.dirty();
1320
- }
1321
1005
  } else {
1322
1006
  util.assertNever(check);
1323
1007
  }
@@ -1349,9 +1033,6 @@ var ZodString = class _ZodString extends ZodType {
1349
1033
  uuid(message) {
1350
1034
  return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1351
1035
  }
1352
- nanoid(message) {
1353
- return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
1354
- }
1355
1036
  cuid(message) {
1356
1037
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1357
1038
  }
@@ -1361,62 +1042,26 @@ var ZodString = class _ZodString extends ZodType {
1361
1042
  ulid(message) {
1362
1043
  return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1363
1044
  }
1364
- base64(message) {
1365
- return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
1366
- }
1367
- base64url(message) {
1368
- return this._addCheck({
1369
- kind: "base64url",
1370
- ...errorUtil.errToObj(message)
1371
- });
1372
- }
1373
- jwt(options) {
1374
- return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
1375
- }
1376
1045
  ip(options) {
1377
1046
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1378
1047
  }
1379
- cidr(options) {
1380
- return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
1381
- }
1382
1048
  datetime(options) {
1049
+ var _a;
1383
1050
  if (typeof options === "string") {
1384
1051
  return this._addCheck({
1385
1052
  kind: "datetime",
1386
1053
  precision: null,
1387
1054
  offset: false,
1388
- local: false,
1389
1055
  message: options
1390
1056
  });
1391
1057
  }
1392
1058
  return this._addCheck({
1393
1059
  kind: "datetime",
1394
- precision: typeof options?.precision === "undefined" ? null : options?.precision,
1395
- offset: options?.offset ?? false,
1396
- local: options?.local ?? false,
1397
- ...errorUtil.errToObj(options?.message)
1060
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1061
+ offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1062
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1398
1063
  });
1399
1064
  }
1400
- date(message) {
1401
- return this._addCheck({ kind: "date", message });
1402
- }
1403
- time(options) {
1404
- if (typeof options === "string") {
1405
- return this._addCheck({
1406
- kind: "time",
1407
- precision: null,
1408
- message: options
1409
- });
1410
- }
1411
- return this._addCheck({
1412
- kind: "time",
1413
- precision: typeof options?.precision === "undefined" ? null : options?.precision,
1414
- ...errorUtil.errToObj(options?.message)
1415
- });
1416
- }
1417
- duration(message) {
1418
- return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
1419
- }
1420
1065
  regex(regex, message) {
1421
1066
  return this._addCheck({
1422
1067
  kind: "regex",
@@ -1428,8 +1073,8 @@ var ZodString = class _ZodString extends ZodType {
1428
1073
  return this._addCheck({
1429
1074
  kind: "includes",
1430
1075
  value,
1431
- position: options?.position,
1432
- ...errorUtil.errToObj(options?.message)
1076
+ position: options === null || options === void 0 ? void 0 : options.position,
1077
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1433
1078
  });
1434
1079
  }
1435
1080
  startsWith(value, message) {
@@ -1468,7 +1113,8 @@ var ZodString = class _ZodString extends ZodType {
1468
1113
  });
1469
1114
  }
1470
1115
  /**
1471
- * Equivalent to `.min(1)`
1116
+ * @deprecated Use z.string().min(1) instead.
1117
+ * @see {@link ZodString.min}
1472
1118
  */
1473
1119
  nonempty(message) {
1474
1120
  return this.min(1, errorUtil.errToObj(message));
@@ -1494,15 +1140,6 @@ var ZodString = class _ZodString extends ZodType {
1494
1140
  get isDatetime() {
1495
1141
  return !!this._def.checks.find((ch) => ch.kind === "datetime");
1496
1142
  }
1497
- get isDate() {
1498
- return !!this._def.checks.find((ch) => ch.kind === "date");
1499
- }
1500
- get isTime() {
1501
- return !!this._def.checks.find((ch) => ch.kind === "time");
1502
- }
1503
- get isDuration() {
1504
- return !!this._def.checks.find((ch) => ch.kind === "duration");
1505
- }
1506
1143
  get isEmail() {
1507
1144
  return !!this._def.checks.find((ch) => ch.kind === "email");
1508
1145
  }
@@ -1515,9 +1152,6 @@ var ZodString = class _ZodString extends ZodType {
1515
1152
  get isUUID() {
1516
1153
  return !!this._def.checks.find((ch) => ch.kind === "uuid");
1517
1154
  }
1518
- get isNANOID() {
1519
- return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1520
- }
1521
1155
  get isCUID() {
1522
1156
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
1523
1157
  }
@@ -1530,15 +1164,6 @@ var ZodString = class _ZodString extends ZodType {
1530
1164
  get isIP() {
1531
1165
  return !!this._def.checks.find((ch) => ch.kind === "ip");
1532
1166
  }
1533
- get isCIDR() {
1534
- return !!this._def.checks.find((ch) => ch.kind === "cidr");
1535
- }
1536
- get isBase64() {
1537
- return !!this._def.checks.find((ch) => ch.kind === "base64");
1538
- }
1539
- get isBase64url() {
1540
- return !!this._def.checks.find((ch) => ch.kind === "base64url");
1541
- }
1542
1167
  get minLength() {
1543
1168
  let min = null;
1544
1169
  for (const ch of this._def.checks) {
@@ -1561,10 +1186,11 @@ var ZodString = class _ZodString extends ZodType {
1561
1186
  }
1562
1187
  };
1563
1188
  ZodString.create = (params) => {
1189
+ var _a;
1564
1190
  return new ZodString({
1565
1191
  checks: [],
1566
1192
  typeName: ZodFirstPartyTypeKind.ZodString,
1567
- coerce: params?.coerce ?? false,
1193
+ coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1568
1194
  ...processCreateParams(params)
1569
1195
  });
1570
1196
  };
@@ -1572,9 +1198,9 @@ function floatSafeRemainder(val, step) {
1572
1198
  const valDecCount = (val.toString().split(".")[1] || "").length;
1573
1199
  const stepDecCount = (step.toString().split(".")[1] || "").length;
1574
1200
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1575
- const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
1576
- const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1577
- return valInt % stepInt / 10 ** decCount;
1201
+ const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
1202
+ const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
1203
+ return valInt % stepInt / Math.pow(10, decCount);
1578
1204
  }
1579
1205
  var ZodNumber = class _ZodNumber extends ZodType {
1580
1206
  constructor() {
@@ -1784,8 +1410,7 @@ var ZodNumber = class _ZodNumber extends ZodType {
1784
1410
  return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1785
1411
  }
1786
1412
  get isFinite() {
1787
- let max = null;
1788
- let min = null;
1413
+ let max = null, min = null;
1789
1414
  for (const ch of this._def.checks) {
1790
1415
  if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1791
1416
  return true;
@@ -1804,7 +1429,7 @@ ZodNumber.create = (params) => {
1804
1429
  return new ZodNumber({
1805
1430
  checks: [],
1806
1431
  typeName: ZodFirstPartyTypeKind.ZodNumber,
1807
- coerce: params?.coerce || false,
1432
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1808
1433
  ...processCreateParams(params)
1809
1434
  });
1810
1435
  };
@@ -1816,15 +1441,17 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
1816
1441
  }
1817
1442
  _parse(input) {
1818
1443
  if (this._def.coerce) {
1819
- try {
1820
- input.data = BigInt(input.data);
1821
- } catch {
1822
- return this._getInvalidInput(input);
1823
- }
1444
+ input.data = BigInt(input.data);
1824
1445
  }
1825
1446
  const parsedType = this._getType(input);
1826
1447
  if (parsedType !== ZodParsedType.bigint) {
1827
- return this._getInvalidInput(input);
1448
+ const ctx2 = this._getOrReturnCtx(input);
1449
+ addIssueToContext(ctx2, {
1450
+ code: ZodIssueCode.invalid_type,
1451
+ expected: ZodParsedType.bigint,
1452
+ received: ctx2.parsedType
1453
+ });
1454
+ return INVALID;
1828
1455
  }
1829
1456
  let ctx = void 0;
1830
1457
  const status = new ParseStatus();
@@ -1871,15 +1498,6 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
1871
1498
  }
1872
1499
  return { status: status.value, value: input.data };
1873
1500
  }
1874
- _getInvalidInput(input) {
1875
- const ctx = this._getOrReturnCtx(input);
1876
- addIssueToContext(ctx, {
1877
- code: ZodIssueCode.invalid_type,
1878
- expected: ZodParsedType.bigint,
1879
- received: ctx.parsedType
1880
- });
1881
- return INVALID;
1882
- }
1883
1501
  gte(value, message) {
1884
1502
  return this.setLimit("min", value, true, errorUtil.toString(message));
1885
1503
  }
@@ -1973,10 +1591,11 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
1973
1591
  }
1974
1592
  };
1975
1593
  ZodBigInt.create = (params) => {
1594
+ var _a;
1976
1595
  return new ZodBigInt({
1977
1596
  checks: [],
1978
1597
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
1979
- coerce: params?.coerce ?? false,
1598
+ coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1980
1599
  ...processCreateParams(params)
1981
1600
  });
1982
1601
  };
@@ -2001,7 +1620,7 @@ var ZodBoolean = class extends ZodType {
2001
1620
  ZodBoolean.create = (params) => {
2002
1621
  return new ZodBoolean({
2003
1622
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
2004
- coerce: params?.coerce || false,
1623
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2005
1624
  ...processCreateParams(params)
2006
1625
  });
2007
1626
  };
@@ -2020,7 +1639,7 @@ var ZodDate = class _ZodDate extends ZodType {
2020
1639
  });
2021
1640
  return INVALID;
2022
1641
  }
2023
- if (Number.isNaN(input.data.getTime())) {
1642
+ if (isNaN(input.data.getTime())) {
2024
1643
  const ctx2 = this._getOrReturnCtx(input);
2025
1644
  addIssueToContext(ctx2, {
2026
1645
  code: ZodIssueCode.invalid_date
@@ -2109,7 +1728,7 @@ var ZodDate = class _ZodDate extends ZodType {
2109
1728
  ZodDate.create = (params) => {
2110
1729
  return new ZodDate({
2111
1730
  checks: [],
2112
- coerce: params?.coerce || false,
1731
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2113
1732
  typeName: ZodFirstPartyTypeKind.ZodDate,
2114
1733
  ...processCreateParams(params)
2115
1734
  });
@@ -2384,8 +2003,7 @@ var ZodObject = class _ZodObject extends ZodType {
2384
2003
  return this._cached;
2385
2004
  const shape = this._def.shape();
2386
2005
  const keys = util.objectKeys(shape);
2387
- this._cached = { shape, keys };
2388
- return this._cached;
2006
+ return this._cached = { shape, keys };
2389
2007
  }
2390
2008
  _parse(input) {
2391
2009
  const parsedType = this._getType(input);
@@ -2435,8 +2053,8 @@ var ZodObject = class _ZodObject extends ZodType {
2435
2053
  });
2436
2054
  status.dirty();
2437
2055
  }
2438
- } else if (unknownKeys === "strip") {
2439
- } else {
2056
+ } else if (unknownKeys === "strip") ;
2057
+ else {
2440
2058
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2441
2059
  }
2442
2060
  } else {
@@ -2458,10 +2076,9 @@ var ZodObject = class _ZodObject extends ZodType {
2458
2076
  const syncPairs = [];
2459
2077
  for (const pair of pairs) {
2460
2078
  const key = await pair.key;
2461
- const value = await pair.value;
2462
2079
  syncPairs.push({
2463
2080
  key,
2464
- value,
2081
+ value: await pair.value,
2465
2082
  alwaysSet: pair.alwaysSet
2466
2083
  });
2467
2084
  }
@@ -2483,10 +2100,11 @@ var ZodObject = class _ZodObject extends ZodType {
2483
2100
  unknownKeys: "strict",
2484
2101
  ...message !== void 0 ? {
2485
2102
  errorMap: (issue, ctx) => {
2486
- const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
2103
+ var _a, _b, _c, _d;
2104
+ const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2487
2105
  if (issue.code === "unrecognized_keys")
2488
2106
  return {
2489
- message: errorUtil.errToObj(message).message ?? defaultError
2107
+ message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
2490
2108
  };
2491
2109
  return {
2492
2110
  message: defaultError
@@ -2617,11 +2235,11 @@ var ZodObject = class _ZodObject extends ZodType {
2617
2235
  }
2618
2236
  pick(mask) {
2619
2237
  const shape = {};
2620
- for (const key of util.objectKeys(mask)) {
2238
+ util.objectKeys(mask).forEach((key) => {
2621
2239
  if (mask[key] && this.shape[key]) {
2622
2240
  shape[key] = this.shape[key];
2623
2241
  }
2624
- }
2242
+ });
2625
2243
  return new _ZodObject({
2626
2244
  ...this._def,
2627
2245
  shape: () => shape
@@ -2629,11 +2247,11 @@ var ZodObject = class _ZodObject extends ZodType {
2629
2247
  }
2630
2248
  omit(mask) {
2631
2249
  const shape = {};
2632
- for (const key of util.objectKeys(this.shape)) {
2250
+ util.objectKeys(this.shape).forEach((key) => {
2633
2251
  if (!mask[key]) {
2634
2252
  shape[key] = this.shape[key];
2635
2253
  }
2636
- }
2254
+ });
2637
2255
  return new _ZodObject({
2638
2256
  ...this._def,
2639
2257
  shape: () => shape
@@ -2647,14 +2265,14 @@ var ZodObject = class _ZodObject extends ZodType {
2647
2265
  }
2648
2266
  partial(mask) {
2649
2267
  const newShape = {};
2650
- for (const key of util.objectKeys(this.shape)) {
2268
+ util.objectKeys(this.shape).forEach((key) => {
2651
2269
  const fieldSchema = this.shape[key];
2652
2270
  if (mask && !mask[key]) {
2653
2271
  newShape[key] = fieldSchema;
2654
2272
  } else {
2655
2273
  newShape[key] = fieldSchema.optional();
2656
2274
  }
2657
- }
2275
+ });
2658
2276
  return new _ZodObject({
2659
2277
  ...this._def,
2660
2278
  shape: () => newShape
@@ -2662,7 +2280,7 @@ var ZodObject = class _ZodObject extends ZodType {
2662
2280
  }
2663
2281
  required(mask) {
2664
2282
  const newShape = {};
2665
- for (const key of util.objectKeys(this.shape)) {
2283
+ util.objectKeys(this.shape).forEach((key) => {
2666
2284
  if (mask && !mask[key]) {
2667
2285
  newShape[key] = this.shape[key];
2668
2286
  } else {
@@ -2673,7 +2291,7 @@ var ZodObject = class _ZodObject extends ZodType {
2673
2291
  }
2674
2292
  newShape[key] = newField;
2675
2293
  }
2676
- }
2294
+ });
2677
2295
  return new _ZodObject({
2678
2296
  ...this._def,
2679
2297
  shape: () => newShape
@@ -2811,25 +2429,15 @@ var getDiscriminator = (type) => {
2811
2429
  } else if (type instanceof ZodEnum) {
2812
2430
  return type.options;
2813
2431
  } else if (type instanceof ZodNativeEnum) {
2814
- return util.objectValues(type.enum);
2432
+ return Object.keys(type.enum);
2815
2433
  } else if (type instanceof ZodDefault) {
2816
2434
  return getDiscriminator(type._def.innerType);
2817
2435
  } else if (type instanceof ZodUndefined) {
2818
2436
  return [void 0];
2819
2437
  } else if (type instanceof ZodNull) {
2820
2438
  return [null];
2821
- } else if (type instanceof ZodOptional) {
2822
- return [void 0, ...getDiscriminator(type.unwrap())];
2823
- } else if (type instanceof ZodNullable) {
2824
- return [null, ...getDiscriminator(type.unwrap())];
2825
- } else if (type instanceof ZodBranded) {
2826
- return getDiscriminator(type.unwrap());
2827
- } else if (type instanceof ZodReadonly) {
2828
- return getDiscriminator(type.unwrap());
2829
- } else if (type instanceof ZodCatch) {
2830
- return getDiscriminator(type._def.innerType);
2831
2439
  } else {
2832
- return [];
2440
+ return null;
2833
2441
  }
2834
2442
  };
2835
2443
  var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
@@ -2889,7 +2497,7 @@ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
2889
2497
  const optionsMap = /* @__PURE__ */ new Map();
2890
2498
  for (const type of options) {
2891
2499
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2892
- if (!discriminatorValues.length) {
2500
+ if (!discriminatorValues) {
2893
2501
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2894
2502
  }
2895
2503
  for (const value of discriminatorValues) {
@@ -3089,8 +2697,7 @@ var ZodRecord = class _ZodRecord extends ZodType {
3089
2697
  for (const key in ctx.data) {
3090
2698
  pairs.push({
3091
2699
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
3092
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
3093
- alwaysSet: key in ctx.data
2700
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
3094
2701
  });
3095
2702
  }
3096
2703
  if (ctx.common.async) {
@@ -3289,7 +2896,12 @@ var ZodFunction = class _ZodFunction extends ZodType {
3289
2896
  return makeIssue({
3290
2897
  data: args,
3291
2898
  path: ctx.path,
3292
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
2899
+ errorMaps: [
2900
+ ctx.common.contextualErrorMap,
2901
+ ctx.schemaErrorMap,
2902
+ getErrorMap(),
2903
+ errorMap
2904
+ ].filter((x) => !!x),
3293
2905
  issueData: {
3294
2906
  code: ZodIssueCode.invalid_arguments,
3295
2907
  argumentsError: error
@@ -3300,7 +2912,12 @@ var ZodFunction = class _ZodFunction extends ZodType {
3300
2912
  return makeIssue({
3301
2913
  data: returns,
3302
2914
  path: ctx.path,
3303
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
2915
+ errorMaps: [
2916
+ ctx.common.contextualErrorMap,
2917
+ ctx.schemaErrorMap,
2918
+ getErrorMap(),
2919
+ errorMap
2920
+ ].filter((x) => !!x),
3304
2921
  issueData: {
3305
2922
  code: ZodIssueCode.invalid_return_type,
3306
2923
  returnTypeError: error
@@ -3435,10 +3052,7 @@ var ZodEnum = class _ZodEnum extends ZodType {
3435
3052
  });
3436
3053
  return INVALID;
3437
3054
  }
3438
- if (!this._cache) {
3439
- this._cache = new Set(this._def.values);
3440
- }
3441
- if (!this._cache.has(input.data)) {
3055
+ if (this._def.values.indexOf(input.data) === -1) {
3442
3056
  const ctx = this._getOrReturnCtx(input);
3443
3057
  const expectedValues = this._def.values;
3444
3058
  addIssueToContext(ctx, {
@@ -3474,17 +3088,11 @@ var ZodEnum = class _ZodEnum extends ZodType {
3474
3088
  }
3475
3089
  return enumValues;
3476
3090
  }
3477
- extract(values, newDef = this._def) {
3478
- return _ZodEnum.create(values, {
3479
- ...this._def,
3480
- ...newDef
3481
- });
3091
+ extract(values) {
3092
+ return _ZodEnum.create(values);
3482
3093
  }
3483
- exclude(values, newDef = this._def) {
3484
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3485
- ...this._def,
3486
- ...newDef
3487
- });
3094
+ exclude(values) {
3095
+ return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
3488
3096
  }
3489
3097
  };
3490
3098
  ZodEnum.create = createZodEnum;
@@ -3501,10 +3109,7 @@ var ZodNativeEnum = class extends ZodType {
3501
3109
  });
3502
3110
  return INVALID;
3503
3111
  }
3504
- if (!this._cache) {
3505
- this._cache = new Set(util.getValidEnumValues(this._def.values));
3506
- }
3507
- if (!this._cache.has(input.data)) {
3112
+ if (nativeEnumValues.indexOf(input.data) === -1) {
3508
3113
  const expectedValues = util.objectValues(nativeEnumValues);
3509
3114
  addIssueToContext(ctx, {
3510
3115
  received: ctx.data,
@@ -3582,38 +3187,26 @@ var ZodEffects = class extends ZodType {
3582
3187
  checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3583
3188
  if (effect.type === "preprocess") {
3584
3189
  const processed = effect.transform(ctx.data, checkCtx);
3190
+ if (ctx.common.issues.length) {
3191
+ return {
3192
+ status: "dirty",
3193
+ value: ctx.data
3194
+ };
3195
+ }
3585
3196
  if (ctx.common.async) {
3586
- return Promise.resolve(processed).then(async (processed2) => {
3587
- if (status.value === "aborted")
3588
- return INVALID;
3589
- const result = await this._def.schema._parseAsync({
3197
+ return Promise.resolve(processed).then((processed2) => {
3198
+ return this._def.schema._parseAsync({
3590
3199
  data: processed2,
3591
3200
  path: ctx.path,
3592
3201
  parent: ctx
3593
3202
  });
3594
- if (result.status === "aborted")
3595
- return INVALID;
3596
- if (result.status === "dirty")
3597
- return DIRTY(result.value);
3598
- if (status.value === "dirty")
3599
- return DIRTY(result.value);
3600
- return result;
3601
3203
  });
3602
3204
  } else {
3603
- if (status.value === "aborted")
3604
- return INVALID;
3605
- const result = this._def.schema._parseSync({
3205
+ return this._def.schema._parseSync({
3606
3206
  data: processed,
3607
3207
  path: ctx.path,
3608
3208
  parent: ctx
3609
3209
  });
3610
- if (result.status === "aborted")
3611
- return INVALID;
3612
- if (result.status === "dirty")
3613
- return DIRTY(result.value);
3614
- if (status.value === "dirty")
3615
- return DIRTY(result.value);
3616
- return result;
3617
3210
  }
3618
3211
  }
3619
3212
  if (effect.type === "refinement") {
@@ -3659,7 +3252,7 @@ var ZodEffects = class extends ZodType {
3659
3252
  parent: ctx
3660
3253
  });
3661
3254
  if (!isValid(base))
3662
- return INVALID;
3255
+ return base;
3663
3256
  const result = effect.transform(base.value, checkCtx);
3664
3257
  if (result instanceof Promise) {
3665
3258
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
@@ -3668,11 +3261,8 @@ var ZodEffects = class extends ZodType {
3668
3261
  } else {
3669
3262
  return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3670
3263
  if (!isValid(base))
3671
- return INVALID;
3672
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3673
- status: status.value,
3674
- value: result
3675
- }));
3264
+ return base;
3265
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
3676
3266
  });
3677
3267
  }
3678
3268
  }
@@ -3905,16 +3495,10 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
3905
3495
  var ZodReadonly = class extends ZodType {
3906
3496
  _parse(input) {
3907
3497
  const result = this._def.innerType._parse(input);
3908
- const freeze = (data) => {
3909
- if (isValid(data)) {
3910
- data.value = Object.freeze(data.value);
3911
- }
3912
- return data;
3913
- };
3914
- return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
3915
- }
3916
- unwrap() {
3917
- return this._def.innerType;
3498
+ if (isValid(result)) {
3499
+ result.value = Object.freeze(result.value);
3500
+ }
3501
+ return result;
3918
3502
  }
3919
3503
  };
3920
3504
  ZodReadonly.create = (type, params) => {
@@ -3924,33 +3508,19 @@ ZodReadonly.create = (type, params) => {
3924
3508
  ...processCreateParams(params)
3925
3509
  });
3926
3510
  };
3927
- function cleanParams(params, data) {
3928
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3929
- const p2 = typeof p === "string" ? { message: p } : p;
3930
- return p2;
3931
- }
3932
- function custom(check, _params = {}, fatal) {
3511
+ var custom = (check, params = {}, fatal) => {
3933
3512
  if (check)
3934
3513
  return ZodAny.create().superRefine((data, ctx) => {
3935
- const r = check(data);
3936
- if (r instanceof Promise) {
3937
- return r.then((r2) => {
3938
- if (!r2) {
3939
- const params = cleanParams(_params, data);
3940
- const _fatal = params.fatal ?? fatal ?? true;
3941
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
3942
- }
3943
- });
3944
- }
3945
- if (!r) {
3946
- const params = cleanParams(_params, data);
3947
- const _fatal = params.fatal ?? fatal ?? true;
3948
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
3514
+ var _a, _b;
3515
+ if (!check(data)) {
3516
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3517
+ const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3518
+ const p2 = typeof p === "string" ? { message: p } : p;
3519
+ ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
3949
3520
  }
3950
- return;
3951
3521
  });
3952
3522
  return ZodAny.create();
3953
- }
3523
+ };
3954
3524
  var late = {
3955
3525
  object: ZodObject.lazycreate
3956
3526
  };
@@ -4044,6 +3614,121 @@ var coerce = {
4044
3614
  date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
4045
3615
  };
4046
3616
  var NEVER = INVALID;
3617
+ var z = /* @__PURE__ */ Object.freeze({
3618
+ __proto__: null,
3619
+ defaultErrorMap: errorMap,
3620
+ setErrorMap,
3621
+ getErrorMap,
3622
+ makeIssue,
3623
+ EMPTY_PATH,
3624
+ addIssueToContext,
3625
+ ParseStatus,
3626
+ INVALID,
3627
+ DIRTY,
3628
+ OK,
3629
+ isAborted,
3630
+ isDirty,
3631
+ isValid,
3632
+ isAsync,
3633
+ get util() {
3634
+ return util;
3635
+ },
3636
+ get objectUtil() {
3637
+ return objectUtil;
3638
+ },
3639
+ ZodParsedType,
3640
+ getParsedType,
3641
+ ZodType,
3642
+ ZodString,
3643
+ ZodNumber,
3644
+ ZodBigInt,
3645
+ ZodBoolean,
3646
+ ZodDate,
3647
+ ZodSymbol,
3648
+ ZodUndefined,
3649
+ ZodNull,
3650
+ ZodAny,
3651
+ ZodUnknown,
3652
+ ZodNever,
3653
+ ZodVoid,
3654
+ ZodArray,
3655
+ ZodObject,
3656
+ ZodUnion,
3657
+ ZodDiscriminatedUnion,
3658
+ ZodIntersection,
3659
+ ZodTuple,
3660
+ ZodRecord,
3661
+ ZodMap,
3662
+ ZodSet,
3663
+ ZodFunction,
3664
+ ZodLazy,
3665
+ ZodLiteral,
3666
+ ZodEnum,
3667
+ ZodNativeEnum,
3668
+ ZodPromise,
3669
+ ZodEffects,
3670
+ ZodTransformer: ZodEffects,
3671
+ ZodOptional,
3672
+ ZodNullable,
3673
+ ZodDefault,
3674
+ ZodCatch,
3675
+ ZodNaN,
3676
+ BRAND,
3677
+ ZodBranded,
3678
+ ZodPipeline,
3679
+ ZodReadonly,
3680
+ custom,
3681
+ Schema: ZodType,
3682
+ ZodSchema: ZodType,
3683
+ late,
3684
+ get ZodFirstPartyTypeKind() {
3685
+ return ZodFirstPartyTypeKind;
3686
+ },
3687
+ coerce,
3688
+ any: anyType,
3689
+ array: arrayType,
3690
+ bigint: bigIntType,
3691
+ boolean: booleanType,
3692
+ date: dateType,
3693
+ discriminatedUnion: discriminatedUnionType,
3694
+ effect: effectsType,
3695
+ "enum": enumType,
3696
+ "function": functionType,
3697
+ "instanceof": instanceOfType,
3698
+ intersection: intersectionType,
3699
+ lazy: lazyType,
3700
+ literal: literalType,
3701
+ map: mapType,
3702
+ nan: nanType,
3703
+ nativeEnum: nativeEnumType,
3704
+ never: neverType,
3705
+ "null": nullType,
3706
+ nullable: nullableType,
3707
+ number: numberType,
3708
+ object: objectType,
3709
+ oboolean,
3710
+ onumber,
3711
+ optional: optionalType,
3712
+ ostring,
3713
+ pipeline: pipelineType,
3714
+ preprocess: preprocessType,
3715
+ promise: promiseType,
3716
+ record: recordType,
3717
+ set: setType,
3718
+ strictObject: strictObjectType,
3719
+ string: stringType,
3720
+ symbol: symbolType,
3721
+ transformer: effectsType,
3722
+ tuple: tupleType,
3723
+ "undefined": undefinedType,
3724
+ union: unionType,
3725
+ unknown: unknownType,
3726
+ "void": voidType,
3727
+ NEVER,
3728
+ ZodIssueCode,
3729
+ quotelessJson,
3730
+ ZodError
3731
+ });
4047
3732
 
4048
3733
  // ../../libs/types/dist/provider.types.js
4049
3734
  var RecognitionProvider;
@@ -4093,73 +3778,73 @@ var RecognitionResultTypeV1;
4093
3778
  RecognitionResultTypeV12["ERROR"] = "Error";
4094
3779
  RecognitionResultTypeV12["CLIENT_CONTROL_MESSAGE"] = "ClientControlMessage";
4095
3780
  })(RecognitionResultTypeV1 || (RecognitionResultTypeV1 = {}));
4096
- var TranscriptionResultSchemaV1 = external_exports.object({
4097
- type: external_exports.literal(RecognitionResultTypeV1.TRANSCRIPTION),
4098
- audioUtteranceId: external_exports.string(),
3781
+ var TranscriptionResultSchemaV1 = z.object({
3782
+ type: z.literal(RecognitionResultTypeV1.TRANSCRIPTION),
3783
+ audioUtteranceId: z.string(),
4099
3784
  // audio utterance id for this transcription session
4100
- finalTranscript: external_exports.string(),
3785
+ finalTranscript: z.string(),
4101
3786
  // transcript that is final and won't be overwritten by ASR. default empty string.
4102
- finalTranscriptConfidence: external_exports.number().min(0).max(1).optional(),
3787
+ finalTranscriptConfidence: z.number().min(0).max(1).optional(),
4103
3788
  // confidence score for the final transcript (0-1). Optional.
4104
- pendingTranscript: external_exports.string().optional(),
3789
+ pendingTranscript: z.string().optional(),
4105
3790
  // transcript that may be overwritten by ASR. Optional.
4106
- pendingTranscriptConfidence: external_exports.number().min(0).max(1).optional(),
3791
+ pendingTranscriptConfidence: z.number().min(0).max(1).optional(),
4107
3792
  // confidence score for the pending transcript (0-1). Optional.
4108
- is_finished: external_exports.boolean(),
3793
+ is_finished: z.boolean(),
4109
3794
  // entire transcription finished. This will be the last message in the transcription.
4110
- voiceStart: external_exports.number().optional(),
3795
+ voiceStart: z.number().optional(),
4111
3796
  // voice start time identified by ASR (in milliseconds from stream start). Optional.
4112
- voiceDuration: external_exports.number().optional(),
3797
+ voiceDuration: z.number().optional(),
4113
3798
  // voice duration identified by ASR (in milliseconds, calculated as maxVoiceEnd - voiceStart). Optional.
4114
- voiceEnd: external_exports.number().optional(),
3799
+ voiceEnd: z.number().optional(),
4115
3800
  // voice end time identified by ASR (in milliseconds from stream start). Optional.
4116
- startTimestamp: external_exports.number().optional(),
3801
+ startTimestamp: z.number().optional(),
4117
3802
  // start timestamp of the transcription in milliseconds. Optional.
4118
- endTimestamp: external_exports.number().optional(),
3803
+ endTimestamp: z.number().optional(),
4119
3804
  // end timestamp of the transcription in milliseconds. Optional.
4120
- receivedAtMs: external_exports.number().optional(),
3805
+ receivedAtMs: z.number().optional(),
4121
3806
  // server timestamp when this transcript was received (ms since epoch). Optional.
4122
- accumulatedAudioTimeMs: external_exports.number().optional()
3807
+ accumulatedAudioTimeMs: z.number().optional()
4123
3808
  // accumulated audio time watermark in milliseconds. Total duration of all audio chunks sent. Optional.
4124
3809
  });
4125
- var FunctionCallResultSchemaV1 = external_exports.object({
4126
- type: external_exports.literal(RecognitionResultTypeV1.FUNCTION_CALL),
4127
- audioUtteranceId: external_exports.string(),
3810
+ var FunctionCallResultSchemaV1 = z.object({
3811
+ type: z.literal(RecognitionResultTypeV1.FUNCTION_CALL),
3812
+ audioUtteranceId: z.string(),
4128
3813
  // audio utterance id for this function call
4129
- functionName: external_exports.string(),
4130
- functionArgJson: external_exports.string()
3814
+ functionName: z.string(),
3815
+ functionArgJson: z.string()
4131
3816
  });
4132
- var MetadataResultSchemaV1 = external_exports.object({
4133
- type: external_exports.literal(RecognitionResultTypeV1.METADATA),
4134
- audioUtteranceId: external_exports.string(),
3817
+ var MetadataResultSchemaV1 = z.object({
3818
+ type: z.literal(RecognitionResultTypeV1.METADATA),
3819
+ audioUtteranceId: z.string(),
4135
3820
  // audio utterance id for this metadata
4136
3821
  // Timing information
4137
- recordingStartMs: external_exports.number().optional(),
3822
+ recordingStartMs: z.number().optional(),
4138
3823
  // When recording started
4139
- recordingEndMs: external_exports.number().optional(),
3824
+ recordingEndMs: z.number().optional(),
4140
3825
  // When recording ended
4141
- transcriptEndMs: external_exports.number().optional(),
3826
+ transcriptEndMs: z.number().optional(),
4142
3827
  // When final transcript was received
4143
- socketCloseAtMs: external_exports.number().optional(),
3828
+ socketCloseAtMs: z.number().optional(),
4144
3829
  // When socket/connection closed
4145
3830
  // Audio Quality Metrics
4146
- duration: external_exports.number().optional(),
3831
+ duration: z.number().optional(),
4147
3832
  // Duration of the audio in milliseconds
4148
- volume: external_exports.number().optional(),
3833
+ volume: z.number().optional(),
4149
3834
  // Volume of the audio in decibels
4150
- accumulatedAudioTimeMs: external_exports.number().optional(),
3835
+ accumulatedAudioTimeMs: z.number().optional(),
4151
3836
  // Accumulated audio time watermark in milliseconds. Total duration of all audio chunks sent. Optional.
4152
3837
  // Cost Information
4153
- costInUSD: external_exports.number().default(0).optional(),
3838
+ costInUSD: z.number().default(0).optional(),
4154
3839
  // Estimated cost in USD for this recognition session. Default: 0
4155
3840
  // ASR API Type
4156
- apiType: external_exports.nativeEnum(ASRApiType).optional(),
3841
+ apiType: z.nativeEnum(ASRApiType).optional(),
4157
3842
  // ASR API type from job (streaming vs file-based)
4158
3843
  // ASR configuration as JSON string (no type validation)
4159
- asrConfig: external_exports.string().optional(),
3844
+ asrConfig: z.string().optional(),
4160
3845
  // Stringified JSON of the ASR provider config
4161
3846
  // Raw ASR metadata payload as provided by the provider (stringified if needed)
4162
- rawAsrMetadata: external_exports.string().optional()
3847
+ rawAsrMetadata: z.string().optional()
4163
3848
  });
4164
3849
  var ErrorTypeV1;
4165
3850
  (function(ErrorTypeV12) {
@@ -4171,17 +3856,17 @@ var ErrorTypeV1;
4171
3856
  ErrorTypeV12["CONNECTION_ERROR"] = "connection_error";
4172
3857
  ErrorTypeV12["UNKNOWN_ERROR"] = "unknown_error";
4173
3858
  })(ErrorTypeV1 || (ErrorTypeV1 = {}));
4174
- var ErrorResultSchemaV1 = external_exports.object({
4175
- type: external_exports.literal(RecognitionResultTypeV1.ERROR),
4176
- audioUtteranceId: external_exports.string(),
3859
+ var ErrorResultSchemaV1 = z.object({
3860
+ type: z.literal(RecognitionResultTypeV1.ERROR),
3861
+ audioUtteranceId: z.string(),
4177
3862
  // audio utterance id for this error
4178
- errorType: external_exports.nativeEnum(ErrorTypeV1).optional(),
3863
+ errorType: z.nativeEnum(ErrorTypeV1).optional(),
4179
3864
  // error type category
4180
- message: external_exports.string().optional(),
3865
+ message: z.string().optional(),
4181
3866
  // Error message
4182
- code: external_exports.union([external_exports.string(), external_exports.number()]).optional(),
3867
+ code: z.union([z.string(), z.number()]).optional(),
4183
3868
  // Error code
4184
- description: external_exports.string().optional()
3869
+ description: z.string().optional()
4185
3870
  // Detailed description
4186
3871
  });
4187
3872
  var ClientControlActionV1;
@@ -4189,16 +3874,16 @@ var ClientControlActionV1;
4189
3874
  ClientControlActionV13["READY_FOR_UPLOADING_RECORDING"] = "ready_for_uploading_recording";
4190
3875
  ClientControlActionV13["STOP_RECORDING"] = "stop_recording";
4191
3876
  })(ClientControlActionV1 || (ClientControlActionV1 = {}));
4192
- var ClientControlActionsV1 = external_exports.nativeEnum(ClientControlActionV1);
4193
- var ClientControlMessageSchemaV1 = external_exports.object({
4194
- type: external_exports.literal(RecognitionResultTypeV1.CLIENT_CONTROL_MESSAGE),
3877
+ var ClientControlActionsV1 = z.nativeEnum(ClientControlActionV1);
3878
+ var ClientControlMessageSchemaV1 = z.object({
3879
+ type: z.literal(RecognitionResultTypeV1.CLIENT_CONTROL_MESSAGE),
4195
3880
  // Message type discriminator
4196
- audioUtteranceId: external_exports.string(),
3881
+ audioUtteranceId: z.string(),
4197
3882
  // audio utterance id for this control message
4198
3883
  action: ClientControlActionsV1
4199
3884
  // The control action to perform
4200
3885
  });
4201
- var RecognitionResultSchemaV1 = external_exports.discriminatedUnion("type", [
3886
+ var RecognitionResultSchemaV1 = z.discriminatedUnion("type", [
4202
3887
  // P0
4203
3888
  TranscriptionResultSchemaV1,
4204
3889
  MetadataResultSchemaV1,
@@ -4218,95 +3903,95 @@ var ProviderMessageType;
4218
3903
  ProviderMessageType2["TIMER"] = "Timer";
4219
3904
  ProviderMessageType2["RAW"] = "Raw";
4220
3905
  })(ProviderMessageType || (ProviderMessageType = {}));
4221
- var RecognitionAlternativeSchema = external_exports.object({
3906
+ var RecognitionAlternativeSchema = z.object({
4222
3907
  /**
4223
3908
  * The transcribed text
4224
3909
  * @example "hello world"
4225
3910
  */
4226
- transcript: external_exports.string(),
3911
+ transcript: z.string(),
4227
3912
  /**
4228
3913
  * Confidence score (0-1)
4229
3914
  * Note: Google only provides confidence for final results
4230
3915
  * @example 0.95
4231
3916
  */
4232
- confidence: external_exports.number().min(0).max(1)
3917
+ confidence: z.number().min(0).max(1)
4233
3918
  });
4234
- var RecognitionChannelSchema = external_exports.object({
3919
+ var RecognitionChannelSchema = z.object({
4235
3920
  /**
4236
3921
  * Array of transcription alternatives, ordered by confidence
4237
3922
  */
4238
- alternatives: external_exports.array(RecognitionAlternativeSchema)
3923
+ alternatives: z.array(RecognitionAlternativeSchema)
4239
3924
  });
4240
- var ModelInfoSchema = external_exports.object({
4241
- name: external_exports.string(),
4242
- canonical_name: external_exports.string(),
4243
- architecture: external_exports.string(),
4244
- languages: external_exports.array(external_exports.string()).optional(),
4245
- version: external_exports.string(),
4246
- uuid: external_exports.string(),
4247
- batch: external_exports.boolean(),
4248
- streaming: external_exports.boolean()
3925
+ var ModelInfoSchema = z.object({
3926
+ name: z.string(),
3927
+ canonical_name: z.string(),
3928
+ architecture: z.string(),
3929
+ languages: z.array(z.string()).optional(),
3930
+ version: z.string(),
3931
+ uuid: z.string(),
3932
+ batch: z.boolean(),
3933
+ streaming: z.boolean()
4249
3934
  });
4250
- var TranscriptMessageSchema = external_exports.object({
4251
- type: external_exports.literal(ProviderMessageType.TRANSCRIPT),
3935
+ var TranscriptMessageSchema = z.object({
3936
+ type: z.literal(ProviderMessageType.TRANSCRIPT),
4252
3937
  /**
4253
3938
  * Provider that generated this message
4254
3939
  * @example "deepgram"
4255
3940
  */
4256
- provider: external_exports.nativeEnum(RecognitionProvider).optional(),
3941
+ provider: z.nativeEnum(RecognitionProvider).optional(),
4257
3942
  /**
4258
3943
  * The transcribed text (extracted from first alternative)
4259
3944
  * @example "hello world"
4260
3945
  */
4261
- text: external_exports.string(),
3946
+ text: z.string(),
4262
3947
  /**
4263
3948
  * Confidence score for the transcript (0-1)
4264
3949
  * @example 0.95
4265
3950
  */
4266
- confidence: external_exports.number().min(0).max(1),
3951
+ confidence: z.number().min(0).max(1),
4267
3952
  /**
4268
3953
  * Voice start time identified by ASR (in milliseconds from stream start)
4269
3954
  * @example 500 (voice starts at 0.5 seconds)
4270
3955
  */
4271
- voiceStart: external_exports.number().optional(),
3956
+ voiceStart: z.number().optional(),
4272
3957
  /**
4273
3958
  * Voice end time identified by ASR (in milliseconds from stream start)
4274
3959
  * @example 2000 (voice ends at 2.0 seconds)
4275
3960
  */
4276
- voiceEnd: external_exports.number().optional(),
3961
+ voiceEnd: z.number().optional(),
4277
3962
  /**
4278
3963
  * Voice duration identified by ASR (in milliseconds)
4279
3964
  * @example 1500 (1.5 seconds of speech, calculated as voiceEnd - voiceStart)
4280
3965
  */
4281
- voiceDuration: external_exports.number().optional(),
3966
+ voiceDuration: z.number().optional(),
4282
3967
  /**
4283
3968
  * Server timestamp when this transcript was received (in milliseconds)
4284
3969
  * @example 1704096005500
4285
3970
  */
4286
- receivedAtMs: external_exports.number().optional(),
3971
+ receivedAtMs: z.number().optional(),
4287
3972
  /**
4288
3973
  * Accumulated audio time watermark (in milliseconds)
4289
3974
  * Total duration of all audio chunks sent to this provider session
4290
3975
  * @example 2500 (2.5 seconds of audio has been sent)
4291
3976
  */
4292
- accumulatedAudioTimeMs: external_exports.number().optional(),
3977
+ accumulatedAudioTimeMs: z.number().optional(),
4293
3978
  /**
4294
3979
  * Whether this transcript is finalized (won't change)
4295
3980
  * @example true
4296
3981
  */
4297
- is_final: external_exports.boolean(),
3982
+ is_final: z.boolean(),
4298
3983
  /**
4299
3984
  * Accumulated confirmed transcript (all finalized text received so far)
4300
3985
  * Contains only the completed/finalized portions
4301
3986
  * @example "hello world how are you"
4302
3987
  */
4303
- confirmedTranscript: external_exports.string().optional(),
3988
+ confirmedTranscript: z.string().optional(),
4304
3989
  /**
4305
3990
  * New pending transcript (current interim text since last confirmation)
4306
3991
  * Contains only the unconfirmed interim text
4307
3992
  * @example "I'm doing"
4308
3993
  */
4309
- newPendingTranscript: external_exports.string().optional(),
3994
+ newPendingTranscript: z.string().optional(),
4310
3995
  /**
4311
3996
  * Whether this is a fallback transcript (forced due to timeout)
4312
3997
  * True when provider didn't send is_final=true within expected timeframe
@@ -4314,114 +3999,114 @@ var TranscriptMessageSchema = external_exports.object({
4314
3999
  * @example true
4315
4000
  * @default false
4316
4001
  */
4317
- is_fallback: external_exports.boolean().optional()
4002
+ is_fallback: z.boolean().optional()
4318
4003
  });
4319
- var VADEndSignalSchema = external_exports.object({
4320
- type: external_exports.literal(ProviderMessageType.VAD_END_SIGNAL),
4004
+ var VADEndSignalSchema = z.object({
4005
+ type: z.literal(ProviderMessageType.VAD_END_SIGNAL),
4321
4006
  /**
4322
4007
  * Provider that generated this message
4323
4008
  */
4324
- provider: external_exports.nativeEnum(RecognitionProvider).optional(),
4009
+ provider: z.nativeEnum(RecognitionProvider).optional(),
4325
4010
  /**
4326
4011
  * Time when the last word ended (in milliseconds)
4327
4012
  * @example 2500 (2.5 seconds)
4328
4013
  */
4329
- last_word_end: external_exports.number().optional()
4014
+ last_word_end: z.number().optional()
4330
4015
  });
4331
- var MetadataMessageSchema = external_exports.object({
4332
- type: external_exports.literal(ProviderMessageType.METADATA),
4333
- provider: external_exports.nativeEnum(RecognitionProvider),
4334
- asrConfig: external_exports.string().optional(),
4016
+ var MetadataMessageSchema = z.object({
4017
+ type: z.literal(ProviderMessageType.METADATA),
4018
+ provider: z.nativeEnum(RecognitionProvider),
4019
+ asrConfig: z.string().optional(),
4335
4020
  // ASR config we sent to provider
4336
- data: external_exports.string().optional()
4021
+ data: z.string().optional()
4337
4022
  // Raw metadata from provider (Deepgram only)
4338
4023
  });
4339
- var ErrorMessageSchema = external_exports.object({
4340
- type: external_exports.literal(ProviderMessageType.ERROR),
4024
+ var ErrorMessageSchema = z.object({
4025
+ type: z.literal(ProviderMessageType.ERROR),
4341
4026
  /**
4342
4027
  * Provider that generated this message
4343
4028
  */
4344
- provider: external_exports.nativeEnum(RecognitionProvider).optional(),
4029
+ provider: z.nativeEnum(RecognitionProvider).optional(),
4345
4030
  /**
4346
4031
  * Categorized error type
4347
4032
  * Defaults to UNKNOWN_ERROR if not specified by provider
4348
4033
  * @example ErrorTypeV1.PROVIDER_ERROR
4349
4034
  */
4350
- errorType: external_exports.nativeEnum(ErrorTypeV1),
4035
+ errorType: z.nativeEnum(ErrorTypeV1),
4351
4036
  /**
4352
4037
  * Error message
4353
4038
  * @example "Stream quota exceeded"
4354
4039
  */
4355
- provider_error: external_exports.string(),
4040
+ provider_error: z.string(),
4356
4041
  /**
4357
4042
  * Provider-specific error code
4358
4043
  * @example "QUOTA_EXCEEDED"
4359
4044
  */
4360
- provider_error_code: external_exports.union([external_exports.string(), external_exports.number()]).optional(),
4045
+ provider_error_code: z.union([z.string(), z.number()]).optional(),
4361
4046
  /**
4362
4047
  * Additional error description
4363
4048
  */
4364
- description: external_exports.string().optional(),
4049
+ description: z.string().optional(),
4365
4050
  /**
4366
4051
  * Whether the error can be immediately recovered by retrying
4367
4052
  * true = transient error, retry may succeed (e.g., UNAVAILABLE, INTERNAL)
4368
4053
  * false = permanent error, retry will fail (e.g., INVALID_ARGUMENT, PERMISSION_DENIED)
4369
4054
  * @example true
4370
4055
  */
4371
- is_immediately_recoverable: external_exports.boolean().optional()
4056
+ is_immediately_recoverable: z.boolean().optional()
4372
4057
  });
4373
- var TimerSchema = external_exports.object({
4374
- type: external_exports.literal(ProviderMessageType.TIMER),
4058
+ var TimerSchema = z.object({
4059
+ type: z.literal(ProviderMessageType.TIMER),
4375
4060
  /**
4376
4061
  * Provider that generated this message
4377
4062
  */
4378
- provider: external_exports.nativeEnum(RecognitionProvider).optional(),
4063
+ provider: z.nativeEnum(RecognitionProvider).optional(),
4379
4064
  /**
4380
4065
  * Timestamp when recording started (in milliseconds)
4381
4066
  * @example 1704096000000
4382
4067
  */
4383
- recordingStartMs: external_exports.number().optional(),
4068
+ recordingStartMs: z.number().optional(),
4384
4069
  /**
4385
4070
  * Timestamp when recording ended (in milliseconds)
4386
4071
  * @example 1704096005000
4387
4072
  */
4388
- recordingEndMs: external_exports.number().optional(),
4073
+ recordingEndMs: z.number().optional(),
4389
4074
  /**
4390
4075
  * Timestamp when final transcript was received (in milliseconds)
4391
4076
  * @example 1704096005500
4392
4077
  */
4393
- transcriptEndMs: external_exports.number().optional(),
4078
+ transcriptEndMs: z.number().optional(),
4394
4079
  /**
4395
4080
  * Timestamp when socket/grpc connection was closed (in milliseconds)
4396
4081
  * @example 1704096006000
4397
4082
  */
4398
- socketCloseAtMs: external_exports.number().optional(),
4083
+ socketCloseAtMs: z.number().optional(),
4399
4084
  /**
4400
4085
  * Accumulated audio time watermark (in milliseconds)
4401
4086
  * Total duration of all audio chunks sent to this provider session
4402
4087
  * @example 2500 (2.5 seconds of audio has been sent)
4403
4088
  */
4404
- accumulatedAudioTimeMs: external_exports.number().optional(),
4089
+ accumulatedAudioTimeMs: z.number().optional(),
4405
4090
  /**
4406
4091
  * Estimated cost in USD for this session
4407
4092
  * Calculated by the job based on audio duration and provider pricing
4408
4093
  * @example 0.0025 (quarter of a cent)
4409
4094
  */
4410
- costInUSD: external_exports.number().optional().default(0),
4095
+ costInUSD: z.number().optional().default(0),
4411
4096
  /**
4412
4097
  * ASR API type from the job
4413
4098
  * - STREAMING: Real-time streaming APIs (Deepgram, AssemblyAI, Google)
4414
4099
  * - FILE_BASED: File upload/batch APIs (OpenAI Batch, Gemini Batch)
4415
4100
  * @example ASRApiType.STREAMING
4416
4101
  */
4417
- apiType: external_exports.nativeEnum(ASRApiType).optional()
4102
+ apiType: z.nativeEnum(ASRApiType).optional()
4418
4103
  });
4419
- var RawMessageSchema = external_exports.object({
4420
- type: external_exports.literal(ProviderMessageType.RAW),
4421
- provider: external_exports.string(),
4422
- data: external_exports.any()
4104
+ var RawMessageSchema = z.object({
4105
+ type: z.literal(ProviderMessageType.RAW),
4106
+ provider: z.string(),
4107
+ data: z.any()
4423
4108
  });
4424
- var ProviderTranscriptionMessageSchema = external_exports.discriminatedUnion("type", [
4109
+ var ProviderTranscriptionMessageSchema = z.discriminatedUnion("type", [
4425
4110
  TranscriptMessageSchema,
4426
4111
  VADEndSignalSchema,
4427
4112
  MetadataMessageSchema,
@@ -4431,100 +4116,100 @@ var ProviderTranscriptionMessageSchema = external_exports.discriminatedUnion("ty
4431
4116
  ]);
4432
4117
 
4433
4118
  // ../../libs/types/dist/error-exception.types.js
4434
- var BaseRecognitionExceptionSchema = external_exports.object({
4119
+ var BaseRecognitionExceptionSchema = z.object({
4435
4120
  /** Error type category */
4436
- errorType: external_exports.nativeEnum(ErrorTypeV1),
4121
+ errorType: z.nativeEnum(ErrorTypeV1),
4437
4122
  /** Error message for logging/debugging */
4438
- message: external_exports.string(),
4123
+ message: z.string(),
4439
4124
  /** Optional error code from provider or system */
4440
- code: external_exports.union([external_exports.string(), external_exports.number()]).optional(),
4125
+ code: z.union([z.string(), z.number()]).optional(),
4441
4126
  /** Detailed description for debugging */
4442
- description: external_exports.string().optional(),
4127
+ description: z.string().optional(),
4443
4128
  /**
4444
4129
  * Whether this error can be immediately shown to user.
4445
4130
  * true = Show to user immediately (clear actionable error)
4446
4131
  * false = Log for investigation, show generic error to user
4447
4132
  */
4448
- isImmediatelyAvailable: external_exports.boolean(),
4133
+ isImmediatelyAvailable: z.boolean(),
4449
4134
  /** Recognition provider that generated this error */
4450
- provider: external_exports.nativeEnum(RecognitionProvider).optional(),
4135
+ provider: z.nativeEnum(RecognitionProvider).optional(),
4451
4136
  /** Audio utterance ID this error relates to */
4452
- audioUtteranceId: external_exports.string().optional(),
4137
+ audioUtteranceId: z.string().optional(),
4453
4138
  /** Timestamp when error occurred */
4454
- timestamp: external_exports.number().optional()
4139
+ timestamp: z.number().optional()
4455
4140
  });
4456
4141
  var AuthenticationExceptionSchema = BaseRecognitionExceptionSchema.extend({
4457
- errorType: external_exports.literal(ErrorTypeV1.AUTHENTICATION_ERROR),
4458
- isImmediatelyAvailable: external_exports.literal(false),
4142
+ errorType: z.literal(ErrorTypeV1.AUTHENTICATION_ERROR),
4143
+ isImmediatelyAvailable: z.literal(false),
4459
4144
  // System issue, not user-facing
4460
4145
  /** Which service failed authentication (e.g., 'deepgram', 'google') */
4461
- service: external_exports.string().optional(),
4146
+ service: z.string().optional(),
4462
4147
  /** Authentication method that failed (e.g., 'api_key', 'oauth') */
4463
- authMethod: external_exports.string().optional()
4148
+ authMethod: z.string().optional()
4464
4149
  });
4465
4150
  var ValidationExceptionSchema = BaseRecognitionExceptionSchema.extend({
4466
- errorType: external_exports.literal(ErrorTypeV1.VALIDATION_ERROR),
4467
- isImmediatelyAvailable: external_exports.literal(true),
4151
+ errorType: z.literal(ErrorTypeV1.VALIDATION_ERROR),
4152
+ isImmediatelyAvailable: z.literal(true),
4468
4153
  // Can show to user
4469
4154
  /** Field name that failed validation */
4470
- field: external_exports.string().optional(),
4155
+ field: z.string().optional(),
4471
4156
  /** Expected value format/type */
4472
- expected: external_exports.string().optional(),
4157
+ expected: z.string().optional(),
4473
4158
  /** Actual value received (sanitized) */
4474
- received: external_exports.string().optional()
4159
+ received: z.string().optional()
4475
4160
  });
4476
4161
  var ProviderExceptionSchema = BaseRecognitionExceptionSchema.extend({
4477
- errorType: external_exports.literal(ErrorTypeV1.PROVIDER_ERROR),
4478
- isImmediatelyAvailable: external_exports.literal(false),
4162
+ errorType: z.literal(ErrorTypeV1.PROVIDER_ERROR),
4163
+ isImmediatelyAvailable: z.literal(false),
4479
4164
  // Provider issue, not user-facing
4480
4165
  /** Provider name (e.g., 'deepgram', 'assemblyai', 'google') */
4481
- provider: external_exports.string().optional(),
4166
+ provider: z.string().optional(),
4482
4167
  /** Provider-specific error code */
4483
- providerErrorCode: external_exports.union([external_exports.string(), external_exports.number()]).optional(),
4168
+ providerErrorCode: z.union([z.string(), z.number()]).optional(),
4484
4169
  /** Whether this provider error might be transient (should retry) */
4485
- isTransient: external_exports.boolean().optional()
4170
+ isTransient: z.boolean().optional()
4486
4171
  });
4487
4172
  var TimeoutExceptionSchema = BaseRecognitionExceptionSchema.extend({
4488
- errorType: external_exports.literal(ErrorTypeV1.TIMEOUT_ERROR),
4489
- isImmediatelyAvailable: external_exports.literal(true),
4173
+ errorType: z.literal(ErrorTypeV1.TIMEOUT_ERROR),
4174
+ isImmediatelyAvailable: z.literal(true),
4490
4175
  // Can tell user to try again
4491
4176
  /** Timeout duration in milliseconds */
4492
- timeoutMs: external_exports.number().optional(),
4177
+ timeoutMs: z.number().optional(),
4493
4178
  /** What operation timed out (e.g., 'connection', 'transcription', 'response') */
4494
- operation: external_exports.string().optional()
4179
+ operation: z.string().optional()
4495
4180
  });
4496
4181
  var QuotaExceededExceptionSchema = BaseRecognitionExceptionSchema.extend({
4497
- errorType: external_exports.literal(ErrorTypeV1.QUOTA_EXCEEDED),
4498
- isImmediatelyAvailable: external_exports.literal(true),
4182
+ errorType: z.literal(ErrorTypeV1.QUOTA_EXCEEDED),
4183
+ isImmediatelyAvailable: z.literal(true),
4499
4184
  // Can tell user to wait
4500
4185
  /** Quota type that was exceeded (e.g., 'rate_limit', 'daily_quota', 'concurrent_requests') */
4501
- quotaType: external_exports.string().optional(),
4186
+ quotaType: z.string().optional(),
4502
4187
  /** When quota resets (Unix timestamp in ms) */
4503
- resetAt: external_exports.number().optional(),
4188
+ resetAt: z.number().optional(),
4504
4189
  /** How long to wait in seconds before retry */
4505
- retryAfterSeconds: external_exports.number().optional()
4190
+ retryAfterSeconds: z.number().optional()
4506
4191
  });
4507
4192
  var ConnectionExceptionSchema = BaseRecognitionExceptionSchema.extend({
4508
- errorType: external_exports.literal(ErrorTypeV1.CONNECTION_ERROR),
4509
- isImmediatelyAvailable: external_exports.literal(true),
4193
+ errorType: z.literal(ErrorTypeV1.CONNECTION_ERROR),
4194
+ isImmediatelyAvailable: z.literal(true),
4510
4195
  // Can tell user about network issues
4511
4196
  /** Number of connection attempts made */
4512
- attempts: external_exports.number().optional(),
4197
+ attempts: z.number().optional(),
4513
4198
  /** URL that failed to connect */
4514
- url: external_exports.string().optional(),
4199
+ url: z.string().optional(),
4515
4200
  /** Underlying error message */
4516
- underlyingError: external_exports.string().optional()
4201
+ underlyingError: z.string().optional()
4517
4202
  });
4518
4203
  var UnknownExceptionSchema = BaseRecognitionExceptionSchema.extend({
4519
- errorType: external_exports.literal(ErrorTypeV1.UNKNOWN_ERROR),
4520
- isImmediatelyAvailable: external_exports.literal(false),
4204
+ errorType: z.literal(ErrorTypeV1.UNKNOWN_ERROR),
4205
+ isImmediatelyAvailable: z.literal(false),
4521
4206
  // Unknown cause, not user-facing
4522
4207
  /** Stack trace for debugging (sanitized) */
4523
- stack: external_exports.string().optional(),
4208
+ stack: z.string().optional(),
4524
4209
  /** Additional context for debugging */
4525
- context: external_exports.record(external_exports.unknown()).optional()
4210
+ context: z.record(z.unknown()).optional()
4526
4211
  });
4527
- var RecognitionExceptionSchema = external_exports.discriminatedUnion("errorType", [
4212
+ var RecognitionExceptionSchema = z.discriminatedUnion("errorType", [
4528
4213
  AuthenticationExceptionSchema,
4529
4214
  ValidationExceptionSchema,
4530
4215
  ProviderExceptionSchema,
@@ -4546,19 +4231,19 @@ var ControlSignalTypeV1;
4546
4231
  ControlSignalTypeV12["START_RECORDING"] = "start_recording";
4547
4232
  ControlSignalTypeV12["STOP_RECORDING"] = "stop_recording";
4548
4233
  })(ControlSignalTypeV1 || (ControlSignalTypeV1 = {}));
4549
- var SlotMapSchema = external_exports.record(external_exports.string(), external_exports.array(external_exports.string()));
4550
- var GameContextSchemaV1 = external_exports.object({
4551
- type: external_exports.literal(RecognitionContextTypeV1.GAME_CONTEXT),
4552
- gameId: external_exports.string(),
4234
+ var SlotMapSchema = z.record(z.string(), z.array(z.string()));
4235
+ var GameContextSchemaV1 = z.object({
4236
+ type: z.literal(RecognitionContextTypeV1.GAME_CONTEXT),
4237
+ gameId: z.string(),
4553
4238
  // Unique identifier for the game
4554
- gamePhase: external_exports.string(),
4239
+ gamePhase: z.string(),
4555
4240
  // Current phase of the game
4556
4241
  // Prompt fields for different processing stages
4557
- promptSTT: external_exports.string().optional(),
4242
+ promptSTT: z.string().optional(),
4558
4243
  // Speech-to-Text: Keywords/phrases to optimize ASR (e.g., for Deepgram keywords)
4559
- promptSTF: external_exports.string().optional(),
4244
+ promptSTF: z.string().optional(),
4560
4245
  // Speech-to-Function: Direct speech to function mapping instructions
4561
- promptTTF: external_exports.string().optional(),
4246
+ promptTTF: z.string().optional(),
4562
4247
  // Text-to-Function: Text to function mapping instructions after transcription
4563
4248
  // Slot map for entity extraction
4564
4249
  slotMap: SlotMapSchema.optional()
@@ -4568,77 +4253,77 @@ var GameContextSchemaV1 = external_exports.object({
4568
4253
  // - Deepgram Nova3: Automatically converts map values to phrases in Search parameters
4569
4254
  // - Prompt-based LLMs: Acts as key->value replacement for entity extraction
4570
4255
  });
4571
- var ControlSignalSchemaV1 = external_exports.object({
4572
- type: external_exports.literal(RecognitionContextTypeV1.CONTROL_SIGNAL),
4573
- signal: external_exports.nativeEnum(ControlSignalTypeV1)
4256
+ var ControlSignalSchemaV1 = z.object({
4257
+ type: z.literal(RecognitionContextTypeV1.CONTROL_SIGNAL),
4258
+ signal: z.nativeEnum(ControlSignalTypeV1)
4574
4259
  });
4575
- var RequestDebugCommandSchema = external_exports.object({
4260
+ var RequestDebugCommandSchema = z.object({
4576
4261
  // Enable verbose debug logging for this request
4577
- enableDebugLog: external_exports.boolean().optional().default(false),
4262
+ enableDebugLog: z.boolean().optional().default(false),
4578
4263
  // Enable audio storage to database/filesystem for debugging
4579
- enableAudioStorage: external_exports.boolean().optional().default(true),
4264
+ enableAudioStorage: z.boolean().optional().default(true),
4580
4265
  // Enable validation that song quiz session ID exists before processing
4581
- enableSongQuizSessionIdCheck: external_exports.boolean().optional().default(true),
4266
+ enableSongQuizSessionIdCheck: z.boolean().optional().default(true),
4582
4267
  // Enable experimental pilot models for testing new features
4583
- enablePilotModels: external_exports.boolean().optional().default(false)
4268
+ enablePilotModels: z.boolean().optional().default(false)
4584
4269
  }).optional();
4585
- var ASRRequestSchemaV1 = external_exports.object({
4586
- type: external_exports.literal(RecognitionContextTypeV1.ASR_REQUEST),
4270
+ var ASRRequestSchemaV1 = z.object({
4271
+ type: z.literal(RecognitionContextTypeV1.ASR_REQUEST),
4587
4272
  // Session identification
4588
- audioUtteranceId: external_exports.string().optional(),
4273
+ audioUtteranceId: z.string().optional(),
4589
4274
  // Optional utterance ID (prefer query param)
4590
4275
  // ASR configuration
4591
- provider: external_exports.string(),
4592
- model: external_exports.string().optional(),
4593
- language: external_exports.string(),
4594
- sampleRate: external_exports.number(),
4595
- encoding: external_exports.number(),
4276
+ provider: z.string(),
4277
+ model: z.string().optional(),
4278
+ language: z.string(),
4279
+ sampleRate: z.number(),
4280
+ encoding: z.number(),
4596
4281
  // Recognition options
4597
- interimResults: external_exports.boolean().optional().default(false),
4282
+ interimResults: z.boolean().optional().default(false),
4598
4283
  // Enable interim/partial results
4599
- useContext: external_exports.boolean().optional().default(false),
4284
+ useContext: z.boolean().optional().default(false),
4600
4285
  // If true, requires GameContext before session creation
4601
4286
  // Final transcript stability mode (timeout for fallback final transcript)
4602
- finalTranscriptStability: external_exports.string().optional(),
4287
+ finalTranscriptStability: z.string().optional(),
4603
4288
  // Stability mode: 'aggressive' | 'balanced' | 'conservative'
4604
4289
  // Debug options (FOR DEBUG/TESTING ONLY - not for production use)
4605
4290
  debugCommand: RequestDebugCommandSchema
4606
4291
  });
4607
- var RecognitionContextSchemaV1 = external_exports.discriminatedUnion("type", [
4292
+ var RecognitionContextSchemaV1 = z.discriminatedUnion("type", [
4608
4293
  GameContextSchemaV1,
4609
4294
  ControlSignalSchemaV1,
4610
4295
  ASRRequestSchemaV1
4611
4296
  ]);
4612
4297
 
4613
4298
  // ../../libs/types/dist/recognition-query.types.js
4614
- var RecognitionGameInfoSchema = external_exports.object({
4615
- userId: external_exports.string().optional(),
4299
+ var RecognitionGameInfoSchema = z.object({
4300
+ userId: z.string().optional(),
4616
4301
  // User identifier
4617
- gameSessionId: external_exports.string().optional(),
4302
+ gameSessionId: z.string().optional(),
4618
4303
  // Volly session identifier . Called "sessionId" in Platform and most games.
4619
- deviceId: external_exports.string().optional(),
4304
+ deviceId: z.string().optional(),
4620
4305
  // Device identifier
4621
- accountId: external_exports.string().optional(),
4306
+ accountId: z.string().optional(),
4622
4307
  // Account identifier
4623
- gameId: external_exports.string().optional(),
4308
+ gameId: z.string().optional(),
4624
4309
  // Game identifier
4625
- gamePhase: external_exports.string().optional(),
4310
+ gamePhase: z.string().optional(),
4626
4311
  // Game phase or scene. A string that describes the current state of the game for client team to optimize specific turn.
4627
- questionAnswerId: external_exports.string().optional(),
4312
+ questionAnswerId: z.string().optional(),
4628
4313
  // Question answer identifier for tracking Q&A sessions
4629
- platform: external_exports.string().optional()
4314
+ platform: z.string().optional()
4630
4315
  // Platform for audio recording device (use the definition of platform teams)
4631
4316
  });
4632
- var RecognitionQueryMetadataSchema = external_exports.object({
4633
- audioUtteranceId: external_exports.string(),
4317
+ var RecognitionQueryMetadataSchema = z.object({
4318
+ audioUtteranceId: z.string(),
4634
4319
  // Audio utterance ID to query
4635
4320
  recognitionGameInfo: RecognitionGameInfoSchema.optional()
4636
4321
  // Optional game info for security
4637
4322
  });
4638
- var UtteranceResourceResponseSchema = external_exports.object({
4639
- audioUtteranceId: external_exports.string(),
4323
+ var UtteranceResourceResponseSchema = z.object({
4324
+ audioUtteranceId: z.string(),
4640
4325
  // Audio utterance ID
4641
- results: external_exports.array(external_exports.any())
4326
+ results: z.array(z.any())
4642
4327
  // Array of RecognitionResult (version-specific)
4643
4328
  });
4644
4329
 
@@ -5078,6 +4763,17 @@ var WebSocketAudioClient = class {
5078
4763
  getReadyState() {
5079
4764
  return this.ws?.readyState ?? WebSocket.CLOSED;
5080
4765
  }
4766
+ /**
4767
+ * Close the WebSocket connection
4768
+ * Protected method for subclasses to implement disconnect logic
4769
+ * @param code - WebSocket close code (default: 1000 = normal closure)
4770
+ * @param reason - Human-readable close reason
4771
+ */
4772
+ closeConnection(code = 1e3, reason = "Client disconnect") {
4773
+ if (this.ws && this.ws.readyState === WebSocket.OPEN) {
4774
+ this.ws.close(code, reason);
4775
+ }
4776
+ }
5081
4777
  };
5082
4778
 
5083
4779
  // ../../libs/websocket/dist/core/audio-upload-websocket-server.js
@@ -5754,6 +5450,16 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
5754
5450
  this.messageHandler.callbacks.onTranscript = this.config.onTranscript;
5755
5451
  });
5756
5452
  }
5453
+ stopAbnormally() {
5454
+ if (this.state === "stopped" /* STOPPED */ || this.state === "failed" /* FAILED */) {
5455
+ this.log("debug", "stopAbnormally called but already in terminal state", { state: this.state });
5456
+ return;
5457
+ }
5458
+ this.log("warn", "Abnormal stop requested - closing connection immediately", { state: this.state });
5459
+ this.state = "stopped" /* STOPPED */;
5460
+ this.cleanup();
5461
+ this.closeConnection(1e3, "Client abnormal stop");
5462
+ }
5757
5463
  getAudioUtteranceId() {
5758
5464
  return this.config.audioUtteranceId;
5759
5465
  }