@basemachina/bm-action-dep-parser 0.0.1 → 0.0.2
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/README.md +36 -7
- package/dist/analyze-action-dependencies.d.ts +4 -1
- package/dist/analyze-action-dependencies.js +26 -10
- package/dist/analyze-action-dependencies.js.map +1 -1
- package/dist/cli.js +0 -0
- package/dist/lib/action-dependency-graph-builder.d.ts +46 -0
- package/dist/lib/action-dependency-graph-builder.js +188 -0
- package/dist/lib/action-dependency-graph-builder.js.map +1 -0
- package/dist/lib/result-formatter.js +4 -1
- package/dist/lib/result-formatter.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -33,33 +33,62 @@ BaseMachina アクション依存関係解析ツール
|
|
33
33
|
- **ビューのエントリーポイント分析**: ビューのエントリーポイントから直接・間接的に依存しているすべてのアクションを可視化(ビューは常にエントリーポイント分析モード)
|
34
34
|
- **カスタムエントリーポイントパターン**: エントリーポイントを柔軟に指定可能(デフォルトは `pages/**/*.{tsx,jsx,ts,js}`)
|
35
35
|
|
36
|
+
### 出力例
|
37
|
+
|
38
|
+
```
|
39
|
+
npx @basemachina/bm-action-dep-parser view ./bm-action-dep-parser/tests/fixtures/views
|
40
|
+
[
|
41
|
+
{
|
42
|
+
"entrypoint": "pages/SortableFormPage.tsx",
|
43
|
+
"dependencies": {
|
44
|
+
"direct": [],
|
45
|
+
"indirect": {
|
46
|
+
"components/SortableForm.tsx": [
|
47
|
+
"get-products",
|
48
|
+
"update-category"
|
49
|
+
]
|
50
|
+
}
|
51
|
+
}
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"entrypoint": "pages/paginatedTable/index.tsx",
|
55
|
+
"dependencies": {
|
56
|
+
"direct": [
|
57
|
+
"get-users"
|
58
|
+
],
|
59
|
+
"indirect": {}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
]
|
63
|
+
```
|
64
|
+
|
36
65
|
## 使用方法
|
37
66
|
|
38
67
|
### CLIツールとして使用
|
39
68
|
|
40
69
|
```bash
|
41
|
-
npx bm-action-dep-parser action ./packages/actions/js
|
42
|
-
npx bm-action-dep-parser view ./packages/views
|
70
|
+
npx @basemachina/bm-action-dep-parser action ./packages/actions/js
|
71
|
+
npx @basemachina/bm-action-dep-parser view ./packages/views
|
43
72
|
```
|
44
73
|
|
45
74
|
### オプション
|
46
75
|
|
47
76
|
```bash
|
48
77
|
# 出力形式を指定(text または json)
|
49
|
-
npx bm-action-dep-parser action ./packages/actions/js --format json
|
78
|
+
npx @basemachina/bm-action-dep-parser action ./packages/actions/js --format json
|
50
79
|
|
51
80
|
# カスタムエントリーポイントパターンを指定(ビューの場合のみ)
|
52
|
-
npx bm-action-dep-parser view ./packages/views --entry-point-patterns "**/*.tsx"
|
81
|
+
npx @basemachina/bm-action-dep-parser view ./packages/views --entry-point-patterns "**/*.tsx"
|
53
82
|
|
54
83
|
# ヘルプを表示
|
55
|
-
npx bm-action-dep-parser --help
|
84
|
+
npx @basemachina/bm-action-dep-parser --help
|
56
85
|
```
|
57
86
|
|
58
87
|
### ローカルでの実行
|
59
88
|
|
60
89
|
```bash
|
61
|
-
|
62
|
-
|
90
|
+
pnpm run analyze action ./packages/actions/js
|
91
|
+
pnpm run analyze view ./packages/views
|
63
92
|
```
|
64
93
|
|
65
94
|
## 技術詳細
|
@@ -39,6 +39,7 @@ const file_finder_1 = require("./lib/file-finder");
|
|
39
39
|
const code_analyzer_1 = require("./lib/code-analyzer");
|
40
40
|
const dependency_extractor_1 = require("./lib/dependency-extractor");
|
41
41
|
const dependency_graph_builder_1 = require("./lib/dependency-graph-builder");
|
42
|
+
const action_dependency_graph_builder_1 = require("./lib/action-dependency-graph-builder");
|
42
43
|
const entry_point_analyzer_1 = require("./lib/entry-point-analyzer");
|
43
44
|
/**
|
44
45
|
* アクション依存関係を解析する関数
|
@@ -66,18 +67,33 @@ async function analyzeActionDependencies(targetType, targetDir, entryPointPatter
|
|
66
67
|
}
|
67
68
|
// アクションの場合
|
68
69
|
if (targetType === 'action') {
|
69
|
-
//
|
70
|
+
// 依存関係グラフの構築
|
71
|
+
const dependencyGraph = new action_dependency_graph_builder_1.ActionDependencyGraph(targetDir);
|
72
|
+
for (const file of files) {
|
73
|
+
await dependencyGraph.addFile(file);
|
74
|
+
}
|
75
|
+
// 依存関係グラフを構築
|
76
|
+
dependencyGraph.buildDependencyGraph();
|
77
|
+
// 各ファイルの依存関係を解析
|
70
78
|
const result = [];
|
71
|
-
for (const
|
72
|
-
|
73
|
-
|
79
|
+
for (const file of files) {
|
80
|
+
// 依存関係を取得
|
81
|
+
const dependencies = dependencyGraph.getReachableActionDependencies(file);
|
82
|
+
// 依存関係がある場合のみ結果に追加
|
83
|
+
if (dependencies.direct.length > 0 || dependencies.indirect.size > 0) {
|
84
|
+
// コマンドで指定したディレクトリからの相対パスに変換
|
85
|
+
const relativePath = path.relative(targetDir, file);
|
86
|
+
result.push({
|
87
|
+
entrypoint: relativePath,
|
88
|
+
dependencies: {
|
89
|
+
direct: dependencies.direct,
|
90
|
+
indirect: Object.fromEntries(Array.from(dependencies.indirect.entries()).map(([key, value]) => [
|
91
|
+
path.relative(targetDir, key),
|
92
|
+
value
|
93
|
+
]))
|
94
|
+
}
|
95
|
+
});
|
74
96
|
}
|
75
|
-
// コマンドで指定したディレクトリからの相対パスに変換
|
76
|
-
const relativePath = path.relative(targetDir, file);
|
77
|
-
result.push({
|
78
|
-
entrypoint: relativePath,
|
79
|
-
dependencies: deps
|
80
|
-
});
|
81
97
|
}
|
82
98
|
return result;
|
83
99
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"analyze-action-dependencies.js","sourceRoot":"","sources":["../analyze-action-dependencies.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"analyze-action-dependencies.js","sourceRoot":"","sources":["../analyze-action-dependencies.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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AI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC;gBACxE,MAAM,CAAC,IAAI,CAAC;oBACV,UAAU,EAAE,UAAU;oBACtB,YAAY,EAAE,IAAI;iBACnB,CAAC,CAAC;YACL,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/cli.js
CHANGED
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/**
|
2
|
+
* アクション間の依存関係を表すグラフ
|
3
|
+
*/
|
4
|
+
export declare class ActionDependencyGraph {
|
5
|
+
private graph;
|
6
|
+
private directActionDependencies;
|
7
|
+
private normalizedPaths;
|
8
|
+
private actionToFilePath;
|
9
|
+
private baseDir;
|
10
|
+
constructor(baseDir: string);
|
11
|
+
/**
|
12
|
+
* ファイルを解析してグラフに追加
|
13
|
+
* @param filePath ファイルパス
|
14
|
+
*/
|
15
|
+
addFile(filePath: string): Promise<void>;
|
16
|
+
/**
|
17
|
+
* 依存関係グラフを構築
|
18
|
+
* 全てのファイルを解析した後に呼び出す必要がある
|
19
|
+
*/
|
20
|
+
buildDependencyGraph(): void;
|
21
|
+
/**
|
22
|
+
* ファイルパスを正規化(絶対パスに変換)
|
23
|
+
* @param filePath ファイルパス
|
24
|
+
* @returns 正規化されたファイルパス
|
25
|
+
*/
|
26
|
+
private normalizePath;
|
27
|
+
/**
|
28
|
+
* エントリーポイントから到達可能なすべてのアクション依存関係を取得
|
29
|
+
* @param entryPoint エントリーポイントのファイルパス
|
30
|
+
* @returns 直接依存するアクションと間接依存するアクション(ファイルパスごと)
|
31
|
+
*/
|
32
|
+
getReachableActionDependencies(entryPoint: string): {
|
33
|
+
direct: string[];
|
34
|
+
indirect: Map<string, string[]>;
|
35
|
+
};
|
36
|
+
/**
|
37
|
+
* 依存関係グラフの統計情報を取得
|
38
|
+
* @returns 統計情報
|
39
|
+
*/
|
40
|
+
getStats(): {
|
41
|
+
totalFiles: number;
|
42
|
+
totalDependencies: number;
|
43
|
+
filesWithActionDependencies: number;
|
44
|
+
totalActionDependencies: number;
|
45
|
+
};
|
46
|
+
}
|
@@ -0,0 +1,188 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
19
|
+
var ownKeys = function(o) {
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
21
|
+
var ar = [];
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
23
|
+
return ar;
|
24
|
+
};
|
25
|
+
return ownKeys(o);
|
26
|
+
};
|
27
|
+
return function (mod) {
|
28
|
+
if (mod && mod.__esModule) return mod;
|
29
|
+
var result = {};
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
+
__setModuleDefault(result, mod);
|
32
|
+
return result;
|
33
|
+
};
|
34
|
+
})();
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
36
|
+
exports.ActionDependencyGraph = void 0;
|
37
|
+
const ts = __importStar(require("typescript"));
|
38
|
+
const fsPromises = __importStar(require("fs/promises"));
|
39
|
+
const path = __importStar(require("path"));
|
40
|
+
const dependency_extractor_1 = require("./dependency-extractor");
|
41
|
+
/**
|
42
|
+
* アクション間の依存関係を表すグラフ
|
43
|
+
*/
|
44
|
+
class ActionDependencyGraph {
|
45
|
+
constructor(baseDir) {
|
46
|
+
// アクション間の依存関係を表すグラフ(キー:ファイルパス、値:依存先ファイルパスのセット)
|
47
|
+
this.graph = new Map();
|
48
|
+
// 各ファイルが直接依存するアクション(キー:ファイルパス、値:アクション識別子のセット)
|
49
|
+
this.directActionDependencies = new Map();
|
50
|
+
// ファイルパスの正規化(絶対パスに変換)
|
51
|
+
this.normalizedPaths = new Map();
|
52
|
+
// アクション識別子とファイルパスのマッピング
|
53
|
+
this.actionToFilePath = new Map();
|
54
|
+
this.baseDir = path.resolve(baseDir);
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* ファイルを解析してグラフに追加
|
58
|
+
* @param filePath ファイルパス
|
59
|
+
*/
|
60
|
+
async addFile(filePath) {
|
61
|
+
const normalizedPath = this.normalizePath(filePath);
|
62
|
+
// すでに解析済みの場合はスキップ
|
63
|
+
if (this.graph.has(normalizedPath)) {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
try {
|
67
|
+
// ファイルの内容を読み込む
|
68
|
+
const content = await fsPromises.readFile(filePath, 'utf-8');
|
69
|
+
// TypeScriptのパーサーを使用してASTを生成
|
70
|
+
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
71
|
+
// アクション呼び出しを解析
|
72
|
+
const actionCalls = (0, dependency_extractor_1.extractDependencies)(sourceFile, 'action');
|
73
|
+
// 直接依存するアクションを記録
|
74
|
+
if (actionCalls.length > 0) {
|
75
|
+
this.directActionDependencies.set(normalizedPath, new Set(actionCalls));
|
76
|
+
}
|
77
|
+
// アクション識別子とファイルパスのマッピングを更新
|
78
|
+
// ファイル名(拡張子なし)とアクション識別子が一致する場合、マッピングを作成
|
79
|
+
const fileName = path.basename(filePath, path.extname(filePath));
|
80
|
+
this.actionToFilePath.set(fileName, normalizedPath);
|
81
|
+
// 依存関係グラフを更新(初期状態では空のセット)
|
82
|
+
this.graph.set(normalizedPath, new Set());
|
83
|
+
}
|
84
|
+
catch (error) {
|
85
|
+
console.error(`Error analyzing file ${filePath}:`, error);
|
86
|
+
// エラーが発生した場合は空の依存関係を設定
|
87
|
+
this.graph.set(normalizedPath, new Set());
|
88
|
+
}
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* 依存関係グラフを構築
|
92
|
+
* 全てのファイルを解析した後に呼び出す必要がある
|
93
|
+
*/
|
94
|
+
buildDependencyGraph() {
|
95
|
+
// 各ファイルの直接依存するアクションに対応するファイルパスを探索
|
96
|
+
for (const [filePath, actionDependencies] of this.directActionDependencies.entries()) {
|
97
|
+
const dependencies = new Set();
|
98
|
+
for (const actionDependency of actionDependencies) {
|
99
|
+
// アクション識別子に対応するファイルパスを検索
|
100
|
+
for (const [action, file] of this.actionToFilePath.entries()) {
|
101
|
+
if (actionDependency === action) {
|
102
|
+
dependencies.add(file);
|
103
|
+
break;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
// 依存関係グラフを更新
|
108
|
+
this.graph.set(filePath, dependencies);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
/**
|
112
|
+
* ファイルパスを正規化(絶対パスに変換)
|
113
|
+
* @param filePath ファイルパス
|
114
|
+
* @returns 正規化されたファイルパス
|
115
|
+
*/
|
116
|
+
normalizePath(filePath) {
|
117
|
+
if (this.normalizedPaths.has(filePath)) {
|
118
|
+
return this.normalizedPaths.get(filePath);
|
119
|
+
}
|
120
|
+
const normalizedPath = path.resolve(this.baseDir, filePath);
|
121
|
+
this.normalizedPaths.set(filePath, normalizedPath);
|
122
|
+
return normalizedPath;
|
123
|
+
}
|
124
|
+
/**
|
125
|
+
* エントリーポイントから到達可能なすべてのアクション依存関係を取得
|
126
|
+
* @param entryPoint エントリーポイントのファイルパス
|
127
|
+
* @returns 直接依存するアクションと間接依存するアクション(ファイルパスごと)
|
128
|
+
*/
|
129
|
+
getReachableActionDependencies(entryPoint) {
|
130
|
+
const normalizedEntryPoint = this.normalizePath(entryPoint);
|
131
|
+
const visited = new Set();
|
132
|
+
const indirect = new Map();
|
133
|
+
// 深さ優先探索でグラフを走査
|
134
|
+
const dfs = (node) => {
|
135
|
+
if (visited.has(node)) {
|
136
|
+
return;
|
137
|
+
}
|
138
|
+
visited.add(node);
|
139
|
+
const dependencies = this.graph.get(node);
|
140
|
+
if (!dependencies) {
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
for (const dependency of dependencies) {
|
144
|
+
const normalizedDependency = this.normalizePath(dependency);
|
145
|
+
// エントリーポイント自身でない場合のみ間接依存関係として追加
|
146
|
+
if (normalizedDependency !== normalizedEntryPoint) {
|
147
|
+
// 依存先ファイルが直接依存するアクションを取得
|
148
|
+
const actionDependencies = this.directActionDependencies.get(normalizedDependency);
|
149
|
+
if (actionDependencies && actionDependencies.size > 0) {
|
150
|
+
indirect.set(normalizedDependency, Array.from(actionDependencies));
|
151
|
+
}
|
152
|
+
}
|
153
|
+
// 依存先ファイルを再帰的に探索
|
154
|
+
dfs(normalizedDependency);
|
155
|
+
}
|
156
|
+
};
|
157
|
+
// エントリーポイントから探索を開始
|
158
|
+
dfs(normalizedEntryPoint);
|
159
|
+
// エントリーポイント自身が直接依存するアクションを取得
|
160
|
+
const direct = this.directActionDependencies.get(normalizedEntryPoint) || new Set();
|
161
|
+
return {
|
162
|
+
direct: Array.from(direct),
|
163
|
+
indirect
|
164
|
+
};
|
165
|
+
}
|
166
|
+
/**
|
167
|
+
* 依存関係グラフの統計情報を取得
|
168
|
+
* @returns 統計情報
|
169
|
+
*/
|
170
|
+
getStats() {
|
171
|
+
let totalDependencies = 0;
|
172
|
+
for (const dependencies of this.graph.values()) {
|
173
|
+
totalDependencies += dependencies.size;
|
174
|
+
}
|
175
|
+
let totalActionDependencies = 0;
|
176
|
+
for (const actionDependencies of this.directActionDependencies.values()) {
|
177
|
+
totalActionDependencies += actionDependencies.size;
|
178
|
+
}
|
179
|
+
return {
|
180
|
+
totalFiles: this.graph.size,
|
181
|
+
totalDependencies,
|
182
|
+
filesWithActionDependencies: this.directActionDependencies.size,
|
183
|
+
totalActionDependencies
|
184
|
+
};
|
185
|
+
}
|
186
|
+
}
|
187
|
+
exports.ActionDependencyGraph = ActionDependencyGraph;
|
188
|
+
//# sourceMappingURL=action-dependency-graph-builder.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"action-dependency-graph-builder.js","sourceRoot":"","sources":["../../lib/action-dependency-graph-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,wDAA0C;AAE1C,2CAA6B;AAC7B,iEAA6D;AAE7D;;GAEG;AACH,MAAa,qBAAqB;IAgBhC,YAAY,OAAe;QAf3B,+CAA+C;QACvC,UAAK,GAA6B,IAAI,GAAG,EAAE,CAAC;QAEpD,8CAA8C;QACtC,6BAAwB,GAA6B,IAAI,GAAG,EAAE,CAAC;QAEvE,sBAAsB;QACd,oBAAe,GAAwB,IAAI,GAAG,EAAE,CAAC;QAEzD,wBAAwB;QAChB,qBAAgB,GAAwB,IAAI,GAAG,EAAE,CAAC;QAMxD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC5B,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAEpD,kBAAkB;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QAED,IAAI,CA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uB,GAAG,CAAC,CAAC;QAChC,KAAK,MAAM,kBAAkB,IAAI,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,EAAE,CAAC;YACxE,uBAAuB,IAAI,kBAAkB,CAAC,IAAI,CAAC;QACrD,CAAC;QAED,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YAC3B,iBAAiB;YACjB,2BAA2B,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI;YAC/D,uBAAuB;SACxB,CAAC;IACJ,CAAC;CACF;AA3LD,sDA2LC"}
|
@@ -20,7 +20,10 @@ function formatJavaScriptActionDependencyAnalysisResult(dependencies) {
|
|
20
20
|
const relativePath = path_1.default.relative(process.cwd(), file);
|
21
21
|
result.push({
|
22
22
|
entrypoint: relativePath,
|
23
|
-
dependencies:
|
23
|
+
dependencies: {
|
24
|
+
direct: deps,
|
25
|
+
indirect: {}
|
26
|
+
}
|
24
27
|
});
|
25
28
|
}
|
26
29
|
return JSON.stringify(result, null, 2);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"result-formatter.js","sourceRoot":"","sources":["../../lib/result-formatter.ts"],"names":[],"mappings":";;;;;AAQA,
|
1
|
+
{"version":3,"file":"result-formatter.js","sourceRoot":"","sources":["../../lib/result-formatter.ts"],"names":[],"mappings":";;;;;AAQA,wGAqBC;AAOD,gFAgBC;AApDD,gDAAwB;AAGxB;;;;GAIG;AACH,SAAgB,8CAA8C,CAC5D,YAAsC;IAEtC,MAAM,MAAM,GAAiC,EAAE,CAAC;IAEhD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACxD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,SAAS;QACX,CAAC;QAED,MAAM,YAAY,GAAG,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;QACxD,MAAM,CAAC,IAAI,CAAC;YACV,UAAU,EAAE,YAAY;YACxB,YAAY,EAAE;gBACZ,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,EAAE;aACb;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,SAAgB,kCAAkC,CAChD,sBAGE;IAEF,MAAM,MAAM,GAAqB,EAAE,CAAC;IAEpC,KAAK,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC;QACxE,MAAM,CAAC,IAAI,CAAC;YACV,UAAU,EAAE,UAAU;YACtB,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
|