@getkist/action-prettier 1.0.2 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getkist/action-prettier",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Prettier code formatting action for kist",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -1,93 +0,0 @@
1
- import { Action } from "../../types/Action.js";
2
- /**
3
- * Options for the PrettierAction
4
- */
5
- export interface PrettierActionOptions {
6
- /**
7
- * Files or glob patterns to format
8
- */
9
- targetFiles: string[];
10
- /**
11
- * Whether to write formatted files back to disk.
12
- * If false, only checks formatting without modifying files.
13
- */
14
- write?: boolean;
15
- /**
16
- * Path to a custom Prettier config file
17
- */
18
- configPath?: string;
19
- /**
20
- * Tab width for indentation
21
- */
22
- tabWidth?: number;
23
- /**
24
- * Use tabs instead of spaces
25
- */
26
- useTabs?: boolean;
27
- /**
28
- * Print semicolons at the ends of statements
29
- */
30
- semi?: boolean;
31
- /**
32
- * Use single quotes instead of double quotes
33
- */
34
- singleQuote?: boolean;
35
- /**
36
- * Print trailing commas wherever possible
37
- */
38
- trailingComma?: "all" | "es5" | "none";
39
- /**
40
- * Print spaces between brackets in object literals
41
- */
42
- bracketSpacing?: boolean;
43
- /**
44
- * Put the closing bracket of a multi-line element on a new line
45
- */
46
- bracketSameLine?: boolean;
47
- /**
48
- * Include parentheses around a sole arrow function parameter
49
- */
50
- arrowParens?: "always" | "avoid";
51
- /**
52
- * Line width that the printer will wrap on
53
- */
54
- printWidth?: number;
55
- /**
56
- * How to handle whitespace in HTML, Vue, Angular, or JSX
57
- */
58
- htmlWhitespaceSensitivity?: "css" | "strict" | "ignore";
59
- /**
60
- * End of line style
61
- */
62
- endOfLine?: "lf" | "crlf" | "cr" | "auto";
63
- /**
64
- * Force parser to use (auto-detected by default)
65
- */
66
- parser?: string;
67
- /**
68
- * Ignore files matching patterns in .prettierignore
69
- */
70
- ignoreUnknown?: boolean;
71
- }
72
- /**
73
- * Action for formatting code files using Prettier.
74
- */
75
- export declare class PrettierAction extends Action<PrettierActionOptions> {
76
- readonly name = "PrettierAction";
77
- describe(): string;
78
- validateOptions(options: PrettierActionOptions): boolean;
79
- execute(options: PrettierActionOptions): Promise<void>;
80
- /**
81
- * Build Prettier options from action options and config file
82
- */
83
- private buildPrettierOptions;
84
- /**
85
- * Resolve file patterns to actual file paths
86
- */
87
- private resolveFiles;
88
- /**
89
- * Process a single file with Prettier
90
- */
91
- private processFile;
92
- }
93
- //# sourceMappingURL=PrettierAction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrettierAction.d.ts","sourceRoot":"","sources":["../../../../src/actions/PrettierAction/PrettierAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAK/C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAEvC;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAEjC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,yBAAyB,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAExD;;OAEG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;IAE1C;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,MAAM,CAAC,qBAAqB,CAAC;IAC7D,QAAQ,CAAC,IAAI,oBAAoB;IAEjC,QAAQ,IAAI,MAAM;IAIlB,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO;IA6BlD,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8D5D;;OAEG;YACW,oBAAoB;IA8BlC;;OAEG;YACW,YAAY;IAuB1B;;OAEG;YACW,WAAW;CAqD5B"}
@@ -1,202 +0,0 @@
1
- import { Action } from "../../types/Action.js";
2
- import { promises as fs } from "fs";
3
- import path from "path";
4
- import * as prettier from "prettier";
5
- /**
6
- * Action for formatting code files using Prettier.
7
- */
8
- export class PrettierAction extends Action {
9
- name = "PrettierAction";
10
- describe() {
11
- return "Format code files using Prettier";
12
- }
13
- validateOptions(options) {
14
- if (!options.targetFiles || !Array.isArray(options.targetFiles) || options.targetFiles.length === 0) {
15
- this.logError("Invalid options: 'targetFiles' must be a non-empty array.");
16
- return false;
17
- }
18
- if (options.trailingComma && !["all", "es5", "none"].includes(options.trailingComma)) {
19
- this.logError("Invalid options: 'trailingComma' must be one of: all, es5, none");
20
- return false;
21
- }
22
- if (options.arrowParens && !["always", "avoid"].includes(options.arrowParens)) {
23
- this.logError("Invalid options: 'arrowParens' must be one of: always, avoid");
24
- return false;
25
- }
26
- if (options.htmlWhitespaceSensitivity && !["css", "strict", "ignore"].includes(options.htmlWhitespaceSensitivity)) {
27
- this.logError("Invalid options: 'htmlWhitespaceSensitivity' must be one of: css, strict, ignore");
28
- return false;
29
- }
30
- if (options.endOfLine && !["lf", "crlf", "cr", "auto"].includes(options.endOfLine)) {
31
- this.logError("Invalid options: 'endOfLine' must be one of: lf, crlf, cr, auto");
32
- return false;
33
- }
34
- return true;
35
- }
36
- async execute(options) {
37
- if (!this.validateOptions(options)) {
38
- throw new Error("Invalid options provided to PrettierAction");
39
- }
40
- const write = options.write ?? true;
41
- const mode = write ? "formatting" : "checking";
42
- this.logInfo(`${write ? "Formatting" : "Checking"} ${options.targetFiles.length} file pattern(s)`);
43
- try {
44
- // Build Prettier options
45
- const prettierOptions = await this.buildPrettierOptions(options);
46
- // Resolve files from patterns
47
- const files = await this.resolveFiles(options.targetFiles);
48
- if (files.length === 0) {
49
- this.logWarning("No files matched the provided patterns");
50
- return;
51
- }
52
- this.logInfo(`Found ${files.length} file(s) to ${mode === "formatting" ? "format" : "check"}`);
53
- let formattedCount = 0;
54
- let unchangedCount = 0;
55
- const errors = [];
56
- for (const file of files) {
57
- try {
58
- const result = await this.processFile(file, prettierOptions, write, options.ignoreUnknown);
59
- if (result === "formatted") {
60
- formattedCount++;
61
- }
62
- else if (result === "unchanged") {
63
- unchangedCount++;
64
- }
65
- }
66
- catch (error) {
67
- const errorMessage = error instanceof Error ? error.message : String(error);
68
- errors.push(`${file}: ${errorMessage}`);
69
- }
70
- }
71
- // Report results
72
- if (write) {
73
- this.logInfo(`Formatted ${formattedCount} file(s), ${unchangedCount} file(s) unchanged`);
74
- }
75
- else {
76
- if (formattedCount > 0) {
77
- throw new Error(`${formattedCount} file(s) need formatting`);
78
- }
79
- this.logInfo(`All ${unchangedCount} file(s) are properly formatted`);
80
- }
81
- if (errors.length > 0) {
82
- this.logWarning(`${errors.length} file(s) had errors:`);
83
- errors.forEach(e => this.logError(e));
84
- }
85
- }
86
- catch (error) {
87
- this.logError("Prettier formatting failed.", error);
88
- throw error;
89
- }
90
- }
91
- /**
92
- * Build Prettier options from action options and config file
93
- */
94
- async buildPrettierOptions(options) {
95
- let configOptions = {};
96
- // Load config file if specified
97
- if (options.configPath) {
98
- const resolvedConfig = await prettier.resolveConfig(options.configPath);
99
- if (resolvedConfig) {
100
- configOptions = resolvedConfig;
101
- }
102
- }
103
- // Build options from action configuration (these override config file)
104
- const actionOptions = {};
105
- if (options.tabWidth !== undefined)
106
- actionOptions.tabWidth = options.tabWidth;
107
- if (options.useTabs !== undefined)
108
- actionOptions.useTabs = options.useTabs;
109
- if (options.semi !== undefined)
110
- actionOptions.semi = options.semi;
111
- if (options.singleQuote !== undefined)
112
- actionOptions.singleQuote = options.singleQuote;
113
- if (options.trailingComma !== undefined)
114
- actionOptions.trailingComma = options.trailingComma;
115
- if (options.bracketSpacing !== undefined)
116
- actionOptions.bracketSpacing = options.bracketSpacing;
117
- if (options.bracketSameLine !== undefined)
118
- actionOptions.bracketSameLine = options.bracketSameLine;
119
- if (options.arrowParens !== undefined)
120
- actionOptions.arrowParens = options.arrowParens;
121
- if (options.printWidth !== undefined)
122
- actionOptions.printWidth = options.printWidth;
123
- if (options.htmlWhitespaceSensitivity !== undefined)
124
- actionOptions.htmlWhitespaceSensitivity = options.htmlWhitespaceSensitivity;
125
- if (options.endOfLine !== undefined)
126
- actionOptions.endOfLine = options.endOfLine;
127
- if (options.parser !== undefined)
128
- actionOptions.parser = options.parser;
129
- return { ...configOptions, ...actionOptions };
130
- }
131
- /**
132
- * Resolve file patterns to actual file paths
133
- */
134
- async resolveFiles(patterns) {
135
- const files = [];
136
- for (const pattern of patterns) {
137
- // Check if it's a direct file path
138
- try {
139
- const stat = await fs.stat(pattern);
140
- if (stat.isFile()) {
141
- files.push(path.resolve(pattern));
142
- }
143
- else if (stat.isDirectory()) {
144
- // Skip directories in this simple implementation
145
- this.logWarning(`Skipping directory: ${pattern} (use glob patterns for directories)`);
146
- }
147
- }
148
- catch {
149
- // File doesn't exist, might be a glob pattern
150
- // For simplicity, we'll just skip non-existent files
151
- this.logWarning(`File not found: ${pattern}`);
152
- }
153
- }
154
- return [...new Set(files)]; // Remove duplicates
155
- }
156
- /**
157
- * Process a single file with Prettier
158
- */
159
- async processFile(filePath, prettierOptions, write, ignoreUnknown) {
160
- const content = await fs.readFile(filePath, "utf8");
161
- // Get file info to determine parser
162
- const fileInfo = await prettier.getFileInfo(filePath, {
163
- ignorePath: ".prettierignore",
164
- });
165
- if (fileInfo.ignored) {
166
- this.logDebug(`Ignored: ${filePath}`);
167
- return "skipped";
168
- }
169
- if (fileInfo.inferredParser === null) {
170
- if (ignoreUnknown) {
171
- this.logDebug(`Unknown file type, skipping: ${filePath}`);
172
- return "skipped";
173
- }
174
- throw new Error(`Could not determine parser for: ${filePath}`);
175
- }
176
- // Merge parser into options
177
- const options = {
178
- ...prettierOptions,
179
- parser: prettierOptions.parser || fileInfo.inferredParser,
180
- filepath: filePath,
181
- };
182
- // Check if file is already formatted
183
- const isFormatted = await prettier.check(content, options);
184
- if (isFormatted) {
185
- this.logDebug(`Already formatted: ${filePath}`);
186
- return "unchanged";
187
- }
188
- if (write) {
189
- // Format and write
190
- const formatted = await prettier.format(content, options);
191
- await fs.writeFile(filePath, formatted, "utf8");
192
- this.logInfo(`Formatted: ${filePath}`);
193
- return "formatted";
194
- }
195
- else {
196
- // Check mode - file needs formatting
197
- this.logInfo(`Needs formatting: ${filePath}`);
198
- return "formatted"; // Count as needing format
199
- }
200
- }
201
- }
202
- //# sourceMappingURL=PrettierAction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrettierAction.js","sourceRoot":"","sources":["../../../../src/actions/PrettierAction/PrettierAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAwFrC;;GAEG;AACH,MA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AQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YAChD,IAAI,CAAC,OAAO,CAAC,cAAc,QAAQ,EAAE,CAAC,CAAC;YACvC,OAAO,WAAW,CAAC;QACvB,CAAC;aAAM,CAAC;YACJ,qCAAqC;YACrC,IAAI,CAAC,OAAO,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;YAC9C,OAAO,WAAW,CAAC,CAAC,0BAA0B;QAClD,CAAC;IACL,CAAC;CACJ"}
@@ -1,3 +0,0 @@
1
- export { PrettierAction } from "./PrettierAction.js";
2
- export type { PrettierActionOptions } from "./PrettierAction.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/actions/PrettierAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { PrettierAction } from "./PrettierAction.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/PrettierAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,16 +0,0 @@
1
- import { PrettierAction } from "./actions/PrettierAction/index.js";
2
- export { PrettierAction } from "./actions/PrettierAction/index.js";
3
- export type { PrettierActionOptions } from "./actions/PrettierAction/index.js";
4
- export { Action } from "./types/Action.js";
5
- /**
6
- * Plugin definition for kist
7
- */
8
- declare const _default: {
9
- name: string;
10
- version: string;
11
- actions: {
12
- PrettierAction: PrettierAction;
13
- };
14
- };
15
- export default _default;
16
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,YAAY,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;;;;;;;;AACH,wBAME"}
package/dist/src/index.js DELETED
@@ -1,14 +0,0 @@
1
- import { PrettierAction } from "./actions/PrettierAction/index.js";
2
- export { PrettierAction } from "./actions/PrettierAction/index.js";
3
- export { Action } from "./types/Action.js";
4
- /**
5
- * Plugin definition for kist
6
- */
7
- export default {
8
- name: "@getkist/action-prettier",
9
- version: "1.0.0",
10
- actions: {
11
- PrettierAction: new PrettierAction(),
12
- },
13
- };
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;AACH,eAAe;IACX,IAAI,EAAE,0BAA0B;IAChC,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE;QACL,cAAc,EAAE,IAAI,cAAc,EAAE;KACvC;CACJ,CAAC"}
@@ -1,48 +0,0 @@
1
- /**
2
- * Base class for kist actions.
3
- * Provides common functionality for all action implementations.
4
- */
5
- export declare abstract class Action<TOptions = Record<string, unknown>> {
6
- /**
7
- * The unique name of this action.
8
- */
9
- abstract readonly name: string;
10
- /**
11
- * Returns a human-readable description of what this action does.
12
- */
13
- abstract describe(): string;
14
- /**
15
- * Validates the provided options before execution.
16
- * @param options - The options to validate
17
- * @returns true if options are valid, false otherwise
18
- */
19
- abstract validateOptions(options: TOptions): boolean;
20
- /**
21
- * Executes the action with the provided options.
22
- * @param options - The options for this action
23
- * @returns A promise that resolves when the action completes
24
- */
25
- abstract execute(options: TOptions): Promise<void>;
26
- /**
27
- * Logs an informational message.
28
- * @param message - The message to log
29
- */
30
- protected logInfo(message: string): void;
31
- /**
32
- * Logs a warning message.
33
- * @param message - The message to log
34
- */
35
- protected logWarning(message: string): void;
36
- /**
37
- * Logs an error message.
38
- * @param message - The message to log
39
- * @param error - Optional error object
40
- */
41
- protected logError(message: string, error?: unknown): void;
42
- /**
43
- * Logs a debug message.
44
- * @param message - The message to log
45
- */
46
- protected logDebug(message: string): void;
47
- }
48
- //# sourceMappingURL=Action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,IAAI,MAAM;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAEpD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAElD;;;OAGG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;;OAGG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3C;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAI1D;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAK5C"}
@@ -1,38 +0,0 @@
1
- /**
2
- * Base class for kist actions.
3
- * Provides common functionality for all action implementations.
4
- */
5
- export class Action {
6
- /**
7
- * Logs an informational message.
8
- * @param message - The message to log
9
- */
10
- logInfo(message) {
11
- console.log(`[${this.name}] ${message}`);
12
- }
13
- /**
14
- * Logs a warning message.
15
- * @param message - The message to log
16
- */
17
- logWarning(message) {
18
- console.warn(`[${this.name}] WARNING: ${message}`);
19
- }
20
- /**
21
- * Logs an error message.
22
- * @param message - The message to log
23
- * @param error - Optional error object
24
- */
25
- logError(message, error) {
26
- console.error(`[${this.name}] ERROR: ${message}`, error || "");
27
- }
28
- /**
29
- * Logs a debug message.
30
- * @param message - The message to log
31
- */
32
- logDebug(message) {
33
- if (process.env.DEBUG) {
34
- console.debug(`[${this.name}] DEBUG: ${message}`);
35
- }
36
- }
37
- }
38
- //# sourceMappingURL=Action.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Action.js","sourceRoot":"","sources":["../../../src/types/Action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAgB,MAAM;IAyBxB;;;OAGG;IACO,OAAO,CAAC,OAAe;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACO,UAAU,CAAC,OAAe;QAChC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,cAAc,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACO,QAAQ,CAAC,OAAe,EAAE,KAAe;QAC/C,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACO,QAAQ,CAAC,OAAe;QAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;CACJ"}