checkly 0.0.0-pr.1045.ff280ee → 0.0.0-pr.1045.ffecb55
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/commands/import/apply.d.ts +4 -0
- package/dist/commands/import/apply.js +73 -14
- package/dist/commands/import/apply.js.map +1 -1
- package/dist/commands/import/cancel.d.ts +1 -0
- package/dist/commands/import/cancel.js +16 -3
- package/dist/commands/import/cancel.js.map +1 -1
- package/dist/commands/import/commit.d.ts +4 -0
- package/dist/commands/import/commit.js +57 -16
- package/dist/commands/import/commit.js.map +1 -1
- package/dist/commands/import/plan.js +222 -69
- package/dist/commands/import/plan.js.map +1 -1
- package/dist/constructs/check-group-codegen.d.ts +3 -0
- package/dist/constructs/check-group-codegen.js +10 -0
- package/dist/constructs/check-group-codegen.js.map +1 -1
- package/dist/constructs/status-page-codegen.js +2 -1
- package/dist/constructs/status-page-codegen.js.map +1 -1
- package/dist/constructs/status-page-service-codegen.d.ts +2 -0
- package/dist/constructs/status-page-service-codegen.js +11 -1
- package/dist/constructs/status-page-service-codegen.js.map +1 -1
- package/dist/constructs/status-page-service.d.ts +10 -0
- package/dist/constructs/status-page-service.js +19 -1
- package/dist/constructs/status-page-service.js.map +1 -1
- package/dist/services/util.js +11 -3
- package/dist/services/util.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +8 -2
- package/package.json +5 -36
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AuthCommand } from '../authCommand';
|
|
2
|
+
import { ImportPlan } from '../../rest/projects';
|
|
3
|
+
import { BaseCommand } from '../baseCommand';
|
|
2
4
|
export default class ImportApplyCommand extends AuthCommand {
|
|
3
5
|
#private;
|
|
4
6
|
static hidden: boolean;
|
|
@@ -8,3 +10,5 @@ export default class ImportApplyCommand extends AuthCommand {
|
|
|
8
10
|
};
|
|
9
11
|
run(): Promise<void>;
|
|
10
12
|
}
|
|
13
|
+
export declare function confirmApply(this: BaseCommand): Promise<boolean>;
|
|
14
|
+
export declare function performApplyAction(this: BaseCommand, plan: ImportPlan): Promise<void>;
|
|
@@ -26,13 +26,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.performApplyAction = exports.confirmApply = void 0;
|
|
29
30
|
const core_1 = require("@oclif/core");
|
|
30
31
|
const prompts_1 = __importDefault(require("prompts"));
|
|
32
|
+
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
33
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
34
|
const api = __importStar(require("../../rest/api"));
|
|
32
35
|
const authCommand_1 = require("../authCommand");
|
|
33
36
|
const common_messages_1 = __importDefault(require("../../messages/common-messages"));
|
|
34
37
|
const util_1 = require("../../services/util");
|
|
35
38
|
const checkly_config_loader_1 = require("../../services/checkly-config-loader");
|
|
39
|
+
const commit_1 = require("./commit");
|
|
36
40
|
class ImportApplyCommand extends authCommand_1.AuthCommand {
|
|
37
41
|
static hidden = false;
|
|
38
42
|
static description = 'Attach imported resources into your project in a pending state.';
|
|
@@ -51,22 +55,17 @@ class ImportApplyCommand extends authCommand_1.AuthCommand {
|
|
|
51
55
|
const { data: unappliedPlans } = await api.projects.findImportPlans(logicalId, {
|
|
52
56
|
onlyUnapplied: true,
|
|
53
57
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
if (unappliedPlans.length === 0) {
|
|
59
|
+
this.log(`${chalk_1.default.red('No plans available to apply.')}`);
|
|
60
|
+
return;
|
|
57
61
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
if (this.fancy) {
|
|
66
|
-
core_1.ux.action.stop('❌');
|
|
67
|
-
}
|
|
68
|
-
throw err;
|
|
62
|
+
const plan = await this.#selectPlan(unappliedPlans);
|
|
63
|
+
await performApplyAction.call(this, plan);
|
|
64
|
+
const commit = await commit_1.confirmCommit.call(this);
|
|
65
|
+
if (!commit) {
|
|
66
|
+
return;
|
|
69
67
|
}
|
|
68
|
+
await commit_1.performCommitAction.call(this, plan);
|
|
70
69
|
}
|
|
71
70
|
async #selectPlan(plans) {
|
|
72
71
|
const choices = plans.map((plan, index) => ({
|
|
@@ -98,4 +97,64 @@ class ImportApplyCommand extends authCommand_1.AuthCommand {
|
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
exports.default = ImportApplyCommand;
|
|
100
|
+
async function confirmApply() {
|
|
101
|
+
const { apply } = await (0, prompts_1.default)({
|
|
102
|
+
name: 'apply',
|
|
103
|
+
type: 'confirm',
|
|
104
|
+
message: 'Would you like to apply the plan now?',
|
|
105
|
+
});
|
|
106
|
+
if (apply) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
this.log();
|
|
110
|
+
this.log(`\
|
|
111
|
+
To apply your plan at a later time, please run:
|
|
112
|
+
|
|
113
|
+
npx checkly import apply
|
|
114
|
+
|
|
115
|
+
To cancel the plan, run:
|
|
116
|
+
|
|
117
|
+
npx checkly import cancel
|
|
118
|
+
`);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
exports.confirmApply = confirmApply;
|
|
122
|
+
async function performApplyAction(plan) {
|
|
123
|
+
if (this.fancy) {
|
|
124
|
+
core_1.ux.action.start('Applying plan');
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
await api.projects.applyImportPlan(plan.id);
|
|
128
|
+
if (this.fancy) {
|
|
129
|
+
core_1.ux.action.stop('✅ ');
|
|
130
|
+
this.log();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
if (this.fancy) {
|
|
135
|
+
core_1.ux.action.stop('❌');
|
|
136
|
+
this.log();
|
|
137
|
+
}
|
|
138
|
+
throw err;
|
|
139
|
+
}
|
|
140
|
+
this.log(`${log_symbols_1.default.success} ${chalk_1.default.bold('Your import plan has been applied!')}`);
|
|
141
|
+
this.log();
|
|
142
|
+
this.log(`\
|
|
143
|
+
The code generated for the import plan is now linked to the underlying
|
|
144
|
+
resources. In other words, if you deploy now, you are modifying the actual
|
|
145
|
+
resources. You may still cancel the plan but any changes you've deployed
|
|
146
|
+
cannot be undone.
|
|
147
|
+
|
|
148
|
+
${log_symbols_1.default.info} \
|
|
149
|
+
${chalk_1.default.cyan('For safety, resources are not deletable until the plan has been committed.')}
|
|
150
|
+
|
|
151
|
+
The final step will be to commit your plan, at which point the underlying
|
|
152
|
+
resources will be fully managed by the Checkly CLI in the exact same
|
|
153
|
+
capacity as any other CLI-native resource.
|
|
154
|
+
|
|
155
|
+
${log_symbols_1.default.warning} \
|
|
156
|
+
${chalk_1.default.yellow('The plan cannot be cancelled after it has been committed.')}
|
|
157
|
+
`);
|
|
158
|
+
}
|
|
159
|
+
exports.performApplyAction = performApplyAction;
|
|
101
160
|
//# sourceMappingURL=apply.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/commands/import/apply.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/commands/import/apply.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAuC;AACvC,sDAA6B;AAC7B,8DAAoC;AACpC,kDAAyB;AAEzB,oDAAqC;AACrC,gDAA4C;AAC5C,qFAA2D;AAC3D,8CAAyD;AACzD,gFAAwE;AAGxE,qCAA6D;AAE7D,MAAqB,kBAAmB,SAAQ,yBAAW;IACzD,MAAM,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,MAAM,CAAC,WAAW,GAAG,iEAAiE,CAAA;IAEtF,MAAM,CAAC,KAAK,GAAG;QACb,MAAM,EAAE,YAAK,CAAC,MAAM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AAC,OAAO;EACpB,eAAK,CAAC,MAAM,CAAC,2DAA2D,CAAC;CAC1E,CAAC,CAAA;AACF,CAAC;AAvCD,gDAuCC"}
|
|
@@ -5,6 +5,7 @@ export default class ImportCancelCommand extends AuthCommand {
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static flags: {
|
|
7
7
|
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
};
|
|
9
10
|
run(): Promise<void>;
|
|
10
11
|
}
|
|
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const core_1 = require("@oclif/core");
|
|
30
30
|
const prompts_1 = __importDefault(require("prompts"));
|
|
31
31
|
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
32
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
32
33
|
const api = __importStar(require("../../rest/api"));
|
|
33
34
|
const authCommand_1 = require("../authCommand");
|
|
34
35
|
const common_messages_1 = __importDefault(require("../../messages/common-messages"));
|
|
@@ -42,19 +43,29 @@ class ImportCancelCommand extends authCommand_1.AuthCommand {
|
|
|
42
43
|
char: 'c',
|
|
43
44
|
description: common_messages_1.default.configFile,
|
|
44
45
|
}),
|
|
46
|
+
all: core_1.Flags.boolean({
|
|
47
|
+
description: 'Cancel all plans.',
|
|
48
|
+
default: false,
|
|
49
|
+
}),
|
|
45
50
|
};
|
|
46
51
|
async run() {
|
|
47
52
|
const { flags } = await this.parse(ImportCancelCommand);
|
|
48
|
-
const { config: configFilename, } = flags;
|
|
53
|
+
const { config: configFilename, all, } = flags;
|
|
49
54
|
const { configDirectory, configFilenames } = (0, util_1.splitConfigFilePath)(configFilename);
|
|
50
55
|
const { config: checklyConfig, } = await (0, checkly_config_loader_1.loadChecklyConfig)(configDirectory, configFilenames);
|
|
51
56
|
const { logicalId, } = checklyConfig;
|
|
52
57
|
const { data: cancelablePlans } = await api.projects.findImportPlans(logicalId, {
|
|
53
58
|
onlyUncommitted: true,
|
|
54
59
|
});
|
|
55
|
-
|
|
60
|
+
if (cancelablePlans.length === 0) {
|
|
61
|
+
this.log(`${chalk_1.default.red('No plans available to cancel.')}`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const plans = all
|
|
65
|
+
? cancelablePlans
|
|
66
|
+
: await this.#selectPlans(cancelablePlans);
|
|
56
67
|
if (this.fancy) {
|
|
57
|
-
core_1.ux.action.start('Canceling
|
|
68
|
+
core_1.ux.action.start('Canceling plan(s)');
|
|
58
69
|
}
|
|
59
70
|
try {
|
|
60
71
|
for (const plan of plans) {
|
|
@@ -63,11 +74,13 @@ class ImportCancelCommand extends authCommand_1.AuthCommand {
|
|
|
63
74
|
}
|
|
64
75
|
if (this.fancy) {
|
|
65
76
|
core_1.ux.action.stop('✅ ');
|
|
77
|
+
this.log();
|
|
66
78
|
}
|
|
67
79
|
}
|
|
68
80
|
catch (err) {
|
|
69
81
|
if (this.fancy) {
|
|
70
82
|
core_1.ux.action.stop('❌');
|
|
83
|
+
this.log();
|
|
71
84
|
}
|
|
72
85
|
throw err;
|
|
73
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/commands/import/cancel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAuC;AACvC,sDAA6B;AAC7B,8DAAoC;
|
|
1
|
+
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/commands/import/cancel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAuC;AACvC,sDAA6B;AAC7B,8DAAoC;AACpC,kDAAyB;AAEzB,oDAAqC;AACrC,gDAA4C;AAC5C,qFAA2D;AAC3D,8CAAyD;AACzD,gFAAwE;AAGxE,MAAqB,mBAAoB,SAAQ,yBAAW;IAC1D,MAAM,CAAC,M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ACrB,OAAO,CAAC,IAAI,CAAC;gBACX,KAAK,EAAE,kBAAkB;gBACzB,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,yCAAyC;aACvD,CAAC,CAAA;QACJ,CAAC;QAED,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAsB,CAAC,CAAA;QAEhG,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,iBAAO,EAAC;YAC/B,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,SAAS,KAAK,CAAC,MAAM,2CAA2C;YACzE,OAAO;SACR,CAAC,CAAA;QAEF,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;YAC/C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACd,CAAC;QAED,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,OAAO,KAAK,CAAA;QACd,CAAC;QAED,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAClC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACvD,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAA;IACf,CAAC;;AAjHH,sCAkHC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AuthCommand } from '../authCommand';
|
|
2
|
+
import { ImportPlan } from '../../rest/projects';
|
|
3
|
+
import { BaseCommand } from '../baseCommand';
|
|
2
4
|
export default class ImportCommitCommand extends AuthCommand {
|
|
3
5
|
#private;
|
|
4
6
|
static hidden: boolean;
|
|
@@ -8,3 +10,5 @@ export default class ImportCommitCommand extends AuthCommand {
|
|
|
8
10
|
};
|
|
9
11
|
run(): Promise<void>;
|
|
10
12
|
}
|
|
13
|
+
export declare function confirmCommit(this: BaseCommand): Promise<boolean>;
|
|
14
|
+
export declare function performCommitAction(this: BaseCommand, plan: ImportPlan): Promise<void>;
|
|
@@ -26,9 +26,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.performCommitAction = exports.confirmCommit = void 0;
|
|
29
30
|
const core_1 = require("@oclif/core");
|
|
30
31
|
const prompts_1 = __importDefault(require("prompts"));
|
|
31
32
|
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
33
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
32
34
|
const api = __importStar(require("../../rest/api"));
|
|
33
35
|
const authCommand_1 = require("../authCommand");
|
|
34
36
|
const common_messages_1 = __importDefault(require("../../messages/common-messages"));
|
|
@@ -56,23 +58,12 @@ class ImportCommitCommand extends authCommand_1.AuthCommand {
|
|
|
56
58
|
const uncommittedPlans = data.filter(plan => {
|
|
57
59
|
return plan.appliedAt;
|
|
58
60
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
await api.projects.commitImportPlan(plan.id);
|
|
65
|
-
if (this.fancy) {
|
|
66
|
-
core_1.ux.action.stop('✅ ');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
if (this.fancy) {
|
|
71
|
-
core_1.ux.action.stop('❌');
|
|
72
|
-
}
|
|
73
|
-
throw err;
|
|
61
|
+
if (uncommittedPlans.length === 0) {
|
|
62
|
+
this.log(`${chalk_1.default.red('No plans available to commit.')}`);
|
|
63
|
+
return;
|
|
74
64
|
}
|
|
75
|
-
|
|
65
|
+
const plan = await this.#selectPlan(uncommittedPlans);
|
|
66
|
+
await performCommitAction.call(this, plan);
|
|
76
67
|
}
|
|
77
68
|
async #selectPlan(plans) {
|
|
78
69
|
const choices = plans.map((plan, index) => ({
|
|
@@ -104,4 +95,54 @@ class ImportCommitCommand extends authCommand_1.AuthCommand {
|
|
|
104
95
|
}
|
|
105
96
|
}
|
|
106
97
|
exports.default = ImportCommitCommand;
|
|
98
|
+
async function confirmCommit() {
|
|
99
|
+
const { commit } = await (0, prompts_1.default)({
|
|
100
|
+
name: 'commit',
|
|
101
|
+
type: 'confirm',
|
|
102
|
+
message: 'Would you like to commit the plan now?',
|
|
103
|
+
});
|
|
104
|
+
if (commit) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
this.log();
|
|
108
|
+
this.log(`\
|
|
109
|
+
To commit your plan at a later time, please run:
|
|
110
|
+
|
|
111
|
+
npx checkly import commit
|
|
112
|
+
|
|
113
|
+
To cancel the plan, run:
|
|
114
|
+
|
|
115
|
+
npx checkly import cancel
|
|
116
|
+
`);
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
exports.confirmCommit = confirmCommit;
|
|
120
|
+
async function performCommitAction(plan) {
|
|
121
|
+
if (this.fancy) {
|
|
122
|
+
core_1.ux.action.start('Committing plan');
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
await api.projects.commitImportPlan(plan.id);
|
|
126
|
+
if (this.fancy) {
|
|
127
|
+
core_1.ux.action.stop('✅ ');
|
|
128
|
+
this.log();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
if (this.fancy) {
|
|
133
|
+
core_1.ux.action.stop('❌');
|
|
134
|
+
this.log();
|
|
135
|
+
}
|
|
136
|
+
throw err;
|
|
137
|
+
}
|
|
138
|
+
this.log(`${log_symbols_1.default.success} ${chalk_1.default.bold('Your import plan has been committed!')}`);
|
|
139
|
+
this.log();
|
|
140
|
+
this.log(`\
|
|
141
|
+
The underlying resources are now fully managed by the Checkly CLI the same
|
|
142
|
+
way as any other CLI-native resource, and the import process is finished.
|
|
143
|
+
|
|
144
|
+
Enjoy!
|
|
145
|
+
`);
|
|
146
|
+
}
|
|
147
|
+
exports.performCommitAction = performCommitAction;
|
|
107
148
|
//# sourceMappingURL=commit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../../src/commands/import/commit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../../src/commands/import/commit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAuC;AACvC,sDAA6B;AAC7B,8DAAoC;AACpC,kDAAyB;AAEzB,oDAAqC;AACrC,gDAA4C;AAC5C,qFAA2D;AAC3D,8CAAyD;AACzD,gFAAwE;AAIxE,MAAqB,mBAAoB,SAAQ,yBAAW;IAC1D,MAAM,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,MAAM,CAAC,WAAW,GAAG,0DAA0D,CAAA;IAE/E,MAAM,CAAC,KAAK,GAAG;QACb,MAAM,EAAE,YAAK,CAAC,MAAM,CAAC;YACnB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,yBAAc,CAAC,UAAU;SACvC,CAAC;KACH,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;QACvD,MAAM,EACJ,MAAM,EAAE,cAAc,GACvB,GAAG,KAAK,CAAA;QAET,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,IAAA,0BAAmB,EAAC,cAAc,CAAC,CAAA;QAChF,MAAM,EACJ,MAAM,EAAE,aAAa,GACtB,GAAG,MAAM,IAAA,yCAAiB,EAAC,eAAe,EAAE,eAAe,CAAC,CAAA;QAE7D,MAAM,EACJ,SAAS,GACV,GAAG,aAAa,CAAA;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