mcp-use 1.5.0-canary.0 → 1.5.0-canary.2
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/.tsbuildinfo +1 -1
- package/dist/{chunk-RE7EYFDV.js → chunk-GPAOZN2F.js} +459 -967
- package/dist/{chunk-GRLCLVAK.js → chunk-UT7O4SIJ.js} +14 -4
- package/dist/index.cjs +500 -998
- package/dist/index.js +12 -6
- package/dist/src/browser.cjs +14 -4
- package/dist/src/browser.js +1 -1
- package/dist/src/client/browser.d.ts.map +1 -1
- package/dist/src/connectors/base.d.ts +5 -0
- package/dist/src/connectors/base.d.ts.map +1 -1
- package/dist/src/connectors/http.d.ts.map +1 -1
- package/dist/src/react/ErrorBoundary.d.ts +24 -0
- package/dist/src/react/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/react/Image.d.ts +11 -0
- package/dist/src/react/Image.d.ts.map +1 -0
- package/dist/src/react/McpUseProvider.d.ts +46 -0
- package/dist/src/react/McpUseProvider.d.ts.map +1 -0
- package/dist/src/react/ThemeProvider.d.ts +14 -0
- package/dist/src/react/ThemeProvider.d.ts.map +1 -0
- package/dist/src/react/WidgetControls.d.ts +44 -0
- package/dist/src/react/WidgetControls.d.ts.map +1 -0
- package/dist/src/react/index.cjs +500 -998
- package/dist/src/react/index.d.ts +9 -6
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/index.js +12 -6
- package/dist/src/react/types.d.ts +2 -0
- package/dist/src/react/types.d.ts.map +1 -1
- package/dist/src/react/useMcp.d.ts.map +1 -1
- package/dist/src/react/useWidget.d.ts.map +1 -1
- package/dist/src/react/widget-types.d.ts +6 -0
- package/dist/src/react/widget-types.d.ts.map +1 -1
- package/dist/src/server/connect-adapter.d.ts.map +1 -1
- package/dist/src/server/index.cjs +232 -21
- package/dist/src/server/index.js +232 -21
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/package.json +6 -4
- package/dist/src/react/WidgetDebugger.d.ts +0 -31
- package/dist/src/react/WidgetDebugger.d.ts.map +0 -1
- package/dist/src/react/WidgetFullscreenWrapper.d.ts +0 -32
- package/dist/src/react/WidgetFullscreenWrapper.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -24,14 +24,17 @@ import {
|
|
|
24
24
|
PROMPTS
|
|
25
25
|
} from "./chunk-WERYJ6PF.js";
|
|
26
26
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
ErrorBoundary,
|
|
28
|
+
Image,
|
|
29
|
+
McpUseProvider,
|
|
30
|
+
ThemeProvider,
|
|
31
|
+
WidgetControls,
|
|
29
32
|
useMcp,
|
|
30
33
|
useWidget,
|
|
31
34
|
useWidgetProps,
|
|
32
35
|
useWidgetState,
|
|
33
36
|
useWidgetTheme
|
|
34
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-GPAOZN2F.js";
|
|
35
38
|
import {
|
|
36
39
|
BaseMCPClient,
|
|
37
40
|
BrowserOAuthClientProvider,
|
|
@@ -40,7 +43,7 @@ import {
|
|
|
40
43
|
MCPSession,
|
|
41
44
|
WebSocketConnector,
|
|
42
45
|
onMcpAuthorization
|
|
43
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-UT7O4SIJ.js";
|
|
44
47
|
import {
|
|
45
48
|
BaseConnector
|
|
46
49
|
} from "./chunk-DSBKVAWD.js";
|
|
@@ -1440,7 +1443,9 @@ export {
|
|
|
1440
1443
|
BrowserOAuthClientProvider,
|
|
1441
1444
|
ConnectMCPServerTool,
|
|
1442
1445
|
E2BCodeExecutor,
|
|
1446
|
+
ErrorBoundary,
|
|
1443
1447
|
HttpConnector,
|
|
1448
|
+
Image,
|
|
1444
1449
|
LINEAR_OAUTH_CONFIG,
|
|
1445
1450
|
LangChainAdapter,
|
|
1446
1451
|
ListMCPServersTool,
|
|
@@ -1448,6 +1453,7 @@ export {
|
|
|
1448
1453
|
MCPAgent,
|
|
1449
1454
|
MCPClient,
|
|
1450
1455
|
MCPSession,
|
|
1456
|
+
McpUseProvider,
|
|
1451
1457
|
OAuthHelper,
|
|
1452
1458
|
ObservabilityManager,
|
|
1453
1459
|
PROMPTS,
|
|
@@ -1456,10 +1462,10 @@ export {
|
|
|
1456
1462
|
ServerManager,
|
|
1457
1463
|
StdioConnector,
|
|
1458
1464
|
Telemetry,
|
|
1465
|
+
ThemeProvider,
|
|
1459
1466
|
VMCodeExecutor,
|
|
1460
1467
|
WebSocketConnector,
|
|
1461
|
-
|
|
1462
|
-
WidgetFullscreenWrapper,
|
|
1468
|
+
WidgetControls,
|
|
1463
1469
|
createOAuthMCPConfig,
|
|
1464
1470
|
createReadableStreamFromGenerator,
|
|
1465
1471
|
isVMAvailable,
|
package/dist/src/browser.cjs
CHANGED
|
@@ -1600,7 +1600,11 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1600
1600
|
maxRetries: 2
|
|
1601
1601
|
}
|
|
1602
1602
|
});
|
|
1603
|
-
|
|
1603
|
+
let transport = await this.connectionManager.start();
|
|
1604
|
+
if (this.opts.wrapTransport) {
|
|
1605
|
+
const serverId = this.baseUrl;
|
|
1606
|
+
transport = this.opts.wrapTransport(transport, serverId);
|
|
1607
|
+
}
|
|
1604
1608
|
this.client = new import_client.Client(this.clientInfo, this.opts.clientOptions);
|
|
1605
1609
|
try {
|
|
1606
1610
|
await this.client.connect(transport);
|
|
@@ -1634,7 +1638,11 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1634
1638
|
headers: this.headers
|
|
1635
1639
|
}
|
|
1636
1640
|
});
|
|
1637
|
-
|
|
1641
|
+
let transport = await this.connectionManager.start();
|
|
1642
|
+
if (this.opts.wrapTransport) {
|
|
1643
|
+
const serverId = this.baseUrl;
|
|
1644
|
+
transport = this.opts.wrapTransport(transport, serverId);
|
|
1645
|
+
}
|
|
1638
1646
|
this.client = new import_client.Client(this.clientInfo, this.opts.clientOptions);
|
|
1639
1647
|
await this.client.connect(transport);
|
|
1640
1648
|
this.connected = true;
|
|
@@ -2058,15 +2066,17 @@ var BrowserMCPClient = class _BrowserMCPClient extends BaseMCPClient {
|
|
|
2058
2066
|
* Supports HTTP and WebSocket connectors only
|
|
2059
2067
|
*/
|
|
2060
2068
|
createConnectorFromConfig(serverConfig) {
|
|
2061
|
-
const { url, transport, headers, authToken, authProvider } = serverConfig;
|
|
2069
|
+
const { url, transport, headers, authToken, authProvider, wrapTransport } = serverConfig;
|
|
2062
2070
|
if (!url) {
|
|
2063
2071
|
throw new Error("Server URL is required");
|
|
2064
2072
|
}
|
|
2065
2073
|
const connectorOptions = {
|
|
2066
2074
|
headers,
|
|
2067
2075
|
authToken,
|
|
2068
|
-
authProvider
|
|
2076
|
+
authProvider,
|
|
2069
2077
|
// ← Pass OAuth provider to connector
|
|
2078
|
+
wrapTransport
|
|
2079
|
+
// ← Pass transport wrapper if provided
|
|
2070
2080
|
};
|
|
2071
2081
|
if (transport === "websocket" || url.startsWith("ws://") || url.startsWith("wss://")) {
|
|
2072
2082
|
return new WebSocketConnector(url, connectorOptions);
|
package/dist/src/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/client/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;gBACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WAI1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,gBAAgB;IAIlE;;;OAGG;IACH,SAAS,CAAC,yBAAyB,CACjC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,aAAa;
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/client/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;gBACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WAI1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,gBAAgB;IAIlE;;;OAGG;IACH,SAAS,CAAC,yBAAyB,CACjC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,aAAa;CAkCjB"}
|
|
@@ -16,6 +16,11 @@ export interface ConnectorInitOptions {
|
|
|
16
16
|
* OAuth client provider for automatic authentication
|
|
17
17
|
*/
|
|
18
18
|
authProvider?: any;
|
|
19
|
+
/**
|
|
20
|
+
* Optional callback to wrap the transport before passing it to the Client.
|
|
21
|
+
* Useful for logging, monitoring, or other transport-level interceptors.
|
|
22
|
+
*/
|
|
23
|
+
wrapTransport?: (transport: any, serverId: string) => any;
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* Base class for MCP connectors.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/connectors/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACd,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,cA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AAI;CAGrD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* ErrorBoundary that catches React errors and displays a friendly error message
|
|
4
|
+
*
|
|
5
|
+
* This component catches JavaScript errors anywhere in the child component tree,
|
|
6
|
+
* logs those errors, and displays a fallback UI instead of crashing the entire app.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ErrorBoundary extends React.Component<{
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}, {
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
}> {
|
|
14
|
+
constructor(props: {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
});
|
|
17
|
+
static getDerivedStateFromError(error: Error): {
|
|
18
|
+
hasError: boolean;
|
|
19
|
+
error: Error;
|
|
20
|
+
};
|
|
21
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
22
|
+
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/react/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAChD;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,EAC7B;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CAAE,CAC3C;gBACa,KAAK,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;IAKhD,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK;;;;IAI5C,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS;IAI1D,MAAM;CAcP"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Image component that automatically handles absolute paths using the MCP public URL.
|
|
4
|
+
*
|
|
5
|
+
* If the src starts with /, it will be prefixed with the MCP public URL (e.g. http://localhost:3000/mcp-use/public).
|
|
6
|
+
* If the src is already absolute (starts with http or data:), it will be used as is.
|
|
7
|
+
*
|
|
8
|
+
* @param props Standard img props
|
|
9
|
+
*/
|
|
10
|
+
export declare const Image: React.FC<React.ImgHTMLAttributes<globalThis.HTMLImageElement>>;
|
|
11
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/react/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAC1B,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAqCrD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface McpUseProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Enable debug button in WidgetControls component
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
debugger?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Enable view controls (fullscreen/pip) in WidgetControls component
|
|
11
|
+
* - `true` = show both pip and fullscreen buttons
|
|
12
|
+
* - `"pip"` = show only pip button
|
|
13
|
+
* - `"fullscreen"` = show only fullscreen button
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
viewControls?: boolean | "pip" | "fullscreen";
|
|
17
|
+
/**
|
|
18
|
+
* Automatically notify OpenAI about container height changes for auto-sizing
|
|
19
|
+
* Uses ResizeObserver to monitor the children container and calls window.openai.notifyIntrinsicHeight()
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
autoSize?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Unified provider component that combines all common React setup for mcp-use widgets.
|
|
26
|
+
*
|
|
27
|
+
* Includes:
|
|
28
|
+
* - StrictMode (always)
|
|
29
|
+
* - ThemeProvider (always)
|
|
30
|
+
* - BrowserRouter with automatic basename calculation (always)
|
|
31
|
+
* - WidgetControls (if debugger={true} or viewControls is set)
|
|
32
|
+
* - ErrorBoundary (always)
|
|
33
|
+
* - Auto-sizing (if autoSize={true})
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <McpUseProvider debugger viewControls autoSize>
|
|
38
|
+
* <AppsSDKUIProvider linkComponent={Link}>
|
|
39
|
+
* <div>My widget content</div>
|
|
40
|
+
* </AppsSDKUIProvider>
|
|
41
|
+
* </McpUseProvider>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function McpUseProvider({ children, debugger: enableDebugger, viewControls, autoSize, }: McpUseProviderProps): React.JSX.Element;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=McpUseProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpUseProvider.d.ts","sourceRoot":"","sources":["../../../src/react/McpUseProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAwB1E,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EAAE,cAAsB,EAChC,YAAoB,EACpB,QAAgB,GACjB,EAAE,mBAAmB,qBAkIrB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* ThemeProvider that manages dark mode class on document root
|
|
4
|
+
*
|
|
5
|
+
* Priority:
|
|
6
|
+
* 1. useWidget theme (from OpenAI Apps SDK)
|
|
7
|
+
* 2. System preference (prefers-color-scheme: dark)
|
|
8
|
+
*
|
|
9
|
+
* Sets the "dark" class on document.documentElement when dark mode is active
|
|
10
|
+
*/
|
|
11
|
+
export declare const ThemeProvider: React.FC<{
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/react/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAGpE;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CA4CjE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper component that adds control buttons for widget debugging and view controls.
|
|
3
|
+
* Combines debug button and view controls (fullscreen/pip) with shared hover logic.
|
|
4
|
+
*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
type Position = "top-left" | "top-center" | "top-right" | "center-left" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
7
|
+
interface WidgetControlsProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
position?: Position;
|
|
11
|
+
attachTo?: HTMLElement | null;
|
|
12
|
+
showLabels?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Enable debug button to display widget debug information
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
debugger?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Enable fullscreen and pip view controls
|
|
20
|
+
* - `true` = show both pip and fullscreen buttons
|
|
21
|
+
* - `"pip"` = show only pip button
|
|
22
|
+
* - `"fullscreen"` = show only fullscreen button
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
viewControls?: boolean | "pip" | "fullscreen";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Wrapper component that adds control buttons for widget debugging and view controls.
|
|
29
|
+
* All buttons share the same hover logic and are rendered together.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const MyWidget: React.FC = () => {
|
|
34
|
+
* return (
|
|
35
|
+
* <WidgetControls debugger viewControls position="top-right">
|
|
36
|
+
* <div>My widget content</div>
|
|
37
|
+
* </WidgetControls>
|
|
38
|
+
* );
|
|
39
|
+
* };
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function WidgetControls({ children, className, position, attachTo, showLabels, debugger: enableDebugger, viewControls, }: WidgetControlsProps): React.JSX.Element;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=WidgetControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WidgetControls.d.ts","sourceRoot":"","sources":["../../../src/react/WidgetControls.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,KAAK,QAAQ,GACT,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC;CAC/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,SAAc,EACd,QAAsB,EACtB,QAAQ,EACR,UAAiB,EACjB,QAAQ,EAAE,cAAsB,EAChC,YAAoB,GACrB,EAAE,mBAAmB,qBAmrBrB"}
|