@rxap/plugin-angular 16.1.0-dev.57 → 16.1.0-dev.58

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 CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [16.1.0-dev.58](https://gitlab.com/rxap/packages/compare/@rxap/plugin-angular@16.1.0-dev.57...@rxap/plugin-angular@16.1.0-dev.58) (2023-10-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - add new route at the start ([5b970e0](https://gitlab.com/rxap/packages/commit/5b970e012b3cdfbaa0597e6480a297c0caff4595))
11
+ - use utility CreateProject function to create a ts-morph Project instance ([78b308f](https://gitlab.com/rxap/packages/commit/78b308fd10747616c7c7f27e81501a4ad5052a77))
12
+
6
13
  # [16.1.0-dev.57](https://gitlab.com/rxap/packages/compare/@rxap/plugin-angular@16.1.0-dev.56...@rxap/plugin-angular@16.1.0-dev.57) (2023-10-12)
7
14
 
8
15
  ### Bug Fixes
package/README.md CHANGED
@@ -19,7 +19,7 @@ yarn add @rxap/plugin-angular
19
19
  ```
20
20
  **Install peer dependencies:**
21
21
  ```bash
22
- yarn add @nx/angular@^16.5.0 @nx/devkit@^16.5.0 @rxap/generator-utilities@^1.1.0-dev.19 @rxap/plugin-localazy@^16.1.0-dev.16 @rxap/plugin-utilities@^16.1.0-dev.21 @rxap/ts-morph@^0.1.0-dev.16 @rxap/utilities@^16.0.0-dev.23 @rxap/workspace-ts-morph@^0.1.0-dev.11 @rxap/workspace-utilities@^0.1.0-dev.23 nx@^16.5.0 ts-morph@^18.0.0 tslib@2.6.2
22
+ yarn add @nx/angular@^16.5.0 @nx/devkit@^16.5.0 @rxap/generator-utilities@^1.1.0-dev.19 @rxap/plugin-localazy@^16.1.0-dev.16 @rxap/plugin-utilities@^16.1.0-dev.21 @rxap/ts-morph@^0.1.0-dev.17 @rxap/utilities@^16.0.0-dev.23 @rxap/workspace-ts-morph@^0.1.0-dev.11 @rxap/workspace-utilities@^0.1.0-dev.23 nx@^16.5.0 ts-morph@^18.0.0 tslib@2.6.2
23
23
  ```
24
24
  **Execute the init generator:**
25
25
  ```bash
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "version": "16.1.0-dev.57",
2
+ "version": "16.1.0-dev.58",
3
3
  "name": "@rxap/plugin-angular",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "dependencies": {
6
- "ignore": "^5.2.4",
6
+ "ignore": "5.2.4",
7
7
  "process": "0.11.10",
8
8
  "semver": "^7.3.5",
9
9
  "tslib": "2.6.2",
@@ -15,7 +15,7 @@
15
15
  "@rxap/generator-utilities": "^1.1.0-dev.19",
16
16
  "@rxap/plugin-localazy": "^16.1.0-dev.16",
17
17
  "@rxap/plugin-utilities": "^16.1.0-dev.21",
18
- "@rxap/ts-morph": "^0.1.0-dev.16",
18
+ "@rxap/ts-morph": "^0.1.0-dev.17",
19
19
  "@rxap/utilities": "^16.0.0-dev.23",
20
20
  "@rxap/workspace-ts-morph": "^0.1.0-dev.11",
21
21
  "@rxap/workspace-utilities": "^0.1.0-dev.23",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  {
70
70
  "package": "@rxap/ts-morph",
71
- "version": "0.1.0-dev.16"
71
+ "version": "0.1.0-dev.17"
72
72
  },
73
73
  {
74
74
  "package": "@rxap/utilities",
@@ -95,7 +95,7 @@
95
95
  },
96
96
  "schematics": "./generators.json",
97
97
  "type": "commonjs",
98
- "gitHead": "cd818f2987632ef7e4ccc0fb3b0a44ba007ce85d",
98
+ "gitHead": "4618ff1e4cbe6cfd826a154d0f361f83c934900a",
99
99
  "main": "./src/index.js",
100
100
  "types": "./src/index.d.ts"
101
101
  }
@@ -1,11 +1,4 @@
1
1
  import { Tree } from '@nx/devkit';
2
- import { SourceFile } from 'ts-morph';
3
2
  import { InitFeatureGeneratorSchema } from './schema';
4
- export interface AngularRoute {
5
- path: string;
6
- loadChildren?: string;
7
- loadComponent?: string;
8
- }
9
- export declare function AddRoute(sourceFile: SourceFile, route: AngularRoute, path?: string[]): void;
10
3
  export declare function initFeatureGenerator(tree: Tree, options: InitFeatureGeneratorSchema): Promise<void>;
11
4
  export default initFeatureGenerator;
@@ -1,92 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initFeatureGenerator = exports.AddRoute = void 0;
3
+ exports.initFeatureGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const generator_utilities_1 = require("@rxap/generator-utilities");
7
- const ts_morph_1 = require("@rxap/ts-morph");
8
7
  const workspace_ts_morph_1 = require("@rxap/workspace-ts-morph");
9
8
  const path = require("path");
10
- const ts_morph_2 = require("ts-morph");
11
- function buildRouteObject(route) {
12
- const obj = {
13
- path: w => w.quote(route.path),
14
- };
15
- if (route.loadChildren) {
16
- obj.loadChildren = `() => import('${route.loadChildren}')`;
17
- }
18
- if (route.loadComponent) {
19
- obj.loadComponent = `() => import('${route.loadComponent}')`;
20
- }
21
- return ts_morph_2.Writers.object(obj);
22
- }
23
- function findParentRoute(ale, path) {
24
- var _a;
25
- for (const e of ale.getElements()) {
26
- if (e instanceof ts_morph_2.ObjectLiteralExpression) {
27
- const pathProperty = e.getProperty('path');
28
- if (pathProperty && pathProperty instanceof ts_morph_2.PropertyAssignment) {
29
- const initializer = pathProperty.getInitializerIfKind(ts_morph_2.SyntaxKind.StringLiteral);
30
- if (initializer) {
31
- const fragment = path.pop();
32
- if (initializer.getLiteralText() === fragment) {
33
- const childrenProperty = (_a = e.getProperty('children')) !== null && _a !== void 0 ? _a : e.addProperty({
34
- name: 'children',
35
- initializer: '[]',
36
- kind: ts_morph_2.StructureKind.PropertyAssignment,
37
- });
38
- if (childrenProperty instanceof ts_morph_2.PropertyAssignment) {
39
- const children = childrenProperty.getInitializerIfKindOrThrow(ts_morph_2.SyntaxKind.ArrayLiteralExpression);
40
- if (path.length) {
41
- // console.log('Continue search for parent route');
42
- return findParentRoute(children, path);
43
- }
44
- else {
45
- // console.log('Found parent route');
46
- return children;
47
- }
48
- }
49
- else {
50
- // console.log('Children property is not a PropertyAssignment');
51
- }
52
- }
53
- else {
54
- // console.log('Path property does not match', initializer.getLiteralText(), fragment);
55
- }
56
- }
57
- else {
58
- // console.log('Path property has no StringLiteral initializer');
59
- }
60
- }
61
- else {
62
- // console.log('Element has no path property');
63
- }
64
- }
65
- else {
66
- // console.log('Element is not an ObjectLiteralExpression');
67
- }
68
- }
69
- return null;
70
- }
71
- function AddRoute(sourceFile, route, path) {
72
- const routes = sourceFile.getVariableDeclaration('ROUTES');
73
- if (routes) {
74
- let initializer = routes.getInitializerIfKindOrThrow(ts_morph_2.SyntaxKind.ArrayLiteralExpression);
75
- if (path === null || path === void 0 ? void 0 : path.length) {
76
- initializer = findParentRoute(initializer, path);
77
- }
78
- if (initializer) {
79
- (0, ts_morph_1.CoerceArrayElement)(initializer, (0, ts_morph_1.FindArrayElementByObjectProperty)('path', route.path), buildRouteObject(route));
80
- }
81
- else {
82
- console.warn('Initializer not found');
83
- }
84
- }
85
- else {
86
- console.warn('appRoutes variable not found');
87
- }
88
- }
89
- exports.AddRoute = AddRoute;
9
+ const add_route_1 = require("../../lib/add-route");
90
10
  function initFeatureGenerator(tree, options) {
91
11
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
92
12
  const projectSourceRoot = (0, generator_utilities_1.GetProjectSourceRoot)(tree, options.project);
@@ -94,7 +14,7 @@ function initFeatureGenerator(tree, options) {
94
14
  (0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
95
15
  project: options.project,
96
16
  }, (_, [sourceFile]) => {
97
- AddRoute(sourceFile, {
17
+ (0, add_route_1.AddRoute)(sourceFile, {
98
18
  path: options.name,
99
19
  loadChildren: '../feature/' + options.name + '/routes',
100
20
  }, ['']);
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/angular/src/generators/init-feature/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAGoB;AACpB,mEAAiE;AACjE,6CAGwB;AACxB,iEAA0E;AAC1E,6BAA6B;AAC7B,uCASkB;AASlB,SAAS,gBAAgB,CAAC,KAAmB;IAC3C,MAAM,GAAG,GAA4C;QACnD,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;KAC/B,CAAC;IACF,IAAI,KAAK,CAAC,YAAY,EAAE;QACtB,GAAG,CAAC,YAAY,GAAG,iBAAkB,KAAK,CAAC,YAAa,IAAI,CAAC;KAC9D;IACD,IAAI,KAAK,CAAC,aAAa,EAAE;QACvB,GAAG,CAAC,aAAa,GAAG,iBAAkB,KAAK,CAAC,aAAc,IAAI,CAAC;KAChE;IACD,OAAO,kBAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,eAAe,CAAC,GAA2B,EAAE,IAAc;;IAClE,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE;QACjC,IAAI,CAAC,YAAY,kCAAuB,EAAE;YACxC,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3C,IAAI,YAAY,IAAI,YAAY,YAAY,6BAAkB,EAAE;gBAC9D,MAAM,WAAW,GAAG,YAAY,CAAC,oBAAoB,CAAC,qBAAU,CAAC,aAAa,CAAC,CAAC;gBAChF,IAAI,WAAW,EAAE;oBACf,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;oBAC5B,IAAI,WAAW,CAAC,cAAc,EAAE,KAAK,QAAQ,EAAE;wBAC7C,MAAM,gBAAgB,GAAG,MAAA,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,mCAAI,CAAC,CAAC,WAAW,CAAC;4BAClE,IAAI,EAAE,U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8BAA8B,CAAC,CAAC;KAC9C;AACH,CAAC;AAfD,4BAeC;AAED,SAAsB,oBAAoB,CACxC,IAAU,EACV,OAAmC;;QAEnC,MAAM,iBAAiB,GAAG,IAAA,0CAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACtE,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9F,IAAA,mDAA8B,EAAC,IAAI,EAAE;YACnC,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,EAAE,CAAC,CAAC,EAAE,CAAE,UAAU,CAAE,EAAE,EAAE;YACvB,QAAQ,CAAC,UAAU,EAAE;gBACnB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,YAAY,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS;aACvD,EAAE,CAAE,EAAE,CAAE,CAAC,CAAC;QACb,CAAC,EAAE,CAAE,sBAAsB,CAAE,CAAC,CAAC;IACjC,CAAC;CAAA;AAdD,oDAcC;AAED,kBAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/angular/src/generators/init-feature/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAGoB;AACpB,mEAAiE;AACjE,iEAA0E;AAC1E,6BAA6B;AAC7B,mDAA+C;AAG/C,SAAsB,oBAAoB,CACxC,IAAU,EACV,OAAmC;;QAEnC,MAAM,iBAAiB,GAAG,IAAA,0CAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACtE,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9F,IAAA,mDAA8B,EAAC,IAAI,EAAE;YACnC,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,EAAE,CAAC,CAAC,EAAE,CAAE,UAAU,CAAE,EAAE,EAAE;YACvB,IAAA,oBAAQ,EAAC,UAAU,EAAE;gBACnB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,YAAY,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS;aACvD,EAAE,CAAE,EAAE,CAAE,CAAC,CAAC;QACb,CAAC,EAAE,CAAE,sBAAsB,CAAE,CAAC,CAAC;IACjC,CAAC;CAAA;AAdD,oDAcC;AAED,kBAAe,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { SourceFile } from 'ts-morph';
2
+ import { AngularRoute } from './build-route-object';
3
+ export declare function AddRoute(sourceFile: SourceFile, route: AngularRoute, path?: string[]): void;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddRoute = void 0;
4
+ const ts_morph_1 = require("@rxap/ts-morph");
5
+ const ts_morph_2 = require("ts-morph");
6
+ const build_route_object_1 = require("./build-route-object");
7
+ const find_parent_route_1 = require("./find-parent-route");
8
+ function AddRoute(sourceFile, route, path) {
9
+ const routes = sourceFile.getVariableDeclaration('ROUTES');
10
+ if (routes) {
11
+ let initializer = routes.getInitializerIfKindOrThrow(ts_morph_2.SyntaxKind.ArrayLiteralExpression);
12
+ if (path === null || path === void 0 ? void 0 : path.length) {
13
+ initializer = (0, find_parent_route_1.FindParentRoute)(initializer, path);
14
+ }
15
+ if (initializer) {
16
+ (0, ts_morph_1.CoerceArrayElement)(initializer, (0, ts_morph_1.FindArrayElementByObjectProperty)('path', route.path), (0, build_route_object_1.BuildRouteObject)(route), () => 0);
17
+ }
18
+ else {
19
+ console.warn('Initializer not found');
20
+ }
21
+ }
22
+ else {
23
+ console.warn('appRoutes variable not found');
24
+ }
25
+ }
26
+ exports.AddRoute = AddRoute;
27
+ //# sourceMappingURL=add-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-route.js","sourceRoot":"","sources":["../../../../../../packages/plugin/angular/src/lib/add-route.ts"],"names":[],"mappings":";;;AAAA,6CAGwB;AACxB,uCAGkB;AAClB,6DAG8B;AAC9B,2DAAsD;AAEtD,SAAgB,QAAQ,CAAC,UAAsB,EAAE,KAAmB,EAAE,IAAe;IACnF,MAAM,MAAM,GAAG,UAAU,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAC3D,IAAI,MAAM,EAAE;QACV,IAAI,WAAW,GAAG,MAAM,CAAC,2BAA2B,CAAC,qBAAU,CAAC,sBAAsB,CAAC,CAAC;QACxF,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,EAAE;YAChB,WAAW,GAAG,IAAA,mCAAe,EAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SAClD;QACD,IAAI,WAAW,EAAE;YACf,IAAA,6BAAkB,EAChB,WAAW,EACX,IAAA,2CAAgC,EAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EACpD,IAAA,qCAAgB,EAAC,KAAK,CAAC,EACvB,GAAG,EAAE,CAAC,CAAC,CACR,CAAC;SACH;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;SACvC;KACF;SAAM;QACL,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;KAC9C;AACH,CAAC;AApBD,4BAoBC"}
@@ -0,0 +1,7 @@
1
+ import { WriterFunction } from 'ts-morph';
2
+ export interface AngularRoute {
3
+ path: string;
4
+ loadChildren?: string;
5
+ loadComponent?: string;
6
+ }
7
+ export declare function BuildRouteObject(route: AngularRoute): WriterFunction;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildRouteObject = void 0;
4
+ const ts_morph_1 = require("ts-morph");
5
+ function BuildRouteObject(route) {
6
+ const obj = {
7
+ path: w => w.quote(route.path),
8
+ };
9
+ if (route.loadChildren) {
10
+ obj.loadChildren = `() => import('${route.loadChildren}')`;
11
+ }
12
+ if (route.loadComponent) {
13
+ obj.loadComponent = `() => import('${route.loadComponent}')`;
14
+ }
15
+ return ts_morph_1.Writers.object(obj);
16
+ }
17
+ exports.BuildRouteObject = BuildRouteObject;
18
+ //# sourceMappingURL=build-route-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-route-object.js","sourceRoot":"","sources":["../../../../../../packages/plugin/angular/src/lib/build-route-object.ts"],"names":[],"mappings":";;;AAAA,uCAGkB;AAQlB,SAAgB,gBAAgB,CAAC,KAAmB;IAClD,MAAM,GAAG,GAA4C;QACnD,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;KAC/B,CAAC;IACF,IAAI,KAAK,CAAC,YAAY,EAAE;QACtB,GAAG,CAAC,YAAY,GAAG,iBAAkB,KAAK,CAAC,YAAa,IAAI,CAAC;KAC9D;IACD,IAAI,KAAK,CAAC,aAAa,EAAE;QACvB,GAAG,CAAC,aAAa,GAAG,iBAAkB,KAAK,CAAC,aAAc,IAAI,CAAC;KAChE;IACD,OAAO,kBAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAXD,4CAWC"}
@@ -0,0 +1,2 @@
1
+ import { ArrayLiteralExpression } from 'ts-morph';
2
+ export declare function FindParentRoute(ale: ArrayLiteralExpression, path: string[]): ArrayLiteralExpression | null;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindParentRoute = void 0;
4
+ const ts_morph_1 = require("ts-morph");
5
+ function FindParentRoute(ale, path) {
6
+ var _a;
7
+ for (const e of ale.getElements()) {
8
+ if (e instanceof ts_morph_1.ObjectLiteralExpression) {
9
+ const pathProperty = e.getProperty('path');
10
+ if (pathProperty && pathProperty instanceof ts_morph_1.PropertyAssignment) {
11
+ const initializer = pathProperty.getInitializerIfKind(ts_morph_1.SyntaxKind.StringLiteral);
12
+ if (initializer) {
13
+ const fragment = path.pop();
14
+ if (initializer.getLiteralText() === fragment) {
15
+ const childrenProperty = (_a = e.getProperty('children')) !== null && _a !== void 0 ? _a : e.addProperty({
16
+ name: 'children',
17
+ initializer: '[]',
18
+ kind: ts_morph_1.StructureKind.PropertyAssignment,
19
+ });
20
+ if (childrenProperty instanceof ts_morph_1.PropertyAssignment) {
21
+ const children = childrenProperty.getInitializerIfKindOrThrow(ts_morph_1.SyntaxKind.ArrayLiteralExpression);
22
+ if (path.length) {
23
+ // console.log('Continue search for parent route');
24
+ return FindParentRoute(children, path);
25
+ }
26
+ else {
27
+ // console.log('Found parent route');
28
+ return children;
29
+ }
30
+ }
31
+ else {
32
+ // console.log('Children property is not a PropertyAssignment');
33
+ }
34
+ }
35
+ else {
36
+ // console.log('Path property does not match', initializer.getLiteralText(), fragment);
37
+ }
38
+ }
39
+ else {
40
+ // console.log('Path property has no StringLiteral initializer');
41
+ }
42
+ }
43
+ else {
44
+ // console.log('Element has no path property');
45
+ }
46
+ }
47
+ else {
48
+ // console.log('Element is not an ObjectLiteralExpression');
49
+ }
50
+ }
51
+ return null;
52
+ }
53
+ exports.FindParentRoute = FindParentRoute;
54
+ //# sourceMappingURL=find-parent-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-parent-route.js","sourceRoot":"","sources":["../../../../../../packages/plugin/angular/src/lib/find-parent-route.ts"],"names":[],"mappings":";;;AAAA,uCAMkB;AAElB,SAAgB,eAAe,CAAC,GAA2B,EAAE,IAAc;;IACzE,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE;QACjC,IAAI,CAAC,YAAY,kCAAuB,EAAE;YACxC,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3C,IAAI,YAAY,IAAI,YAAY,YAAY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