@mediaproc/cli 0.4.0 → 0.5.1

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 (40) hide show
  1. package/README.md +93 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +19 -12
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/add.d.ts.map +1 -1
  6. package/dist/commands/add.js +97 -125
  7. package/dist/commands/add.js.map +1 -1
  8. package/dist/commands/convert.js +2 -2
  9. package/dist/commands/convert.js.map +1 -1
  10. package/dist/commands/info.js +2 -2
  11. package/dist/commands/info.js.map +1 -1
  12. package/dist/commands/list.d.ts.map +1 -1
  13. package/dist/commands/list.js +3 -19
  14. package/dist/commands/list.js.map +1 -1
  15. package/dist/commands/optimize.js +2 -2
  16. package/dist/commands/optimize.js.map +1 -1
  17. package/dist/commands/remove.d.ts.map +1 -1
  18. package/dist/commands/remove.js +1 -4
  19. package/dist/commands/remove.js.map +1 -1
  20. package/dist/commands/update.d.ts +6 -0
  21. package/dist/commands/update.d.ts.map +1 -0
  22. package/dist/commands/update.js +227 -0
  23. package/dist/commands/update.js.map +1 -0
  24. package/dist/plugin-manager.d.ts +0 -19
  25. package/dist/plugin-manager.d.ts.map +1 -1
  26. package/dist/plugin-manager.js +0 -33
  27. package/dist/plugin-manager.js.map +1 -1
  28. package/package.json +2 -1
  29. package/dist/commands/config.d.ts +0 -3
  30. package/dist/commands/config.d.ts.map +0 -1
  31. package/dist/commands/config.js +0 -109
  32. package/dist/commands/config.js.map +0 -1
  33. package/dist/commands/init.d.ts +0 -3
  34. package/dist/commands/init.d.ts.map +0 -1
  35. package/dist/commands/init.js +0 -35
  36. package/dist/commands/init.js.map +0 -1
  37. package/dist/config-manager.d.ts +0 -110
  38. package/dist/config-manager.d.ts.map +0 -1
  39. package/dist/config-manager.js +0 -201
  40. package/dist/config-manager.js.map +0 -1
