@nexus-ioc/language-service 0.1.0 → 0.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.
Files changed (48) hide show
  1. package/README.md +46 -71
  2. package/dist/actions/get-completion-info.actions.js +4 -6
  3. package/dist/actions/get-completion-info.actions.js.map +1 -1
  4. package/dist/actions/get-semantic-diagnostics.actions.d.ts +13 -0
  5. package/dist/actions/get-semantic-diagnostics.actions.js +467 -48
  6. package/dist/actions/get-semantic-diagnostics.actions.js.map +1 -1
  7. package/dist/actions/go-to-dependency-definition.actions.d.ts +18 -0
  8. package/dist/actions/go-to-dependency-definition.actions.js +73 -0
  9. package/dist/actions/go-to-dependency-definition.actions.js.map +1 -0
  10. package/dist/index.d.ts +10 -0
  11. package/dist/index.js +37 -4
  12. package/dist/index.js.map +1 -1
  13. package/dist/language-service/ns-language-service.d.ts +6 -5
  14. package/dist/language-service/ns-language-service.js +8 -2
  15. package/dist/language-service/ns-language-service.js.map +1 -1
  16. package/dist/language-service/parse-config-service.js +1 -0
  17. package/dist/language-service/parse-config-service.js.map +1 -1
  18. package/dist/language-service/types.d.ts +0 -1
  19. package/dist/logger.js +1 -0
  20. package/dist/logger.js.map +1 -1
  21. package/package.json +19 -11
  22. package/dist/helpers/check-types.helper.d.ts +0 -3
  23. package/dist/helpers/check-types.helper.js +0 -30
  24. package/dist/helpers/check-types.helper.js.map +0 -1
  25. package/dist/helpers/compare-string-types.helper.d.ts +0 -4
  26. package/dist/helpers/compare-string-types.helper.js +0 -16
  27. package/dist/helpers/compare-string-types.helper.js.map +0 -1
  28. package/dist/helpers/find-node-at-position.helper.d.ts +0 -2
  29. package/dist/helpers/find-node-at-position.helper.js +0 -16
  30. package/dist/helpers/find-node-at-position.helper.js.map +0 -1
  31. package/dist/helpers/find-type-references.helper.d.ts +0 -8
  32. package/dist/helpers/find-type-references.helper.js +0 -51
  33. package/dist/helpers/find-type-references.helper.js.map +0 -1
  34. package/dist/helpers/get-type-of-node.helper.d.ts +0 -2
  35. package/dist/helpers/get-type-of-node.helper.js +0 -14
  36. package/dist/helpers/get-type-of-node.helper.js.map +0 -1
  37. package/dist/parsers/inject.parser.d.ts +0 -16
  38. package/dist/parsers/inject.parser.js +0 -44
  39. package/dist/parsers/inject.parser.js.map +0 -1
  40. package/dist/parsers/injectable.parser.d.ts +0 -5
  41. package/dist/parsers/injectable.parser.js +0 -13
  42. package/dist/parsers/injectable.parser.js.map +0 -1
  43. package/dist/parsers/ns-module.parser.d.ts +0 -45
  44. package/dist/parsers/ns-module.parser.js +0 -237
  45. package/dist/parsers/ns-module.parser.js.map +0 -1
  46. package/dist/parsers/ns-modules.parser.d.ts +0 -7
  47. package/dist/parsers/ns-modules.parser.js +0 -35
  48. package/dist/parsers/ns-modules.parser.js.map +0 -1
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InjectParser = void 0;
4
- const tsquery_1 = require("@phenomnomnominal/tsquery");
5
- // biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
6
- class InjectParser {
7
- static execute(classDeclaration, logger) {
8
- const params = [];
9
- logger.log(`[InjectParser][execute] ${classDeclaration.getText()}`);
10
- const injectConstructorParams = tsquery_1.tsquery.query(classDeclaration, `Constructor > Parameter:has(Decorator > CallExpression > Identifier[name="Inject"])`);
11
- for (const injectConstructorParam of injectConstructorParams) {
12
- const [dependencyStringName] = tsquery_1.tsquery.query(injectConstructorParam, "Decorator > CallExpression StringLiteral") || [];
13
- const [dependencyLink] = tsquery_1.tsquery.query(injectConstructorParam, "Decorator > CallExpression Identifier:not([name='Inject'])") || [];
14
- const dependencyName = dependencyStringName || dependencyLink;
15
- if (!dependencyName) {
16
- continue;
17
- }
18
- const start = injectConstructorParam.getStart();
19
- const end = injectConstructorParam.getEnd();
20
- const parameterName = injectConstructorParam.name.getText();
21
- const parameterType = InjectParser.getParameterTypeNode(injectConstructorParam);
22
- params.push({
23
- name: dependencyName,
24
- location: "constructor",
25
- declaration: injectConstructorParam,
26
- start,
27
- end,
28
- length: end - start,
29
- parameterName,
30
- parameterType,
31
- });
32
- }
33
- // const injectPropertyParams = tsquery.query<ts.PropertyDeclaration>(
34
- // classDeclaration,
35
- // selectorInjectProperty,
36
- // );
37
- return params;
38
- }
39
- static getParameterTypeNode(param) {
40
- return param.type;
41
- }
42
- }
43
- exports.InjectParser = InjectParser;
44
- //# sourceMappingURL=inject.parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject.parser.js","sourceRoot":"","sources":["../../src/parsers/inject.parser.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAepD,gEAAgE;AAChE,MAAa,YAAY;IACjB,MAAM,CAAC,OAAO,CAAC,gBAAqC,EAAE,MAAc;QAC1E,MAAM,MAAM,GAAiC,EAAE,CAAC;QAChD,MAAM,CAAC,GAAG,CAAC,2BAA2B,gBAAgB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpE,MAAM,uBAAuB,GAAG,iBAAO,CAAC,KAAK,CAC5C,gBAAgB,EAChB,qFAAqF,CACrF,CAAC;QAEF,KAAK,MAAM,sBAAsB,IAAI,uBAAuB,EAAE,CAAC;YAC9D,MAAM,CAAC,oBAAoB,CAAC,GAC3B,iBAAO,CAAC,KAAK,CACZ,sBAAsB,EACtB,0CAA0C,CAC1C,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,cAAc,CAAC,GACrB,iBAAO,CAAC,KAAK,CACZ,sBAAsB,EACtB,4DAA4D,CAC5D,IAAI,EAAE,CAAC;YAET,MAAM,cAAc,GAAG,oBAAoB,IAAI,cAAc,CAAC;YAE9D,IAAI,CAAC,cAAc,EAAE,CAAC;gBACrB,SAAS;YACV,CAAC;YAED,MAAM,KAAK,GAAG,sBAAsB,CAAC,QAAQ,EAAE,CAAC;YAChD,MAAM,GAAG,GAAG,sBAAsB,CAAC,MAAM,EAAE,CAAC;YAC5C,MAAM,aAAa,GAAG,sBAAsB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC5D,MAAM,aAAa,GAAG,YAAY,CAAC,oBAAoB,CACtD,sBAAsB,CACtB,CAAC;YAEF,MAAM,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,cAAc;gBACpB,QAAQ,EAAE,aAAa;gBACvB,WAAW,EAAE,sBAAsB;gBACnC,KAAK;gBACL,GAAG;gBACH,MAAM,EAAE,GAAG,GAAG,KAAK;gBACnB,aAAa;gBACb,aAAa;aACb,CAAC,CAAC;QACJ,CAAC;QAED,sEAAsE;QACtE,qBAAqB;QACrB,2BAA2B;QAC3B,KAAK;QAEL,OAAO,MAAM,CAAC;IACf,CAAC;IAEO,MAAM,CAAC,oBAAoB,CAAC,KAA8B;QACjE,OAAO,KAAK,CAAC,IAAI,CAAC;IACnB,CAAC;CACD;AAzDD,oCAyDC"}
@@ -1,5 +0,0 @@
1
- import { type SourceFile } from "@phenomnomnominal/tsquery";
2
- import type ts from "typescript/lib/tsserverlibrary";
3
- export declare class InjectableParser {
4
- static execute(sourceFile: SourceFile): ts.ClassDeclaration[];
5
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InjectableParser = void 0;
4
- const tsquery_1 = require("@phenomnomnominal/tsquery");
5
- const selector = `ClassDeclaration:has(Decorator > CallExpression > Identifier[name="Injectable"])`;
6
- // biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
7
- class InjectableParser {
8
- static execute(sourceFile) {
9
- return tsquery_1.tsquery.query(sourceFile, selector);
10
- }
11
- }
12
- exports.InjectableParser = InjectableParser;
13
- //# sourceMappingURL=injectable.parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"injectable.parser.js","sourceRoot":"","sources":["../../src/parsers/injectable.parser.ts"],"names":[],"mappings":";;;AAAA,uDAAqE;AAGrE,MAAM,QAAQ,GAAG,kFAAkF,CAAC;AAEpG,gEAAgE;AAChE,MAAa,gBAAgB;IACrB,MAAM,CAAC,OAAO,CAAC,UAAsB;QAC3C,OAAO,iBAAO,CAAC,KAAK,CAAsB,UAAU,EAAE,QAAQ,CAAC,CAAC;IACjE,CAAC;CACD;AAJD,4CAIC"}
@@ -1,45 +0,0 @@
1
- import * as ts from "typescript/lib/tsserverlibrary";
2
- import type { Logger } from "../logger";
3
- export type ProviderType = {
4
- provide: ts.Expression | ts.StringLiteral;
5
- provideType: "class" | "useClass" | "useValue" | "useFactory";
6
- declaration: ts.Expression | ts.Identifier;
7
- start: number;
8
- end: number;
9
- length: number;
10
- };
11
- export type ImportType = {
12
- importType: "local" | "feature" | "global";
13
- declaration: ts.Expression;
14
- start: number;
15
- end: number;
16
- length: number;
17
- };
18
- export type ExportType = {
19
- name?: string;
20
- scope: "internal" | "external";
21
- declaration: ts.Identifier | ts.StringLiteral;
22
- start: number;
23
- end: number;
24
- length: number;
25
- illegal: boolean;
26
- };
27
- export type NsModuleDeclaration = {
28
- moduleName: string;
29
- providers: ProviderType[];
30
- imports: ImportType[];
31
- exports: ExportType[];
32
- start: number;
33
- end: number;
34
- length: number;
35
- sourceFile: ts.SourceFile;
36
- };
37
- export declare class NsModuleParser {
38
- static execute(modules: ts.ClassDeclaration[], typeChecker: ts.TypeChecker, logger: Logger): NsModuleDeclaration[];
39
- private static getNsModuleName;
40
- private static getNsModuleDecoratorValue;
41
- private static parseImports;
42
- private static parseExports;
43
- private static parseProviders;
44
- private static parseUseProvider;
45
- }
@@ -1,237 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NsModuleParser = void 0;
4
- const tslib_1 = require("tslib");
5
- const tsquery_1 = require("@phenomnomnominal/tsquery");
6
- const ts = tslib_1.__importStar(require("typescript/lib/tsserverlibrary"));
7
- const findPropertyInObject = (obj, key) => obj.properties.find((property) => {
8
- return obj.properties.find((property) => {
9
- if (ts.isPropertyAssignment(property) && ts.isIdentifier(property.name)) {
10
- return property.name.text === key;
11
- }
12
- if (ts.isMethodDeclaration(property) && ts.isIdentifier(property.name)) {
13
- return property.name.text === key;
14
- }
15
- return false;
16
- });
17
- });
18
- // biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
19
- class NsModuleParser {
20
- static execute(modules, typeChecker, logger) {
21
- const result = [];
22
- for (const module of modules) {
23
- const moduleName = NsModuleParser.getNsModuleName(module);
24
- if (!NsModuleParser) {
25
- continue;
26
- }
27
- const start = module.getStart();
28
- const end = module.getEnd();
29
- const length = end - start;
30
- const { providers, imports, exports } = NsModuleParser.getNsModuleDecoratorValue(module, typeChecker, logger);
31
- const sourceFile = module.getSourceFile();
32
- result.push({
33
- moduleName,
34
- providers,
35
- imports,
36
- exports,
37
- start,
38
- end,
39
- length,
40
- sourceFile,
41
- });
42
- }
43
- return result;
44
- }
45
- static getNsModuleName(classDeclaration) {
46
- return classDeclaration.name?.getText();
47
- }
48
- static getNsModuleDecoratorValue(classDeclaration, typeChecker, logger) {
49
- const [decoratorValue] = tsquery_1.tsquery.query(classDeclaration, `CallExpression:has(Identifier[name="NsModule"]) > ObjectLiteralExpression`) || [];
50
- const providersRaw = decoratorValue.properties.find((item) => item.name?.getText() === "providers");
51
- const importsRaw = decoratorValue.properties.find((item) => item.name?.getText() === "imports");
52
- const exportsRaw = decoratorValue.properties.find((item) => item.name?.getText() === "exports");
53
- const providers = providersRaw?.initializer
54
- ? NsModuleParser.parseProviders(providersRaw.initializer, logger)
55
- : [];
56
- const imports = importsRaw?.initializer
57
- ? NsModuleParser.parseImports(importsRaw.initializer, logger)
58
- : [];
59
- const exports = exportsRaw?.initializer
60
- ? NsModuleParser.parseExports(exportsRaw.initializer, providers, typeChecker, logger)
61
- : [];
62
- return {
63
- imports,
64
- exports,
65
- providers,
66
- };
67
- }
68
- static parseImports(imports, logger) {
69
- const result = [];
70
- imports.forEachChild((child) => {
71
- if (ts.isIdentifier(child) || ts.isCallExpression(child)) {
72
- const start = child.getStart();
73
- const end = child.getEnd();
74
- const length = end - start;
75
- let importType = null;
76
- let type = ts.isIdentifier(child) ? child : null;
77
- if (ts.isIdentifier(child)) {
78
- importType = "local";
79
- }
80
- else if (ts.isCallExpression(child)) {
81
- const [typeNode] = (0, tsquery_1.tsquery)(child, "PropertyAccessExpression Identifier");
82
- type = typeNode;
83
- const isFeature = Boolean((0, tsquery_1.tsquery)(child, `PropertyAccessExpression Identifier[name="forFeature"]`)?.length);
84
- const isRoot = Boolean((0, tsquery_1.tsquery)(child, `PropertyAccessExpression Identifier[name="forRoot"]`)?.length);
85
- if (isFeature) {
86
- importType = "feature";
87
- }
88
- else if (isRoot) {
89
- importType = "global";
90
- }
91
- }
92
- if (!importType || !type) {
93
- return;
94
- }
95
- result.push({
96
- importType,
97
- start,
98
- end,
99
- length,
100
- declaration: type,
101
- });
102
- return;
103
- }
104
- });
105
- return result;
106
- }
107
- static parseExports(exports, providers, typeChecker, logger) {
108
- const result = [];
109
- exports.forEachChild((child) => {
110
- if (ts.isIdentifier(child)) {
111
- const type = child;
112
- const start = child.getStart();
113
- const end = child.getEnd();
114
- const length = end - start;
115
- let importType = "external";
116
- for (const provider of providers) {
117
- const type1 = typeChecker.getTypeAtLocation(provider.declaration);
118
- const type2 = typeChecker.getTypeAtLocation(type);
119
- if (typeChecker.isTypeAssignableTo(type1, type2) &&
120
- typeChecker.isTypeAssignableTo(type2, type1)) {
121
- importType = "internal";
122
- }
123
- }
124
- result.push({
125
- scope: importType,
126
- declaration: type,
127
- start,
128
- end,
129
- length,
130
- illegal: false,
131
- });
132
- return;
133
- }
134
- if (ts.isStringLiteral(child)) {
135
- const type = child;
136
- const start = child.getStart();
137
- const end = child.getEnd();
138
- const length = end - start;
139
- let depType = "external";
140
- for (const provider of providers) {
141
- if (provider.provide?.getText() === type.text) {
142
- depType = "internal";
143
- }
144
- }
145
- result.push({
146
- name: type.getText(),
147
- scope: depType,
148
- start,
149
- end,
150
- length,
151
- declaration: type,
152
- illegal: depType === "external",
153
- });
154
- return;
155
- }
156
- });
157
- return result;
158
- }
159
- static parseProviders(providers, logger) {
160
- const result = [];
161
- providers.forEachChild((child) => {
162
- if (ts.isIdentifier(child)) {
163
- const start = child.getStart();
164
- const end = child.getEnd();
165
- const length = end - start;
166
- result.push({
167
- provide: child,
168
- provideType: "class",
169
- start,
170
- end,
171
- length,
172
- declaration: child,
173
- });
174
- return;
175
- }
176
- if (ts.isObjectLiteralExpression(child)) {
177
- const provider = NsModuleParser.parseUseProvider(child, logger);
178
- if (provider) {
179
- result.push(provider);
180
- }
181
- return;
182
- }
183
- });
184
- return result;
185
- }
186
- static parseUseProvider(provider, logger) {
187
- const provideNameNode = findPropertyInObject(provider, "provide");
188
- const provideUseClassNode = findPropertyInObject(provider, "useClass");
189
- const provideUseValueNode = findPropertyInObject(provider, "useValue");
190
- const provideUseFactoryNode = findPropertyInObject(provider, "useFactory");
191
- const providerNode = provideUseClassNode || provideUseValueNode || provideUseFactoryNode;
192
- if (!provideNameNode || !providerNode) {
193
- return null;
194
- }
195
- let provide = null;
196
- if (ts.isPropertyAssignment(provideNameNode) &&
197
- ts.isStringLiteral(provideNameNode.initializer)) {
198
- provide = provideNameNode.initializer;
199
- }
200
- else if (ts.isPropertyAssignment(provideNameNode) &&
201
- ts.isExpression(provideNameNode.initializer)) {
202
- provide = provideNameNode.initializer;
203
- }
204
- const providerTypeLink = ts.isPropertyAssignment(providerNode)
205
- ? providerNode.initializer
206
- : null;
207
- if (!provide || !providerTypeLink) {
208
- return null;
209
- }
210
- const start = provideNameNode.getStart();
211
- const end = provideNameNode.getEnd();
212
- const length = end - start;
213
- let provideType = null;
214
- if (provideUseClassNode) {
215
- provideType = "useClass";
216
- }
217
- else if (provideUseValueNode) {
218
- provideType = "useValue";
219
- }
220
- else if (provideUseFactoryNode) {
221
- provideType = "useFactory";
222
- }
223
- if (!provideType) {
224
- return null;
225
- }
226
- return {
227
- provide,
228
- provideType,
229
- declaration: providerTypeLink,
230
- start,
231
- end,
232
- length,
233
- };
234
- }
235
- }
236
- exports.NsModuleParser = NsModuleParser;
237
- //# sourceMappingURL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qB,EAAE,CAAC;YAClC,WAAW,GAAG,YAAY,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,OAAO;YACN,OAAO;YACP,WAAW;YACX,WAAW,EAAE,gBAAgB;YAC7B,KAAK;YACL,GAAG;YACH,MAAM;SACN,CAAC;IACH,CAAC;CACD;AAhUD,wCAgUC"}
@@ -1,7 +0,0 @@
1
- import type * as ts from "typescript/lib/tsserverlibrary";
2
- import type { Logger } from "../logger";
3
- export declare class NsModulesParser {
4
- static execute(sourceFile: ts.SourceFile): ts.ClassDeclaration[];
5
- static executeByClassDependency(sourceFile: ts.SourceFile, classDependency: ts.ClassDeclaration, logger: Logger): ts.ClassDeclaration[];
6
- static executeByModuleName(sourceFile: ts.SourceFile, moduleDeclaration: ts.Identifier, typeChecker: ts.TypeChecker, logger: Logger): ts.ClassDeclaration[];
7
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NsModulesParser = void 0;
4
- const tsquery_1 = require("@phenomnomnominal/tsquery");
5
- const check_types_helper_1 = require("../helpers/check-types.helper");
6
- // biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
7
- class NsModulesParser {
8
- static execute(sourceFile) {
9
- return tsquery_1.tsquery.query(sourceFile, `ClassDeclaration:has(Decorator > CallExpression > Identifier[name="NsModule"])`);
10
- }
11
- static executeByClassDependency(sourceFile, classDependency, logger) {
12
- const modules = NsModulesParser.execute(sourceFile);
13
- const result = [];
14
- for (const module of modules) {
15
- const [existModule] = (0, tsquery_1.tsquery)(module, `Decorator PropertyAssignment:has(Identifier[name="providers"]) ArrayLiteralExpression Identifier[name="${classDependency.name?.text}"]`) || [];
16
- if (existModule) {
17
- result.push(module);
18
- }
19
- }
20
- return result;
21
- }
22
- static executeByModuleName(sourceFile, moduleDeclaration, typeChecker, logger) {
23
- const modules = NsModulesParser.execute(sourceFile);
24
- const result = [];
25
- for (const module of modules) {
26
- const moduleIsEqual = (0, check_types_helper_1.checkTypesHelper)(module, moduleDeclaration, typeChecker, logger);
27
- if (moduleIsEqual) {
28
- result.push(module);
29
- }
30
- }
31
- return result;
32
- }
33
- }
34
- exports.NsModulesParser = NsModulesParser;
35
- //# sourceMappingURL=ns-modules.parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ns-modules.parser.js","sourceRoot":"","sources":["../../src/parsers/ns-modules.parser.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAEpD,sEAAiE;AAGjE,gEAAgE;AAChE,MAAa,eAAe;IACpB,MAAM,CAAC,OAAO,CAAC,UAAyB;QAC9C,OAAO,iBAAO,CAAC,KAAK,CACnB,UAAU,EACV,gFAAgF,CAChF,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,wBAAwB,CACrC,UAAyB,EACzB,eAAoC,EACpC,MAAc;QAEd,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,MAAM,GAA0B,EAAE,CAAC;QAEzC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC9B,MAAM,CAAC,WAAW,CAAC,GAClB,IAAA,iBAAO,EACN,MAAM,EACN,0GAA0G,eAAe,CAAC,IAAI,EAAE,IAAI,IAAI,CACxI,IAAI,EAAE,CAAC;YAET,IAAI,WAAW,EAAE,CAAC;gBACjB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,CAAC;QACF,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,MAAM,CAAC,mBAAmB,CAChC,UAAyB,EACzB,iBAAgC,EAChC,WAA2B,EAC3B,MAAc;QAEd,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,MAAM,GAA0B,EAAE,CAAC;QAEzC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC9B,MAAM,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