@tpitre/story-ui 4.7.0 → 4.8.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.
- package/dist/cli/index.js +50 -9
- package/dist/mcp-server/index.js +2 -2
- package/dist/mcp-server/mcp-stdio-server.js +15 -2
- package/dist/mcp-server/routes/components.d.ts.map +1 -1
- package/dist/mcp-server/routes/components.js +30 -12
- package/dist/mcp-server/routes/generateStory.d.ts.map +1 -1
- package/dist/mcp-server/routes/generateStory.js +7 -1
- package/dist/story-generator/componentDiscovery.d.ts +14 -0
- package/dist/story-generator/componentDiscovery.d.ts.map +1 -1
- package/dist/story-generator/enhancedComponentDiscovery.d.ts +34 -0
- package/dist/story-generator/enhancedComponentDiscovery.d.ts.map +1 -1
- package/dist/story-generator/enhancedComponentDiscovery.js +461 -1
- package/dist/story-generator/framework-adapters/angular-adapter.d.ts +0 -4
- package/dist/story-generator/framework-adapters/angular-adapter.d.ts.map +1 -1
- package/dist/story-generator/framework-adapters/angular-adapter.js +1 -9
- package/dist/story-generator/framework-adapters/base-adapter.d.ts +8 -0
- package/dist/story-generator/framework-adapters/base-adapter.d.ts.map +1 -1
- package/dist/story-generator/framework-adapters/base-adapter.js +89 -2
- package/dist/story-generator/framework-adapters/react-adapter.d.ts.map +1 -1
- package/dist/story-generator/framework-adapters/react-adapter.js +68 -10
- package/dist/story-generator/framework-adapters/web-components-adapter.d.ts +0 -4
- package/dist/story-generator/framework-adapters/web-components-adapter.d.ts.map +1 -1
- package/dist/story-generator/framework-adapters/web-components-adapter.js +1 -9
- package/dist/story-generator/postProcessStory.d.ts +23 -0
- package/dist/story-generator/postProcessStory.d.ts.map +1 -1
- package/dist/story-generator/postProcessStory.js +134 -0
- package/dist/story-generator/promptGenerator.d.ts.map +1 -1
- package/dist/story-generator/promptGenerator.js +165 -11
- package/dist/story-ui.config.d.ts +16 -0
- package/dist/story-ui.config.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -30,12 +30,16 @@ program
|
|
|
30
30
|
.description('Start the Story UI server')
|
|
31
31
|
.option('-p, --port <port>', 'Port to run the server on', '4001')
|
|
32
32
|
.option('-c, --config <config>', 'Path to configuration file')
|
|
33
|
+
.option('--mcp', 'Also start MCP stdio server for Claude Desktop integration')
|
|
33
34
|
.action(async (options) => {
|
|
34
|
-
|
|
35
|
+
// Use stderr for all logging to avoid breaking MCP JSON-RPC protocol
|
|
36
|
+
// when Claude Desktop spawns this process
|
|
37
|
+
console.error('🚀 Starting Story UI server...');
|
|
35
38
|
// Use absolute path to avoid dist/dist issue when package is linked
|
|
36
39
|
const pkgRoot = path.resolve(__dirname, '..');
|
|
37
40
|
const serverPath = path.join(pkgRoot, 'mcp-server/index.js');
|
|
38
|
-
|
|
41
|
+
const mcpStdioPath = path.join(pkgRoot, 'mcp-server/mcp-stdio-server.js');
|
|
42
|
+
console.error(`✅ Using HTTP server at: ${serverPath}`);
|
|
39
43
|
// FIRST_EDIT: determine an available port
|
|
40
44
|
const requestedPort = parseInt(options.port || '4001', 10);
|
|
41
45
|
const isPortFree = (port) => {
|
|
@@ -55,7 +59,7 @@ program
|
|
|
55
59
|
finalPort += 1;
|
|
56
60
|
}
|
|
57
61
|
if (finalPort !== requestedPort) {
|
|
58
|
-
console.
|
|
62
|
+
console.error(`⚠️ Port ${requestedPort} is in use. Using ${finalPort} instead.`);
|
|
59
63
|
}
|
|
60
64
|
const env = { ...process.env, PORT: String(finalPort) };
|
|
61
65
|
// Set memory limit to prevent heap exhaustion during vision/image processing
|
|
@@ -66,16 +70,53 @@ program
|
|
|
66
70
|
if (options.config) {
|
|
67
71
|
env.STORY_UI_CONFIG_PATH = options.config;
|
|
68
72
|
}
|
|
73
|
+
// Log the working directory for debugging
|
|
74
|
+
console.error(`📁 Working directory: ${process.cwd()}`);
|
|
75
|
+
// Redirect child stdout to stderr to avoid breaking MCP JSON-RPC protocol
|
|
76
|
+
// when Claude Desktop spawns this process. The HTTP server logs will still
|
|
77
|
+
// be visible but won't interfere with MCP communication.
|
|
69
78
|
const server = spawn('node', [serverPath], {
|
|
70
|
-
stdio: 'inherit',
|
|
71
|
-
env
|
|
79
|
+
stdio: ['ignore', 'pipe', 'inherit'],
|
|
80
|
+
env,
|
|
81
|
+
cwd: process.cwd() // Explicitly pass cwd to ensure config is found
|
|
72
82
|
});
|
|
83
|
+
// Pipe child's stdout to stderr so logs are visible without breaking MCP
|
|
84
|
+
if (server.stdout) {
|
|
85
|
+
server.stdout.pipe(process.stderr);
|
|
86
|
+
}
|
|
73
87
|
server.on('close', (code) => {
|
|
74
|
-
console.
|
|
75
|
-
});
|
|
76
|
-
process.on('SIGINT', () => {
|
|
77
|
-
server.kill('SIGINT');
|
|
88
|
+
console.error(`HTTP server exited with code ${code}`);
|
|
78
89
|
});
|
|
90
|
+
// If --mcp flag is set, also start the MCP stdio server for Claude Desktop
|
|
91
|
+
// This allows a single command to run both HTTP server and MCP protocol handler
|
|
92
|
+
if (options.mcp) {
|
|
93
|
+
console.error('📡 Starting MCP stdio server for Claude Desktop...');
|
|
94
|
+
// Wait a moment for HTTP server to start
|
|
95
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
96
|
+
const mcpEnv = {
|
|
97
|
+
...process.env,
|
|
98
|
+
STORY_UI_HTTP_PORT: String(finalPort)
|
|
99
|
+
};
|
|
100
|
+
// Spawn MCP stdio server with stdin/stdout inherited for JSON-RPC communication
|
|
101
|
+
const mcpServer = spawn('node', [mcpStdioPath], {
|
|
102
|
+
stdio: 'inherit',
|
|
103
|
+
env: mcpEnv,
|
|
104
|
+
cwd: process.cwd() // Explicitly pass cwd to ensure config is found
|
|
105
|
+
});
|
|
106
|
+
mcpServer.on('close', (code) => {
|
|
107
|
+
console.error(`MCP stdio server exited with code ${code}`);
|
|
108
|
+
server.kill('SIGTERM');
|
|
109
|
+
});
|
|
110
|
+
process.on('SIGINT', () => {
|
|
111
|
+
mcpServer.kill('SIGINT');
|
|
112
|
+
server.kill('SIGINT');
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
process.on('SIGINT', () => {
|
|
117
|
+
server.kill('SIGINT');
|
|
118
|
+
});
|
|
119
|
+
}
|
|
79
120
|
});
|
|
80
121
|
program
|
|
81
122
|
.command('config')
|
package/dist/mcp-server/index.js
CHANGED
|
@@ -769,8 +769,8 @@ if (storybookProxyEnabled) {
|
|
|
769
769
|
}
|
|
770
770
|
// Start server
|
|
771
771
|
app.listen(PORT, () => {
|
|
772
|
-
console.
|
|
773
|
-
console.
|
|
772
|
+
console.error(`MCP server running on port ${PORT}`);
|
|
773
|
+
console.error(`Stories will be generated to: ${config.generatedStoriesPath}`);
|
|
774
774
|
}).on('error', (err) => {
|
|
775
775
|
if (err.code === 'EADDRINUSE') {
|
|
776
776
|
console.error(`\n❌ Port ${PORT} is already in use!`);
|
|
@@ -12,7 +12,8 @@ import { fileURLToPath } from 'url';
|
|
|
12
12
|
// Get package version dynamically
|
|
13
13
|
const __filename_mcp = fileURLToPath(import.meta.url);
|
|
14
14
|
const __dirname_mcp = path.dirname(__filename_mcp);
|
|
15
|
-
|
|
15
|
+
// Go up two levels from dist/mcp-server/ to reach the project root
|
|
16
|
+
const packageJsonPath = path.resolve(__dirname_mcp, '../../package.json');
|
|
16
17
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
17
18
|
const PACKAGE_VERSION = packageJson.version;
|
|
18
19
|
// Check for working directory override from environment or command line
|
|
@@ -409,7 +410,19 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
409
410
|
}]
|
|
410
411
|
};
|
|
411
412
|
}
|
|
412
|
-
const propsList = Object.entries(props).map(([name, info]) =>
|
|
413
|
+
const propsList = Object.entries(props).map(([name, info]) => {
|
|
414
|
+
let line = `- ${name}: ${info.type}`;
|
|
415
|
+
// Show options for select/radio types
|
|
416
|
+
if (info.options && info.options.length > 0) {
|
|
417
|
+
const optionsStr = info.options.slice(0, 6).map((o) => `"${o}"`).join(' | ');
|
|
418
|
+
line += ` [${optionsStr}${info.options.length > 6 ? ' | ...' : ''}]`;
|
|
419
|
+
}
|
|
420
|
+
line += ` ${info.required ? '(required)' : '(optional)'}`;
|
|
421
|
+
if (info.description) {
|
|
422
|
+
line += ` - ${info.description}`;
|
|
423
|
+
}
|
|
424
|
+
return line;
|
|
425
|
+
}).join('\n');
|
|
413
426
|
return {
|
|
414
427
|
content: [{
|
|
415
428
|
type: "text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAqB5C,wBAAsB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,2DAmC9D;AAED,wBAAsB,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,2DAgEzD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { loadUserConfig } from '../../story-generator/configLoader.js';
|
|
2
2
|
import { EnhancedComponentDiscovery } from '../../story-generator/enhancedComponentDiscovery.js';
|
|
3
|
-
// Cache discovered components for performance
|
|
4
3
|
let cachedComponents = null;
|
|
5
4
|
let cacheTimestamp = 0;
|
|
6
5
|
const CACHE_TTL = 60000; // 1 minute
|
|
@@ -16,12 +15,13 @@ export async function getComponents(req, res) {
|
|
|
16
15
|
// Use enhanced discovery
|
|
17
16
|
const discovery = new EnhancedComponentDiscovery(config);
|
|
18
17
|
const components = await discovery.discoverAll();
|
|
19
|
-
// Transform to API format
|
|
18
|
+
// Transform to API format - include propTypes for rich type info
|
|
20
19
|
const apiComponents = components.map(comp => ({
|
|
21
20
|
name: comp.name,
|
|
22
21
|
description: comp.description,
|
|
23
22
|
category: comp.category,
|
|
24
23
|
props: comp.props,
|
|
24
|
+
propTypes: comp.propTypes,
|
|
25
25
|
slots: comp.slots
|
|
26
26
|
}));
|
|
27
27
|
// Cache the results
|
|
@@ -51,6 +51,7 @@ export async function getProps(req, res) {
|
|
|
51
51
|
description: comp.description,
|
|
52
52
|
category: comp.category,
|
|
53
53
|
props: comp.props,
|
|
54
|
+
propTypes: comp.propTypes,
|
|
54
55
|
slots: comp.slots
|
|
55
56
|
}));
|
|
56
57
|
cacheTimestamp = now;
|
|
@@ -58,19 +59,36 @@ export async function getProps(req, res) {
|
|
|
58
59
|
// Find the requested component
|
|
59
60
|
const comp = cachedComponents.find(c => c.name === component);
|
|
60
61
|
if (!comp) {
|
|
61
|
-
return res.json(
|
|
62
|
+
return res.json({});
|
|
62
63
|
}
|
|
63
|
-
// Return props
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
// Return props as an object keyed by prop name (for MCP handler compatibility)
|
|
65
|
+
// Use rich propTypes if available, otherwise fall back to simple props
|
|
66
|
+
const propsObject = {};
|
|
67
|
+
if (comp.propTypes && comp.propTypes.length > 0) {
|
|
68
|
+
// Use rich prop type information
|
|
69
|
+
for (const propType of comp.propTypes) {
|
|
70
|
+
propsObject[propType.name] = {
|
|
71
|
+
type: propType.type || 'string',
|
|
72
|
+
description: propType.description || `${propType.name} property`,
|
|
73
|
+
required: propType.required || false,
|
|
74
|
+
...(propType.options && propType.options.length > 0 ? { options: propType.options } : {})
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Fall back to simple props with generic metadata
|
|
80
|
+
for (const prop of comp.props) {
|
|
81
|
+
propsObject[prop] = {
|
|
82
|
+
type: 'string',
|
|
83
|
+
description: `${prop} property`,
|
|
84
|
+
required: false
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
res.json(propsObject);
|
|
71
89
|
}
|
|
72
90
|
catch (error) {
|
|
73
91
|
console.error('Error getting component props:', error);
|
|
74
|
-
res.json(
|
|
92
|
+
res.json({});
|
|
75
93
|
}
|
|
76
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateStory.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/generateStory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAyd5C,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"generateStory.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/generateStory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAyd5C,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,2DA2mBxE"}
|
|
@@ -10,7 +10,7 @@ import { isBlacklistedComponent, isBlacklistedIcon, getBlacklistErrorMessage, IC
|
|
|
10
10
|
import { StoryTracker } from '../../story-generator/storyTracker.js';
|
|
11
11
|
import { EnhancedComponentDiscovery } from '../../story-generator/enhancedComponentDiscovery.js';
|
|
12
12
|
import { getDocumentation } from '../../story-generator/documentation-sources.js';
|
|
13
|
-
import { postProcessStory } from '../../story-generator/postProcessStory.js';
|
|
13
|
+
import { postProcessStory, fixBarrelImports } from '../../story-generator/postProcessStory.js';
|
|
14
14
|
import { validateStory } from '../../story-generator/storyValidator.js';
|
|
15
15
|
import { StoryHistoryManager } from '../../story-generator/storyHistory.js';
|
|
16
16
|
import { logger } from '../../story-generator/logger.js';
|
|
@@ -782,6 +782,12 @@ export async function generateStoryFromPrompt(req, res) {
|
|
|
782
782
|
logger.log('✅ Applied validation fixes (React import removal or syntax fixes)');
|
|
783
783
|
fixedFileContents = finalValidation.fixedCode;
|
|
784
784
|
}
|
|
785
|
+
// Fix barrel imports to individual file imports if configured
|
|
786
|
+
// This MUST be done after validation since validation can overwrite the code
|
|
787
|
+
// Pass discoveredComponents for design-system agnostic import resolution
|
|
788
|
+
if (config.importPath && config.importStyle === 'individual') {
|
|
789
|
+
fixedFileContents = fixBarrelImports(fixedFileContents, config.importPath, config.importStyle, config.componentsPath, discoveredComponents);
|
|
790
|
+
}
|
|
785
791
|
if (!finalValidation.isValid) {
|
|
786
792
|
logger.log('⚠️ Post-processing introduced syntax errors:', finalValidation.errors);
|
|
787
793
|
// If we don't have fixed code at this point, we can't recover
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { StoryUIConfig } from '../story-ui.config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Rich prop type information extracted from argTypes
|
|
4
|
+
* Design-system and framework agnostic - works with any Storybook project
|
|
5
|
+
*/
|
|
6
|
+
export interface PropInfo {
|
|
7
|
+
name: string;
|
|
8
|
+
type: 'string' | 'boolean' | 'number' | 'select' | 'radio' | 'object' | 'array' | 'function' | 'unknown';
|
|
9
|
+
options?: string[];
|
|
10
|
+
description?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
defaultValue?: unknown;
|
|
13
|
+
control?: string;
|
|
14
|
+
}
|
|
2
15
|
export interface DiscoveredComponent {
|
|
3
16
|
name: string;
|
|
4
17
|
filePath: string;
|
|
5
18
|
props: string[];
|
|
19
|
+
propTypes?: PropInfo[];
|
|
6
20
|
description: string;
|
|
7
21
|
category: 'layout' | 'content' | 'form' | 'navigation' | 'feedback' | 'other';
|
|
8
22
|
slots?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentDiscovery.d.ts","sourceRoot":"","sources":["../../story-generator/componentDiscovery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,aAAa,EAAE,MAAM,uBAAuB,CA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IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;IAC9E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,cAAc,EAAE,MAAM,EACtB,eAAe,GAAE,MAAW,GAC3B,mBAAmB,EAAE,CA2DvB;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,kBAAkB,EAAE,MAAM,EAC1B,eAAe,GAAE,MAAW,GAC3B,mBAAmB,EAAE,CAwCvB;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,MAAM,EACnB,eAAe,GAAE,MAAW,GAC3B,mBAAmB,EAAE,CA8DvB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,mBAAmB,EAAE,CAmB/E"}
|
|
@@ -84,8 +84,42 @@ export declare class EnhancedComponentDiscovery {
|
|
|
84
84
|
private extractComponentNames;
|
|
85
85
|
/**
|
|
86
86
|
* Extract props from file content
|
|
87
|
+
* Supports multiple patterns:
|
|
88
|
+
* - TypeScript interfaces (interface ButtonProps { variant: ... })
|
|
89
|
+
* - PropTypes (Component.propTypes = { variant: ... })
|
|
90
|
+
* - Function parameter destructuring ({ className, variant, ...props }: Props)
|
|
91
|
+
* - VariantProps from class-variance-authority
|
|
87
92
|
*/
|
|
88
93
|
private extractPropsFromFile;
|
|
94
|
+
/**
|
|
95
|
+
* Extract props from function parameter destructuring patterns
|
|
96
|
+
* Works with React, Vue <script setup>, and other frameworks
|
|
97
|
+
*/
|
|
98
|
+
private extractDestructuredProps;
|
|
99
|
+
/**
|
|
100
|
+
* Extract props from co-located story file (e.g., Button.stories.tsx)
|
|
101
|
+
* This is a fallback for components like shadcn/ui that don't use interface Props patterns
|
|
102
|
+
*/
|
|
103
|
+
private extractPropsFromStoryFile;
|
|
104
|
+
/**
|
|
105
|
+
* Extract rich prop type information from story file argTypes
|
|
106
|
+
* Framework-agnostic: works with any Storybook project (React, Vue, Angular, Svelte, etc.)
|
|
107
|
+
*/
|
|
108
|
+
private extractRichPropsFromStoryFile;
|
|
109
|
+
/**
|
|
110
|
+
* Scan story code for prop usage patterns to infer select types
|
|
111
|
+
* Looks for patterns like: variant="destructive", size='lg', type={value}
|
|
112
|
+
*/
|
|
113
|
+
private inferSelectTypesFromStoryCode;
|
|
114
|
+
/**
|
|
115
|
+
* Generate better descriptions for common props when not provided
|
|
116
|
+
*/
|
|
117
|
+
private enhancePropDescriptions;
|
|
118
|
+
/**
|
|
119
|
+
* Extract the content of the argTypes block using brace counting
|
|
120
|
+
* This handles nested objects more reliably than regex
|
|
121
|
+
*/
|
|
122
|
+
private extractArgTypesBlock;
|
|
89
123
|
/**
|
|
90
124
|
* Extract slots from content
|
|
91
125
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enhancedComponentDiscovery.d.ts","sourceRoot":"","sources":["../../story-generator/enhancedComponentDiscovery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"enhancedComponentDiscovery.d.ts","sourceRoot":"","sources":["../../story-generator/enhancedComponentDiscovery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAY,MAAM,yBAAy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