@@ -1,109 +0,0 @@
1
- import chalk from 'chalk';
2
- import { ConfigManager } from '../config-manager.js';
3
- export function configCommand(program) {
4
- const configCmd = program
5
- .command('config')
6
- .description('Manage MediaProc configuration');
7
- configCmd
8
- .command('show')
9
- .description('Show current configuration')
10
- .action(() => {
11
- const configManager = new ConfigManager();
12
- if (!configManager.exists()) {
13
- console.log(chalk.yellow('No config file found. Run: ') + chalk.cyan('mediaproc init'));
14
- return;
15
- }
16
- try {
17
- const config = configManager.get();
18
- const configPath = ConfigManager.getConfigPath();
19
- console.log('');
20
- console.log(chalk.bold('MediaProc Configuration'));
21
- console.log(chalk.dim(`Location: ${configPath}`));
22
- console.log(chalk.dim('─'.repeat(50)));
23
- console.log('');
24
- console.log(chalk.cyan('Version: ') + config.version);
25
- console.log(chalk.cyan('Last Updated: ') + (config.lastUpdated ? new Date(config.lastUpdated).toLocaleString() : 'Never'));
26
- console.log('');
27
- console.log(chalk.bold('Installed Plugins:'));
28
- if (config.installedPlugins.length === 0) {
29
- console.log(chalk.dim(' (none)'));
30
- }
31
- else {
32
- config.installedPlugins.forEach(p => {
33
- const isLoaded = config.loadedPlugins.includes(p);
34
- const status = isLoaded ? chalk.green('✓ loaded') : chalk.yellow('not loaded');
35
- console.log(` ${p} ${chalk.dim(`[${status}${chalk.dim(']')}`)}`);
36
- });
37
- }
38
- console.log('');
39
- if (config.defaults && Object.keys(config.defaults).length > 0) {
40
- console.log(chalk.bold('Defaults:'));
41
- console.log(JSON.stringify(config.defaults, null, 2));
42
- console.log('');
43
- }
44
- if (config.pipelines && Object.keys(config.pipelines).length > 0) {
45
- console.log(chalk.bold('Pipelines:'));
46
- console.log(JSON.stringify(config.pipelines, null, 2));
47
- console.log('');
48
- }
49
- }
50
- catch (error) {
51
- console.error(chalk.red('✗ Failed to read config file'));
52
- const errorMessage = error instanceof Error ? error.message : String(error);
53
- console.error(chalk.dim(errorMessage));
54
- process.exit(1);
55
- }
56
- });
57
- configCmd
58
- .command('set <key> <value>')
59
- .description('Set a configuration value')
60
- .action((key, value) => {
61
- const configManager = new ConfigManager();
62
- if (!configManager.exists()) {
63
- console.log(chalk.yellow('No config file found. Run: ') + chalk.cyan('mediaproc init'));
64
- return;
65
- }
66
- try {
67
- // Try to parse value as JSON, fallback to string
68
- let parsedValue;
69
- try {
70
- parsedValue = JSON.parse(value);
71
- }
72
- catch {
73
- parsedValue = value;
74
- }
75
- configManager.set(key, parsedValue);
76
- console.log(chalk.green(`✓ Set ${key} = ${JSON.stringify(parsedValue)}`));
77
- }
78
- catch (error) {
79
- console.error(chalk.red('✗ Failed to update config'));
80
- const errorMessage = error instanceof Error ? error.message : String(error);
81
- console.error(chalk.dim(errorMessage));
82
- process.exit(1);
83
- }
84
- });
85
- configCmd
86
- .command('get <key>')
87
- .description('Get a configuration value')
88
- .action((key) => {
89
- const configManager = new ConfigManager();
90
- if (!configManager.exists()) {
91
- console.log(chalk.yellow('No config file found. Run: ') + chalk.cyan('mediaproc init'));
92
- return;
93
- }
94
- const value = configManager.getValue(key);
95
- if (value === undefined) {
96
- console.log(chalk.yellow(`Key '${key}' not found in config`));
97
- }
98
- else {
99
- console.log(JSON.stringify(value, null, 2));
100
- }
101
- });
102
- configCmd
103
- .command('path')
104
- .description('Show configuration file path')
105
- .action(() => {
106
- console.log(ConfigManager.getConfigPath());
107
- });
108
- }
109
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,MAAM,SAAS,GAAG,OAAO;SACtB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,gCAAgC,CAAC,CAAC;IAEjD,SAAS;SACN,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,4BAA4B,CAAC;SACzC,MAAM,CAAC,GAAG,EAAE;QACX,MAAM,aAA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,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,SAAS;SACN,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,8BAA8B,CAAC;SAC3C,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function initCommand(program: Command): void;
3
- //# sourceMappingURL=init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiClD"}
@@ -1,35 +0,0 @@
1
- import chalk from 'chalk';
2
- import { ConfigManager } from '../config-manager.js';
3
- export function initCommand(program) {
4
- program
5
- .command('init')
6
- .description('Initialize MediaProc configuration in ~/.mediaproc/')
7
- .option('--reset', 'Reset existing configuration')
8
- .action((options) => {
9
- const configManager = new ConfigManager();
10
- const configPath = ConfigManager.getConfigPath();
11
- if (configManager.exists() && !options.reset) {
12
- console.log(chalk.yellow('⚠️ Configuration already exists at:'));
13
- console.log(chalk.dim(` ${configPath}`));
14
- console.log('');
15
- console.log(chalk.dim('Use --reset flag to reset configuration'));
16
- process.exit(1);
17
- }
18
- if (options.reset) {
19
- console.log(chalk.yellow('Resetting configuration...'));
20
- configManager.reset();
21
- }
22
- else {
23
- // Load will create default config if not exists
24
- configManager.load();
25
- }
26
- console.log(chalk.green('✓ MediaProc configuration initialized'));
27
- console.log(chalk.dim(` Location: ${configPath}`));
28
- console.log('');
29
- console.log(chalk.bold('Next steps:'));
30
- console.log(chalk.dim(' 1. Browse plugins: ') + chalk.cyan('mediaproc plugins'));
31
- console.log(chalk.dim(' 2. Install plugins: ') + chalk.cyan('mediaproc add image'));
32
- console.log(chalk.dim(' 3. View config: ') + chalk.cyan('mediaproc config show'));
33
- });
34
- }
35
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,qDAAqD,CAAC;SAClE,MAAM,CAAC,SAAS,EAAE,8BAA8B,CAAC;SACjD,MAAM,CAAC,CAAC,OAA4B,EAAE,EAAE;QACvC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,EAAE,CAAC;QAEjD,IAAI,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC,CAAC;YAClE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,UAAU,EAAE,CAAC,CAAC,CAAC;YAC3C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC,CAAC;YAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC;YACxD,aAAa,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,gDAAgD;YAChD,aAAa,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,UAAU,EAAE,CAAC,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,uBAAuB,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAClF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;QACrF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,110 +0,0 @@
1
- /**
2
- * Configuration structure for MediaProc
3
- */
4
- export interface MediaProcConfig {
5
- version: string;
6
- installedPlugins: string[];
7
- loadedPlugins: string[];
8
- defaults?: {
9
- [plugin: string]: {
10
- [key: string]: any;
11
- };
12
- };
13
- pipelines?: {
14
- [name: string]: {
15
- name: string;
16
- steps: Array<{
17
- plugin: string;
18
- command: string;
19
- options?: Record<string, any>;
20
- }>;
21
- };
22
- };
23
- lastUpdated?: string;
24
- }
25
- /**
26
- * Configuration manager for MediaProc
27
- * Handles reading/writing config from ~/.mediaproc/config.json
28
- */
29
- export declare class ConfigManager {
30
- private static readonly CONFIG_DIR;
31
- private static readonly CONFIG_FILE;
32
- private config;
33
- /**
34
- * Get the config directory path
35
- */
36
- static getConfigDir(): string;
37
- /**
38
- * Get the config file path
39
- */
40
- static getConfigPath(): string;
41
- /**
42
- * Ensure config directory exists
43
- */
44
- private ensureConfigDir;
45
- /**
46
- * Load config from file
47
- */
48
- load(): MediaProcConfig;
49
- /**
50
- * Create default config
51
- */
52
- private createDefaultConfig;
53
- /**
54
- * Save config to file
55
- */
56
- save(): void;
57
- /**
58
- * Get current config
59
- */
60
- get(): MediaProcConfig;
61
- /**
62
- * Check if a plugin is installed
63
- */
64
- isPluginInstalled(pluginName: string): boolean;
65
- /**
66
- * Check if a plugin is loaded
67
- */
68
- isPluginLoaded(pluginName: string): boolean;
69
- /**
70
- * Add plugin to installed list
71
- */
72
- addInstalledPlugin(pluginName: string): void;
73
- /**
74
- * Remove plugin from installed list
75
- */
76
- removeInstalledPlugin(pluginName: string): void;
77
- /**
78
- * Add plugin to loaded list
79
- */
80
- addLoadedPlugin(pluginName: string): void;
81
- /**
82
- * Remove plugin from loaded list
83
- */
84
- removeLoadedPlugin(pluginName: string): void;
85
- /**
86
- * Get list of installed plugins
87
- */
88
- getInstalledPlugins(): string[];
89
- /**
90
- * Get list of loaded plugins
91
- */
92
- getLoadedPlugins(): string[];
93
- /**
94
- * Set a configuration value
95
- */
96
- set(key: string, value: any): void;
97
- /**
98
- * Get a configuration value
99
- */
100
- getValue(key: string): any;
101
- /**
102
- * Reset config to defaults
103
- */
104
- reset(): void;
105
- /**
106
- * Check if config file exists
107
- */
108
- exists(): boolean;
109
- }
110
- //# sourceMappingURL=config-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../src/config-manager.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE;QACP,CAAC,MAAM,EAAE,MAAM,GAAG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G,IAAI;IAM5C;;OAEG;IACH,mBAAmB,IAAI,MAAM,EAAE;IAK/B;;OAEG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAK5B;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAgBlC;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG;IAe1B;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,MAAM,IAAI,OAAO;CAGpB"}
@@ -1,201 +0,0 @@
1
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
2
- import { join } from 'path';
3
- import { homedir } from 'os';
4
- /**
5
- * Configuration manager for MediaProc
6
- * Handles reading/writing config from ~/.mediaproc/config.json
7
- */
8
- export class ConfigManager {
9
- static CONFIG_DIR = join(homedir(), '.mediaproc');
10
- static CONFIG_FILE = join(ConfigManager.CONFIG_DIR, 'config.json');
11
- config = null;
12
- /**
13
- * Get the config directory path
14
- */
15
- static getConfigDir() {
16
- return ConfigManager.CONFIG_DIR;
17
- }
18
- /**
19
- * Get the config file path
20
- */
21
- static getConfigPath() {
22
- return ConfigManager.CONFIG_FILE;
23
- }
24
- /**
25
- * Ensure config directory exists
26
- */
27
- ensureConfigDir() {
28
- if (!existsSync(ConfigManager.CONFIG_DIR)) {
29
- mkdirSync(ConfigManager.CONFIG_DIR, { recursive: true });
30
- }
31
- }
32
- /**
33
- * Load config from file
34
- */
35
- load() {
36
- if (this.config) {
37
- return this.config;
38
- }
39
- this.ensureConfigDir();
40
- if (!existsSync(ConfigManager.CONFIG_FILE)) {
41
- // Create default config
42
- this.config = this.createDefaultConfig();
43
- this.save();
44
- return this.config;
45
- }
46
- try {
47
- const data = readFileSync(ConfigManager.CONFIG_FILE, 'utf-8');
48
- this.config = JSON.parse(data);
49
- return this.config;
50
- }
51
- catch (error) {
52
- console.error('Failed to parse config file, creating new one');
53
- this.config = this.createDefaultConfig();
54
- this.save();
55
- return this.config;
56
- }
57
- }
58
- /**
59
- * Create default config
60
- */
61
- createDefaultConfig() {
62
- return {
63
- version: '1.0',
64
- installedPlugins: [],
65
- loadedPlugins: [],
66
- defaults: {},
67
- pipelines: {},
68
- lastUpdated: new Date().toISOString(),
69
- };
70
- }
71
- /**
72
- * Save config to file
73
- */
74
- save() {
75
- if (!this.config) {
76
- return;
77
- }
78
- this.ensureConfigDir();
79
- this.config.lastUpdated = new Date().toISOString();
80
- writeFileSync(ConfigManager.CONFIG_FILE, JSON.stringify(this.config, null, 2), 'utf-8');
81
- }
82
- /**
83
- * Get current config
84
- */
85
- get() {
86
- if (!this.config) {
87
- return this.load();
88
- }
89
- return this.config;
90
- }
91
- /**
92
- * Check if a plugin is installed
93
- */
94
- isPluginInstalled(pluginName) {
95
- const config = this.get();
96
- return config.installedPlugins.includes(pluginName);
97
- }
98
- /**
99
- * Check if a plugin is loaded
100
- */
101
- isPluginLoaded(pluginName) {
102
- const config = this.get();
103
- return config.loadedPlugins.includes(pluginName);
104
- }
105
- /**
106
- * Add plugin to installed list
107
- */
108
- addInstalledPlugin(pluginName) {
109
- const config = this.get();
110
- if (!config.installedPlugins.includes(pluginName)) {
111
- config.installedPlugins.push(pluginName);
112
- this.save();
113
- }
114
- }
115
- /**
116
- * Remove plugin from installed list
117
- */
118
- removeInstalledPlugin(pluginName) {
119
- const config = this.get();
120
- config.installedPlugins = config.installedPlugins.filter(p => p !== pluginName);
121
- config.loadedPlugins = config.loadedPlugins.filter(p => p !== pluginName);
122
- this.save();
123
- }
124
- /**
125
- * Add plugin to loaded list
126
- */
127
- addLoadedPlugin(pluginName) {
128
- const config = this.get();
129
- if (!config.loadedPlugins.includes(pluginName)) {
130
- config.loadedPlugins.push(pluginName);
131
- this.save();
132
- }
133
- }
134
- /**
135
- * Remove plugin from loaded list
136
- */
137
- removeLoadedPlugin(pluginName) {
138
- const config = this.get();
139
- config.loadedPlugins = config.loadedPlugins.filter(p => p !== pluginName);
140
- this.save();
141
- }
142
- /**
143
- * Get list of installed plugins
144
- */
145
- getInstalledPlugins() {
146
- const config = this.get();
147
- return [...config.installedPlugins];
148
- }
149
- /**
150
- * Get list of loaded plugins
151
- */
152
- getLoadedPlugins() {
153
- const config = this.get();
154
- return [...config.loadedPlugins];
155
- }
156
- /**
157
- * Set a configuration value
158
- */
159
- set(key, value) {
160
- const config = this.get();
161
- const keys = key.split('.');
162
- let current = config;
163
- for (let i = 0; i < keys.length - 1; i++) {
164
- if (!current[keys[i]]) {
165
- current[keys[i]] = {};
166
- }
167
- current = current[keys[i]];
168
- }
169
- current[keys[keys.length - 1]] = value;
170
- this.save();
171
- }
172
- /**
173
- * Get a configuration value
174
- */
175
- getValue(key) {
176
- const config = this.get();
177
- const keys = key.split('.');
178
- let current = config;
179
- for (const k of keys) {
180
- if (current[k] === undefined) {
181
- return undefined;
182
- }
183
- current = current[k];
184
- }
185
- return current;
186
- }
187
- /**
188
- * Reset config to defaults
189
- */
190
- reset() {
191
- this.config = this.createDefaultConfig();
192
- this.save();
193
- }
194
- /**
195
- * Check if config file exists
196
- */
197
- exists() {
198
- return existsSync(ConfigManager.CONFIG_FILE);
199
- }
200
- }
201
- //# sourceMappingURL=config-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-manager.js","sourceRoot":"","sources":["../src/config-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AA2B7B;;;GAGG;AACH,MAAM,OAAO,aAAa;IACd,MAAM,CAAU,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;IAC3D,MAAM,CAAU,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAE5E,MA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