@intrig/react 0.0.15-27 → 0.0.15-29

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.
@@ -0,0 +1,127 @@
1
+ import { XMLParser } from 'fast-xml-parser';
2
+
3
+ // type Encoders = {
4
+ // [k: string]: <T>(
5
+ // request: T,
6
+ // mediaType: string,
7
+ // schema: ZodSchema,
8
+ // ) => Promise<any>;
9
+ // };
10
+
11
+ const encoders = {};
12
+ function encode(request, mediaType, schema) {
13
+ if (encoders[mediaType]) {
14
+ return encoders[mediaType](request, mediaType, schema);
15
+ }
16
+ return request;
17
+ }
18
+ encoders['application/json'] = (request, mediaType, schema) => {
19
+ return request;
20
+ };
21
+ function appendFormData(formData, data, parentKey) {
22
+ if (data instanceof Blob || typeof data === 'string') {
23
+ formData.append(parentKey, data);
24
+ } else if (data !== null && typeof data === 'object') {
25
+ if (Array.isArray(data)) {
26
+ data.forEach((item, index) => {
27
+ const key = `${parentKey}`;
28
+ appendFormData(formData, item, key);
29
+ });
30
+ } else {
31
+ Object.keys(data).forEach(key => {
32
+ const newKey = parentKey ? `${parentKey}[${key}]` : key;
33
+ appendFormData(formData, data[key], newKey);
34
+ });
35
+ }
36
+ } else {
37
+ formData.append(parentKey, data == null ? '' : String(data));
38
+ }
39
+ }
40
+ encoders['multipart/form-data'] = (request, mediaType, schema) => {
41
+ const _request = request;
42
+ const formData = new FormData();
43
+ Object.keys(_request).forEach(key => {
44
+ appendFormData(formData, _request[key], key);
45
+ });
46
+ return formData;
47
+ };
48
+ encoders['application/octet-stream'] = (request, mediaType, schema) => {
49
+ return request;
50
+ };
51
+ encoders['application/x-www-form-urlencoded'] = (request, mediaType, schema) => {
52
+ const formData = new FormData();
53
+ for (const key in request) {
54
+ const value = request[key];
55
+ formData.append(key, value instanceof Blob || typeof value === 'string' ? value : String(value));
56
+ }
57
+ return formData;
58
+ };
59
+ const transformers = {};
60
+ function transform(request, mediaType, schema) {
61
+ if (transformers[mediaType]) {
62
+ return transformers[mediaType](request, mediaType, schema);
63
+ }
64
+ throw new Error(`Unsupported media type: ` + mediaType);
65
+ }
66
+ transformers['application/json'] = async (request, mediaType, schema) => {
67
+ return schema.parse(await request.json());
68
+ };
69
+ transformers['multipart/form-data'] = async (request, mediaType, schema) => {
70
+ const formData = await request.formData();
71
+ const content = {};
72
+ formData.forEach((value, key) => {
73
+ if (content[key]) {
74
+ if (!(content[key] instanceof Array)) {
75
+ content[key] = [content[key]];
76
+ }
77
+ content[key].push(value);
78
+ } else {
79
+ content[key] = value;
80
+ }
81
+ });
82
+ return schema.parse(content);
83
+ };
84
+ transformers['application/octet-stream'] = async (request, mediaType, schema) => {
85
+ return schema.parse(new Blob([await request.arrayBuffer()], {
86
+ type: 'application/octet-stream'
87
+ }));
88
+ };
89
+ transformers['application/x-www-form-urlencoded'] = async (request, mediaType, schema) => {
90
+ const formData = await request.formData();
91
+ const content = {};
92
+ formData.forEach((value, key) => content[key] = value);
93
+ return schema.parse(content);
94
+ };
95
+ transformers['application/xml'] = async (request, mediaType, schema) => {
96
+ const xmlParser = new XMLParser();
97
+ const content = await xmlParser.parse(await request.text());
98
+ return schema.parse(await content);
99
+ };
100
+ transformers['text/plain'] = async (request, mediaType, schema) => {
101
+ return schema.parse(await request.text());
102
+ };
103
+ transformers['text/html'] = async (request, mediaType, schema) => {
104
+ return schema.parse(await request.text());
105
+ };
106
+ transformers['text/css'] = async (request, mediaType, schema) => {
107
+ return schema.parse(await request.text());
108
+ };
109
+ transformers['text/javascript'] = async (request, mediaType, schema) => {
110
+ return schema.parse(await request.text());
111
+ };
112
+ const responseTransformers = {};
113
+ responseTransformers['application/json'] = async (data, mediaType, schema) => {
114
+ return schema.parse(data);
115
+ };
116
+ responseTransformers['application/xml'] = async (data, mediaType, schema) => {
117
+ const parsed = new XMLParser().parse(data);
118
+ return schema.parse(parsed);
119
+ };
120
+ async function transformResponse(data, mediaType, schema) {
121
+ if (responseTransformers[mediaType]) {
122
+ return await responseTransformers[mediaType](data, mediaType, schema);
123
+ }
124
+ return data;
125
+ }
126
+
127
+ export { encode, transform, transformResponse };
@@ -0,0 +1,353 @@
1
+ /**
2
+ * State of an asynchronous call. Network state follows the state diagram given below.
3
+ *
4
+ *
5
+ * <pre>
6
+ * ┌──────┐
7
+ * ┌─────────────► Init ◄────────────┐
8
+ * │ └▲────┬┘ │
9
+ * │ │ │ │
10
+ * │ Reset Execute │
11
+ * Reset │ │ Reset
12
+ * │ ┌──┴────┴──┐ │
13
+ * │ ┌────► Pending ◄────┐ │
14
+ * │ │ └──┬────┬──┘ │ │
15
+ * │ Execute │ │ Execute │
16
+ * │ │ │ │ │ │
17
+ * │ │ OnSuccess OnError │ │
18
+ * │ ┌────┴──┐ │ │ ┌──┴───┐ │
19
+ * └─┤Success◄────┘ └────►Error ├─┘
20
+ * └───────┘ └──────┘
21
+ *
22
+ * </pre>
23
+ */
24
+
25
+ /**
26
+ * Network call is not yet started
27
+ */
28
+
29
+ /**
30
+ * Checks whether the state is init state
31
+ * @param state
32
+ */
33
+ function isInit(state) {
34
+ return state.state === 'init';
35
+ }
36
+
37
+ /**
38
+ * Initializes a new state.
39
+ *
40
+ * @template T The type of the state.
41
+ * @return {InitState<T>} An object representing the initial state.
42
+ */
43
+ function init() {
44
+ return {
45
+ state: 'init'
46
+ };
47
+ }
48
+
49
+ /**
50
+ * Network call is not yet completed
51
+ */
52
+
53
+ /**
54
+ * Interface representing progress information for an upload or download operation.
55
+ *
56
+ * @typedef {object} Progress
57
+ *
58
+ * @property {'upload' | 'download'} type - The type of the operation.
59
+ *
60
+ * @property {number} loaded - The amount of data that has been loaded so far.
61
+ *
62
+ * @property {number} [total] - The total amount of data to be loaded (if known).
63
+ */
64
+
65
+ /**
66
+ * Checks whether the state is pending state
67
+ * @param state
68
+ */
69
+ function isPending(state) {
70
+ return state.state === 'pending';
71
+ }
72
+
73
+ /**
74
+ * Generates a PendingState object with a state of "pending".
75
+ *
76
+ * @return {PendingState<T>} An object representing the pending state.
77
+ */
78
+ function pending(progress = undefined, data = undefined) {
79
+ return {
80
+ state: 'pending',
81
+ progress,
82
+ data
83
+ };
84
+ }
85
+
86
+ /**
87
+ * Network call is completed with success state
88
+ */
89
+
90
+ /**
91
+ * Checks whether the state is success response
92
+ * @param state
93
+ */
94
+ function isSuccess(state) {
95
+ return state.state === 'success';
96
+ }
97
+
98
+ /**
99
+ * Creates a success state object with the provided data.
100
+ *
101
+ * @param {T} data - The data to be included in the success state.
102
+ * @return {SuccessState<T>} An object representing a success state containing the provided data.
103
+ */
104
+ function success(data) {
105
+ return {
106
+ state: 'success',
107
+ data
108
+ };
109
+ }
110
+
111
+ /**
112
+ * Network call is completed with error response
113
+ */
114
+
115
+ /**
116
+ * Checks whether the state is error state
117
+ * @param state
118
+ */
119
+ function isError(state) {
120
+ return state.state === 'error';
121
+ }
122
+
123
+ /**
124
+ * Constructs an ErrorState object representing an error.
125
+ *
126
+ * @param {any} error - The error object or message.
127
+ * @param {string} [statusCode] - An optional status code associated with the error.
128
+ * @return {ErrorState<T>} An object representing the error state.
129
+ */
130
+ function error(error, statusCode, request) {
131
+ return {
132
+ state: 'error',
133
+ error,
134
+ statusCode,
135
+ request
136
+ };
137
+ }
138
+
139
+ /**
140
+ * Represents an error state with additional contextual information.
141
+ *
142
+ * @typedef {Object} ErrorWithContext
143
+ * @template T
144
+ * @extends ErrorState<T>
145
+ *
146
+ * @property {string} source - The origin of the error.
147
+ * @property {string} operation - The operation being performed when the error occurred.
148
+ * @property {string} key - A unique key identifying the specific error instance.
149
+ */
150
+
151
+ /**
152
+ * Represents an action in the network context.
153
+ *
154
+ * @template T - The type of data associated with the network action
155
+ *
156
+ * @property {NetworkState<any>} state - The current state of the network action
157
+ * @property {string} key - The unique identifier for the network action
158
+ */
159
+
160
+ /**
161
+ * Represents the dispatch state of a process.
162
+ *
163
+ * @template T The type of the state information.
164
+ * @interface
165
+ *
166
+ * @property {string} state The current state of the dispatch process.
167
+ */
168
+
169
+ /**
170
+ * Represents a successful dispatch state.
171
+ *
172
+ * @template T - Type of the data associated with the dispatch.
173
+ *
174
+ * @extends DispatchState<T>
175
+ *
176
+ * @property {string} state - The state of the dispatch, always 'success'.
177
+ */
178
+
179
+ /**
180
+ * Indicates a successful dispatch state.
181
+ *
182
+ * @return {DispatchState<T>} An object representing a successful state.
183
+ */
184
+ function successfulDispatch() {
185
+ return {
186
+ state: 'success'
187
+ };
188
+ }
189
+
190
+ /**
191
+ * Determines if the provided dispatch state represents a successful dispatch.
192
+ *
193
+ * @param {DispatchState<T>} value - The dispatch state to check.
194
+ * @return {value is SuccessfulDispatch<T>} - True if the dispatch state indicates success, false otherwise.
195
+ */
196
+ function isSuccessfulDispatch(value) {
197
+ return value.state === 'success';
198
+ }
199
+
200
+ /**
201
+ * ValidationError interface represents a specific type of dispatch state
202
+ * where a validation error has occurred.
203
+ *
204
+ * @typeparam T - The type of the data associated with this dispatch state.
205
+ */
206
+
207
+ /**
208
+ * Generates a ValidationError object.
209
+ *
210
+ * @param error The error details that caused the validation to fail.
211
+ * @return The ValidationError object containing the error state and details.
212
+ */
213
+ function validationError(error) {
214
+ return {
215
+ state: 'validation-error',
216
+ error
217
+ };
218
+ }
219
+
220
+ /**
221
+ * Determines if a provided DispatchState object is a ValidationError.
222
+ *
223
+ * @param {DispatchState<T>} value - The DispatchState object to evaluate.
224
+ * @return {boolean} - Returns true if the provided DispatchState object is a ValidationError, otherwise returns false.
225
+ */
226
+ function isValidationError(value) {
227
+ return value.state === 'validation-error';
228
+ }
229
+
230
+ /**
231
+ * Represents an error structure with a specified type and associated data.
232
+ *
233
+ * @template T - The type of the data associated with the error.
234
+ * @template E - The type of the error detail.
235
+ *
236
+ * @property {string} type - A string representing the type of the error.
237
+ */
238
+
239
+ /**
240
+ * Represents an error encountered during a network operation.
241
+ * Extends from the `IntrigError` interface, adding network-specific properties.
242
+ *
243
+ * @template T - The type of the intrinsic data associated with the error.
244
+ * @template E - The type of the error details, defaulting to `unknown`.
245
+ *
246
+ * @property {string} type - A constant property representing the error type, always set to 'network'.
247
+ * @property {string} statusCode - A string representation of the HTTP status code associated with the error, indicating the nature of the network failure.
248
+ * @property {E} error - The detailed error information specific to the failure, type extends from the generic E, allowing flexibility in the error details.
249
+ * @property {any} request - The request object that was attempted when the network error occurred, providing context for what operation failed.
250
+ */
251
+
252
+ /**
253
+ * Constructs a network error object.
254
+ *
255
+ * @param error The error object corresponding to the network request.
256
+ * @param statusCode A string representing the HTTP status code returned.
257
+ * @param request The request object associated with the network operation.
258
+ * @return A NetworkError object containing the error type, status code, error details, and the original request.
259
+ */
260
+ function networkError(error, statusCode, request) {
261
+ return {
262
+ type: 'network',
263
+ statusCode,
264
+ error,
265
+ request
266
+ };
267
+ }
268
+
269
+ /**
270
+ * Determines if the provided IntrigError is of type 'network'.
271
+ *
272
+ * @param {IntrigError<T, E>} value - The error value to check the type of.
273
+ * @return {boolean} - Returns true if the error is of type 'network', otherwise false.
274
+ */
275
+ function isNetworkError(value) {
276
+ return value.type === 'network';
277
+ }
278
+
279
+ /**
280
+ * Interface representing a request validation error.
281
+ *
282
+ * This error occurs when a validation process on a request fails. It extends the IntrigError interface
283
+ * by adding specific properties related to request validation.
284
+ *
285
+ * @template T - The type of the data associated with the error.
286
+ * @template E - The optional type of additional error information. Defaults to unknown.
287
+ *
288
+ * @extends IntrigError<T, E>
289
+ *
290
+ * @property {string} type - A string literal indicating the error type as 'request-validation'.
291
+ * @property {ZodError} error - An instance of ZodError containing detailed validation error information.
292
+ */
293
+
294
+ /**
295
+ * Constructs a RequestValidationError object encapsulating the ZodError.
296
+ *
297
+ * @param {ZodError} error - The error object resulting from Zod schema validation.
298
+ * @return {RequestValidationError<T, E>} A RequestValidationError object containing the validation error information.
299
+ */
300
+ function requestValidationError(error) {
301
+ return {
302
+ type: 'request-validation',
303
+ error
304
+ };
305
+ }
306
+
307
+ /**
308
+ * Determines if a given error is of type RequestValidationError.
309
+ *
310
+ * @param value The error object to check, which implements the IntrigError interface.
311
+ * @return A boolean indicating whether the error is a RequestValidationError.
312
+ */
313
+ function isRequestValidationError(value) {
314
+ return value.type === 'request-validation';
315
+ }
316
+
317
+ /**
318
+ * ResponseValidationError interface is designed to extend the capabilities of the IntrigError interface,
319
+ * specifically for handling errors related to response validation.
320
+ *
321
+ * @template T - Represents the type of the data or payload associated with the error.
322
+ * @template E - Represents the type of any additional error information. Defaults to unknown.
323
+ *
324
+ * @extends IntrigError
325
+ *
326
+ * @property type - A string literal that identifies the type of error as 'response-validation'.
327
+ * @property error - An instance of ZodError representing the validation error encountered.
328
+ */
329
+
330
+ /**
331
+ * Constructs a ResponseValidationError object with a specified error.
332
+ *
333
+ * @param {ZodError} error - The validation error encountered during response validation.
334
+ * @return {ResponseValidationError<T, E>} An error object containing the type of error and the validation error details.
335
+ */
336
+ function responseValidationError(error) {
337
+ return {
338
+ type: 'response-validation',
339
+ error
340
+ };
341
+ }
342
+
343
+ /**
344
+ * Determines if the given error is a response validation error.
345
+ *
346
+ * @param {IntrigError<T, E>} value - The error object to assess.
347
+ * @return {boolean} True if the error is a response validation error, otherwise false.
348
+ */
349
+ function isResponseValidationError(value) {
350
+ return value.type === 'response-validation';
351
+ }
352
+
353
+ export { error, init, isError, isInit, isNetworkError, isPending, isRequestValidationError, isResponseValidationError, isSuccess, isSuccessfulDispatch, isValidationError, networkError, pending, requestValidationError, responseValidationError, success, successfulDispatch, validationError };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@intrig/react",
3
- "version": "0.0.15-27",
3
+ "version": "0.0.15-29",
4
4
  "type": "module",
