@frontmcp/uipack 0.12.2 → 1.0.0-beta.10
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/CLAUDE.md +56 -154
- package/README.md +367 -62
- package/adapters/base-template.d.ts +30 -0
- package/adapters/base-template.d.ts.map +1 -0
- package/adapters/cdn-info.d.ts +34 -0
- package/adapters/cdn-info.d.ts.map +1 -0
- package/adapters/constants.d.ts +18 -0
- package/adapters/constants.d.ts.map +1 -0
- package/adapters/content-detector.d.ts +19 -0
- package/adapters/content-detector.d.ts.map +1 -0
- package/adapters/content-renderers.d.ts +27 -0
- package/adapters/content-renderers.d.ts.map +1 -0
- package/adapters/index.d.ts +14 -7
- package/adapters/index.d.ts.map +1 -1
- package/adapters/index.js +2343 -426
- package/adapters/render-failure.d.ts +18 -0
- package/adapters/render-failure.d.ts.map +1 -0
- package/adapters/response-builder.d.ts +34 -104
- package/adapters/response-builder.d.ts.map +1 -1
- package/adapters/serving-mode.d.ts +28 -91
- package/adapters/serving-mode.d.ts.map +1 -1
- package/adapters/template-renderer.d.ts +50 -0
- package/adapters/template-renderer.d.ts.map +1 -0
- package/adapters/type-detector.d.ts +18 -0
- package/adapters/type-detector.d.ts.map +1 -0
- package/bridge-runtime/index.js +1 -1
- package/component/index.d.ts +14 -0
- package/component/index.d.ts.map +1 -0
- package/component/index.js +2043 -0
- package/component/loader.d.ts +36 -0
- package/component/loader.d.ts.map +1 -0
- package/component/renderer.d.ts +30 -0
- package/component/renderer.d.ts.map +1 -0
- package/component/transpiler.d.ts +49 -0
- package/component/transpiler.d.ts.map +1 -0
- package/component/types.d.ts +82 -0
- package/component/types.d.ts.map +1 -0
- package/esm/adapters/index.mjs +2337 -422
- package/esm/bridge-runtime/index.mjs +1 -1
- package/esm/component/index.mjs +2013 -0
- package/esm/index.mjs +3446 -13935
- package/esm/package.json +4 -13
- package/esm/resolver/index.mjs +661 -0
- package/esm/shell/index.mjs +1406 -0
- package/esm/types/index.mjs +11 -11
- package/esm/utils/index.mjs +53 -8
- package/index.d.ts +12 -40
- package/index.d.ts.map +1 -1
- package/index.js +3579 -14218
- package/package.json +4 -13
- package/resolver/cdn-registry.d.ts +39 -0
- package/resolver/cdn-registry.d.ts.map +1 -0
- package/resolver/esm-sh.resolver.d.ts +54 -0
- package/resolver/esm-sh.resolver.d.ts.map +1 -0
- package/resolver/import-map.d.ts +47 -0
- package/resolver/import-map.d.ts.map +1 -0
- package/resolver/import-parser.d.ts +28 -0
- package/resolver/import-parser.d.ts.map +1 -0
- package/resolver/import-rewriter.d.ts +29 -0
- package/resolver/import-rewriter.d.ts.map +1 -0
- package/resolver/index.d.ts +15 -0
- package/resolver/index.d.ts.map +1 -0
- package/resolver/index.js +708 -0
- package/resolver/types.d.ts +191 -0
- package/resolver/types.d.ts.map +1 -0
- package/shell/builder.d.ts +31 -0
- package/shell/builder.d.ts.map +1 -0
- package/shell/csp.d.ts +37 -0
- package/shell/csp.d.ts.map +1 -0
- package/shell/custom-shell-applier.d.ts +33 -0
- package/shell/custom-shell-applier.d.ts.map +1 -0
- package/shell/custom-shell-resolver.d.ts +47 -0
- package/shell/custom-shell-resolver.d.ts.map +1 -0
- package/shell/custom-shell-types.d.ts +75 -0
- package/shell/custom-shell-types.d.ts.map +1 -0
- package/shell/custom-shell-validator.d.ts +26 -0
- package/shell/custom-shell-validator.d.ts.map +1 -0
- package/shell/data-injector.d.ts +40 -0
- package/shell/data-injector.d.ts.map +1 -0
- package/shell/index.d.ts +19 -0
- package/shell/index.d.ts.map +1 -0
- package/shell/index.js +1453 -0
- package/shell/types.d.ts +54 -0
- package/shell/types.d.ts.map +1 -0
- package/types/index.d.ts +1 -3
- package/types/index.d.ts.map +1 -1
- package/types/index.js +11 -11
- package/types/ui-config.d.ts +50 -11
- package/types/ui-config.d.ts.map +1 -1
- package/types/ui-runtime.d.ts +8 -82
- package/types/ui-runtime.d.ts.map +1 -1
- package/utils/index.d.ts +9 -3
- package/utils/index.d.ts.map +1 -1
- package/utils/index.js +59 -7
- package/adapters/platform-meta.constants.d.ts +0 -26
- package/adapters/platform-meta.constants.d.ts.map +0 -1
- package/adapters/platform-meta.d.ts +0 -234
- package/adapters/platform-meta.d.ts.map +0 -1
- package/base-template/bridge.d.ts +0 -90
- package/base-template/bridge.d.ts.map +0 -1
- package/base-template/default-base-template.d.ts +0 -91
- package/base-template/default-base-template.d.ts.map +0 -1
- package/base-template/index.d.ts +0 -15
- package/base-template/index.d.ts.map +0 -1
- package/base-template/index.js +0 -1393
- package/base-template/polyfills.d.ts +0 -31
- package/base-template/polyfills.d.ts.map +0 -1
- package/base-template/theme-styles.d.ts +0 -74
- package/base-template/theme-styles.d.ts.map +0 -1
- package/build/builders/base-builder.d.ts +0 -124
- package/build/builders/base-builder.d.ts.map +0 -1
- package/build/builders/esbuild-config.d.ts +0 -94
- package/build/builders/esbuild-config.d.ts.map +0 -1
- package/build/builders/hybrid-builder.d.ts +0 -93
- package/build/builders/hybrid-builder.d.ts.map +0 -1
- package/build/builders/index.d.ts +0 -17
- package/build/builders/index.d.ts.map +0 -1
- package/build/builders/inline-builder.d.ts +0 -83
- package/build/builders/inline-builder.d.ts.map +0 -1
- package/build/builders/static-builder.d.ts +0 -78
- package/build/builders/static-builder.d.ts.map +0 -1
- package/build/builders/types.d.ts +0 -341
- package/build/builders/types.d.ts.map +0 -1
- package/build/cdn-resources.d.ts +0 -244
- package/build/cdn-resources.d.ts.map +0 -1
- package/build/hybrid-data.d.ts +0 -127
- package/build/hybrid-data.d.ts.map +0 -1
- package/build/index.d.ts +0 -299
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -8699
- package/build/ui-components-browser.d.ts +0 -64
- package/build/ui-components-browser.d.ts.map +0 -1
- package/build/widget-manifest.d.ts +0 -362
- package/build/widget-manifest.d.ts.map +0 -1
- package/bundler/cache.d.ts +0 -173
- package/bundler/cache.d.ts.map +0 -1
- package/bundler/file-cache/component-builder.d.ts +0 -167
- package/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/bundler/file-cache/index.d.ts +0 -12
- package/bundler/file-cache/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/bundler/file-cache/storage/index.d.ts +0 -11
- package/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/interface.d.ts +0 -152
- package/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/bundler/file-cache/storage/redis.d.ts +0 -139
- package/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/bundler/index.d.ts +0 -35
- package/bundler/index.d.ts.map +0 -1
- package/bundler/index.js +0 -2953
- package/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/bundler/sandbox/executor.d.ts +0 -14
- package/bundler/sandbox/executor.d.ts.map +0 -1
- package/bundler/sandbox/policy.d.ts +0 -62
- package/bundler/sandbox/policy.d.ts.map +0 -1
- package/bundler/types.d.ts +0 -702
- package/bundler/types.d.ts.map +0 -1
- package/dependency/cdn-registry.d.ts +0 -98
- package/dependency/cdn-registry.d.ts.map +0 -1
- package/dependency/import-map.d.ts +0 -186
- package/dependency/import-map.d.ts.map +0 -1
- package/dependency/import-parser.d.ts +0 -82
- package/dependency/import-parser.d.ts.map +0 -1
- package/dependency/index.d.ts +0 -17
- package/dependency/index.d.ts.map +0 -1
- package/dependency/index.js +0 -3180
- package/dependency/resolver.d.ts +0 -164
- package/dependency/resolver.d.ts.map +0 -1
- package/dependency/schemas.d.ts +0 -486
- package/dependency/schemas.d.ts.map +0 -1
- package/dependency/template-loader.d.ts +0 -204
- package/dependency/template-loader.d.ts.map +0 -1
- package/dependency/template-processor.d.ts +0 -118
- package/dependency/template-processor.d.ts.map +0 -1
- package/dependency/types.d.ts +0 -739
- package/dependency/types.d.ts.map +0 -1
- package/esm/base-template/index.mjs +0 -1359
- package/esm/build/index.mjs +0 -8601
- package/esm/bundler/index.mjs +0 -2895
- package/esm/dependency/index.mjs +0 -3068
- package/esm/handlebars/index.mjs +0 -587
- package/esm/registry/index.mjs +0 -6305
- package/esm/renderers/index.mjs +0 -1557
- package/esm/runtime/index.mjs +0 -5361
- package/esm/styles/index.mjs +0 -171
- package/esm/theme/index.mjs +0 -756
- package/esm/tool-template/index.mjs +0 -3652
- package/esm/validation/index.mjs +0 -542
- package/handlebars/expression-extractor.d.ts +0 -147
- package/handlebars/expression-extractor.d.ts.map +0 -1
- package/handlebars/helpers.d.ts +0 -339
- package/handlebars/helpers.d.ts.map +0 -1
- package/handlebars/index.d.ts +0 -195
- package/handlebars/index.d.ts.map +0 -1
- package/handlebars/index.js +0 -659
- package/preview/claude-preview.d.ts +0 -67
- package/preview/claude-preview.d.ts.map +0 -1
- package/preview/generic-preview.d.ts +0 -66
- package/preview/generic-preview.d.ts.map +0 -1
- package/preview/index.d.ts +0 -36
- package/preview/index.d.ts.map +0 -1
- package/preview/openai-preview.d.ts +0 -70
- package/preview/openai-preview.d.ts.map +0 -1
- package/preview/types.d.ts +0 -199
- package/preview/types.d.ts.map +0 -1
- package/registry/index.d.ts +0 -46
- package/registry/index.d.ts.map +0 -1
- package/registry/index.js +0 -6342
- package/registry/render-template.d.ts +0 -91
- package/registry/render-template.d.ts.map +0 -1
- package/registry/tool-ui.registry.d.ts +0 -294
- package/registry/tool-ui.registry.d.ts.map +0 -1
- package/registry/uri-utils.d.ts +0 -56
- package/registry/uri-utils.d.ts.map +0 -1
- package/renderers/cache.d.ts +0 -145
- package/renderers/cache.d.ts.map +0 -1
- package/renderers/html.renderer.d.ts +0 -123
- package/renderers/html.renderer.d.ts.map +0 -1
- package/renderers/index.d.ts +0 -36
- package/renderers/index.d.ts.map +0 -1
- package/renderers/index.js +0 -1603
- package/renderers/mdx-client.renderer.d.ts +0 -124
- package/renderers/mdx-client.renderer.d.ts.map +0 -1
- package/renderers/registry.d.ts +0 -133
- package/renderers/registry.d.ts.map +0 -1
- package/renderers/types.d.ts +0 -343
- package/renderers/types.d.ts.map +0 -1
- package/renderers/utils/detect.d.ts +0 -107
- package/renderers/utils/detect.d.ts.map +0 -1
- package/renderers/utils/hash.d.ts +0 -40
- package/renderers/utils/hash.d.ts.map +0 -1
- package/renderers/utils/index.d.ts +0 -9
- package/renderers/utils/index.d.ts.map +0 -1
- package/renderers/utils/transpiler.d.ts +0 -70
- package/renderers/utils/transpiler.d.ts.map +0 -1
- package/runtime/adapters/html.adapter.d.ts +0 -59
- package/runtime/adapters/html.adapter.d.ts.map +0 -1
- package/runtime/adapters/index.d.ts +0 -26
- package/runtime/adapters/index.d.ts.map +0 -1
- package/runtime/adapters/mdx.adapter.d.ts +0 -73
- package/runtime/adapters/mdx.adapter.d.ts.map +0 -1
- package/runtime/adapters/types.d.ts +0 -95
- package/runtime/adapters/types.d.ts.map +0 -1
- package/runtime/csp.d.ts +0 -48
- package/runtime/csp.d.ts.map +0 -1
- package/runtime/index.d.ts +0 -17
- package/runtime/index.d.ts.map +0 -1
- package/runtime/index.js +0 -5432
- package/runtime/mcp-bridge.d.ts +0 -101
- package/runtime/mcp-bridge.d.ts.map +0 -1
- package/runtime/renderer-runtime.d.ts +0 -133
- package/runtime/renderer-runtime.d.ts.map +0 -1
- package/runtime/sanitizer.d.ts +0 -180
- package/runtime/sanitizer.d.ts.map +0 -1
- package/runtime/types.d.ts +0 -415
- package/runtime/types.d.ts.map +0 -1
- package/runtime/wrapper.d.ts +0 -421
- package/runtime/wrapper.d.ts.map +0 -1
- package/styles/index.d.ts +0 -8
- package/styles/index.d.ts.map +0 -1
- package/styles/index.js +0 -222
- package/styles/variants.d.ts +0 -51
- package/styles/variants.d.ts.map +0 -1
- package/theme/cdn.d.ts +0 -195
- package/theme/cdn.d.ts.map +0 -1
- package/theme/css-to-theme.d.ts +0 -64
- package/theme/css-to-theme.d.ts.map +0 -1
- package/theme/index.d.ts +0 -19
- package/theme/index.d.ts.map +0 -1
- package/theme/index.js +0 -814
- package/theme/platforms.d.ts +0 -102
- package/theme/platforms.d.ts.map +0 -1
- package/theme/presets/github-openai.d.ts +0 -50
- package/theme/presets/github-openai.d.ts.map +0 -1
- package/theme/presets/index.d.ts +0 -11
- package/theme/presets/index.d.ts.map +0 -1
- package/theme/theme.d.ts +0 -396
- package/theme/theme.d.ts.map +0 -1
- package/tool-template/builder.d.ts +0 -213
- package/tool-template/builder.d.ts.map +0 -1
- package/tool-template/index.d.ts +0 -16
- package/tool-template/index.d.ts.map +0 -1
- package/tool-template/index.js +0 -3690
- package/validation/error-box.d.ts +0 -56
- package/validation/error-box.d.ts.map +0 -1
- package/validation/index.d.ts +0 -13
- package/validation/index.d.ts.map +0 -1
- package/validation/index.js +0 -576
- package/validation/schema-paths.d.ts +0 -118
- package/validation/schema-paths.d.ts.map +0 -1
- package/validation/template-validator.d.ts +0 -143
- package/validation/template-validator.d.ts.map +0 -1
- package/validation/wrapper.d.ts +0 -97
- package/validation/wrapper.d.ts.map +0 -1
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builder Types
|
|
3
|
-
*
|
|
4
|
-
* Type definitions for the Static, Hybrid, and Inline builders.
|
|
5
|
-
* These builders create universal HTML documents for MCP clients.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import type { UITemplateConfig } from '../../types';
|
|
10
|
-
import type { ThemeConfig, DeepPartial } from '../../theme';
|
|
11
|
-
/**
|
|
12
|
-
* Build mode for widget generation.
|
|
13
|
-
*
|
|
14
|
-
* - `'static'`: Full HTML with placeholders. Data injected at preview time.
|
|
15
|
-
* Best for production - widget is cached, only data changes per request.
|
|
16
|
-
*
|
|
17
|
-
* - `'hybrid'`: Vendor shell (cached) + component chunks (per-tool).
|
|
18
|
-
* Shell delivered via resource URI, component via tool response.
|
|
19
|
-
* Optimal for OpenAI where shell is fetched once and cached.
|
|
20
|
-
*
|
|
21
|
-
* - `'inline'`: Minimal loader at discovery, full HTML per request.
|
|
22
|
-
* Best for development/review. Each request gets complete widget.
|
|
23
|
-
*/
|
|
24
|
-
export type BuildMode = 'static' | 'hybrid' | 'inline';
|
|
25
|
-
/**
|
|
26
|
-
* CDN loading mode for dependencies.
|
|
27
|
-
*
|
|
28
|
-
* - `'cdn'`: Load React/deps from CDN (smaller HTML, requires network)
|
|
29
|
-
* - `'inline'`: Bundle all deps inline (larger HTML, works offline)
|
|
30
|
-
*/
|
|
31
|
-
export type CdnMode = 'cdn' | 'inline';
|
|
32
|
-
/**
|
|
33
|
-
* Common options for all builders.
|
|
34
|
-
*/
|
|
35
|
-
export interface BuilderOptions {
|
|
36
|
-
/**
|
|
37
|
-
* CDN loading mode for dependencies.
|
|
38
|
-
* @default 'cdn'
|
|
39
|
-
*/
|
|
40
|
-
cdnMode?: CdnMode;
|
|
41
|
-
/**
|
|
42
|
-
* Whether to minify the output HTML.
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
minify?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Theme configuration override.
|
|
48
|
-
*/
|
|
49
|
-
theme?: DeepPartial<ThemeConfig>;
|
|
50
|
-
/**
|
|
51
|
-
* Whether to include source maps.
|
|
52
|
-
* @default false
|
|
53
|
-
*/
|
|
54
|
-
sourceMaps?: boolean;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Options for building a specific tool's UI.
|
|
58
|
-
*/
|
|
59
|
-
export interface BuildToolOptions<In = unknown, Out = unknown> {
|
|
60
|
-
/**
|
|
61
|
-
* UI template configuration.
|
|
62
|
-
*/
|
|
63
|
-
template: UITemplateConfig<In, Out>;
|
|
64
|
-
/**
|
|
65
|
-
* Name of the tool this UI is for.
|
|
66
|
-
*/
|
|
67
|
-
toolName: string;
|
|
68
|
-
/**
|
|
69
|
-
* Optional title for the HTML document.
|
|
70
|
-
*/
|
|
71
|
-
title?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Sample input for preview/development.
|
|
74
|
-
*/
|
|
75
|
-
sampleInput?: In;
|
|
76
|
-
/**
|
|
77
|
-
* Sample output for preview/development.
|
|
78
|
-
*/
|
|
79
|
-
sampleOutput?: Out;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Result from a static build.
|
|
83
|
-
*
|
|
84
|
-
* Static builds produce a complete HTML document with placeholders
|
|
85
|
-
* that are replaced with actual data at preview time.
|
|
86
|
-
*/
|
|
87
|
-
export interface StaticBuildResult {
|
|
88
|
-
/**
|
|
89
|
-
* Build mode identifier.
|
|
90
|
-
*/
|
|
91
|
-
mode: 'static';
|
|
92
|
-
/**
|
|
93
|
-
* Complete HTML document with placeholders.
|
|
94
|
-
*/
|
|
95
|
-
html: string;
|
|
96
|
-
/**
|
|
97
|
-
* Content hash for caching.
|
|
98
|
-
*/
|
|
99
|
-
hash: string;
|
|
100
|
-
/**
|
|
101
|
-
* Size in bytes.
|
|
102
|
-
*/
|
|
103
|
-
size: number;
|
|
104
|
-
/**
|
|
105
|
-
* Estimated gzipped size in bytes.
|
|
106
|
-
*/
|
|
107
|
-
gzipSize: number;
|
|
108
|
-
/**
|
|
109
|
-
* Placeholders present in the HTML.
|
|
110
|
-
*/
|
|
111
|
-
placeholders: {
|
|
112
|
-
hasOutput: boolean;
|
|
113
|
-
hasInput: boolean;
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Renderer type used (html, react, mdx).
|
|
117
|
-
*/
|
|
118
|
-
rendererType: string;
|
|
119
|
-
/**
|
|
120
|
-
* Build timestamp (ISO 8601).
|
|
121
|
-
*/
|
|
122
|
-
buildTime: string;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Result from a hybrid build.
|
|
126
|
-
*
|
|
127
|
-
* Hybrid builds produce a vendor shell (cached, shared across tools)
|
|
128
|
-
* and component chunks (per-tool, externalized dependencies).
|
|
129
|
-
*/
|
|
130
|
-
export interface HybridBuildResult {
|
|
131
|
-
/**
|
|
132
|
-
* Build mode identifier.
|
|
133
|
-
*/
|
|
134
|
-
mode: 'hybrid';
|
|
135
|
-
/**
|
|
136
|
-
* Vendor shell HTML (shared across all tools).
|
|
137
|
-
* Contains React, Bridge, UI components from CDN.
|
|
138
|
-
*/
|
|
139
|
-
vendorShell: string;
|
|
140
|
-
/**
|
|
141
|
-
* Transpiled component code (externalized).
|
|
142
|
-
* Imports React/deps from shell's globals.
|
|
143
|
-
*/
|
|
144
|
-
componentChunk: string;
|
|
145
|
-
/**
|
|
146
|
-
* Resource URI for the vendor shell.
|
|
147
|
-
* Used in _meta['openai/outputTemplate'].
|
|
148
|
-
*/
|
|
149
|
-
shellResourceUri: string;
|
|
150
|
-
/**
|
|
151
|
-
* Content hash for caching.
|
|
152
|
-
*/
|
|
153
|
-
hash: string;
|
|
154
|
-
/**
|
|
155
|
-
* Size of vendor shell in bytes.
|
|
156
|
-
*/
|
|
157
|
-
shellSize: number;
|
|
158
|
-
/**
|
|
159
|
-
* Size of component chunk in bytes.
|
|
160
|
-
*/
|
|
161
|
-
componentSize: number;
|
|
162
|
-
/**
|
|
163
|
-
* Renderer type used (html, react, mdx).
|
|
164
|
-
*/
|
|
165
|
-
rendererType: string;
|
|
166
|
-
/**
|
|
167
|
-
* Build timestamp (ISO 8601).
|
|
168
|
-
*/
|
|
169
|
-
buildTime: string;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Result from an inline build.
|
|
173
|
-
*
|
|
174
|
-
* Inline builds produce a minimal loader shell (for discovery)
|
|
175
|
-
* and full widget HTML (for each tool execution).
|
|
176
|
-
*/
|
|
177
|
-
export interface InlineBuildResult {
|
|
178
|
-
/**
|
|
179
|
-
* Build mode identifier.
|
|
180
|
-
*/
|
|
181
|
-
mode: 'inline';
|
|
182
|
-
/**
|
|
183
|
-
* Minimal loader HTML (returned at tools/list).
|
|
184
|
-
* Contains bridge + loading indicator + injector script.
|
|
185
|
-
*/
|
|
186
|
-
loaderShell: string;
|
|
187
|
-
/**
|
|
188
|
-
* Full widget HTML generator.
|
|
189
|
-
* Called with input/output to produce complete HTML.
|
|
190
|
-
*/
|
|
191
|
-
buildFullWidget: (input: unknown, output: unknown) => Promise<string>;
|
|
192
|
-
/**
|
|
193
|
-
* Content hash for the loader.
|
|
194
|
-
*/
|
|
195
|
-
hash: string;
|
|
196
|
-
/**
|
|
197
|
-
* Size of loader in bytes.
|
|
198
|
-
*/
|
|
199
|
-
loaderSize: number;
|
|
200
|
-
/**
|
|
201
|
-
* Renderer type used (html, react, mdx).
|
|
202
|
-
*/
|
|
203
|
-
rendererType: string;
|
|
204
|
-
/**
|
|
205
|
-
* Build timestamp (ISO 8601).
|
|
206
|
-
*/
|
|
207
|
-
buildTime: string;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Union type for all build results.
|
|
211
|
-
* Named BuilderResult to avoid conflict with the existing BuildResult type in build/index.ts.
|
|
212
|
-
*/
|
|
213
|
-
export type BuilderResult = StaticBuildResult | HybridBuildResult | InlineBuildResult;
|
|
214
|
-
/**
|
|
215
|
-
* Interface for all builders.
|
|
216
|
-
*/
|
|
217
|
-
export interface Builder<TResult extends BuilderResult> {
|
|
218
|
-
/**
|
|
219
|
-
* Build mode this builder produces.
|
|
220
|
-
*/
|
|
221
|
-
readonly mode: BuildMode;
|
|
222
|
-
/**
|
|
223
|
-
* Build a tool UI.
|
|
224
|
-
*/
|
|
225
|
-
build<In = unknown, Out = unknown>(options: BuildToolOptions<In, Out>): Promise<TResult>;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Interface for the static builder.
|
|
229
|
-
*/
|
|
230
|
-
export interface IStaticBuilder extends Builder<StaticBuildResult> {
|
|
231
|
-
readonly mode: 'static';
|
|
232
|
-
/**
|
|
233
|
-
* Inject data into a pre-built shell.
|
|
234
|
-
*/
|
|
235
|
-
injectData(shell: string, input: unknown, output: unknown): string;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Interface for the hybrid builder.
|
|
239
|
-
*/
|
|
240
|
-
export interface IHybridBuilder extends Builder<HybridBuildResult> {
|
|
241
|
-
readonly mode: 'hybrid';
|
|
242
|
-
/**
|
|
243
|
-
* Build just the vendor shell (cached, shared).
|
|
244
|
-
*/
|
|
245
|
-
buildVendorShell(): Promise<string>;
|
|
246
|
-
/**
|
|
247
|
-
* Build a component chunk for a specific template.
|
|
248
|
-
*/
|
|
249
|
-
buildComponentChunk<In = unknown, Out = unknown>(template: UITemplateConfig<In, Out>['template']): Promise<string>;
|
|
250
|
-
/**
|
|
251
|
-
* Combine shell and component for Claude/inline delivery.
|
|
252
|
-
*/
|
|
253
|
-
combineForInline(shell: string, component: string, input: unknown, output: unknown): string;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Interface for the inline builder.
|
|
257
|
-
*/
|
|
258
|
-
export interface IInlineBuilder extends Builder<InlineBuildResult> {
|
|
259
|
-
readonly mode: 'inline';
|
|
260
|
-
/**
|
|
261
|
-
* Build the minimal loader shell.
|
|
262
|
-
*/
|
|
263
|
-
buildLoader(toolName: string): string;
|
|
264
|
-
/**
|
|
265
|
-
* Build full widget HTML with embedded data.
|
|
266
|
-
*/
|
|
267
|
-
buildFullWidget<In = unknown, Out = unknown>(template: UITemplateConfig<In, Out>['template'], input: In, output: Out): Promise<string>;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Detected template type.
|
|
271
|
-
*/
|
|
272
|
-
export type TemplateType = 'html-string' | 'html-function' | 'react-component' | 'react-element' | 'mdx';
|
|
273
|
-
/**
|
|
274
|
-
* Template detection result.
|
|
275
|
-
*/
|
|
276
|
-
export interface TemplateDetection {
|
|
277
|
-
/**
|
|
278
|
-
* Detected template type.
|
|
279
|
-
*/
|
|
280
|
-
type: TemplateType;
|
|
281
|
-
/**
|
|
282
|
-
* Renderer to use for this template.
|
|
283
|
-
*/
|
|
284
|
-
renderer: 'html' | 'react' | 'mdx';
|
|
285
|
-
/**
|
|
286
|
-
* Whether the template needs transpilation.
|
|
287
|
-
*/
|
|
288
|
-
needsTranspilation: boolean;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Options for transpiling component code.
|
|
292
|
-
*/
|
|
293
|
-
export interface TranspileOptions {
|
|
294
|
-
/**
|
|
295
|
-
* External dependencies to exclude from bundle.
|
|
296
|
-
* These will be loaded from the shell's globals.
|
|
297
|
-
*/
|
|
298
|
-
externals?: string[];
|
|
299
|
-
/**
|
|
300
|
-
* Output format.
|
|
301
|
-
* @default 'esm'
|
|
302
|
-
*/
|
|
303
|
-
format?: 'esm' | 'iife';
|
|
304
|
-
/**
|
|
305
|
-
* Target ES version.
|
|
306
|
-
* @default 'es2020'
|
|
307
|
-
*/
|
|
308
|
-
target?: string;
|
|
309
|
-
/**
|
|
310
|
-
* Whether to minify output.
|
|
311
|
-
* @default false
|
|
312
|
-
*/
|
|
313
|
-
minify?: boolean;
|
|
314
|
-
/**
|
|
315
|
-
* JSX import source.
|
|
316
|
-
* @default 'react'
|
|
317
|
-
*/
|
|
318
|
-
jsxImportSource?: string;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Result of transpilation.
|
|
322
|
-
*/
|
|
323
|
-
export interface TranspileResult {
|
|
324
|
-
/**
|
|
325
|
-
* Transpiled JavaScript code.
|
|
326
|
-
*/
|
|
327
|
-
code: string;
|
|
328
|
-
/**
|
|
329
|
-
* Source map (if requested).
|
|
330
|
-
*/
|
|
331
|
-
map?: string;
|
|
332
|
-
/**
|
|
333
|
-
* Size in bytes.
|
|
334
|
-
*/
|
|
335
|
-
size: number;
|
|
336
|
-
/**
|
|
337
|
-
* Detected imports that were externalized.
|
|
338
|
-
*/
|
|
339
|
-
externalizedImports: string[];
|
|
340
|
-
}
|
|
341
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../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,UAAU,CAAC,EAC/C,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,GAAG,GACV,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAMD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,eAAe,GAAG,iBAAiB,GAAG,eAAe,GAAG,KAAK,CAAC;AAEzG;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IAEnC;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAMD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B"}
|
package/build/cdn-resources.d.ts
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CDN Resource URLs
|
|
3
|
-
*
|
|
4
|
-
* Default CDN URLs for runtime dependencies (React, MDX, Handlebars, etc).
|
|
5
|
-
* These URLs are used when resourceMode is 'cdn' (default).
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import type { CDNResource, UIType, RendererAssets, ResourceMode } from '../types';
|
|
10
|
-
/**
|
|
11
|
-
* React 19 from esm.sh (ES module).
|
|
12
|
-
*
|
|
13
|
-
* React 19 removed UMD builds, so we use esm.sh which provides
|
|
14
|
-
* ES module builds that work in modern browsers.
|
|
15
|
-
*/
|
|
16
|
-
export declare const REACT_CDN: CDNResource;
|
|
17
|
-
/**
|
|
18
|
-
* ReactDOM 19 client from esm.sh (ES module).
|
|
19
|
-
*
|
|
20
|
-
* React 19 removed UMD builds, so we use esm.sh which provides
|
|
21
|
-
* ES module builds that work in modern browsers.
|
|
22
|
-
*/
|
|
23
|
-
export declare const REACT_DOM_CDN: CDNResource;
|
|
24
|
-
/**
|
|
25
|
-
* Marked markdown parser from unpkg.
|
|
26
|
-
*/
|
|
27
|
-
export declare const MARKED_CDN: CDNResource;
|
|
28
|
-
/**
|
|
29
|
-
* Handlebars runtime from unpkg.
|
|
30
|
-
*/
|
|
31
|
-
export declare const HANDLEBARS_CDN: CDNResource;
|
|
32
|
-
/**
|
|
33
|
-
* MDX runtime from esm.sh (for browser use).
|
|
34
|
-
* Note: MDX compilation typically happens server-side.
|
|
35
|
-
*/
|
|
36
|
-
export declare const MDX_RUNTIME_CDN: CDNResource;
|
|
37
|
-
/**
|
|
38
|
-
* Tailwind CSS Browser CDN (play.tailwindcss.com CDN).
|
|
39
|
-
* This is a JIT compiler that generates CSS on-the-fly.
|
|
40
|
-
* Supports all Tailwind classes including arbitrary values.
|
|
41
|
-
*
|
|
42
|
-
* Note: This CDN is NOT trusted by Claude Artifacts sandbox.
|
|
43
|
-
* Use CLOUDFLARE_CDN.tailwindCss for Claude.
|
|
44
|
-
*/
|
|
45
|
-
export declare const TAILWIND_CDN: CDNResource;
|
|
46
|
-
/**
|
|
47
|
-
* Platform type for CDN selection.
|
|
48
|
-
*/
|
|
49
|
-
export type CDNPlatform = 'openai' | 'claude' | 'unknown';
|
|
50
|
-
/**
|
|
51
|
-
* Cloudflare CDN resources (trusted by Claude Artifacts).
|
|
52
|
-
*
|
|
53
|
-
* Claude's sandbox only allows resources from cdnjs.cloudflare.com.
|
|
54
|
-
* These are pre-built files (not JIT compilers) and work in restricted environments.
|
|
55
|
-
*
|
|
56
|
-
* Note: Tailwind from cloudflare is pre-built CSS, not the JIT compiler.
|
|
57
|
-
* This means arbitrary values like `w-[123px]` won't work - only standard classes.
|
|
58
|
-
*/
|
|
59
|
-
export declare const CLOUDFLARE_CDN: {
|
|
60
|
-
/**
|
|
61
|
-
* Pre-built Tailwind CSS (standard classes only, no JIT).
|
|
62
|
-
* Use this instead of TAILWIND_CDN for Claude Artifacts.
|
|
63
|
-
*/
|
|
64
|
-
readonly tailwindCss: {
|
|
65
|
-
readonly url: "https://cdnjs.cloudflare.com/ajax/libs/tailwindcss-browser/4.1.13/index.global.min.js";
|
|
66
|
-
readonly integrity: "sha512-TscjjxDy2iXx5s55Ar78c01JDHUug0K5aw4YKId9Yuocjx3ueX/X9PFyH5XNRVWqagx3TtcQWQVBaHAIPFjiFA==";
|
|
67
|
-
readonly crossorigin: "anonymous";
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* HTMX for dynamic interactions.
|
|
71
|
-
*/
|
|
72
|
-
readonly htmx: {
|
|
73
|
-
readonly url: "https://cdnjs.cloudflare.com/ajax/libs/htmx/2.0.4/htmx.min.js";
|
|
74
|
-
readonly integrity: "sha512-2kIcAizYXhIn5IyXrMC72f2nh0JAtESHRpOieVw5dYPYeHwLCC2eKCqvdZDYRSEgasKrPpEPpRFjL8gqwBZWAA==";
|
|
75
|
-
readonly crossorigin: "anonymous";
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Alpine.js for reactive components.
|
|
79
|
-
*/
|
|
80
|
-
readonly alpinejs: {
|
|
81
|
-
readonly url: "https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.14.3/cdn.min.js";
|
|
82
|
-
readonly integrity: "sha512-lrQ8FHgsWKFSuQFq8NKPJicjlvJFEIrCqEj8zeX7ZOUlHWltN/Iow4jND+x84jqTdDf9n+hvQpJjGDvOl/eDRA==";
|
|
83
|
-
readonly crossorigin: "anonymous";
|
|
84
|
-
readonly defer: true;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Marked markdown parser.
|
|
88
|
-
*/
|
|
89
|
-
readonly marked: {
|
|
90
|
-
readonly url: "https://cdnjs.cloudflare.com/ajax/libs/marked/15.0.4/marked.min.js";
|
|
91
|
-
readonly integrity: "sha512-Rn/d0sGeizGbk3VJEiYNDt/mMcfuzYoFkia3iBffv+HX8VUrHMo/0cKjZuxWGoZLPh/VxUcC9ais+RBFZW9EBg==";
|
|
92
|
-
readonly crossorigin: "anonymous";
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Handlebars templating.
|
|
96
|
-
*/
|
|
97
|
-
readonly handlebars: {
|
|
98
|
-
readonly url: "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.8/handlebars.min.js";
|
|
99
|
-
readonly integrity: "sha512-E1dSFxg+wsfJ4HKjutk/WaCzK7S2wv1POn1RRPGh8ZK+ag9l244Vqxji3r6wgz9YBf6+vhQEYJZpSjqWFPg9gg==";
|
|
100
|
-
readonly crossorigin: "anonymous";
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* Get the appropriate Tailwind tag for a platform.
|
|
105
|
-
*
|
|
106
|
-
* - OpenAI: Uses Play CDN (JIT compiler, all classes + arbitrary values)
|
|
107
|
-
* - Claude: Uses pre-built CSS from Cloudflare (standard classes only)
|
|
108
|
-
* - Unknown: Defaults to pre-built CSS for maximum compatibility
|
|
109
|
-
*
|
|
110
|
-
* @param platform - Target platform
|
|
111
|
-
* @returns HTML tag string (script or link)
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```typescript
|
|
115
|
-
* // For OpenAI (JIT compiler)
|
|
116
|
-
* getTailwindForPlatform('openai');
|
|
117
|
-
* // '<script src="https://cdn.tailwindcss.com" crossorigin="anonymous"></script>'
|
|
118
|
-
*
|
|
119
|
-
* // For Claude (pre-built CSS)
|
|
120
|
-
* getTailwindForPlatform('claude');
|
|
121
|
-
* // '<link href="https://cdnjs.cloudflare.com/.../tailwind.min.css" rel="stylesheet">'
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
export declare function getTailwindForPlatform(platform: CDNPlatform): string;
|
|
125
|
-
/**
|
|
126
|
-
* Build a stylesheet link tag for Cloudflare CSS resources.
|
|
127
|
-
*
|
|
128
|
-
* @param url - CSS file URL
|
|
129
|
-
* @returns HTML link tag string
|
|
130
|
-
*/
|
|
131
|
-
export declare function buildCloudflareStylesheetTag(url: string): string;
|
|
132
|
-
/**
|
|
133
|
-
* Build a script tag for Cloudflare JS resources.
|
|
134
|
-
*
|
|
135
|
-
* @param resource - Cloudflare CDN resource
|
|
136
|
-
* @returns HTML script tag string
|
|
137
|
-
*/
|
|
138
|
-
export declare function buildCloudflareScriptTag(resource: {
|
|
139
|
-
url: string;
|
|
140
|
-
integrity?: string;
|
|
141
|
-
crossorigin?: string;
|
|
142
|
-
defer?: boolean;
|
|
143
|
-
}): string;
|
|
144
|
-
/**
|
|
145
|
-
* Get default CDN resources for a UI type.
|
|
146
|
-
*
|
|
147
|
-
* @param uiType - The UI renderer type
|
|
148
|
-
* @param mode - Resource loading mode (cdn or inline)
|
|
149
|
-
* @returns RendererAssets with appropriate CDN URLs
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* ```typescript
|
|
153
|
-
* // Get CDN assets for React
|
|
154
|
-
* const assets = getDefaultAssets('react', 'cdn');
|
|
155
|
-
* console.log(assets.react.url);
|
|
156
|
-
* // "https://unpkg.com/react@18/umd/react.production.min.js"
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
export declare function getDefaultAssets(uiType: UIType, mode?: ResourceMode): RendererAssets;
|
|
160
|
-
/**
|
|
161
|
-
* Build a script tag for a CDN resource.
|
|
162
|
-
*
|
|
163
|
-
* @param resource - CDN resource configuration
|
|
164
|
-
* @param options - Additional script tag options
|
|
165
|
-
* @returns HTML script tag string
|
|
166
|
-
*/
|
|
167
|
-
export declare function buildCDNScriptTag(resource: CDNResource, options?: {
|
|
168
|
-
async?: boolean;
|
|
169
|
-
defer?: boolean;
|
|
170
|
-
type?: string;
|
|
171
|
-
}): string;
|
|
172
|
-
/**
|
|
173
|
-
* Build all required script tags for a UI type.
|
|
174
|
-
*
|
|
175
|
-
* @param uiType - The UI renderer type
|
|
176
|
-
* @param mode - Resource mode (cdn or inline)
|
|
177
|
-
* @returns Array of script tag strings
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* ```typescript
|
|
181
|
-
* const scripts = buildScriptsForUIType('react', 'cdn');
|
|
182
|
-
* // Returns:
|
|
183
|
-
* // [
|
|
184
|
-
* // '<script src="https://unpkg.com/react@18/..." crossorigin="anonymous"></script>',
|
|
185
|
-
* // '<script src="https://unpkg.com/react-dom@18/..." crossorigin="anonymous"></script>',
|
|
186
|
-
* // ]
|
|
187
|
-
* ```
|
|
188
|
-
*/
|
|
189
|
-
export declare function buildScriptsForUIType(uiType: UIType, mode?: ResourceMode): string[];
|
|
190
|
-
/**
|
|
191
|
-
* Build a Tailwind script tag.
|
|
192
|
-
*
|
|
193
|
-
* @param config - Optional Tailwind config to inline
|
|
194
|
-
* @returns Tailwind script tag(s)
|
|
195
|
-
*/
|
|
196
|
-
export declare function buildTailwindScriptTag(config?: string): string;
|
|
197
|
-
/**
|
|
198
|
-
* Check if inline scripts are available in cache.
|
|
199
|
-
*
|
|
200
|
-
* Inline scripts need to be pre-fetched and cached before use.
|
|
201
|
-
* This is typically done at build time or server startup.
|
|
202
|
-
*/
|
|
203
|
-
export declare function hasInlineScripts(): boolean;
|
|
204
|
-
/**
|
|
205
|
-
* Get all CDN URLs that need to be pre-fetched for inline mode.
|
|
206
|
-
*
|
|
207
|
-
* @param uiType - The UI renderer type
|
|
208
|
-
* @returns Array of URLs to fetch
|
|
209
|
-
*/
|
|
210
|
-
export declare function getURLsToPreFetch(uiType: UIType): string[];
|
|
211
|
-
/**
|
|
212
|
-
* CDN info structure for tools/list _meta['ui/cdn'].
|
|
213
|
-
*
|
|
214
|
-
* Contains CDN URLs for runtime dependencies needed to render the widget.
|
|
215
|
-
*/
|
|
216
|
-
export interface CDNInfo {
|
|
217
|
-
react?: string;
|
|
218
|
-
reactDom?: string;
|
|
219
|
-
handlebars?: string;
|
|
220
|
-
marked?: string;
|
|
221
|
-
mdxRuntime?: string;
|
|
222
|
-
tailwind?: string;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Build CDN info object for a UI type.
|
|
226
|
-
*
|
|
227
|
-
* This is used in tools/list response _meta to inform clients
|
|
228
|
-
* which CDN resources are needed to render the widget.
|
|
229
|
-
*
|
|
230
|
-
* @param uiType - The UI renderer type
|
|
231
|
-
* @returns CDN info object with URLs
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```typescript
|
|
235
|
-
* // In tools/list response
|
|
236
|
-
* item._meta = {
|
|
237
|
-
* 'openai/outputTemplate': 'ui://widget/get_weather.html',
|
|
238
|
-
* 'ui/cdn': buildCDNInfoForUIType('react'),
|
|
239
|
-
* // { react: 'https://...', reactDom: 'https://...' }
|
|
240
|
-
* };
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
|
-
export declare function buildCDNInfoForUIType(uiType: UIType): CDNInfo;
|
|
244
|
-
//# sourceMappingURL=cdn-resources.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cdn-resources.d.ts","sourceRoot":"","sources":["../../src/build/cdn-resources.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAMlF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,WAGvB,CAAC;AAEF;;;;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