go-go-try 7.2.1 → 7.4.0

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.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,11 @@
1
+ /**
2
+ * Core Result types for go-go-try
3
+ */
1
4
  type Success<T> = readonly [undefined, T];
2
5
  type Failure<E> = readonly [E, undefined];
3
6
  type Result<E, T> = Success<T> | Failure<E>;
7
+ type ResultWithDefault<E, T> = readonly [E | undefined, T];
8
+ type MaybePromise<T> = T | Promise<T>;
4
9
  /**
5
10
  * Base interface for tagged errors.
6
11
  * The `_tag` property enables discriminated union narrowing.
@@ -10,35 +15,98 @@ interface TaggedError<T extends string> {
10
15
  readonly message: string;
11
16
  readonly cause?: unknown;
12
17
  }
18
+ interface GoTryAllOptions {
19
+ /**
20
+ * Maximum number of concurrent promises.
21
+ * Set to 0 (default) for unlimited concurrency (all promises run in parallel).
22
+ */
23
+ concurrency?: number;
24
+ }
13
25
  /**
14
- * Creates a tagged error class for discriminated error handling.
26
+ * Type for error constructors that can be used with goTryRaw.
27
+ */
28
+ type ErrorConstructor<E> = new (message: string, options?: {
29
+ cause?: unknown;
30
+ }) => E;
31
+ /**
32
+ * Options for goTryRaw function.
33
+ * errorClass and systemErrorClass are mutually exclusive - you can only provide one.
34
+ */
35
+ type GoTryRawOptions<E = Error> = {
36
+ errorClass: ErrorConstructor<E>;
37
+ systemErrorClass?: never;
38
+ } | {
39
+ errorClass?: never;
40
+ systemErrorClass: ErrorConstructor<E>;
41
+ } | {
42
+ errorClass?: never;
43
+ systemErrorClass?: never;
44
+ };
45
+ /**
46
+ * Creates a union type from multiple tagged error classes.
15
47
  *
16
- * @template T The literal type of the tag
17
- * @param tag The string tag to identify this error type (e.g., 'DatabaseError')
18
- * @returns A class constructor for creating tagged errors
48
+ * @template T A tuple of tagged error class types
49
+ * @returns A union of all instance types
19
50
  *
20
51
  * @example
21
52
  * const DatabaseError = taggedError('DatabaseError')
22
53
  * const NetworkError = taggedError('NetworkError')
23
54
  *
24
- * type MyError = InstanceType<typeof DatabaseError> | InstanceType<typeof NetworkError>
55
+ * type AppError = TaggedUnion<[typeof DatabaseError, typeof NetworkError]>
56
+ * // Equivalent to: DatabaseError | NetworkError
57
+ */
58
+ type TaggedUnion<T extends readonly ErrorConstructor<unknown>[]> = {
59
+ [K in keyof T]: T[K] extends ErrorConstructor<infer E> ? E : never;
60
+ }[number];
61
+
62
+ /**
63
+ * Executes a function, promise, or value and returns a Result type.
64
+ * If an error occurs, it returns a Failure with the error message as a string.
25
65
  *
26
- * function fetchUser(id: string): Result<MyError, User> {
27
- * const [err, user] = goTryRaw(fetch(`/users/${id}`), DatabaseError)
28
- * if (err) return failure(err)
29
- * // ...
30
- * }
66
+ * @template T The type of the successful result
67
+ * @param {T | Promise<T> | (() => T | Promise<T>)} value - The value, promise, or function to execute
68
+ * @returns {Result<string, T> | Promise<Result<string, T>>} A Result type or a Promise of a Result type
31
69
  *
32
- * // Pattern matching on errors
33
- * if (err._tag === 'DatabaseError') {
34
- * // TypeScript knows this is DatabaseError
70
+ * @example
71
+ * // With a value
72
+ * const [err, result] = goTry(42);
73
+ *
74
+ * @example
75
+ * // With a function
76
+ * const [err, result] = goTry(() => JSON.parse('{"key": "value"}'));
77
+ *
78
+ * @example
79
+ * // With a promise
80
+ * const [err, result] = await goTry(fetch('https://api.example.com/data'));
81
+ */
82
+ declare function goTry<T>(fn: () => never): Result<string, never>;
83
+ declare function goTry<T>(fn: () => Promise<T>): Promise<Result<string, T>>;
84
+ declare function goTry<T>(promise: Promise<T>): Promise<Result<string, T>>;
85
+ declare function goTry<T>(fn: () => T): Result<string, T>;
86
+ declare function goTry<T>(value: T): Result<string, T>;
87
+
88
+ /**
89
+ * Default system error class for errors that aren't already wrapped in a tagged error class.
90
+ *
91
+ * @example
92
+ * // By default, goTryRaw wraps unknown errors in UnknownError
93
+ * const [err, result] = goTryRaw(() => mightThrow())
94
+ * if (err) {
95
+ * console.log(err._tag) // 'UnknownError'
35
96
  * }
97
+ *
98
+ * @example
99
+ * // Use a custom system error class
100
+ * const SystemError = taggedError('SystemError')
101
+ * const [err, result] = goTryRaw(() => mightThrow(), {
102
+ * systemErrorClass: SystemError
103
+ * })
36
104
  */