5
- "main": "./index.esm.js",
6
- "module": "./index.esm.js",
7
- "types": "./index.esm.d.ts",
5
+ "main": "./index.js",
6
+ "module": "./index.js",
7
+ "types": "./src/index.d.ts",
8
8
  "dependencies": {
9
9
  "axios": "^1.7.7",
10
10
  "date-fns": "^4.1.0",
@@ -12,7 +12,6 @@
12
12
  "fast-xml-parser": "^4.5.0",
13
13
  "immer": "^10.1.1",
14
14
  "loglevel": "1.8.1",
15
- "module-alias": "^2.2.2",
16
15
  "zod": "^3.23.8"
17
16
  },
18
17
  "devDependencies": {
@@ -28,16 +27,24 @@
28
27
  "react": "^18.0.0 || ^19.0.0",
29
28
  "react-dom": "^18.0.0 || ^19.0.0"
30
29
  },
31
- "_moduleAliases": {
32
- "@intrig/react": "./src"
33
- },
34
30
  "exports": {
35
31
  "./package.json": "./package.json",
36
32
  ".": {
37
- "development": "./src/index.ts",
38
- "types": "./index.esm.d.ts",
39
- "import": "./index.esm.js",
40
- "default": "./index.esm.js"
33
+ "types": "./src/index.d.ts",
34
+ "import": "./index.js",
35
+ "default": "./index.js"
36
+ },
37
+ "./*": {
38
+ "types": "./src/*.d.ts",
39
+ "import": "./*.js",
40
+ "default": "./*.js"
41
+ }
42
+ },
43
+ "typesVersions": {
44
+ "*": {
45
+ "*": [
46
+ "src/*"
47
+ ]
41
48
  }
42
49
  }
