@deepdiver_sj/claude-settings 0.1.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.
@@ -0,0 +1,463 @@
1
+ /**
2
+ * @file src/core/constants.ts
3
+ * @description Claude Settings 전역 상수 정의
4
+ * @author Claude
5
+ *
6
+ * 포함 내용:
7
+ * - 앱 메타데이터
8
+ * - 버전 정보
9
+ * - 폴더 구조 표준
10
+ * - 설정 파일명
11
+ * - 프로세스 상수
12
+ */
13
+ /**
14
+ * 앱 메타데이터
15
+ *
16
+ * @constant
17
+ */
18
+ export const APP_METADATA = {
19
+ /** 애플리케이션 이름 */
20
+ name: 'Claude Settings CLI',
21
+ /** 짧은 이름 (명령어용) */
22
+ shortName: 'claude-settings',
23
+ /** 애플리케이션 설명 */
24
+ description: 'Manage Claude global settings across Windows, Linux, and macOS',
25
+ /** 저자 */
26
+ author: 'Anthropic',
27
+ /** 라이선스 */
28
+ license: 'MIT',
29
+ };
30
+ /**
31
+ * 버전 정보
32
+ *
33
+ * @constant
34
+ * @note package.json과 동기화 필수
35
+ */
36
+ export const VERSION = {
37
+ /** 주 버전 */
38
+ major: 0,
39
+ /** 부 버전 */
40
+ minor: 1,
41
+ /** 패치 버전 */
42
+ patch: 0,
43
+ /** 프리릴리즈 (alpha, beta, rc)*/
44
+ prerelease: 'alpha',
45
+ /**
46
+ * 전체 버전 문자열
47
+ * @example "0.1.0-alpha"
48
+ */
49
+ get full() {
50
+ const base = `${this.major}.${this.minor}.${this.patch}`;
51
+ return this.prerelease ? `${base}-${this.prerelease}` : base;
52
+ },
53
+ };
54
+ /**
55
+ * 표준화된 폴더 구조
56
+ *
57
+ * @constant
58
+ *
59
+ * Phase 1 마이그레이션의 목표 구조:
60
+ * ```
61
+ * claude/
62
+ * ├── config/ ← 설정 파일만
63
+ * ├── data/ ← 사용자 데이터
64
+ * ├── cache/ ← 캐시/임시
65
+ * ├── backup/ ← 백업
66
+ * └── state/ ← 런타임 상태
67
+ * ```
68
+ */
69
+ export const FOLDER_STRUCTURE = {
70
+ // 주요 폴더
71
+ config: 'config',
72
+ data: 'data',
73
+ cache: 'cache',
74
+ backup: 'backup',
75
+ state: 'state',
76
+ // 데이터 하위 폴더
77
+ skills: 'skills',
78
+ plugins: 'plugins',
79
+ templates: 'templates',
80
+ teams: 'teams',
81
+ tasks: 'tasks',
82
+ // 캐시 하위 폴더
83
+ fileHistory: 'file-history',
84
+ pasteCache: 'paste-cache',
85
+ chrome: 'chrome',
86
+ // 상태 하위 폴더
87
+ hud: 'hud',
88
+ ide: 'ide',
89
+ wezterm: 'wezterm-shim',
90
+ // 마이그레이션용 (레거시 폴더)
91
+ legacyFileHistory: '%file-history%',
92
+ legacyHooks: '%hooks%',
93
+ legacyExecutables: '%executables%',
94
+ };
95
+ /**
96
+ * 설정 파일명
97
+ *
98
+ * @constant
99
+ */
100
+ export const CONFIG_FILES = {
101
+ // 메인 설정
102
+ settings: 'settings.json',
103
+ settingsYaml: 'settings.yaml',
104
+ // 플러그인/스킬
105
+ plugins: 'plugins.json',
106
+ skills: 'skills.json',
107
+ // 사용자 설정
108
+ preferences: 'preferences.yaml',
109
+ userConfig: 'user.config.json',
110
+ // 시스템 설정
111
+ system: 'system.json',
112
+ environment: '.env',
113
+ // 메타데이터
114
+ manifest: 'manifest.json',
115
+ metadata: 'metadata.json',
116
+ // 버전 정보
117
+ version: '.version',
118
+ lastSync: '.last-sync',
119
+ };
120
+ /**
121
+ * 환경 이름
122
+ *
123
+ * @constant
124
+ */
125
+ export const ENVIRONMENT = {
126
+ development: 'development',
127
+ production: 'production',
128
+ testing: 'testing',
129
+ staging: 'staging',
130
+ };
131
+ /**
132
+ * 로그 레벨
133
+ *
134
+ * @constant
135
+ * @see https://en.wikipedia.org/wiki/Syslog
136
+ */
137
+ export const LOG_LEVELS = {
138
+ debug: 0,
139
+ info: 1,
140
+ warn: 2,
141
+ error: 3,
142
+ fatal: 4,
143
+ };
144
+ /**
145
+ * 플랫폼 이름 매핑
146
+ *
147
+ * @constant
148
+ */
149
+ export const PLATFORM_NAMES = {
150
+ win32: 'Windows',
151
+ linux: 'Linux',
152
+ darwin: 'macOS',
153
+ };
154
+ /**
155
+ * 기본 타임아웃 (밀리초)
156
+ *
157
+ * @constant
158
+ */
159
+ export const TIMEOUTS = {
160
+ /** 파일 읽기/쓰기 타임아웃 */
161
+ fileIO: 5000,
162
+ /** 네트워크 요청 타임아웃 */
163
+ network: 10000,
164
+ /** 프로세스 타임아웃 */
165
+ process: 30000,
166
+ /** 일반 작업 타임아웃 */
167
+ default: 15000,
168
+ };
169
+ /**
170
+ * 재시도 정책
171
+ *
172
+ * @constant
173
+ */
174
+ export const RETRY_POLICY = {
175
+ /** 최대 재시도 횟수 */
176
+ maxAttempts: 3,
177
+ /** 초기 대기 시간 (밀리초) */
178
+ initialDelay: 100,
179
+ /** 최대 대기 시간 (밀리초) */
180
+ maxDelay: 5000,
181
+ /** 지수 백오프 배수 */
182
+ backoffMultiplier: 2,
183
+ };
184
+ /**
185
+ * 패턴 (정규표현식)
186
+ *
187
+ * @constant
188
+ */
189
+ export const PATTERNS = {
190
+ // UUID v4 매칭
191
+ uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
192
+ // 이메일
193
+ email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
194
+ // 시맨틱 버전 (e.g., 1.2.3-alpha.4)
195
+ semver: /^\d+\.\d+\.\d+(?:-[a-z0-9.]+)?$/i,
196
+ // ISO 8601 날짜 (e.g., 2024-01-15T10:30:00Z)
197
+ isoDate: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z?$/,
198
+ // 파일 경로 (Windows/Unix)
199
+ filePath: /^[a-zA-Z0-9._\-/\\~@:]+$/,
200
+ };
201
+ /**
202
+ * 권한 (chmod 값)
203
+ *
204
+ * @constant
205
+ */
206
+ export const PERMISSIONS = {
207
+ // 폴더 권한
208
+ folderDefault: 0o755, // drwxr-xr-x
209
+ folderPrivate: 0o700, // drwx------
210
+ folderShared: 0o770, // drwxrwx---
211
+ // 파일 권한
212
+ fileDefault: 0o644, // -rw-r--r--
213
+ filePrivate: 0o600, // -rw-------
214
+ fileExecutable: 0o755, // -rwxr-xr-x
215
+ };
216
+ /**
217
+ * 파일 크기 상수 (바이트)
218
+ *
219
+ * @constant
220
+ */
221
+ export const FILE_SIZES = {
222
+ KB: 1024,
223
+ MB: 1024 * 1024,
224
+ GB: 1024 * 1024 * 1024,
225
+ };
226
+ /**
227
+ * 마이그레이션 버전
228
+ *
229
+ * @constant
230
+ *
231
+ * 마이그레이션 히스토리:
232
+ * - 1.0: 초기 구조 (혼합형)
233
+ * - 2.0: Phase 1 표준화 (config/data/cache 분리)
234
+ * - 3.0: OS별 경로 표준화
235
+ */
236
+ export const MIGRATION_VERSION = {
237
+ current: 3,
238
+ legacy: 1,
239
+ // 마이그레이션 타입
240
+ types: {
241
+ folderRestructure: 'folder_restructure',
242
+ pathStandardization: 'path_standardization',
243
+ uuidFolderRename: 'uuid_folder_rename',
244
+ cacheCleanup: 'cache_cleanup',
245
+ },
246
+ };
247
+ /**
248
+ * 지원하는 파일 인코딩
249
+ *
250
+ * @constant
251
+ */
252
+ export const ENCODINGS = {
253
+ utf8: 'utf8',
254
+ utf16: 'utf16le',
255
+ ascii: 'ascii',
256
+ latin1: 'latin1',
257
+ };
258
+ /**
259
+ * 줄바꿈 타입
260
+ *
261
+ * @constant
262
+ */
263
+ export const LINE_ENDINGS = {
264
+ lf: '\n', // Unix (Linux, macOS)
265
+ crlf: '\r\n', // Windows
266
+ cr: '\r', // Old Mac (레거시)
267
+ };
268
+ /**
269
+ * 캐시 만료 시간 (초)
270
+ *
271
+ * @constant
272
+ */
273
+ export const CACHE_EXPIRY = {
274
+ short: 60 * 5, // 5분
275
+ medium: 60 * 60, // 1시간
276
+ long: 60 * 60 * 24, // 1일
277
+ veryLong: 60 * 60 * 24 * 7, // 1주
278
+ };
279
+ /**
280
+ * 에러 코드
281
+ *
282
+ * @constant
283
+ */
284
+ export const ERROR_CODES = {
285
+ // 환경 에러
286
+ ENV_VAR_NOT_SET: 'ENV_VAR_NOT_SET',
287
+ UNSUPPORTED_PLATFORM: 'UNSUPPORTED_PLATFORM',
288
+ // 파일 에러
289
+ FILE_NOT_FOUND: 'FILE_NOT_FOUND',
290
+ FILE_WRITE_ERROR: 'FILE_WRITE_ERROR',
291
+ FILE_READ_ERROR: 'FILE_READ_ERROR',
292
+ // 경로 에러
293
+ INVALID_PATH: 'INVALID_PATH',
294
+ PATH_NORMALIZE_ERROR: 'PATH_NORMALIZE_ERROR',
295
+ // 권한 에러
296
+ PERMISSION_DENIED: 'PERMISSION_DENIED',
297
+ PERMISSION_ERROR: 'PERMISSION_ERROR',
298
+ // 설정 에러
299
+ CONFIG_PARSE_ERROR: 'CONFIG_PARSE_ERROR',
300
+ CONFIG_INVALID: 'CONFIG_INVALID',
301
+ // 마이그레이션 에러
302
+ MIGRATION_FAILED: 'MIGRATION_FAILED',
303
+ MIGRATION_CONFLICT: 'MIGRATION_CONFLICT',
304
+ };
305
+ /**
306
+ * 자주 사용되는 환경변수명
307
+ *
308
+ * @constant
309
+ */
310
+ export const ENV_VARS = {
311
+ // Windows
312
+ appData: 'APPDATA',
313
+ localAppData: 'LOCALAPPDATA',
314
+ userProfile: 'USERPROFILE',
315
+ // Unix/Linux
316
+ home: 'HOME',
317
+ shell: 'SHELL',
318
+ // XDG (Linux)
319
+ xdgConfigHome: 'XDG_CONFIG_HOME',
320
+ xdgDataHome: 'XDG_DATA_HOME',
321
+ xdgCacheHome: 'XDG_CACHE_HOME',
322
+ xdgRuntimeDir: 'XDG_RUNTIME_DIR',
323
+ // 커스텀
324
+ claudeHome: 'CLAUDE_HOME',
325
+ claudeConfig: 'CLAUDE_CONFIG_HOME',
326
+ claudeData: 'CLAUDE_DATA_HOME',
327
+ claudeCache: 'CLAUDE_CACHE_HOME',
328
+ // 일반
329
+ temp: 'TEMP',
330
+ tmp: 'TMP',
331
+ user: 'USER',
332
+ username: 'USERNAME',
333
+ lang: 'LANG',
334
+ logLevel: 'LOG_LEVEL',
335
+ nodeEnv: 'NODE_ENV',
336
+ };
337
+ /**
338
+ * 플러그인 메타데이터 스키마 버전
339
+ *
340
+ * @constant
341
+ */
342
+ export const PLUGIN_SCHEMA_VERSION = {
343
+ current: '1.0.0',
344
+ minSupported: '1.0.0',
345
+ };
346
+ /**
347
+ * 스킬 메타데이터 스키마 버전
348
+ *
349
+ * @constant
350
+ */
351
+ export const SKILL_SCHEMA_VERSION = {
352
+ current: '1.0.0',
353
+ minSupported: '1.0.0',
354
+ };
355
+ /**
356
+ * 지원하는 파일 형식
357
+ *
358
+ * @constant
359
+ */
360
+ export const FILE_FORMATS = {
361
+ json: '.json',
362
+ yaml: '.yaml',
363
+ yml: '.yml',
364
+ env: '.env',
365
+ toml: '.toml',
366
+ xml: '.xml',
367
+ js: '.js',
368
+ ts: '.ts',
369
+ mjs: '.mjs',
370
+ };
371
+ /**
372
+ * 마이그레이션 전략
373
+ *
374
+ * @constant
375
+ */
376
+ export const MIGRATION_STRATEGY = {
377
+ // 백업 전략
378
+ backup: {
379
+ /** 마이그레이션 전 백업 생성 */
380
+ createBefore: true,
381
+ /** 마이그레이션 실패 시 롤백 */
382
+ rollbackOnFailure: true,
383
+ /** 백업 보관 기간 (일) */
384
+ retentionDays: 30,
385
+ },
386
+ // 검증 전략
387
+ validation: {
388
+ /** 마이그레이션 후 파일 무결성 검사 */
389
+ checkIntegrity: true,
390
+ /** 설정 유효성 검사 */
391
+ validateSchema: true,
392
+ },
393
+ // 성능 전략
394
+ performance: {
395
+ /** 병렬 처리 활성화 */
396
+ parallel: true,
397
+ /** 배치 크기 */
398
+ batchSize: 50,
399
+ },
400
+ };
401
+ // ─────────────────────────────────────────────────────────────────────────────
402
+ // Snapshot (export / import) constants
403
+ // ─────────────────────────────────────────────────────────────────────────────
404
+ export const SNAPSHOT = {
405
+ /** Directories to copy relative to ~/.claude */
406
+ INCLUDE_DIRS: ['executables', 'rules'],
407
+ /** Top-level files to copy */
408
+ INCLUDE_FILES: ['CLAUDE.md', 'settings.json', '.omc-config.json'],
409
+ /** Directories to skip entirely */
410
+ EXCLUDE_DIRS: [
411
+ 'file-history',
412
+ 'backups',
413
+ 'cache',
414
+ 'paste-cache',
415
+ 'debug',
416
+ 'hud',
417
+ 'ide',
418
+ 'plans',
419
+ 'projects',
420
+ 'plugins/cache',
421
+ 'todos',
422
+ 'chrome',
423
+ 'tmp',
424
+ ],
425
+ /** Top-level files to never export */
426
+ EXCLUDE_FILES: [
427
+ '.credentials.json',
428
+ '.session-stats.json',
429
+ '.omc/update-check.json',
430
+ '.omc/update-state.json',
431
+ ],
432
+ /** Directories containing plugin install manifests (re-install on import) */
433
+ INSTALL_META_DIRS: ['plugins/.install-manifests'],
434
+ /** Placeholder used in exported hooks paths */
435
+ CLAUDE_HOME_PLACEHOLDER: '{{CLAUDE_HOME}}',
436
+ /** Current snapshot format version */
437
+ SNAPSHOT_VERSION: '1',
438
+ };
439
+ export default {
440
+ APP_METADATA,
441
+ VERSION,
442
+ FOLDER_STRUCTURE,
443
+ CONFIG_FILES,
444
+ ENVIRONMENT,
445
+ LOG_LEVELS,
446
+ PLATFORM_NAMES,
447
+ TIMEOUTS,
448
+ RETRY_POLICY,
449
+ PATTERNS,
450
+ PERMISSIONS,
451
+ FILE_SIZES,
452
+ MIGRATION_VERSION,
453
+ ENCODINGS,
454
+ LINE_ENDINGS,
455
+ CACHE_EXPIRY,
456
+ ERROR_CODES,
457
+ ENV_VARS,
458
+ PLUGIN_SCHEMA_VERSION,
459
+ SKILL_SCHEMA_VERSION,
460
+ FILE_FORMATS,
461
+ MIGRATION_STRATEGY,
462
+ };
463
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"m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ts
3
+ * @description Claude Settings OS별 경로 계산 핵심 로직
4
+ * @author Claude
5
+ *
6
+ * 기능:
7
+ * - Windows: %APPDATA%, %LOCALAPPDATA% 처리
8
+ * - Linux: XDG Base Directory 표준 준수
9
+ * - macOS: ~/Library 구조 지원
10
+ * - 경로 정규화 및 검증
11
+ */
12
+ /**
13
+ * 경로 설정 인터페이스
14
+ *
15
+ * @interface PathsConfig
16
+ * @property {string} config - 설정 파일 저장 경로
17
+ * @property {string} data - 사용자 데이터 저장 경로
18
+ * @property {string} cache - 캐시 저장 경로
19
+ * @property {string} [backup] - 백업 저장 경로 (선택)
20
+ * @property {string} [state] - 런타임 상태 저장 경로 (선택)
21
+ * @property {string} [runtime] - XDG_RUNTIME_DIR (Linux 전용)
22
+ *
23
+ * @example
24
+ * const config: PathsConfig = {
25
+ * config: '/home/user/.config/claude',
26
+ * data: '/home/user/.local/share/claude',
27
+ * cache: '/home/user/.cache/claude',
28
+ * };
29
+ */
30
+ export interface PathsConfig {
31
+ config: string;
32
+ data: string;
33
+ cache: string;
34
+ backup?: string;
35
+ state?: string;
36
+ runtime?: string;
37
+ }
38
+ /**
39
+ * 경로 계산 결과 인터페이스
40
+ *
41
+ * @interface PathsResult
42
+ * @property {string} config - 설정 폴더 절대경로
43
+ * @property {string} data - 데이터 폴더 절대경로
44
+ * @property {string} cache - 캐시 폴더 절대경로
45
+ * @property {string} [backup] - 백업 폴더 절대경로
46
+ * @property {string} [state] - 상태 폴더 절대경로
47
+ * @property {string} [runtime] - 런타임 폴더 절대경로
48
+ */
49
+ export interface PathsResult extends PathsConfig {
50
+ }
51
+ /**
52
+ * 플랫폼 타입 정의
53
+ *
54
+ * @type PlatformType
55
+ */
56
+ export type PlatformType = 'win32' | 'linux' | 'darwin';
57
+ /**
58
+ * OS별 경로 계산 (메인 함수)
59
+ *
60
+ * @param {PlatformType} [platform] - 운영체제 타입 (기본값: process.platform)
61
+ * @param {Partial<PathsConfig>} [customConfig] - 커스텀 설정
62
+ * @returns {PathsResult} OS별 정규화된 경로
63
+ * @throws {Error} 필수 환경변수가 없거나 지원하지 않는 OS일 때
64
+ *
65
+ * @example
66
+ * // 현재 OS의 경로 획득
67
+ * const paths = getPaths();
68
+ * console.log(paths.config);
69
+ *
70
+ * @example
71
+ * // 특정 OS의 경로 획득
72
+ * const winPaths = getPaths('win32');
73
+ * const linuxPaths = getPaths('linux');
74
+ *
75
+ * @example
76
+ * // 커스텀 경로 적용
77
+ * const customPaths = getPaths('linux', {
78
+ * cache: '/mnt/fast-ssd/claude-cache'
79
+ * });
80
+ */
81
+ export declare function getPaths(platform?: PlatformType, customConfig?: Partial<PathsConfig>): PathsResult;
82
+ /**
83
+ * 현재 환경의 경로 빠르게 획득
84
+ *
85
+ * getPaths()의 래퍼 함수로, 플랫폼과 커스텀 설정 없이 기본값만 사용합니다.
86
+ *
87
+ * @param {Partial<PathsConfig>} [customConfig] - 커스텀 설정
88
+ * @returns {PathsResult} 현재 환경의 경로
89
+ *
90
+ * @example
91
+ * const paths = getDefaultPaths();
92
+ */
93
+ export declare function getDefaultPaths(customConfig?: Partial<PathsConfig>): PathsResult;
94
+ /**
95
+ * 경로 검증
96
+ *
97
+ * @param {string} pathStr - 검증할 경로
98
+ * @param {PlatformType} platform - 운영체제 타입
99
+ * @returns {boolean} 유효한 경로일 경우 true
100
+ *
101
+ * 검증 항목:
102
+ * - 절대 경로인지 확인
103
+ * - OS별 금지 문자 없는지 확인
104
+ *
105
+ * @example
106
+ * isValidPath('C:\\Users\\test\\.config', 'win32') // => true
107
+ * isValidPath('/home/user/.config', 'linux') // => true
108
+ */
109
+ export declare function isValidPath(pathStr: string, platform: PlatformType): boolean;
110
+ /**
111
+ * 경로의 부모 폴더 확장
112
+ *
113
+ * @param {string} pathStr - 입력 경로
114
+ * @param {number} [levels=1] - 올라갈 폴더 레벨
115
+ * @returns {string} 부모 폴더 경로
116
+ *
117
+ * @example
118
+ * getParentPath('/home/user/.config/claude/data', 2)
119
+ * // => '/home/user/.config/claude'
120
+ */
121
+ export declare function getParentPath(pathStr: string, levels?: number): string;
122
+ /**
123
+ * Returns the actual Claude Code home directory (same on all platforms).
124
+ * Claude Code always uses ~/.claude regardless of OS.
125
+ */
126
+ export declare function getClaudeHomePath(): string;
127
+ declare const _default: {
128
+ getPaths: typeof getPaths;
129
+ getDefaultPaths: typeof getDefaultPaths;
130
+ isValidPath: typeof isValidPath;
131
+ getParentPath: typeof getParentPath;
132
+ };
133
+ export default _default;
134
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAY,SAAQ,WAAW;CAAG;AAEnD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AA0LxD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,GAAE,YAAiD,EAC3D,YAAY,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAClC,WAAW,CA0Cb;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAEhF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAgB5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAMzE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;;;;;;;AAED,wBAKE"}