37
- declare function taggedError<T extends string>(tag: T): {
105
+ declare const UnknownError: {
38
106
  new (message: string, options?: {
39
107
  cause?: unknown;
40
- }): {
41
- readonly _tag: T;
108
+ } | undefined): {
109
+ readonly _tag: "UnknownError";
42
110
  readonly cause?: unknown;
43
111
  name: string;
44
112
  message: string;
@@ -46,19 +114,51 @@ declare function taggedError<T extends string>(tag: T): {
46
114
  };
47
115
  isError(error: unknown): error is Error;
48
116
  };
49
- type ResultWithDefault<E, T> = readonly [E | undefined, T];
50
- type MaybePromise<T> = T | Promise<T>;
51
- interface GoTryAllOptions {
52
- /**
53
- * Maximum number of concurrent promises.
54
- * Set to 0 (default) for unlimited concurrency (all promises run in parallel).
55
- */
56
- concurrency?: number;
57
- }
58
- declare function isSuccess<E, T>(result: Result<E, T>): result is Success<T>;
59
- declare function isFailure<E, T>(result: Result<E, T>): result is Failure<E>;
60
- declare function success<T>(value: T): Success<T>;
61
- declare function failure<E>(error: E): Failure<E>;
117
+
118
+ /**
119
+ * Executes a function, promise, or value and returns a Result type.
120
+ * If an error occurs, it returns a Failure with the raw error object.
121
+ *
122
+ * @template T The type of the successful result
123
+ * @template E The type of the error
124
+ * @param {T | Promise<T> | (() => T | Promise<T>)} value - The value, promise, or function to execute
125
+ * @param {GoTryRawOptions<E>} [options] - Optional options object
126
+ * @returns {Result<E, T> | Promise<Result<E, T>>} A Result type or a Promise of a Result type
127
+ *
128
+ * @example
129
+ * // With a value
130
+ * const [err, result] = goTryRaw(42);
131
+ *
132
+ * @example
133
+ * // With a function
134
+ * const [err, result] = goTryRaw(() => JSON.parse('{"key": "value"}'));
135
+ *
136
+ * @example
137
+ * // With a promise
138
+ * const [err, result] = await goTryRaw(fetch('https://api.example.com/data'));
139
+ *
140
+ * @example
141
+ * // With options object - wrap all errors
142
+ * const DatabaseError = taggedError('DatabaseError');
143
+ * const [err, result] = await goTryRaw(fetchData(), { errorClass: DatabaseError });
144
+ *
145
+ * @example
146
+ * // With options object - systemErrorClass only wraps non-tagged errors
147
+ * const [err, result] = await goTryRaw(fetchData(), { systemErrorClass: UnknownError });
148
+ * // Errors thrown as tagged errors pass through
149
+ * // Other errors are wrapped in UnknownError
150
+ */
151
+ declare function goTryRaw<T>(fn: () => never): Result<Error, never>;
152
+ declare function goTryRaw<T, E = InstanceType<typeof UnknownError>>(fn: () => never, options: GoTryRawOptions<E>): Result<E, never>;
153
+ declare function goTryRaw<T>(fn: () => Promise<T>): Promise<Result<Error, T>>;
154
+ declare function goTryRaw<T, E = InstanceType<typeof UnknownError>>(fn: () => Promise<T>, options: GoTryRawOptions<E>): Promise<Result<E, T>>;
155
+ declare function goTryRaw<T>(promise: Promise<T>): Promise<Result<Error, T>>;
156
+ declare function goTryRaw<T, E = InstanceType<typeof UnknownError>>(promise: Promise<T>, options: GoTryRawOptions<E>): Promise<Result<E, T>>;
157
+ declare function goTryRaw<T>(fn: () => T): Result<Error, T>;
158
+ declare function goTryRaw<T, E = InstanceType<typeof UnknownError>>(fn: () => T, options: GoTryRawOptions<E>): Result<E, T>;
159
+ declare function goTryRaw<T>(value: T): Result<Error, T>;
160
+ declare function goTryRaw<T, E = InstanceType<typeof UnknownError>>(value: T, options: GoTryRawOptions<E>): Result<E, T>;
161
+
62
162
  /**
63
163
  * Executes a function, promise, or value and returns a Result type with a fallback default.
64
164
  * If an error occurs, it returns the error message and the default value.
@@ -85,6 +185,7 @@ declare function goTryOr<T>(fn: () => Promise<T>, defaultValue: T | (() => T)):
85
185
  declare function goTryOr<T>(promise: Promise<T>, defaultValue: T | (() => T)): Promise<ResultWithDefault<string, T>>;
86
186
  declare function goTryOr<T>(fn: () => T, defaultValue: T | (() => T)): ResultWithDefault<string, T>;
87
187
  declare function goTryOr<T>(value: T, defaultValue: T | (() => T)): ResultWithDefault<string, T>;
188
+
88
189
  /**
89
190
  * Executes multiple promises or factory functions in parallel (or with limited concurrency)
90
191
  * and returns a tuple of [errors, results]. Unlike Promise.all, this doesn't fail fast -
@@ -141,92 +242,114 @@ declare function goTryAllRaw<T extends readonly unknown[]>(items: {
141
242
  }, {
142
243
  [K in keyof T]: T[K] | undefined;
143
244
  }]>;
245
+
144
246
  /**
145
- * Executes a function, promise, or value and returns a Result type.
146
- * If an error occurs, it returns a Failure with the error message as a string.
247
+ * Creates a tagged error class for discriminated error handling.
147
248
  *
148
- * @template T The type of the successful result
149
- * @param {T | Promise<T> | (() => T | Promise<T>)} value - The value, promise, or function to execute
150
- * @returns {Result<string, T> | Promise<Result<string, T>>} A Result type or a Promise of a Result type
249
+ * @template T The literal type of the tag
250
+ * @param tag The string tag to identify this error type (e.g., 'DatabaseError')
251
+ * @returns A class constructor for creating tagged errors
151
252
  *
152
253
  * @example
153
- * // With a value
154
- * const [err, result] = goTry(42);
254
+ * const DatabaseError = taggedError('DatabaseError')
255
+ * const NetworkError = taggedError('NetworkError')
155
256
  *
156
- * @example
157
- * // With a function
158
- * const [err, result] = goTry(() => JSON.parse('{"key": "value"}'));
257
+ * type MyError = InstanceType<typeof DatabaseError> | InstanceType<typeof NetworkError>
159
258
  *
160
- * @example
161
- * // With a promise
162
- * const [err, result] = await goTry(fetch('https://api.example.com/data'));
163
- */
164
- declare function goTry<T>(fn: () => never): Result<string, never>;
165
- declare function goTry<T>(fn: () => Promise<T>): Promise<Result<string, T>>;
166
- declare function goTry<T>(promise: Promise<T>): Promise<Result<string, T>>;
167
- declare function goTry<T>(fn: () => T): Result<string, T>;
168
- declare function goTry<T>(value: T): Result<string, T>;
169
- /**
170
- * Type for error constructors that can be used with goTryRaw.
259
+ * function fetchUser(id: string): Result<MyError, User> {
260
+ * const [err, user] = goTryRaw(fetch(`/users/${id}`), DatabaseError)
261
+ * if (err) return failure(err)
262
+ * // ...
263
+ * }
264
+ *
265
+ * // Pattern matching on errors
266
+ * if (err._tag === 'DatabaseError') {
267
+ * // TypeScript knows this is DatabaseError
268
+ * }
171
269
  */
172
- type ErrorConstructor<E> = new (message: string, options?: {
173
- cause?: unknown;
174
- }) => E;
270
+ declare function taggedError<T extends string>(tag: T): {
271
+ new (message: string, options?: {
272
+ cause?: unknown;
273
+ }): {
274
+ readonly _tag: T;
275
+ readonly cause?: unknown;
276
+ name: string;
277
+ message: string;
278
+ stack?: string;
279
+ };
280
+ isError(error: unknown): error is Error;
281
+ };
282
+
175
283
  /**
176
- * Creates a union type from multiple tagged error classes.
284
+ * Asserts that a condition is true, otherwise throws the provided error.
285
+ * Provides type narrowing when used with Result types.
177
286
  *
178
- * @template T A tuple of tagged error class types
179
- * @returns A union of all instance types
287
+ * @param condition - The condition to assert
288
+ * @param error - An Error instance or string message to throw if condition is falsy
289
+ * @throws {Error} Throws the provided error if condition is falsy
180
290
  *
181
291
  * @example
182
- * const DatabaseError = taggedError('DatabaseError')
183
- * const NetworkError = taggedError('NetworkError')
292
+ * // With Result type - narrows error to undefined after assertion
293
+ * const [err, user] = goTryRaw(fetchUser(), DatabaseError)
294
+ * assert(err === undefined, new DatabaseError('Failed to fetch user'))
295
+ * // TypeScript now knows: err is undefined, user is User
184
296
  *
185
- * type AppError = TaggedUnion<[typeof DatabaseError, typeof NetworkError]>
186
- * // Equivalent to: DatabaseError | NetworkError
297
+ * @example
298
+ * // With string message
299
+ * assert(response.ok, 'Response was not ok')
300
+ *
301
+ * @example
302
+ * // With custom Error instance
303
+ * assert(value > 0, new ValidationError('Value must be positive'))
187
304
  */
188
- type TaggedUnion<T extends readonly ErrorConstructor<unknown>[]> = {
189
- [K in keyof T]: T[K] extends ErrorConstructor<infer E> ? E : never;
190
- }[number];
305
+ declare function assert(condition: unknown, error: Error | string): asserts condition;
191
306
  /**
192
- * Executes a function, promise, or value and returns a Result type.
193
- * If an error occurs, it returns a Failure with the raw error object.
307
+ * Asserts that a condition is true, otherwise instantiates and throws the error class.
308
+ * Provides type narrowing when used with Result types.
194
309
  *
195
- * @template T The type of the successful result
196
- * @template E The type of the error, defaults to Error
197
- * @param {T | Promise<T> | (() => T | Promise<T>)} value - The value, promise, or function to execute
198
- * @param {ErrorConstructor<E>} [ErrorClass] - Optional error constructor to wrap caught errors
199
- * @returns {Result<E, T> | Promise<Result<E, T>>} A Result type or a Promise of a Result type
310
+ * @param condition - The condition to assert
311
+ * @param ErrorClass - An Error class constructor (e.g., from taggedError)
312
+ * @param message - The error message to pass to the constructor
313
+ * @throws {Error} Throws a new instance of ErrorClass if condition is falsy
200
314
  *
201
315
  * @example
202
- * // With a value
203
- * const [err, result] = goTryRaw(42);
316
+ * const ValidationError = taggedError('ValidationError')
317
+ * assert(value > 0, ValidationError, 'Value must be positive')
318
+ * // Equivalent to: if (!(value > 0)) throw new ValidationError('Value must be positive')
319
+ */
320
+ declare function assert<T extends Error>(condition: unknown, ErrorClass: new (message: string) => T, message: string): asserts condition;
321
+
322
+ declare function isSuccess<E, T>(result: Result<E, T>): result is Success<T>;
323
+ declare function isFailure<E, T>(result: Result<E, T>): result is Failure<E>;
324
+ declare function success<T>(value: T): Success<T>;
325
+ declare function failure<E>(error: E): Failure<E>;
326
+ /**
327
+ * Helper for exhaustive switch checks on discriminated unions.
328
+ * If this function is called, it means a case was forgotten in a switch statement.
329
+ * Use this in the `default` case of switch statements handling tagged errors.
204
330
  *
205
- * @example
206
- * // With a function
207
- * const [err, result] = goTryRaw(() => JSON.parse('{"key": "value"}'));
331
+ * @param value - The value that should be of type `never` if all cases are handled
332
+ * @throws {Error} Always throws an error indicating unhandled case
208
333
  *
209
334
  * @example
210
- * // With a promise
211
- * const [err, result] = await goTryRaw(fetch('https://api.example.com/data'));
335
+ * const DatabaseError = taggedError('DatabaseError')
336
+ * const NetworkError = taggedError('NetworkError')
337
+ * type AppError = InstanceType<typeof DatabaseError> | InstanceType<typeof NetworkError>
212
338
  *
213
- * @example
214
- * // With tagged error for discriminated unions
215
- * const DatabaseError = taggedError('DatabaseError');
216
- * const [err, result] = await goTryRaw(fetchData(), DatabaseError);
217
- * // err is InstanceType<typeof DatabaseError> | undefined
339
+ * function handleError(err: AppError): string {
340
+ * switch (err._tag) {
341
+ * case 'DatabaseError':
342
+ * return `DB: ${err.message}`
343
+ * case 'NetworkError':
344
+ * return `NET: ${err.message}`
345
+ * default:
346
+ * // TypeScript will error if we forget a case above
347
+ * return assertNever(err)
348
+ * }
349
+ * }
218
350
  */
219
- declare function goTryRaw<T, E = Error>(fn: () => never): Result<E, never>;
220
- declare function goTryRaw<T, E = Error>(fn: () => never, ErrorClass: ErrorConstructor<E>): Result<E, never>;
221
- declare function goTryRaw<T, E = Error>(fn: () => Promise<T>): Promise<Result<E, T>>;
222
- declare function goTryRaw<T, E = Error>(fn: () => Promise<T>, ErrorClass: ErrorConstructor<E>): Promise<Result<E, T>>;
223
- declare function goTryRaw<T, E = Error>(promise: Promise<T>): Promise<Result<E, T>>;
224
- declare function goTryRaw<T, E = Error>(promise: Promise<T>, ErrorClass: ErrorConstructor<E>): Promise<Result<E, T>>;
225
- declare function goTryRaw<T, E = Error>(fn: () => T): Result<E, T>;
226
- declare function goTryRaw<T, E = Error>(fn: () => T, ErrorClass: ErrorConstructor<E>): Result<E, T>;
227
- declare function goTryRaw<T, E = Error>(value: T): Result<E, T>;
228
- declare function goTryRaw<T, E = Error>(value: T, ErrorClass: ErrorConstructor<E>): Result<E, T>;
351
+ declare function assertNever(value: never): never;
229
352
 
230
- export { failure, goTry, goTryAll, goTryAllRaw, goTryOr, goTryRaw, isFailure, isSuccess, success, taggedError };
231
- export type { ErrorConstructor, Failure, GoTryAllOptions, MaybePromise, Result, ResultWithDefault, Success, TaggedError, TaggedUnion };
353
+ export { UnknownError, assert, assertNever, failure, goTry, goTryAll, goTryAllRaw, goTryOr, goTryRaw, isFailure, isSuccess, success, taggedError };
354
+ export type { ErrorConstructor, Failure, GoTryAllOptions, GoTryRawOptions, MaybePromise, Result, ResultWithDefault, Success, TaggedError, TaggedUnion };
232
355
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sources":["../src/index.ts"],"mappings":"KAAY,OAAO,CAAC,CAAC,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;KACpC,OAAO,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;KACpC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAElD;AAAA;AACA;GAEG;UACc,WAAW,CAAC,CAAC,SAAS,MAAM;IAC3C,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;IAChB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CACzB;AAED;AADA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;GAGG;iBACa,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC;kBAK3B,MAAM,YAAY;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;uBAH3C,CAAC;yBACC,OAAO;AAC5B;AACA;AACA;AACA;AACA,sCAAsC,KAAK;EAG1C;KAEW,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAA;KAErD,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;UAE3B,eAAe;IAC9B;AAJF;AACA;OAMK;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;iBAEe,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,IAAI,OAAO,CAA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AU,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;iBAClF,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;iBAC9C,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;;;;","names":[]}
1
+ {"version":3,"file":"index.d.cts","sources":["../src/types.ts","../src/goTry.ts","../src/unknown-error.ts","../src/goTryRaw.ts","../src/goTryOr.ts","../src/goTryAll.ts","../src/tagged-error.ts","../src/assert.ts","../src/result-helpers.ts"],"mappings":"AAAA;;;AAIM,KAAM,OAAO;AACb,KAAM,OAAO;AACb,KAAM,MAAM,SAAS,OAAO,MAAM,OAAO;AAEzC,KAAM,iBAAiB;AAEvB,KAAM,YAAY,UAAU,OAAO;AAEzC;;;;AAIM,UAAW,WAAW;;;;;AAMtB,UAAW,eAAe;;;;;;;AAQhC;;;AAGM,KAAM,gBAAgB;;;AAO5B;;;;AAIM,KAAM,eAAe,KAAK,KAAK;gBACnB,gBAAgB;;;;sBACU,gBAAgB;;;;;AAG5D;;;;;;;;;;;;;AAaM,KAAM,WAAW,oBAAoB,gBAAgB;iCAC1B,gBAAgB;;;AC3DjD;;;;;;;;;;;;;;;;;;;;AAoBA,iBAAgB,KAAK,sBAAsB,MAAM;AACjD,iBAAgB,KAAK,cAAc,OAAO,MAAM,OAAO,CAAC,MAAM;AAC9D,iBAAgB,KAAK,aAAa,OAAO,MAAM,OAAO,CAAC,MAAM;AAC7D,iBAAgB,KAAK,kBAAkB,MAAM;AAC7C,iBAAgB,KAAK,eAAe,MAAM;;AC1B1C;;;;;;;;;;;;;;;;;AAiBA,cAAa,YAAY;;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