43
50
  }
package/src/extra.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BinaryFunctionHook, BinaryHookOptions, BinaryProduceHook, ConstantHook, NetworkState, UnaryFunctionHook, UnaryHookOptions, UnaryProduceHook, UnitHook, UnitHookOptions } from '@intrig/react/network-state';
1
+ import { BinaryFunctionHook, BinaryHookOptions, BinaryProduceHook, ConstantHook, NetworkState, UnaryFunctionHook, UnaryHookOptions, UnaryProduceHook, UnitHook, UnitHookOptions } from './network-state';
2
2
  /**
3
3
  * Converts a given hook into a promise-based function.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"extra.d.ts","sourceRoot":"","sources":["../../../lib/src/extra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EAQZ,YAAY,EAGZ,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,eAAe,EAChB,MAAM,6BAA6B,CAAC;AAWrC;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC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AS,CAAC;AAEb,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EACzC,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,EACxB,OAAO,EAAE,eAAe,GACvB,CAAC,GAAG,SAAS,CAAC;AAEjB,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EACzC,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAC5B,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC3B,SAAS,CAAC;AAEb,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC5C,IAAI,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAChC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC3B,CAAC,GAAG,SAAS,CAAC;AAEjB,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC5C,IAAI,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAChC,OAAO,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC/B,SAAS,CAAC;AAEb,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/C,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACpC,OAAO,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC/B,CAAC,GAAG,SAAS,CAAC"}
@@ -1,7 +1,7 @@
1
- import { NetworkAction, NetworkState } from '@intrig/react/network-state';
1
+ import { NetworkAction, NetworkState } from './network-state';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { ZodSchema } from 'zod';
4
- import { DefaultConfigs } from '@intrig/react/intrig-provider';
4
+ import type { DefaultConfigs } from './intrig-provider';
5
5
  type GlobalState = Record<string, NetworkState>;
6
6
  interface RequestType<T = any> extends AxiosRequestConfig {
7
7
  originalData?: T;
@@ -1 +1 @@
1
- {"version":3,"file":"intrig-context.d.ts","sourceRoot":"","sources":["../../../lib/src/intrig-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAEhD,UAAU,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,kBAAkB;IACvD,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,CAAC;IACnB,aAAa,EAAE,WAAW,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,CAAC,CAAC,EACT,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,EAC1C,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,EAChC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,KAClC,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED;;;;;GAKG;AACH,QAAA,MAAM,OAAO,sCAUX,CAAC;AAEH,wBAAgB,gBAAgB,gBAE/B;AAED,OAAO,EAAC,OAAO,EAAC,CAAC;AACjB,YAAY,E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