@pagopa/selfcare-common-frontend 0.1.4 → 1.2.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/CHANGELOG.md +21 -0
- package/README.md +97 -1
- package/build.info +2 -2
- package/components/EndingPage.d.ts +17 -0
- package/components/EndingPage.js +9 -0
- package/components/EndingPage.js.map +1 -0
- package/components/ErrorBoundary/ErrorBoundary.js +29 -8
- package/components/ErrorBoundary/ErrorBoundary.js.map +1 -1
- package/components/ErrorBoundary/components/BlockingErrorPage.js +3 -2
- package/components/ErrorBoundary/components/BlockingErrorPage.js.map +1 -1
- package/components/FilterModal.d.ts +1 -1
- package/components/Footer/Footer.d.ts +2 -1
- package/components/Footer/Footer.js +10 -5
- package/components/Footer/Footer.js.map +1 -1
- package/components/TitleBox.d.ts +6 -3
- package/components/TitleBox.js +2 -2
- package/components/TitleBox.js.map +1 -1
- package/components/UnloadEventHandler.d.ts +8 -0
- package/components/UnloadEventHandler.js +33 -0
- package/components/UnloadEventHandler.js.map +1 -0
- package/components/UserNotifyHandle.d.ts +7 -0
- package/components/UserNotifyHandle.js +55 -0
- package/components/UserNotifyHandle.js.map +1 -0
- package/components/icons/CheckIllustrationIcon.d.ts +4 -0
- package/components/icons/CheckIllustrationIcon.js +7 -0
- package/components/icons/CheckIllustrationIcon.js.map +1 -0
- package/components/icons/FaultIcon.d.ts +4 -0
- package/components/icons/FaultIcon.js +7 -0
- package/components/icons/FaultIcon.js.map +1 -0
- package/config/env.d.ts +1 -0
- package/config/env.js +1 -0
- package/config/env.js.map +1 -1
- package/hooks/useErrorDispatcher.d.ts +1 -1
- package/hooks/useErrorDispatcher.js +1 -1
- package/hooks/useErrorDispatcher.js.map +1 -1
- package/hooks/useLoading.d.ts +1 -1
- package/hooks/useLoading.js +1 -1
- package/hooks/useLoading.js.map +1 -1
- package/hooks/useLogin.js +9 -7
- package/hooks/useLogin.js.map +1 -1
- package/hooks/useUnloadEventInterceptor.d.ts +17 -0
- package/hooks/useUnloadEventInterceptor.js +60 -0
- package/hooks/useUnloadEventInterceptor.js.map +1 -0
- package/hooks/useUserNotify.d.ts +3 -0
- package/hooks/useUserNotify.js +11 -0
- package/hooks/useUserNotify.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/model/UserNotify.d.ts +23 -0
- package/model/UserNotify.js +3 -0
- package/model/UserNotify.js.map +1 -0
- package/package.json +16 -6
- package/redux/slices/appStateSlice.d.ts +47 -2
- package/redux/slices/appStateSlice.js +43 -0
- package/redux/slices/appStateSlice.js.map +1 -1
- package/redux/slices/userSlice.d.ts +3 -1
- package/redux/slices/userSlice.js.map +1 -1
- package/services/assistanceService.d.ts +1 -0
- package/services/assistanceService.js +19 -0
- package/services/assistanceService.js.map +1 -0
- package/utils/api-utils.d.ts +16 -0
- package/utils/api-utils.js +63 -0
- package/utils/api-utils.js.map +1 -0
- package/utils/constants.d.ts +3 -0
- package/utils/constants.js +3 -0
- package/utils/constants.js.map +1 -1
- package/utils/fixSwagger20ArraySchemaDef.js +67 -0
- package/utils/routes-utils.d.ts +1 -0
- package/utils/routes-utils.js +1 -0
- package/utils/routes-utils.js.map +1 -1
- package/utils/storage-utils.d.ts +3 -0
- package/utils/storage-utils.js +3 -0
- package/utils/storage-utils.js.map +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractResponse = exports.buildFetchApi = exports.onRedirectToLogin = void 0;
|
|
4
|
+
const Either_1 = require("fp-ts/lib/Either");
|
|
5
|
+
const ts_commons_1 = require("@pagopa/ts-commons");
|
|
6
|
+
const fetch_1 = require("@pagopa/ts-commons/lib/fetch");
|
|
7
|
+
const env_1 = require("../config/env");
|
|
8
|
+
const appStateSlice_1 = require("../redux/slices/appStateSlice");
|
|
9
|
+
/** To show an error popup to inform of the not valid session */
|
|
10
|
+
const onRedirectToLogin = (store) => store.dispatch(appStateSlice_1.appStateActions.addError({
|
|
11
|
+
id: 'tokenNotValid',
|
|
12
|
+
error: new Error(),
|
|
13
|
+
techDescription: 'token expired or not valid',
|
|
14
|
+
toNotify: false,
|
|
15
|
+
blocking: false,
|
|
16
|
+
displayableTitle: 'Sessione scaduta',
|
|
17
|
+
displayableDescription: 'Stai per essere rediretto alla pagina di login...',
|
|
18
|
+
}));
|
|
19
|
+
exports.onRedirectToLogin = onRedirectToLogin;
|
|
20
|
+
/** Return the implementation of fetch configured with a timeout */
|
|
21
|
+
const buildFetchApi = (timeoutMs = 300000) => {
|
|
22
|
+
// Must be an https endpoint so we use an https agent
|
|
23
|
+
const abortableFetch = (0, fetch_1.AbortableFetch)(ts_commons_1.agent.getHttpFetch(process.env));
|
|
24
|
+
const fetchWithTimeout = (0, fetch_1.toFetch)((0, fetch_1.setFetchTimeout)(timeoutMs, abortableFetch));
|
|
25
|
+
// tslint:disable-next-line: no-any
|
|
26
|
+
return fetch;
|
|
27
|
+
};
|
|
28
|
+
exports.buildFetchApi = buildFetchApi;
|
|
29
|
+
/** Extract the response of a @pagopa/openapi-codegen-ts generated client rest invocation having status code successHttpStatus.
|
|
30
|
+
If notValidTokenHttpStatus is not null and the returned status is equal to notValidTokenHttpStatus, it will call the onRedirectToLogin function and will schedule the redirect towards logout path.
|
|
31
|
+
If notAuthorizedTokenHttpStatus is not null and the returned status is equal to notAuthorizedTokenHttpStatus, it will throw an Error with message "Operation not allowed".
|
|
32
|
+
If emptyResponseHttpStatus is not null and the returned status is equal to emptyResponseHttpStatus, it will return a promise that resolve to null value.
|
|
33
|
+
Other statuses will return will throw a generic error. */
|
|
34
|
+
const extractResponse = async (response, successHttpStatus, onRedirectToLogin, notValidTokenHttpStatus = 401, notAuthorizedTokenHttpStatus = 403, emptyResponseHttpStatus = 404) => {
|
|
35
|
+
if ((0, Either_1.isRight)(response)) {
|
|
36
|
+
if (response.right.status === successHttpStatus) {
|
|
37
|
+
return response.right.value;
|
|
38
|
+
}
|
|
39
|
+
else if (notValidTokenHttpStatus && response.right.status === notValidTokenHttpStatus) {
|
|
40
|
+
onRedirectToLogin();
|
|
41
|
+
window.setTimeout(() => window.location.assign(env_1.CONFIG.URL_FE.LOGOUT), 2000);
|
|
42
|
+
return new Promise(() => null);
|
|
43
|
+
}
|
|
44
|
+
else if (notAuthorizedTokenHttpStatus &&
|
|
45
|
+
response.right.status === notAuthorizedTokenHttpStatus) {
|
|
46
|
+
throw new Error(`Operation not allowed!`);
|
|
47
|
+
}
|
|
48
|
+
else if (emptyResponseHttpStatus && response.right.status === emptyResponseHttpStatus) {
|
|
49
|
+
return new Promise((resolve) => resolve(null));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
console.error(JSON.stringify(response.right));
|
|
53
|
+
throw new Error(`Unexpected HTTP status! Expected ${successHttpStatus} obtained ${response.right.status}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.error('Something gone wrong while fetching data');
|
|
58
|
+
console.error(JSON.stringify(response.left));
|
|
59
|
+
throw (0, Either_1.toError)(response.left);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.extractResponse = extractResponse;
|
|
63
|
+
//# sourceMappingURL=api-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-utils.js","sourceRoot":"","sources":["../../src/lib/utils/api-utils.ts"],"names":[],"mappings":";;;AACA,6CAAoD;AAEpD,mDAA2C;AAC3C,wDAAwF;AAGxF,uCAAuC;AACvC,iEAAgE;AAEhE,gEAAgE;AACzD,MAAM,iBAAiB,GAAG,CAAC,KAAoB,EAAE,EAAE,CACxD,KAAK,CAAC,QAAQ,CACZ,+BAAe,CAAC,QAAQ,CAAC;IACvB,EAAE,EAAE,eAAe;IACnB,KAAK,EAAE,IAAI,KAAK,EAAE;IAClB,eAAe,EAAE,4BAA4B;IAC7C,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,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A,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC3C;aAAM,IAAI,uBAAuB,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,uBAAuB,EAAE;YACvF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAoB,CAAC,CAAC,CAAC;SAChE;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CACb,oCAAoC,iBAAiB,aAAa,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,CAC1F,CAAC;SACH;KACF;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC1D,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7C,MAAM,IAAA,gBAAO,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KAC9B;AACH,CAAC,CAAC;AAnCW,QAAA,eAAe,mBAmC1B"}
|
package/utils/constants.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { UserRole } from '../model/Party';
|
|
2
|
+
/** The key used to store in the session storage the loggedUser in selfcare projects */
|
|
2
3
|
export declare const STORAGE_KEY_USER = "user";
|
|
4
|
+
/** The key used to store in the session storage the logged user token in selfcare projects */
|
|
3
5
|
export declare const STORAGE_KEY_TOKEN = "token";
|
|
4
6
|
export declare const LOADING_TASK_LOGIN_CHECK = "LOGIN_CHECK";
|
|
7
|
+
/** The short and long labels used for the roles of selfcare's projects */
|
|
5
8
|
export declare const roleLabels: {
|
|
6
9
|
[key in UserRole]: {
|
|
7
10
|
shortLabel: string;
|
package/utils/constants.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.roleLabels = exports.LOADING_TASK_LOGIN_CHECK = exports.STORAGE_KEY_TOKEN = exports.STORAGE_KEY_USER = void 0;
|
|
4
|
+
/** The key used to store in the session storage the loggedUser in selfcare projects */
|
|
4
5
|
exports.STORAGE_KEY_USER = 'user';
|
|
6
|
+
/** The key used to store in the session storage the logged user token in selfcare projects */
|
|
5
7
|
exports.STORAGE_KEY_TOKEN = 'token';
|
|
6
8
|
exports.LOADING_TASK_LOGIN_CHECK = 'LOGIN_CHECK';
|
|
9
|
+
/** The short and long labels used for the roles of selfcare's projects */
|
|
7
10
|
exports.roleLabels = {
|
|
8
11
|
ADMIN: { shortLabel: 'Ref. Amministrativo', longLabel: 'Referente Amministrativo' },
|
|
9
12
|
LIMITED: { shortLabel: 'Ref. Operativo', longLabel: 'Referente Operativo' },
|
package/utils/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/utils/constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/utils/constants.ts"],"names":[],"mappings":";;;AAEA,uFAAuF;AAC1E,QAAA,gBAAgB,GAAG,MAAM,CAAC;AACvC,8FAA8F;AACjF,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAE5B,QAAA,wBAAwB,GAAG,aAAa,CAAC;AAEtD,0EAA0E;AAC7D,QAAA,UAAU,GAAqE;IAC1F,KAAK,EAAE,EAAE,UAAU,EAAE,qBAAqB,EAAE,SAAS,EAAE,0BAA0B,EAAE;IACnF,OAAO,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,qBAAqB,EAAE;CAC5E,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const regexReplace = require('regex-replace');
|
|
3
|
+
|
|
4
|
+
console.log(`Fixing Swagger 2.0 schema array definition in ${process.argv[2]}`);
|
|
5
|
+
|
|
6
|
+
const filePath = process.argv[2];
|
|
7
|
+
|
|
8
|
+
const patternRef =
|
|
9
|
+
/"schema"\s*:\s*\{[^{]+\{\s*"\$ref"\s*:\s*"#\/definitions\/([^"]+)"[^,]+,\s+"type"\s*:\s*"array"[^}]+}((?:\n|.)*"definitions"\s*:\s*\{)/gm;
|
|
10
|
+
const patternRef2 =
|
|
11
|
+
/"schema"\s*:\s*\{\s*"type"\s*:\s*"array"[^{]+\{\s*"\$ref"\s*:\s*"#\/definitions\/([^"]+)"[^}]*}[^}]*}((?:\n|.)*"definitions"\s*:\s*\{)/gm;
|
|
12
|
+
const replaceRef =
|
|
13
|
+
'"schema":{"$ref":"#/definitions/$1Array"}$2"$1Array":{"type": "array", "items": {"$ref": "#/definitions/$1"}},';
|
|
14
|
+
|
|
15
|
+
async function fixArrayDef(patternRef, replaceRef) {
|
|
16
|
+
regexReplace(patternRef, replaceRef, filePath).then((r) => {
|
|
17
|
+
fs.readFile(filePath, 'utf8', function (err, doc) {
|
|
18
|
+
if (doc.match(patternRef)) {
|
|
19
|
+
fixArrayDef(patternRef, replaceRef);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const patternNativeArrayType = (nativeType) =>
|
|
26
|
+
new RegExp(
|
|
27
|
+
`"schema"\\s*:\\s*\\{[^{]+\\{\\s*"type"\\s*:\\s*"${nativeType}"[^,]+,\\s+"type"\\s*:\\s*"array"[^}]+}`,
|
|
28
|
+
'gm'
|
|
29
|
+
);
|
|
30
|
+
const replaceNativeArrayType = (nativeType) =>
|
|
31
|
+
`"schema":{"$ref":"#/definitions/${nativeType.toUpperCase()}Array"}`;
|
|
32
|
+
|
|
33
|
+
const patternNativeTypeRef = /"definitions"\s*:\s*\{/gm;
|
|
34
|
+
const replaceNativeArrayTypeRef = (nativeType) =>
|
|
35
|
+
`"definitions" : {"${nativeType.toUpperCase()}Array":{"type": "array", "items": {"type": "${nativeType}"}},`;
|
|
36
|
+
|
|
37
|
+
async function fixArrayNativeDef(nativeType) {
|
|
38
|
+
await regexReplace(
|
|
39
|
+
patternNativeArrayType(nativeType),
|
|
40
|
+
replaceNativeArrayType(nativeType),
|
|
41
|
+
filePath
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
await regexReplace(patternNativeTypeRef, replaceNativeArrayTypeRef(nativeType), filePath);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const patternNativeType = (nativeType) =>
|
|
48
|
+
new RegExp(`"schema"\\s*:\\s*\\{\\s*"type"\\s*:\\s*"${nativeType}"\\s*}`, 'gm');
|
|
49
|
+
const replaceNativeType = (nativeType) =>
|
|
50
|
+
`"schema":{"$ref":"#/definitions/${nativeType.toUpperCase()}Wrapper"}`;
|
|
51
|
+
const replaceNativeTypeRef = (nativeType) =>
|
|
52
|
+
`"definitions" : {"${nativeType.toUpperCase()}Wrapper":{"type": "${nativeType}"},`;
|
|
53
|
+
|
|
54
|
+
async function fixNativeDef(nativeType) {
|
|
55
|
+
await regexReplace(patternNativeType(nativeType), replaceNativeType(nativeType), filePath);
|
|
56
|
+
|
|
57
|
+
await regexReplace(patternNativeTypeRef, replaceNativeTypeRef(nativeType), filePath);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function exec() {
|
|
61
|
+
await fixArrayDef(patternRef, replaceRef);
|
|
62
|
+
await fixArrayDef(patternRef2, replaceRef);
|
|
63
|
+
await fixArrayNativeDef('string');
|
|
64
|
+
await fixNativeDef('string');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exec();
|
package/utils/routes-utils.d.ts
CHANGED
package/utils/routes-utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolvePathVariables = void 0;
|
|
4
|
+
/** It will resolve the path variables in path using the provided map */
|
|
4
5
|
const resolvePathVariables = (path, pathVariables) => Object.keys(pathVariables).reduce((result, key) => result.replace(`:${key}`, pathVariables[key]), path);
|
|
5
6
|
exports.resolvePathVariables = resolvePathVariables;
|
|
6
7
|
//# sourceMappingURL=routes-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-utils.js","sourceRoot":"","sources":["../../src/lib/utils/routes-utils.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"routes-utils.js","sourceRoot":"","sources":["../../src/lib/utils/routes-utils.tsx"],"names":[],"mappings":";;;AAAA,wEAAwE;AACjE,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,aAAwC,EAAE,EAAE,CAC7F,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,CAC/B,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,EAC9D,IAAI,CACL,CAAC;AAJS,QAAA,oBAAoB,wBAI7B"}
|
package/utils/storage-utils.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
declare type StorageValue = string | number | object;
|
|
2
2
|
declare type StorageValueType = 'string' | 'number' | 'object';
|
|
3
|
+
/** It will delete a key from the local session storage */
|
|
3
4
|
export declare function storageDelete(key: string): void;
|
|
5
|
+
/** It will store a key/value pair in the local session storage */
|
|
4
6
|
export declare function storageWrite(key: string, value: StorageValue, type: StorageValueType): void;
|
|
7
|
+
/** It will read a key from the local session storage */
|
|
5
8
|
export declare function storageRead(key: string, type: StorageValueType): any;
|
|
6
9
|
export {};
|
package/utils/storage-utils.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.storageRead = exports.storageWrite = exports.storageDelete = void 0;
|
|
4
|
+
/** It will delete a key from the local session storage */
|
|
4
5
|
function storageDelete(key) {
|
|
5
6
|
window.sessionStorage.removeItem(key);
|
|
6
7
|
}
|
|
7
8
|
exports.storageDelete = storageDelete;
|
|
9
|
+
/** It will store a key/value pair in the local session storage */
|
|
8
10
|
function storageWrite(key, value, type) {
|
|
9
11
|
const stringifyFn = {
|
|
10
12
|
string: () => value,
|
|
@@ -15,6 +17,7 @@ function storageWrite(key, value, type) {
|
|
|
15
17
|
window.sessionStorage.setItem(key, stringified);
|
|
16
18
|
}
|
|
17
19
|
exports.storageWrite = storageWrite;
|
|
20
|
+
/** It will read a key from the local session storage */
|
|
18
21
|
function storageRead(key, type) {
|
|
19
22
|
const value = window.sessionStorage.getItem(key);
|
|
20
23
|
if (value === null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-utils.js","sourceRoot":"","sources":["../../src/lib/utils/storage-utils.ts"],"names":[],"mappings":";;;AAIA,SAAgB,aAAa,CAAC,GAAW;IACvC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC;AAFD,sCAEC;AAED,SAAgB,YAAY,CAAC,GAAW,EAAE,KAAmB,EAAE,IAAsB;IACnF,MAAM,WAAW,GAAgD;QAC/D,MAAM,EAAE,GAAG,EAAE,CAAC,KAAe;QAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;KACpC,CAAC;IAEF,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;IAExC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAClD,CAAC;AAVD,oCAUC;AAED,SAAgB,WAAW,CAAC,GAAW,EAAE,IAAsB;IAC7D,MAAM,KAAK,GAAkB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEhE,IAAI,KAA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