@leanmcp/ui 0.2.0 → 0.3.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/chunk-2HRO6CFU.js +138 -0
- package/dist/chunk-2HRO6CFU.js.map +1 -0
- package/dist/chunk-KX75VCMM.mjs +124 -0
- package/dist/chunk-KX75VCMM.mjs.map +1 -0
- package/dist/index.d.mts +105 -3
- package/dist/index.d.ts +105 -3
- package/dist/index.js +844 -663
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +525 -383
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +115 -1
- package/dist/server.d.ts +115 -1
- package/dist/server.js +48 -7
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +2 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-3PV26V5F.js +0 -50
- package/dist/chunk-3PV26V5F.js.map +0 -1
- package/dist/chunk-WORZ46KI.mjs +0 -42
- package/dist/chunk-WORZ46KI.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk2HRO6CFU_js = require('./chunk-2HRO6CFU.js');
|
|
4
|
+
var React26 = require('react');
|
|
5
5
|
var extApps = require('@modelcontextprotocol/ext-apps');
|
|
6
6
|
var lucideReact = require('lucide-react');
|
|
7
7
|
var nextThemes = require('next-themes');
|
|
@@ -49,7 +49,7 @@ function _interopNamespace(e) {
|
|
|
49
49
|
return Object.freeze(n);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
var
|
|
52
|
+
var React26__namespace = /*#__PURE__*/_interopNamespace(React26);
|
|
53
53
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
|
|
54
54
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
55
55
|
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
@@ -64,30 +64,33 @@ var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPr
|
|
|
64
64
|
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
65
65
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
66
66
|
|
|
67
|
-
var McpAppContext = /* @__PURE__ */
|
|
67
|
+
var McpAppContext = /* @__PURE__ */ React26.createContext(null);
|
|
68
68
|
function AppProvider({ appInfo, capabilities = {}, options = {
|
|
69
69
|
autoResize: true
|
|
70
70
|
}, onTeardown, children }) {
|
|
71
|
-
const [app, setApp] =
|
|
72
|
-
const [isConnected, setIsConnected] =
|
|
73
|
-
const [error, setError] =
|
|
74
|
-
const [hostContext, setHostContext] =
|
|
75
|
-
const [toolInput, setToolInput] =
|
|
76
|
-
const [toolInputPartial, setToolInputPartial] =
|
|
77
|
-
const [toolResult, setToolResult] =
|
|
78
|
-
const [toolCancelled, setToolCancelled] =
|
|
71
|
+
const [app, setApp] = React26.useState(null);
|
|
72
|
+
const [isConnected, setIsConnected] = React26.useState(false);
|
|
73
|
+
const [error, setError] = React26.useState(null);
|
|
74
|
+
const [hostContext, setHostContext] = React26.useState({});
|
|
75
|
+
const [toolInput, setToolInput] = React26.useState(null);
|
|
76
|
+
const [toolInputPartial, setToolInputPartial] = React26.useState(null);
|
|
77
|
+
const [toolResult, setToolResult] = React26.useState(null);
|
|
78
|
+
const [toolCancelled, setToolCancelled] = React26.useState({
|
|
79
79
|
cancelled: false
|
|
80
80
|
});
|
|
81
|
-
const stylesApplied =
|
|
82
|
-
const applyHostStyles =
|
|
81
|
+
const stylesApplied = React26.useRef(false);
|
|
82
|
+
const applyHostStyles = React26.useCallback((context) => {
|
|
83
83
|
if (context.theme) {
|
|
84
84
|
extApps.applyDocumentTheme(context.theme);
|
|
85
85
|
}
|
|
86
86
|
if (context.styles?.variables) {
|
|
87
87
|
extApps.applyHostStyleVariables(context.styles.variables);
|
|
88
88
|
}
|
|
89
|
+
if (context.styles?.css?.fonts) {
|
|
90
|
+
extApps.applyHostFonts(context.styles.css.fonts);
|
|
91
|
+
}
|
|
89
92
|
}, []);
|
|
90
|
-
|
|
93
|
+
React26.useEffect(() => {
|
|
91
94
|
let mounted = true;
|
|
92
95
|
let appInstance = null;
|
|
93
96
|
async function connect() {
|
|
@@ -156,7 +159,7 @@ function AppProvider({ appInfo, capabilities = {}, options = {
|
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
}
|
|
159
|
-
|
|
162
|
+
chunk2HRO6CFU_js.__name(connect, "connect");
|
|
160
163
|
connect();
|
|
161
164
|
return () => {
|
|
162
165
|
mounted = false;
|
|
@@ -170,7 +173,7 @@ function AppProvider({ appInfo, capabilities = {}, options = {
|
|
|
170
173
|
applyHostStyles,
|
|
171
174
|
onTeardown
|
|
172
175
|
]);
|
|
173
|
-
const callTool =
|
|
176
|
+
const callTool = React26.useCallback(async (name, args = {}) => {
|
|
174
177
|
if (!app) {
|
|
175
178
|
throw new Error("Not connected to host");
|
|
176
179
|
}
|
|
@@ -186,7 +189,7 @@ function AppProvider({ appInfo, capabilities = {}, options = {
|
|
|
186
189
|
}, [
|
|
187
190
|
app
|
|
188
191
|
]);
|
|
189
|
-
const sendMessage =
|
|
192
|
+
const sendMessage = React26.useCallback(async (text) => {
|
|
190
193
|
if (!app) {
|
|
191
194
|
console.warn("[AppProvider] Not connected - cannot send message");
|
|
192
195
|
return;
|
|
@@ -203,7 +206,7 @@ function AppProvider({ appInfo, capabilities = {}, options = {
|
|
|
203
206
|
}, [
|
|
204
207
|
app
|
|
205
208
|
]);
|
|
206
|
-
const sendLog =
|
|
209
|
+
const sendLog = React26.useCallback(async (level, data) => {
|
|
207
210
|
if (!app) {
|
|
208
211
|
console.log(`[MCP App] ${level}:`, data);
|
|
209
212
|
return;
|
|
@@ -215,7 +218,7 @@ function AppProvider({ appInfo, capabilities = {}, options = {
|
|
|
215
218
|
}, [
|
|
216
219
|
app
|
|
217
220
|
]);
|
|
218
|
-
const openLink =
|
|
221
|
+
const openLink = React26.useCallback(async (url) => {
|
|
219
222
|
if (!app) {
|
|
220
223
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
221
224
|
return;
|
|
@@ -226,7 +229,7 @@ function AppProvider({ appInfo, capabilities = {}, options = {
|
|
|
226
229
|
}, [
|
|
227
230
|
app
|
|
228
231
|
]);
|
|
229
|
-
const requestDisplayMode =
|
|
232
|
+
const requestDisplayMode = React26.useCallback(async (mode) => {
|
|
230
233
|
if (!app) {
|
|
231
234
|
console.warn("[AppProvider] Not connected - cannot request display mode");
|
|
232
235
|
return "inline";
|
|
@@ -254,14 +257,14 @@ function AppProvider({ appInfo, capabilities = {}, options = {
|
|
|
254
257
|
requestDisplayMode
|
|
255
258
|
};
|
|
256
259
|
const theme = hostContext.theme ?? "light";
|
|
257
|
-
return /* @__PURE__ */
|
|
260
|
+
return /* @__PURE__ */ React26__namespace.default.createElement(McpAppContext.Provider, {
|
|
258
261
|
value
|
|
259
|
-
}, /* @__PURE__ */
|
|
262
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
260
263
|
className: "lui-root",
|
|
261
264
|
"data-theme": theme
|
|
262
265
|
}, children));
|
|
263
266
|
}
|
|
264
|
-
|
|
267
|
+
chunk2HRO6CFU_js.__name(AppProvider, "AppProvider");
|
|
265
268
|
var ssrDefaultContext = {
|
|
266
269
|
app: null,
|
|
267
270
|
isConnected: false,
|
|
@@ -273,41 +276,158 @@ var ssrDefaultContext = {
|
|
|
273
276
|
toolCancelled: {
|
|
274
277
|
cancelled: false
|
|
275
278
|
},
|
|
276
|
-
callTool: /* @__PURE__ */
|
|
279
|
+
callTool: /* @__PURE__ */ chunk2HRO6CFU_js.__name(async () => {
|
|
277
280
|
throw new Error("callTool not available during SSR");
|
|
278
281
|
}, "callTool"),
|
|
279
|
-
sendMessage: /* @__PURE__ */
|
|
282
|
+
sendMessage: /* @__PURE__ */ chunk2HRO6CFU_js.__name(async () => {
|
|
280
283
|
console.warn("sendMessage not available during SSR");
|
|
281
284
|
}, "sendMessage"),
|
|
282
|
-
sendLog: /* @__PURE__ */
|
|
285
|
+
sendLog: /* @__PURE__ */ chunk2HRO6CFU_js.__name(async () => {
|
|
283
286
|
console.warn("sendLog not available during SSR");
|
|
284
287
|
}, "sendLog"),
|
|
285
|
-
openLink: /* @__PURE__ */
|
|
288
|
+
openLink: /* @__PURE__ */ chunk2HRO6CFU_js.__name(async () => {
|
|
286
289
|
console.warn("openLink not available during SSR");
|
|
287
290
|
}, "openLink"),
|
|
288
|
-
requestDisplayMode: /* @__PURE__ */
|
|
291
|
+
requestDisplayMode: /* @__PURE__ */ chunk2HRO6CFU_js.__name(async () => {
|
|
289
292
|
console.warn("requestDisplayMode not available during SSR");
|
|
290
293
|
return "inline";
|
|
291
294
|
}, "requestDisplayMode")
|
|
292
295
|
};
|
|
293
296
|
function useMcpApp() {
|
|
294
|
-
const context =
|
|
297
|
+
const context = React26.useContext(McpAppContext);
|
|
295
298
|
if (!context) {
|
|
296
299
|
return ssrDefaultContext;
|
|
297
300
|
}
|
|
298
301
|
return context;
|
|
299
302
|
}
|
|
300
|
-
|
|
303
|
+
chunk2HRO6CFU_js.__name(useMcpApp, "useMcpApp");
|
|
304
|
+
var GptAppContext = /* @__PURE__ */ React26.createContext(null);
|
|
305
|
+
function GPTAppProvider({ appName, children }) {
|
|
306
|
+
const [isConnected, setIsConnected] = React26.useState(false);
|
|
307
|
+
const [error, setError] = React26.useState(null);
|
|
308
|
+
const [theme, setTheme] = React26.useState("light");
|
|
309
|
+
const [displayMode, setDisplayMode] = React26.useState("inline");
|
|
310
|
+
const [locale, setLocale] = React26.useState("en");
|
|
311
|
+
const [maxHeight, setMaxHeight] = React26.useState(600);
|
|
312
|
+
React26.useEffect(() => {
|
|
313
|
+
let mounted = true;
|
|
314
|
+
let checkAttempts = 0;
|
|
315
|
+
const maxAttempts = 50;
|
|
316
|
+
function checkConnection() {
|
|
317
|
+
if (!mounted) return;
|
|
318
|
+
if (window.openai) {
|
|
319
|
+
setIsConnected(true);
|
|
320
|
+
setError(null);
|
|
321
|
+
if (window.openai.theme) setTheme(window.openai.theme);
|
|
322
|
+
if (window.openai.displayMode) setDisplayMode(window.openai.displayMode);
|
|
323
|
+
if (window.openai.locale) setLocale(window.openai.locale);
|
|
324
|
+
if (window.openai.maxHeight) setMaxHeight(window.openai.maxHeight);
|
|
325
|
+
} else {
|
|
326
|
+
checkAttempts++;
|
|
327
|
+
if (checkAttempts < maxAttempts) {
|
|
328
|
+
setTimeout(checkConnection, 100);
|
|
329
|
+
} else {
|
|
330
|
+
setError(new Error("ChatGPT SDK not available"));
|
|
331
|
+
setIsConnected(false);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
chunk2HRO6CFU_js.__name(checkConnection, "checkConnection");
|
|
336
|
+
checkConnection();
|
|
337
|
+
return () => {
|
|
338
|
+
mounted = false;
|
|
339
|
+
};
|
|
340
|
+
}, [
|
|
341
|
+
appName
|
|
342
|
+
]);
|
|
343
|
+
const callTool = React26.useCallback(async (name, args = {}) => {
|
|
344
|
+
if (!window.openai?.callTool) {
|
|
345
|
+
throw new Error("ChatGPT SDK not available");
|
|
346
|
+
}
|
|
347
|
+
const result = await window.openai.callTool(name, args);
|
|
348
|
+
return result;
|
|
349
|
+
}, []);
|
|
350
|
+
const value = {
|
|
351
|
+
isConnected,
|
|
352
|
+
error,
|
|
353
|
+
theme,
|
|
354
|
+
displayMode,
|
|
355
|
+
locale,
|
|
356
|
+
maxHeight,
|
|
357
|
+
callTool
|
|
358
|
+
};
|
|
359
|
+
return /* @__PURE__ */ React26__namespace.default.createElement(GptAppContext.Provider, {
|
|
360
|
+
value
|
|
361
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
362
|
+
className: "lui-root",
|
|
363
|
+
"data-theme": theme
|
|
364
|
+
}, children));
|
|
365
|
+
}
|
|
366
|
+
chunk2HRO6CFU_js.__name(GPTAppProvider, "GPTAppProvider");
|
|
367
|
+
function useGptApp() {
|
|
368
|
+
const context = React26.useContext(GptAppContext);
|
|
369
|
+
if (!context) {
|
|
370
|
+
return {
|
|
371
|
+
isConnected: false,
|
|
372
|
+
error: new Error("GPTAppProvider not found"),
|
|
373
|
+
theme: "light",
|
|
374
|
+
displayMode: "inline",
|
|
375
|
+
locale: "en",
|
|
376
|
+
maxHeight: 600,
|
|
377
|
+
callTool: /* @__PURE__ */ chunk2HRO6CFU_js.__name(async () => {
|
|
378
|
+
throw new Error("Not connected to ChatGPT");
|
|
379
|
+
}, "callTool")
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
return context;
|
|
383
|
+
}
|
|
384
|
+
chunk2HRO6CFU_js.__name(useGptApp, "useGptApp");
|
|
385
|
+
function useGptTool(toolName) {
|
|
386
|
+
const { callTool, isConnected } = useGptApp();
|
|
387
|
+
const [result, setResult] = React26.useState(null);
|
|
388
|
+
const [loading, setLoading] = React26.useState(false);
|
|
389
|
+
const [error, setError] = React26.useState(null);
|
|
390
|
+
const call = React26.useCallback(async (args = {}) => {
|
|
391
|
+
if (!isConnected) {
|
|
392
|
+
setError(new Error("Not connected to ChatGPT"));
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
setLoading(true);
|
|
396
|
+
setError(null);
|
|
397
|
+
try {
|
|
398
|
+
const res = await callTool(toolName, args);
|
|
399
|
+
setResult(res);
|
|
400
|
+
return res;
|
|
401
|
+
} catch (err) {
|
|
402
|
+
setError(err);
|
|
403
|
+
throw err;
|
|
404
|
+
} finally {
|
|
405
|
+
setLoading(false);
|
|
406
|
+
}
|
|
407
|
+
}, [
|
|
408
|
+
callTool,
|
|
409
|
+
isConnected,
|
|
410
|
+
toolName
|
|
411
|
+
]);
|
|
412
|
+
return {
|
|
413
|
+
call,
|
|
414
|
+
result,
|
|
415
|
+
loading,
|
|
416
|
+
error,
|
|
417
|
+
isConnected
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
chunk2HRO6CFU_js.__name(useGptTool, "useGptTool");
|
|
301
421
|
var DEFAULT_CONTEXT = {
|
|
302
422
|
resultDisplay: {
|
|
303
423
|
display: "none"
|
|
304
424
|
},
|
|
305
425
|
showLoading: true
|
|
306
426
|
};
|
|
307
|
-
var ToolContext = /* @__PURE__ */
|
|
427
|
+
var ToolContext = /* @__PURE__ */ React26.createContext(DEFAULT_CONTEXT);
|
|
308
428
|
function ToolProvider({ defaults = {}, children }) {
|
|
309
|
-
const parentContext =
|
|
310
|
-
const value =
|
|
429
|
+
const parentContext = React26.useContext(ToolContext);
|
|
430
|
+
const value = React26.useMemo(() => ({
|
|
311
431
|
resultDisplay: defaults.resultDisplay ?? parentContext.resultDisplay,
|
|
312
432
|
onError: defaults.onError ?? parentContext.onError,
|
|
313
433
|
showLoading: defaults.showLoading ?? parentContext.showLoading
|
|
@@ -315,34 +435,34 @@ function ToolProvider({ defaults = {}, children }) {
|
|
|
315
435
|
defaults,
|
|
316
436
|
parentContext
|
|
317
437
|
]);
|
|
318
|
-
return /* @__PURE__ */
|
|
438
|
+
return /* @__PURE__ */ React26__namespace.createElement(ToolContext.Provider, {
|
|
319
439
|
value
|
|
320
440
|
}, children);
|
|
321
441
|
}
|
|
322
|
-
|
|
442
|
+
chunk2HRO6CFU_js.__name(ToolProvider, "ToolProvider");
|
|
323
443
|
function useToolContext() {
|
|
324
|
-
return
|
|
444
|
+
return React26.useContext(ToolContext);
|
|
325
445
|
}
|
|
326
|
-
|
|
327
|
-
var Toaster = /* @__PURE__ */
|
|
446
|
+
chunk2HRO6CFU_js.__name(useToolContext, "useToolContext");
|
|
447
|
+
var Toaster = /* @__PURE__ */ chunk2HRO6CFU_js.__name(({ ...props }) => {
|
|
328
448
|
const { theme = "system" } = nextThemes.useTheme();
|
|
329
|
-
return /* @__PURE__ */
|
|
449
|
+
return /* @__PURE__ */ React26__namespace.default.createElement(sonner.Toaster, {
|
|
330
450
|
theme,
|
|
331
451
|
className: "toaster group",
|
|
332
452
|
icons: {
|
|
333
|
-
success: /* @__PURE__ */
|
|
453
|
+
success: /* @__PURE__ */ React26__namespace.default.createElement(lucideReact.CircleCheckIcon, {
|
|
334
454
|
className: "size-4"
|
|
335
455
|
}),
|
|
336
|
-
info: /* @__PURE__ */
|
|
456
|
+
info: /* @__PURE__ */ React26__namespace.default.createElement(lucideReact.InfoIcon, {
|
|
337
457
|
className: "size-4"
|
|
338
458
|
}),
|
|
339
|
-
warning: /* @__PURE__ */
|
|
459
|
+
warning: /* @__PURE__ */ React26__namespace.default.createElement(lucideReact.TriangleAlertIcon, {
|
|
340
460
|
className: "size-4"
|
|
341
461
|
}),
|
|
342
|
-
error: /* @__PURE__ */
|
|
462
|
+
error: /* @__PURE__ */ React26__namespace.default.createElement(lucideReact.OctagonXIcon, {
|
|
343
463
|
className: "size-4"
|
|
344
464
|
}),
|
|
345
|
-
loading: /* @__PURE__ */
|
|
465
|
+
loading: /* @__PURE__ */ React26__namespace.default.createElement(lucideReact.Loader2Icon, {
|
|
346
466
|
className: "size-4 animate-spin"
|
|
347
467
|
})
|
|
348
468
|
},
|
|
@@ -358,7 +478,7 @@ var Toaster = /* @__PURE__ */ chunk3PV26V5F_js.__name(({ ...props }) => {
|
|
|
358
478
|
function cn(...inputs) {
|
|
359
479
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
360
480
|
}
|
|
361
|
-
|
|
481
|
+
chunk2HRO6CFU_js.__name(cn, "cn");
|
|
362
482
|
|
|
363
483
|
// src/components/ui/button.tsx
|
|
364
484
|
var buttonVariants = classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
@@ -387,7 +507,7 @@ var buttonVariants = classVarianceAuthority.cva("inline-flex items-center justif
|
|
|
387
507
|
});
|
|
388
508
|
function Button({ className, variant = "default", size = "default", asChild = false, ...props }) {
|
|
389
509
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
390
|
-
return /* @__PURE__ */
|
|
510
|
+
return /* @__PURE__ */ React26__namespace.createElement(Comp, {
|
|
391
511
|
"data-slot": "button",
|
|
392
512
|
"data-variant": variant,
|
|
393
513
|
"data-size": size,
|
|
@@ -399,90 +519,90 @@ function Button({ className, variant = "default", size = "default", asChild = fa
|
|
|
399
519
|
...props
|
|
400
520
|
});
|
|
401
521
|
}
|
|
402
|
-
|
|
522
|
+
chunk2HRO6CFU_js.__name(Button, "Button");
|
|
403
523
|
function Dialog({ ...props }) {
|
|
404
|
-
return /* @__PURE__ */
|
|
524
|
+
return /* @__PURE__ */ React26__namespace.createElement(DialogPrimitive__namespace.Root, {
|
|
405
525
|
"data-slot": "dialog",
|
|
406
526
|
...props
|
|
407
527
|
});
|
|
408
528
|
}
|
|
409
|
-
|
|
529
|
+
chunk2HRO6CFU_js.__name(Dialog, "Dialog");
|
|
410
530
|
function DialogTrigger({ ...props }) {
|
|
411
|
-
return /* @__PURE__ */
|
|
531
|
+
return /* @__PURE__ */ React26__namespace.createElement(DialogPrimitive__namespace.Trigger, {
|
|
412
532
|
"data-slot": "dialog-trigger",
|
|
413
533
|
...props
|
|
414
534
|
});
|
|
415
535
|
}
|
|
416
|
-
|
|
536
|
+
chunk2HRO6CFU_js.__name(DialogTrigger, "DialogTrigger");
|
|
417
537
|
function DialogPortal({ ...props }) {
|
|
418
|
-
return /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ React26__namespace.createElement(DialogPrimitive__namespace.Portal, {
|
|
419
539
|
"data-slot": "dialog-portal",
|
|
420
540
|
...props
|
|
421
541
|
});
|
|
422
542
|
}
|
|
423
|
-
|
|
543
|
+
chunk2HRO6CFU_js.__name(DialogPortal, "DialogPortal");
|
|
424
544
|
function DialogClose({ ...props }) {
|
|
425
|
-
return /* @__PURE__ */
|
|
545
|
+
return /* @__PURE__ */ React26__namespace.createElement(DialogPrimitive__namespace.Close, {
|
|
426
546
|
"data-slot": "dialog-close",
|
|
427
547
|
...props
|
|
428
548
|
});
|
|
429
549
|
}
|
|
430
|
-
|
|
550
|
+
chunk2HRO6CFU_js.__name(DialogClose, "DialogClose");
|
|
431
551
|
function DialogOverlay({ className, ...props }) {
|
|
432
|
-
return /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ React26__namespace.createElement(DialogPrimitive__namespace.Overlay, {
|
|
433
553
|
"data-slot": "dialog-overlay",
|
|
434
554
|
className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className),
|
|
435
555
|
...props
|
|
436
556
|
});
|
|
437
557
|
}
|
|
438
|
-
|
|
558
|
+
chunk2HRO6CFU_js.__name(DialogOverlay, "DialogOverlay");
|
|
439
559
|
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
440
|
-
return /* @__PURE__ */
|
|
560
|
+
return /* @__PURE__ */ React26__namespace.createElement(DialogPortal, {
|
|
441
561
|
"data-slot": "dialog-portal"
|
|
442
|
-
}, /* @__PURE__ */
|
|
562
|
+
}, /* @__PURE__ */ React26__namespace.createElement(DialogOverlay, null), /* @__PURE__ */ React26__namespace.createElement(DialogPrimitive__namespace.Content, {
|
|
443
563
|
"data-slot": "dialog-content",
|
|
444
564
|
className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg", className),
|
|
445
565
|
...props
|
|
446
|
-
}, children, showCloseButton && /* @__PURE__ */
|
|
566
|
+
}, children, showCloseButton && /* @__PURE__ */ React26__namespace.createElement(DialogPrimitive__namespace.Close, {
|
|
447
567
|
"data-slot": "dialog-close",
|
|
448
568
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
449
|
-
}, /* @__PURE__ */
|
|
569
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.XIcon, null), /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
450
570
|
className: "sr-only"
|
|
451
571
|
}, "Close"))));
|
|
452
572
|
}
|
|
453
|
-
|
|
573
|
+
chunk2HRO6CFU_js.__name(DialogContent, "DialogContent");
|
|
454
574
|
function DialogHeader({ className, ...props }) {
|
|
455
|
-
return /* @__PURE__ */
|
|
575
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
456
576
|
"data-slot": "dialog-header",
|
|
457
577
|
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
458
578
|
...props
|
|
459
579
|
});
|
|
460
580
|
}
|
|
461
|
-
|
|
581
|
+
chunk2HRO6CFU_js.__name(DialogHeader, "DialogHeader");
|
|
462
582
|
function DialogFooter({ className, ...props }) {
|
|
463
|
-
return /* @__PURE__ */
|
|
583
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
464
584
|
"data-slot": "dialog-footer",
|
|
465
585
|
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
466
586
|
...props
|
|
467
587
|
});
|
|
468
588
|
}
|
|
469
|
-
|
|
589
|
+
chunk2HRO6CFU_js.__name(DialogFooter, "DialogFooter");
|
|
470
590
|
function DialogTitle({ className, ...props }) {
|
|
471
|
-
return /* @__PURE__ */
|
|
591
|
+
return /* @__PURE__ */ React26__namespace.createElement(DialogPrimitive__namespace.Title, {
|
|
472
592
|
"data-slot": "dialog-title",
|
|
473
593
|
className: cn("text-lg leading-none font-semibold", className),
|
|
474
594
|
...props
|
|
475
595
|
});
|
|
476
596
|
}
|
|
477
|
-
|
|
597
|
+
chunk2HRO6CFU_js.__name(DialogTitle, "DialogTitle");
|
|
478
598
|
function DialogDescription({ className, ...props }) {
|
|
479
|
-
return /* @__PURE__ */
|
|
599
|
+
return /* @__PURE__ */ React26__namespace.createElement(DialogPrimitive__namespace.Description, {
|
|
480
600
|
"data-slot": "dialog-description",
|
|
481
601
|
className: cn("text-muted-foreground text-sm", className),
|
|
482
602
|
...props
|
|
483
603
|
});
|
|
484
604
|
}
|
|
485
|
-
|
|
605
|
+
chunk2HRO6CFU_js.__name(DialogDescription, "DialogDescription");
|
|
486
606
|
function extractResultData(result) {
|
|
487
607
|
if ("structuredContent" in result && result.structuredContent) {
|
|
488
608
|
return result.structuredContent;
|
|
@@ -491,7 +611,14 @@ function extractResultData(result) {
|
|
|
491
611
|
const textContent = result.content.filter((c) => c.type === "text").map((c) => c.text).join("");
|
|
492
612
|
if (textContent) {
|
|
493
613
|
try {
|
|
494
|
-
|
|
614
|
+
const parsed = JSON.parse(textContent);
|
|
615
|
+
if (parsed && typeof parsed === "object" && "content" in parsed && Array.isArray(parsed.content)) {
|
|
616
|
+
const nested = extractResultData(parsed);
|
|
617
|
+
if (nested !== null) {
|
|
618
|
+
return nested;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return parsed;
|
|
495
622
|
} catch {
|
|
496
623
|
return textContent;
|
|
497
624
|
}
|
|
@@ -499,15 +626,15 @@ function extractResultData(result) {
|
|
|
499
626
|
}
|
|
500
627
|
return result;
|
|
501
628
|
}
|
|
502
|
-
|
|
629
|
+
chunk2HRO6CFU_js.__name(extractResultData, "extractResultData");
|
|
503
630
|
function useTool(toolName, options = {}) {
|
|
504
631
|
const { callTool } = useMcpApp();
|
|
505
|
-
const [state, setState] =
|
|
506
|
-
const [result, setResult] =
|
|
507
|
-
const [error, setError] =
|
|
508
|
-
const abortControllerRef =
|
|
509
|
-
const lastArgsRef =
|
|
510
|
-
const retryCountRef =
|
|
632
|
+
const [state, setState] = React26.useState("idle");
|
|
633
|
+
const [result, setResult] = React26.useState(null);
|
|
634
|
+
const [error, setError] = React26.useState(null);
|
|
635
|
+
const abortControllerRef = React26.useRef(null);
|
|
636
|
+
const lastArgsRef = React26.useRef(void 0);
|
|
637
|
+
const retryCountRef = React26.useRef(0);
|
|
511
638
|
const { defaultArgs, transform, retry, onStart, onSuccess, onError, onComplete } = options;
|
|
512
639
|
const retryConfig = typeof retry === "number" ? {
|
|
513
640
|
count: retry,
|
|
@@ -516,7 +643,7 @@ function useTool(toolName, options = {}) {
|
|
|
516
643
|
count: 0,
|
|
517
644
|
delay: 1e3
|
|
518
645
|
};
|
|
519
|
-
const executeCall =
|
|
646
|
+
const executeCall = React26.useCallback(async (args) => {
|
|
520
647
|
const mergedArgs = {
|
|
521
648
|
...defaultArgs,
|
|
522
649
|
...args
|
|
@@ -568,25 +695,25 @@ function useTool(toolName, options = {}) {
|
|
|
568
695
|
onError,
|
|
569
696
|
onComplete
|
|
570
697
|
]);
|
|
571
|
-
const call =
|
|
698
|
+
const call = React26.useCallback(async (args) => {
|
|
572
699
|
retryCountRef.current = 0;
|
|
573
700
|
return executeCall(args);
|
|
574
701
|
}, [
|
|
575
702
|
executeCall
|
|
576
703
|
]);
|
|
577
|
-
const mutate =
|
|
704
|
+
const mutate = React26.useCallback(async (args) => {
|
|
578
705
|
return call(args);
|
|
579
706
|
}, [
|
|
580
707
|
call
|
|
581
708
|
]);
|
|
582
|
-
const reset =
|
|
709
|
+
const reset = React26.useCallback(() => {
|
|
583
710
|
setState("idle");
|
|
584
711
|
setResult(null);
|
|
585
712
|
setError(null);
|
|
586
713
|
retryCountRef.current = 0;
|
|
587
714
|
abortControllerRef.current?.abort();
|
|
588
715
|
}, []);
|
|
589
|
-
const retryCall =
|
|
716
|
+
const retryCall = React26.useCallback(async () => {
|
|
590
717
|
if (lastArgsRef.current === void 0 && !defaultArgs) {
|
|
591
718
|
return null;
|
|
592
719
|
}
|
|
@@ -596,7 +723,7 @@ function useTool(toolName, options = {}) {
|
|
|
596
723
|
executeCall,
|
|
597
724
|
defaultArgs
|
|
598
725
|
]);
|
|
599
|
-
const abort =
|
|
726
|
+
const abort = React26.useCallback(() => {
|
|
600
727
|
abortControllerRef.current?.abort();
|
|
601
728
|
setState("idle");
|
|
602
729
|
}, []);
|
|
@@ -612,7 +739,7 @@ function useTool(toolName, options = {}) {
|
|
|
612
739
|
abort
|
|
613
740
|
};
|
|
614
741
|
}
|
|
615
|
-
|
|
742
|
+
chunk2HRO6CFU_js.__name(useTool, "useTool");
|
|
616
743
|
function ToolButton({ tool, args = {}, resultDisplay = "none", renderResult, resultDuration = 3e3, successMessage, errorMessage, onToolStart, onToolSuccess, onToolError, onToolComplete, loadingText, loadingIcon, disableWhileLoading = true, confirm, children, className, variant = "default", size = "default", disabled, asChild = false, ...props }) {
|
|
617
744
|
const toolConfig = typeof tool === "string" ? {
|
|
618
745
|
name: tool
|
|
@@ -629,8 +756,8 @@ function ToolButton({ tool, args = {}, resultDisplay = "none", renderResult, res
|
|
|
629
756
|
onError: onToolError,
|
|
630
757
|
onComplete: onToolComplete
|
|
631
758
|
});
|
|
632
|
-
const [showConfirm, setShowConfirm] =
|
|
633
|
-
const [showResult, setShowResult] =
|
|
759
|
+
const [showConfirm, setShowConfirm] = React26.useState(false);
|
|
760
|
+
const [showResult, setShowResult] = React26.useState(false);
|
|
634
761
|
const buttonState = {
|
|
635
762
|
loading,
|
|
636
763
|
state,
|
|
@@ -638,7 +765,7 @@ function ToolButton({ tool, args = {}, resultDisplay = "none", renderResult, res
|
|
|
638
765
|
error,
|
|
639
766
|
hasResult: result !== null || error !== null
|
|
640
767
|
};
|
|
641
|
-
const executeCall =
|
|
768
|
+
const executeCall = React26.useCallback(async () => {
|
|
642
769
|
try {
|
|
643
770
|
const res = await call();
|
|
644
771
|
if (resultDisplay === "toast") {
|
|
@@ -664,7 +791,7 @@ function ToolButton({ tool, args = {}, resultDisplay = "none", renderResult, res
|
|
|
664
791
|
errorMessage,
|
|
665
792
|
resultDuration
|
|
666
793
|
]);
|
|
667
|
-
const handleClick =
|
|
794
|
+
const handleClick = React26.useCallback(() => {
|
|
668
795
|
if (confirm) {
|
|
669
796
|
setShowConfirm(true);
|
|
670
797
|
} else {
|
|
@@ -674,7 +801,7 @@ function ToolButton({ tool, args = {}, resultDisplay = "none", renderResult, res
|
|
|
674
801
|
confirm,
|
|
675
802
|
executeCall
|
|
676
803
|
]);
|
|
677
|
-
const handleConfirm =
|
|
804
|
+
const handleConfirm = React26.useCallback(() => {
|
|
678
805
|
setShowConfirm(false);
|
|
679
806
|
executeCall();
|
|
680
807
|
}, [
|
|
@@ -686,31 +813,31 @@ function ToolButton({ tool, args = {}, resultDisplay = "none", renderResult, res
|
|
|
686
813
|
confirmText: "Confirm",
|
|
687
814
|
cancelText: "Cancel"
|
|
688
815
|
};
|
|
689
|
-
const renderChildren = /* @__PURE__ */
|
|
816
|
+
const renderChildren = /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => {
|
|
690
817
|
if (typeof children === "function") {
|
|
691
818
|
return children(buttonState);
|
|
692
819
|
}
|
|
693
820
|
if (loading) {
|
|
694
|
-
return /* @__PURE__ */
|
|
821
|
+
return /* @__PURE__ */ React26__namespace.createElement(React26__namespace.Fragment, null, loadingIcon ?? /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
695
822
|
className: "animate-spin"
|
|
696
|
-
}), loadingText && /* @__PURE__ */
|
|
823
|
+
}), loadingText && /* @__PURE__ */ React26__namespace.createElement("span", null, loadingText), !loadingText && children);
|
|
697
824
|
}
|
|
698
825
|
if (showResult && resultDisplay === "inline") {
|
|
699
826
|
if (error) {
|
|
700
|
-
return /* @__PURE__ */
|
|
827
|
+
return /* @__PURE__ */ React26__namespace.createElement(React26__namespace.Fragment, null, /* @__PURE__ */ React26__namespace.createElement(lucideReact.X, {
|
|
701
828
|
className: "text-destructive"
|
|
702
|
-
}), /* @__PURE__ */
|
|
829
|
+
}), /* @__PURE__ */ React26__namespace.createElement("span", null, error.message));
|
|
703
830
|
}
|
|
704
831
|
if (renderResult) {
|
|
705
832
|
return renderResult(result);
|
|
706
833
|
}
|
|
707
|
-
return /* @__PURE__ */
|
|
834
|
+
return /* @__PURE__ */ React26__namespace.createElement(React26__namespace.Fragment, null, /* @__PURE__ */ React26__namespace.createElement(lucideReact.Check, {
|
|
708
835
|
className: "text-success"
|
|
709
|
-
}), /* @__PURE__ */
|
|
836
|
+
}), /* @__PURE__ */ React26__namespace.createElement("span", null, "Done"));
|
|
710
837
|
}
|
|
711
838
|
return children;
|
|
712
839
|
}, "renderChildren");
|
|
713
|
-
return /* @__PURE__ */
|
|
840
|
+
return /* @__PURE__ */ React26__namespace.createElement(React26__namespace.Fragment, null, /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
714
841
|
type: "button",
|
|
715
842
|
variant,
|
|
716
843
|
size,
|
|
@@ -719,116 +846,116 @@ function ToolButton({ tool, args = {}, resultDisplay = "none", renderResult, res
|
|
|
719
846
|
onClick: handleClick,
|
|
720
847
|
asChild,
|
|
721
848
|
...props
|
|
722
|
-
}, renderChildren()), confirm && /* @__PURE__ */
|
|
849
|
+
}, renderChildren()), confirm && /* @__PURE__ */ React26__namespace.createElement(Dialog, {
|
|
723
850
|
open: showConfirm,
|
|
724
851
|
onOpenChange: setShowConfirm
|
|
725
|
-
}, /* @__PURE__ */
|
|
852
|
+
}, /* @__PURE__ */ React26__namespace.createElement(DialogContent, null, /* @__PURE__ */ React26__namespace.createElement(DialogHeader, null, /* @__PURE__ */ React26__namespace.createElement(DialogTitle, null, confirmConfig.title), confirmConfig.description && /* @__PURE__ */ React26__namespace.createElement(DialogDescription, null, confirmConfig.description)), /* @__PURE__ */ React26__namespace.createElement(DialogFooter, null, /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
726
853
|
variant: "outline",
|
|
727
|
-
onClick: /* @__PURE__ */
|
|
728
|
-
}, confirmConfig.cancelText ?? "Cancel"), /* @__PURE__ */
|
|
854
|
+
onClick: /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => setShowConfirm(false), "onClick")
|
|
855
|
+
}, confirmConfig.cancelText ?? "Cancel"), /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
729
856
|
variant: confirmConfig.confirmVariant ?? (variant === "destructive" ? "destructive" : "default"),
|
|
730
857
|
onClick: handleConfirm
|
|
731
858
|
}, confirmConfig.confirmText ?? "Confirm")))));
|
|
732
859
|
}
|
|
733
|
-
|
|
860
|
+
chunk2HRO6CFU_js.__name(ToolButton, "ToolButton");
|
|
734
861
|
function Select({ ...props }) {
|
|
735
|
-
return /* @__PURE__ */
|
|
862
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Root, {
|
|
736
863
|
"data-slot": "select",
|
|
737
864
|
...props
|
|
738
865
|
});
|
|
739
866
|
}
|
|
740
|
-
|
|
867
|
+
chunk2HRO6CFU_js.__name(Select, "Select");
|
|
741
868
|
function SelectGroup({ ...props }) {
|
|
742
|
-
return /* @__PURE__ */
|
|
869
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Group, {
|
|
743
870
|
"data-slot": "select-group",
|
|
744
871
|
...props
|
|
745
872
|
});
|
|
746
873
|
}
|
|
747
|
-
|
|
874
|
+
chunk2HRO6CFU_js.__name(SelectGroup, "SelectGroup");
|
|
748
875
|
function SelectValue({ ...props }) {
|
|
749
|
-
return /* @__PURE__ */
|
|
876
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Value, {
|
|
750
877
|
"data-slot": "select-value",
|
|
751
878
|
...props
|
|
752
879
|
});
|
|
753
880
|
}
|
|
754
|
-
|
|
881
|
+
chunk2HRO6CFU_js.__name(SelectValue, "SelectValue");
|
|
755
882
|
function SelectTrigger({ className, size = "default", children, ...props }) {
|
|
756
|
-
return /* @__PURE__ */
|
|
883
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Trigger, {
|
|
757
884
|
"data-slot": "select-trigger",
|
|
758
885
|
"data-size": size,
|
|
759
886
|
className: cn("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
760
887
|
...props
|
|
761
|
-
}, children, /* @__PURE__ */
|
|
888
|
+
}, children, /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Icon, {
|
|
762
889
|
asChild: true
|
|
763
|
-
}, /* @__PURE__ */
|
|
890
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.ChevronDownIcon, {
|
|
764
891
|
className: "size-4 opacity-50"
|
|
765
892
|
})));
|
|
766
893
|
}
|
|
767
|
-
|
|
894
|
+
chunk2HRO6CFU_js.__name(SelectTrigger, "SelectTrigger");
|
|
768
895
|
function SelectContent({ className, children, position = "item-aligned", align = "center", ...props }) {
|
|
769
|
-
return /* @__PURE__ */
|
|
896
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Portal, null, /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Content, {
|
|
770
897
|
"data-slot": "select-content",
|
|
771
898
|
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
772
899
|
position,
|
|
773
900
|
align,
|
|
774
901
|
...props
|
|
775
|
-
}, /* @__PURE__ */
|
|
902
|
+
}, /* @__PURE__ */ React26__namespace.createElement(SelectScrollUpButton, null), /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Viewport, {
|
|
776
903
|
className: cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1")
|
|
777
|
-
}, children), /* @__PURE__ */
|
|
904
|
+
}, children), /* @__PURE__ */ React26__namespace.createElement(SelectScrollDownButton, null)));
|
|
778
905
|
}
|
|
779
|
-
|
|
906
|
+
chunk2HRO6CFU_js.__name(SelectContent, "SelectContent");
|
|
780
907
|
function SelectLabel({ className, ...props }) {
|
|
781
|
-
return /* @__PURE__ */
|
|
908
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Label, {
|
|
782
909
|
"data-slot": "select-label",
|
|
783
910
|
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
784
911
|
...props
|
|
785
912
|
});
|
|
786
913
|
}
|
|
787
|
-
|
|
914
|
+
chunk2HRO6CFU_js.__name(SelectLabel, "SelectLabel");
|
|
788
915
|
function SelectItem({ className, children, ...props }) {
|
|
789
|
-
return /* @__PURE__ */
|
|
916
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Item, {
|
|
790
917
|
"data-slot": "select-item",
|
|
791
918
|
className: cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
792
919
|
...props
|
|
793
|
-
}, /* @__PURE__ */
|
|
920
|
+
}, /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
794
921
|
"data-slot": "select-item-indicator",
|
|
795
922
|
className: "absolute right-2 flex size-3.5 items-center justify-center"
|
|
796
|
-
}, /* @__PURE__ */
|
|
923
|
+
}, /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React26__namespace.createElement(lucideReact.CheckIcon, {
|
|
797
924
|
className: "size-4"
|
|
798
|
-
}))), /* @__PURE__ */
|
|
925
|
+
}))), /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.ItemText, null, children));
|
|
799
926
|
}
|
|
800
|
-
|
|
927
|
+
chunk2HRO6CFU_js.__name(SelectItem, "SelectItem");
|
|
801
928
|
function SelectSeparator({ className, ...props }) {
|
|
802
|
-
return /* @__PURE__ */
|
|
929
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.Separator, {
|
|
803
930
|
"data-slot": "select-separator",
|
|
804
931
|
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
805
932
|
...props
|
|
806
933
|
});
|
|
807
934
|
}
|
|
808
|
-
|
|
935
|
+
chunk2HRO6CFU_js.__name(SelectSeparator, "SelectSeparator");
|
|
809
936
|
function SelectScrollUpButton({ className, ...props }) {
|
|
810
|
-
return /* @__PURE__ */
|
|
937
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.ScrollUpButton, {
|
|
811
938
|
"data-slot": "select-scroll-up-button",
|
|
812
939
|
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
813
940
|
...props
|
|
814
|
-
}, /* @__PURE__ */
|
|
941
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.ChevronUpIcon, {
|
|
815
942
|
className: "size-4"
|
|
816
943
|
}));
|
|
817
944
|
}
|
|
818
|
-
|
|
945
|
+
chunk2HRO6CFU_js.__name(SelectScrollUpButton, "SelectScrollUpButton");
|
|
819
946
|
function SelectScrollDownButton({ className, ...props }) {
|
|
820
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ React26__namespace.createElement(SelectPrimitive__namespace.ScrollDownButton, {
|
|
821
948
|
"data-slot": "select-scroll-down-button",
|
|
822
949
|
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
823
950
|
...props
|
|
824
|
-
}, /* @__PURE__ */
|
|
951
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.ChevronDownIcon, {
|
|
825
952
|
className: "size-4"
|
|
826
953
|
}));
|
|
827
954
|
}
|
|
828
|
-
|
|
955
|
+
chunk2HRO6CFU_js.__name(SelectScrollDownButton, "SelectScrollDownButton");
|
|
829
956
|
function ToolSelect({ onSelectTool, argName = "value", additionalArgs = {}, optionsTool, optionsArgs = {}, transformOptions, options: staticOptions = [], placeholder = "Select an option", loadingPlaceholder = "Loading...", emptyMessage = "No options available", value: controlledValue, defaultValue, onValueChange, onOptionsLoaded, onSelectionSuccess, onSelectionError, showSuccessToast = false, successMessage, className, disabled = false }) {
|
|
830
|
-
const [fetchedOptions, setFetchedOptions] =
|
|
831
|
-
const [internalValue, setInternalValue] =
|
|
957
|
+
const [fetchedOptions, setFetchedOptions] = React26.useState([]);
|
|
958
|
+
const [internalValue, setInternalValue] = React26.useState(defaultValue ?? "");
|
|
832
959
|
const optionsToolConfig = optionsTool ? typeof optionsTool === "string" ? {
|
|
833
960
|
name: optionsTool
|
|
834
961
|
} : optionsTool : null;
|
|
@@ -842,7 +969,7 @@ function ToolSelect({ onSelectTool, argName = "value", additionalArgs = {}, opti
|
|
|
842
969
|
}
|
|
843
970
|
});
|
|
844
971
|
const selectHook = useTool(selectToolConfig?.name ?? "", {
|
|
845
|
-
onSuccess: /* @__PURE__ */
|
|
972
|
+
onSuccess: /* @__PURE__ */ chunk2HRO6CFU_js.__name((result) => {
|
|
846
973
|
onSelectionSuccess?.(result);
|
|
847
974
|
if (showSuccessToast) {
|
|
848
975
|
const message = typeof successMessage === "function" ? successMessage(result) : successMessage ?? "Selection saved";
|
|
@@ -851,7 +978,7 @@ function ToolSelect({ onSelectTool, argName = "value", additionalArgs = {}, opti
|
|
|
851
978
|
}, "onSuccess"),
|
|
852
979
|
onError: onSelectionError
|
|
853
980
|
});
|
|
854
|
-
|
|
981
|
+
React26.useEffect(() => {
|
|
855
982
|
if (optionsToolConfig) {
|
|
856
983
|
optionsHook.call().then((result) => {
|
|
857
984
|
const options = transformOptions ? transformOptions(result) : result;
|
|
@@ -868,7 +995,7 @@ function ToolSelect({ onSelectTool, argName = "value", additionalArgs = {}, opti
|
|
|
868
995
|
...fetchedOptions
|
|
869
996
|
];
|
|
870
997
|
const value = controlledValue ?? internalValue;
|
|
871
|
-
const handleValueChange =
|
|
998
|
+
const handleValueChange = React26.useCallback((newValue) => {
|
|
872
999
|
setInternalValue(newValue);
|
|
873
1000
|
onValueChange?.(newValue);
|
|
874
1001
|
if (selectToolConfig) {
|
|
@@ -886,138 +1013,138 @@ function ToolSelect({ onSelectTool, argName = "value", additionalArgs = {}, opti
|
|
|
886
1013
|
]);
|
|
887
1014
|
const isLoading = optionsHook.loading || selectHook.loading;
|
|
888
1015
|
const hasError = optionsHook.error || selectHook.error;
|
|
889
|
-
return /* @__PURE__ */
|
|
1016
|
+
return /* @__PURE__ */ React26__namespace.createElement(Select, {
|
|
890
1017
|
value,
|
|
891
1018
|
onValueChange: handleValueChange,
|
|
892
1019
|
disabled: disabled || isLoading
|
|
893
|
-
}, /* @__PURE__ */
|
|
1020
|
+
}, /* @__PURE__ */ React26__namespace.createElement(SelectTrigger, {
|
|
894
1021
|
className: cn("w-full", className)
|
|
895
|
-
}, isLoading ? /* @__PURE__ */
|
|
1022
|
+
}, isLoading ? /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
896
1023
|
className: "flex items-center gap-2"
|
|
897
|
-
}, /* @__PURE__ */
|
|
1024
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
898
1025
|
className: "h-4 w-4 animate-spin"
|
|
899
|
-
}), /* @__PURE__ */
|
|
1026
|
+
}), /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
900
1027
|
className: "text-muted-foreground"
|
|
901
|
-
}, optionsHook.loading ? loadingPlaceholder : "Saving...")) : /* @__PURE__ */
|
|
1028
|
+
}, optionsHook.loading ? loadingPlaceholder : "Saving...")) : /* @__PURE__ */ React26__namespace.createElement(SelectValue, {
|
|
902
1029
|
placeholder
|
|
903
|
-
})), /* @__PURE__ */
|
|
1030
|
+
})), /* @__PURE__ */ React26__namespace.createElement(SelectContent, null, allOptions.length === 0 ? /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
904
1031
|
className: "py-6 text-center text-sm text-muted-foreground"
|
|
905
|
-
}, hasError ? "Error loading options" : emptyMessage) : allOptions.map((option) => /* @__PURE__ */
|
|
1032
|
+
}, hasError ? "Error loading options" : emptyMessage) : allOptions.map((option) => /* @__PURE__ */ React26__namespace.createElement(SelectItem, {
|
|
906
1033
|
key: option.value,
|
|
907
1034
|
value: option.value,
|
|
908
1035
|
disabled: option.disabled
|
|
909
|
-
}, /* @__PURE__ */
|
|
1036
|
+
}, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
910
1037
|
className: "flex items-center gap-2"
|
|
911
|
-
}, option.icon, /* @__PURE__ */
|
|
1038
|
+
}, option.icon, /* @__PURE__ */ React26__namespace.createElement("div", null, /* @__PURE__ */ React26__namespace.createElement("div", null, option.label), option.description && /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
912
1039
|
className: "text-xs text-muted-foreground"
|
|
913
1040
|
}, option.description)))))));
|
|
914
1041
|
}
|
|
915
|
-
|
|
1042
|
+
chunk2HRO6CFU_js.__name(ToolSelect, "ToolSelect");
|
|
916
1043
|
function Input({ className, type, ...props }) {
|
|
917
|
-
return /* @__PURE__ */
|
|
1044
|
+
return /* @__PURE__ */ React26__namespace.createElement("input", {
|
|
918
1045
|
type,
|
|
919
1046
|
"data-slot": "input",
|
|
920
1047
|
className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className),
|
|
921
1048
|
...props
|
|
922
1049
|
});
|
|
923
1050
|
}
|
|
924
|
-
|
|
1051
|
+
chunk2HRO6CFU_js.__name(Input, "Input");
|
|
925
1052
|
function Command({ className, ...props }) {
|
|
926
|
-
return /* @__PURE__ */
|
|
1053
|
+
return /* @__PURE__ */ React26__namespace.createElement(cmdk.Command, {
|
|
927
1054
|
"data-slot": "command",
|
|
928
1055
|
className: cn("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md", className),
|
|
929
1056
|
...props
|
|
930
1057
|
});
|
|
931
1058
|
}
|
|
932
|
-
|
|
1059
|
+
chunk2HRO6CFU_js.__name(Command, "Command");
|
|
933
1060
|
function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = true, ...props }) {
|
|
934
|
-
return /* @__PURE__ */
|
|
1061
|
+
return /* @__PURE__ */ React26__namespace.createElement(Dialog, props, /* @__PURE__ */ React26__namespace.createElement(DialogHeader, {
|
|
935
1062
|
className: "sr-only"
|
|
936
|
-
}, /* @__PURE__ */
|
|
1063
|
+
}, /* @__PURE__ */ React26__namespace.createElement(DialogTitle, null, title), /* @__PURE__ */ React26__namespace.createElement(DialogDescription, null, description)), /* @__PURE__ */ React26__namespace.createElement(DialogContent, {
|
|
937
1064
|
className: cn("overflow-hidden p-0", className),
|
|
938
1065
|
showCloseButton
|
|
939
|
-
}, /* @__PURE__ */
|
|
1066
|
+
}, /* @__PURE__ */ React26__namespace.createElement(Command, {
|
|
940
1067
|
className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5"
|
|
941
1068
|
}, children)));
|
|
942
1069
|
}
|
|
943
|
-
|
|
1070
|
+
chunk2HRO6CFU_js.__name(CommandDialog, "CommandDialog");
|
|
944
1071
|
function CommandInput({ className, ...props }) {
|
|
945
|
-
return /* @__PURE__ */
|
|
1072
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
946
1073
|
"data-slot": "command-input-wrapper",
|
|
947
1074
|
className: "flex h-9 items-center gap-2 border-b px-3"
|
|
948
|
-
}, /* @__PURE__ */
|
|
1075
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.SearchIcon, {
|
|
949
1076
|
className: "size-4 shrink-0 opacity-50"
|
|
950
|
-
}), /* @__PURE__ */
|
|
1077
|
+
}), /* @__PURE__ */ React26__namespace.createElement(cmdk.Command.Input, {
|
|
951
1078
|
"data-slot": "command-input",
|
|
952
1079
|
className: cn("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
953
1080
|
...props
|
|
954
1081
|
}));
|
|
955
1082
|
}
|
|
956
|
-
|
|
1083
|
+
chunk2HRO6CFU_js.__name(CommandInput, "CommandInput");
|
|
957
1084
|
function CommandList({ className, ...props }) {
|
|
958
|
-
return /* @__PURE__ */
|
|
1085
|
+
return /* @__PURE__ */ React26__namespace.createElement(cmdk.Command.List, {
|
|
959
1086
|
"data-slot": "command-list",
|
|
960
1087
|
className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className),
|
|
961
1088
|
...props
|
|
962
1089
|
});
|
|
963
1090
|
}
|
|
964
|
-
|
|
1091
|
+
chunk2HRO6CFU_js.__name(CommandList, "CommandList");
|
|
965
1092
|
function CommandEmpty({ ...props }) {
|
|
966
|
-
return /* @__PURE__ */
|
|
1093
|
+
return /* @__PURE__ */ React26__namespace.createElement(cmdk.Command.Empty, {
|
|
967
1094
|
"data-slot": "command-empty",
|
|
968
1095
|
className: "py-6 text-center text-sm",
|
|
969
1096
|
...props
|
|
970
1097
|
});
|
|
971
1098
|
}
|
|
972
|
-
|
|
1099
|
+
chunk2HRO6CFU_js.__name(CommandEmpty, "CommandEmpty");
|
|
973
1100
|
function CommandGroup({ className, ...props }) {
|
|
974
|
-
return /* @__PURE__ */
|
|
1101
|
+
return /* @__PURE__ */ React26__namespace.createElement(cmdk.Command.Group, {
|
|
975
1102
|
"data-slot": "command-group",
|
|
976
1103
|
className: cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", className),
|
|
977
1104
|
...props
|
|
978
1105
|
});
|
|
979
1106
|
}
|
|
980
|
-
|
|
1107
|
+
chunk2HRO6CFU_js.__name(CommandGroup, "CommandGroup");
|
|
981
1108
|
function CommandSeparator({ className, ...props }) {
|
|
982
|
-
return /* @__PURE__ */
|
|
1109
|
+
return /* @__PURE__ */ React26__namespace.createElement(cmdk.Command.Separator, {
|
|
983
1110
|
"data-slot": "command-separator",
|
|
984
1111
|
className: cn("bg-border -mx-1 h-px", className),
|
|
985
1112
|
...props
|
|
986
1113
|
});
|
|
987
1114
|
}
|
|
988
|
-
|
|
1115
|
+
chunk2HRO6CFU_js.__name(CommandSeparator, "CommandSeparator");
|
|
989
1116
|
function CommandItem({ className, ...props }) {
|
|
990
|
-
return /* @__PURE__ */
|
|
1117
|
+
return /* @__PURE__ */ React26__namespace.createElement(cmdk.Command.Item, {
|
|
991
1118
|
"data-slot": "command-item",
|
|
992
1119
|
className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
993
1120
|
...props
|
|
994
1121
|
});
|
|
995
1122
|
}
|
|
996
|
-
|
|
1123
|
+
chunk2HRO6CFU_js.__name(CommandItem, "CommandItem");
|
|
997
1124
|
function CommandShortcut({ className, ...props }) {
|
|
998
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
999
1126
|
"data-slot": "command-shortcut",
|
|
1000
1127
|
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
|
|
1001
1128
|
...props
|
|
1002
1129
|
});
|
|
1003
1130
|
}
|
|
1004
|
-
|
|
1131
|
+
chunk2HRO6CFU_js.__name(CommandShortcut, "CommandShortcut");
|
|
1005
1132
|
function Popover({ ...props }) {
|
|
1006
|
-
return /* @__PURE__ */
|
|
1133
|
+
return /* @__PURE__ */ React26__namespace.createElement(PopoverPrimitive__namespace.Root, {
|
|
1007
1134
|
"data-slot": "popover",
|
|
1008
1135
|
...props
|
|
1009
1136
|
});
|
|
1010
1137
|
}
|
|
1011
|
-
|
|
1138
|
+
chunk2HRO6CFU_js.__name(Popover, "Popover");
|
|
1012
1139
|
function PopoverTrigger({ ...props }) {
|
|
1013
|
-
return /* @__PURE__ */
|
|
1140
|
+
return /* @__PURE__ */ React26__namespace.createElement(PopoverPrimitive__namespace.Trigger, {
|
|
1014
1141
|
"data-slot": "popover-trigger",
|
|
1015
1142
|
...props
|
|
1016
1143
|
});
|
|
1017
1144
|
}
|
|
1018
|
-
|
|
1145
|
+
chunk2HRO6CFU_js.__name(PopoverTrigger, "PopoverTrigger");
|
|
1019
1146
|
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
1020
|
-
return /* @__PURE__ */
|
|
1147
|
+
return /* @__PURE__ */ React26__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React26__namespace.createElement(PopoverPrimitive__namespace.Content, {
|
|
1021
1148
|
"data-slot": "popover-content",
|
|
1022
1149
|
align,
|
|
1023
1150
|
sideOffset,
|
|
@@ -1025,22 +1152,22 @@ function PopoverContent({ className, align = "center", sideOffset = 4, ...props
|
|
|
1025
1152
|
...props
|
|
1026
1153
|
}));
|
|
1027
1154
|
}
|
|
1028
|
-
|
|
1155
|
+
chunk2HRO6CFU_js.__name(PopoverContent, "PopoverContent");
|
|
1029
1156
|
function PopoverAnchor({ ...props }) {
|
|
1030
|
-
return /* @__PURE__ */
|
|
1157
|
+
return /* @__PURE__ */ React26__namespace.createElement(PopoverPrimitive__namespace.Anchor, {
|
|
1031
1158
|
"data-slot": "popover-anchor",
|
|
1032
1159
|
...props
|
|
1033
1160
|
});
|
|
1034
1161
|
}
|
|
1035
|
-
|
|
1162
|
+
chunk2HRO6CFU_js.__name(PopoverAnchor, "PopoverAnchor");
|
|
1036
1163
|
|
|
1037
1164
|
// src/mcp/ToolInput.tsx
|
|
1038
1165
|
function ToolInput({ searchTool, debounce = 300, minChars = 1, argName = "query", additionalArgs = {}, autocomplete = false, transformSuggestions, onSuggestionSelect, emptyMessage = "No results found", value: controlledValue, onChange, onSearchResults, onSearchError, showSearchIcon = true, showClearButton = true, showLoadingIndicator = true, className, placeholder = "Search...", disabled, ...props }) {
|
|
1039
|
-
const [internalValue, setInternalValue] =
|
|
1040
|
-
const [suggestions, setSuggestions] =
|
|
1041
|
-
const [isOpen, setIsOpen] =
|
|
1042
|
-
const debounceRef =
|
|
1043
|
-
const inputRef =
|
|
1166
|
+
const [internalValue, setInternalValue] = React26.useState("");
|
|
1167
|
+
const [suggestions, setSuggestions] = React26.useState([]);
|
|
1168
|
+
const [isOpen, setIsOpen] = React26.useState(false);
|
|
1169
|
+
const debounceRef = React26.useRef(null);
|
|
1170
|
+
const inputRef = React26.useRef(null);
|
|
1044
1171
|
const toolConfig = searchTool ? typeof searchTool === "string" ? {
|
|
1045
1172
|
name: searchTool
|
|
1046
1173
|
} : searchTool : null;
|
|
@@ -1049,7 +1176,7 @@ function ToolInput({ searchTool, debounce = 300, minChars = 1, argName = "query"
|
|
|
1049
1176
|
...toolConfig?.args,
|
|
1050
1177
|
...additionalArgs
|
|
1051
1178
|
},
|
|
1052
|
-
onSuccess: /* @__PURE__ */
|
|
1179
|
+
onSuccess: /* @__PURE__ */ chunk2HRO6CFU_js.__name((result) => {
|
|
1053
1180
|
onSearchResults?.(result);
|
|
1054
1181
|
if (autocomplete && transformSuggestions) {
|
|
1055
1182
|
const suggestions2 = transformSuggestions(result);
|
|
@@ -1062,7 +1189,7 @@ function ToolInput({ searchTool, debounce = 300, minChars = 1, argName = "query"
|
|
|
1062
1189
|
onError: onSearchError
|
|
1063
1190
|
});
|
|
1064
1191
|
const value = controlledValue ?? internalValue;
|
|
1065
|
-
const handleChange =
|
|
1192
|
+
const handleChange = React26.useCallback((e) => {
|
|
1066
1193
|
const newValue = e.target.value;
|
|
1067
1194
|
setInternalValue(newValue);
|
|
1068
1195
|
onChange?.(newValue);
|
|
@@ -1089,7 +1216,7 @@ function ToolInput({ searchTool, debounce = 300, minChars = 1, argName = "query"
|
|
|
1089
1216
|
debounce,
|
|
1090
1217
|
call
|
|
1091
1218
|
]);
|
|
1092
|
-
const handleClear =
|
|
1219
|
+
const handleClear = React26.useCallback(() => {
|
|
1093
1220
|
setInternalValue("");
|
|
1094
1221
|
onChange?.("");
|
|
1095
1222
|
setSuggestions([]);
|
|
@@ -1100,7 +1227,7 @@ function ToolInput({ searchTool, debounce = 300, minChars = 1, argName = "query"
|
|
|
1100
1227
|
onChange,
|
|
1101
1228
|
reset
|
|
1102
1229
|
]);
|
|
1103
|
-
const handleSelect =
|
|
1230
|
+
const handleSelect = React26.useCallback((suggestion) => {
|
|
1104
1231
|
setInternalValue(suggestion.label);
|
|
1105
1232
|
onChange?.(suggestion.label);
|
|
1106
1233
|
setIsOpen(false);
|
|
@@ -1109,18 +1236,18 @@ function ToolInput({ searchTool, debounce = 300, minChars = 1, argName = "query"
|
|
|
1109
1236
|
onChange,
|
|
1110
1237
|
onSuggestionSelect
|
|
1111
1238
|
]);
|
|
1112
|
-
|
|
1239
|
+
React26.useEffect(() => {
|
|
1113
1240
|
return () => {
|
|
1114
1241
|
if (debounceRef.current) {
|
|
1115
1242
|
clearTimeout(debounceRef.current);
|
|
1116
1243
|
}
|
|
1117
1244
|
};
|
|
1118
1245
|
}, []);
|
|
1119
|
-
const inputElement = /* @__PURE__ */
|
|
1246
|
+
const inputElement = /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1120
1247
|
className: cn("relative", className)
|
|
1121
|
-
}, showSearchIcon && /* @__PURE__ */
|
|
1248
|
+
}, showSearchIcon && /* @__PURE__ */ React26__namespace.createElement(lucideReact.Search, {
|
|
1122
1249
|
className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"
|
|
1123
|
-
}), /* @__PURE__ */
|
|
1250
|
+
}), /* @__PURE__ */ React26__namespace.createElement(Input, {
|
|
1124
1251
|
ref: inputRef,
|
|
1125
1252
|
value,
|
|
1126
1253
|
onChange: handleChange,
|
|
@@ -1128,71 +1255,71 @@ function ToolInput({ searchTool, debounce = 300, minChars = 1, argName = "query"
|
|
|
1128
1255
|
disabled,
|
|
1129
1256
|
className: cn(showSearchIcon && "pl-9", (showClearButton || showLoadingIndicator) && "pr-9"),
|
|
1130
1257
|
...props
|
|
1131
|
-
}), /* @__PURE__ */
|
|
1258
|
+
}), /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1132
1259
|
className: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1"
|
|
1133
|
-
}, showLoadingIndicator && loading && /* @__PURE__ */
|
|
1260
|
+
}, showLoadingIndicator && loading && /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
1134
1261
|
className: "h-4 w-4 animate-spin text-muted-foreground"
|
|
1135
|
-
}), showClearButton && value && !loading && /* @__PURE__ */
|
|
1262
|
+
}), showClearButton && value && !loading && /* @__PURE__ */ React26__namespace.createElement("button", {
|
|
1136
1263
|
type: "button",
|
|
1137
1264
|
onClick: handleClear,
|
|
1138
1265
|
className: "h-4 w-4 text-muted-foreground hover:text-foreground transition-colors"
|
|
1139
|
-
}, /* @__PURE__ */
|
|
1266
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.X, {
|
|
1140
1267
|
className: "h-4 w-4"
|
|
1141
1268
|
}))));
|
|
1142
1269
|
if (!autocomplete) {
|
|
1143
1270
|
return inputElement;
|
|
1144
1271
|
}
|
|
1145
|
-
return /* @__PURE__ */
|
|
1272
|
+
return /* @__PURE__ */ React26__namespace.createElement(Popover, {
|
|
1146
1273
|
open: isOpen,
|
|
1147
1274
|
onOpenChange: setIsOpen
|
|
1148
|
-
}, /* @__PURE__ */
|
|
1275
|
+
}, /* @__PURE__ */ React26__namespace.createElement(PopoverTrigger, {
|
|
1149
1276
|
asChild: true
|
|
1150
|
-
}, inputElement), /* @__PURE__ */
|
|
1277
|
+
}, inputElement), /* @__PURE__ */ React26__namespace.createElement(PopoverContent, {
|
|
1151
1278
|
className: "p-0 w-[var(--radix-popover-trigger-width)]",
|
|
1152
1279
|
align: "start",
|
|
1153
|
-
onOpenAutoFocus: /* @__PURE__ */
|
|
1154
|
-
}, /* @__PURE__ */
|
|
1280
|
+
onOpenAutoFocus: /* @__PURE__ */ chunk2HRO6CFU_js.__name((e) => e.preventDefault(), "onOpenAutoFocus")
|
|
1281
|
+
}, /* @__PURE__ */ React26__namespace.createElement(Command, null, /* @__PURE__ */ React26__namespace.createElement(CommandList, null, /* @__PURE__ */ React26__namespace.createElement(CommandEmpty, null, emptyMessage), /* @__PURE__ */ React26__namespace.createElement(CommandGroup, null, suggestions.map((suggestion) => /* @__PURE__ */ React26__namespace.createElement(CommandItem, {
|
|
1155
1282
|
key: suggestion.value,
|
|
1156
1283
|
value: suggestion.value,
|
|
1157
|
-
onSelect: /* @__PURE__ */
|
|
1158
|
-
}, /* @__PURE__ */
|
|
1284
|
+
onSelect: /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => handleSelect(suggestion), "onSelect")
|
|
1285
|
+
}, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1159
1286
|
className: "flex items-center gap-2"
|
|
1160
|
-
}, suggestion.icon, /* @__PURE__ */
|
|
1287
|
+
}, suggestion.icon, /* @__PURE__ */ React26__namespace.createElement("div", null, /* @__PURE__ */ React26__namespace.createElement("div", null, suggestion.label), suggestion.description && /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1161
1288
|
className: "text-xs text-muted-foreground"
|
|
1162
1289
|
}, suggestion.description))))))))));
|
|
1163
1290
|
}
|
|
1164
|
-
|
|
1291
|
+
chunk2HRO6CFU_js.__name(ToolInput, "ToolInput");
|
|
1165
1292
|
function Label2({ className, ...props }) {
|
|
1166
|
-
return /* @__PURE__ */
|
|
1293
|
+
return /* @__PURE__ */ React26__namespace.createElement(LabelPrimitive__namespace.Root, {
|
|
1167
1294
|
"data-slot": "label",
|
|
1168
1295
|
className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
1169
1296
|
...props
|
|
1170
1297
|
});
|
|
1171
1298
|
}
|
|
1172
|
-
|
|
1299
|
+
chunk2HRO6CFU_js.__name(Label2, "Label");
|
|
1173
1300
|
function Textarea({ className, ...props }) {
|
|
1174
|
-
return /* @__PURE__ */
|
|
1301
|
+
return /* @__PURE__ */ React26__namespace.createElement("textarea", {
|
|
1175
1302
|
"data-slot": "textarea",
|
|
1176
1303
|
className: cn("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className),
|
|
1177
1304
|
...props
|
|
1178
1305
|
});
|
|
1179
1306
|
}
|
|
1180
|
-
|
|
1307
|
+
chunk2HRO6CFU_js.__name(Textarea, "Textarea");
|
|
1181
1308
|
function Checkbox({ className, ...props }) {
|
|
1182
|
-
return /* @__PURE__ */
|
|
1309
|
+
return /* @__PURE__ */ React26__namespace.createElement(CheckboxPrimitive__namespace.Root, {
|
|
1183
1310
|
"data-slot": "checkbox",
|
|
1184
1311
|
className: cn("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
1185
1312
|
...props
|
|
1186
|
-
}, /* @__PURE__ */
|
|
1313
|
+
}, /* @__PURE__ */ React26__namespace.createElement(CheckboxPrimitive__namespace.Indicator, {
|
|
1187
1314
|
"data-slot": "checkbox-indicator",
|
|
1188
1315
|
className: "grid place-content-center text-current transition-none"
|
|
1189
|
-
}, /* @__PURE__ */
|
|
1316
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.CheckIcon, {
|
|
1190
1317
|
className: "size-3.5"
|
|
1191
1318
|
})));
|
|
1192
1319
|
}
|
|
1193
|
-
|
|
1320
|
+
chunk2HRO6CFU_js.__name(Checkbox, "Checkbox");
|
|
1194
1321
|
function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }) {
|
|
1195
|
-
const _values =
|
|
1322
|
+
const _values = React26__namespace.useMemo(() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [
|
|
1196
1323
|
min,
|
|
1197
1324
|
max
|
|
1198
1325
|
], [
|
|
@@ -1201,7 +1328,7 @@ function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }
|
|
|
1201
1328
|
min,
|
|
1202
1329
|
max
|
|
1203
1330
|
]);
|
|
1204
|
-
return /* @__PURE__ */
|
|
1331
|
+
return /* @__PURE__ */ React26__namespace.createElement(SliderPrimitive__namespace.Root, {
|
|
1205
1332
|
"data-slot": "slider",
|
|
1206
1333
|
defaultValue,
|
|
1207
1334
|
value,
|
|
@@ -1209,32 +1336,32 @@ function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }
|
|
|
1209
1336
|
max,
|
|
1210
1337
|
className: cn("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", className),
|
|
1211
1338
|
...props
|
|
1212
|
-
}, /* @__PURE__ */
|
|
1339
|
+
}, /* @__PURE__ */ React26__namespace.createElement(SliderPrimitive__namespace.Track, {
|
|
1213
1340
|
"data-slot": "slider-track",
|
|
1214
1341
|
className: cn("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5")
|
|
1215
|
-
}, /* @__PURE__ */
|
|
1342
|
+
}, /* @__PURE__ */ React26__namespace.createElement(SliderPrimitive__namespace.Range, {
|
|
1216
1343
|
"data-slot": "slider-range",
|
|
1217
1344
|
className: cn("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")
|
|
1218
1345
|
})), Array.from({
|
|
1219
1346
|
length: _values.length
|
|
1220
|
-
}, (_, index) => /* @__PURE__ */
|
|
1347
|
+
}, (_, index) => /* @__PURE__ */ React26__namespace.createElement(SliderPrimitive__namespace.Thumb, {
|
|
1221
1348
|
"data-slot": "slider-thumb",
|
|
1222
1349
|
key: index,
|
|
1223
1350
|
className: "border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
1224
1351
|
})));
|
|
1225
1352
|
}
|
|
1226
|
-
|
|
1353
|
+
chunk2HRO6CFU_js.__name(Slider, "Slider");
|
|
1227
1354
|
function Switch({ className, ...props }) {
|
|
1228
|
-
return /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ React26__namespace.createElement(SwitchPrimitive__namespace.Root, {
|
|
1229
1356
|
"data-slot": "switch",
|
|
1230
1357
|
className: cn("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
1231
1358
|
...props
|
|
1232
|
-
}, /* @__PURE__ */
|
|
1359
|
+
}, /* @__PURE__ */ React26__namespace.createElement(SwitchPrimitive__namespace.Thumb, {
|
|
1233
1360
|
"data-slot": "switch-thumb",
|
|
1234
1361
|
className: cn("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")
|
|
1235
1362
|
}));
|
|
1236
1363
|
}
|
|
1237
|
-
|
|
1364
|
+
chunk2HRO6CFU_js.__name(Switch, "Switch");
|
|
1238
1365
|
var alertVariants = classVarianceAuthority.cva("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current", {
|
|
1239
1366
|
variants: {
|
|
1240
1367
|
variant: {
|
|
@@ -1247,7 +1374,7 @@ var alertVariants = classVarianceAuthority.cva("relative w-full rounded-lg borde
|
|
|
1247
1374
|
}
|
|
1248
1375
|
});
|
|
1249
1376
|
function Alert({ className, variant, ...props }) {
|
|
1250
|
-
return /* @__PURE__ */
|
|
1377
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1251
1378
|
"data-slot": "alert",
|
|
1252
1379
|
role: "alert",
|
|
1253
1380
|
className: cn(alertVariants({
|
|
@@ -1256,27 +1383,27 @@ function Alert({ className, variant, ...props }) {
|
|
|
1256
1383
|
...props
|
|
1257
1384
|
});
|
|
1258
1385
|
}
|
|
1259
|
-
|
|
1386
|
+
chunk2HRO6CFU_js.__name(Alert, "Alert");
|
|
1260
1387
|
function AlertTitle({ className, ...props }) {
|
|
1261
|
-
return /* @__PURE__ */
|
|
1388
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1262
1389
|
"data-slot": "alert-title",
|
|
1263
1390
|
className: cn("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight", className),
|
|
1264
1391
|
...props
|
|
1265
1392
|
});
|
|
1266
1393
|
}
|
|
1267
|
-
|
|
1394
|
+
chunk2HRO6CFU_js.__name(AlertTitle, "AlertTitle");
|
|
1268
1395
|
function AlertDescription({ className, ...props }) {
|
|
1269
|
-
return /* @__PURE__ */
|
|
1396
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1270
1397
|
"data-slot": "alert-description",
|
|
1271
1398
|
className: cn("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed", className),
|
|
1272
1399
|
...props
|
|
1273
1400
|
});
|
|
1274
1401
|
}
|
|
1275
|
-
|
|
1402
|
+
chunk2HRO6CFU_js.__name(AlertDescription, "AlertDescription");
|
|
1276
1403
|
function ToolForm({ toolName, fields: manualFields, autoSchema = false, submitText = "Submit", loadingText, onSuccess, onError, showResult = false, showSuccessToast = false, successMessage, resetOnSuccess = false, className, layout = "vertical" }) {
|
|
1277
1404
|
const { app, isConnected } = useMcpApp();
|
|
1278
1405
|
const { call, loading, result, error, reset } = useTool(toolName, {
|
|
1279
|
-
onSuccess: /* @__PURE__ */
|
|
1406
|
+
onSuccess: /* @__PURE__ */ chunk2HRO6CFU_js.__name((result2) => {
|
|
1280
1407
|
onSuccess?.(result2);
|
|
1281
1408
|
if (showSuccessToast) {
|
|
1282
1409
|
const message = typeof successMessage === "function" ? successMessage(result2) : successMessage ?? "Form submitted successfully";
|
|
@@ -1288,10 +1415,10 @@ function ToolForm({ toolName, fields: manualFields, autoSchema = false, submitTe
|
|
|
1288
1415
|
}, "onSuccess"),
|
|
1289
1416
|
onError
|
|
1290
1417
|
});
|
|
1291
|
-
const [fields, setFields] =
|
|
1292
|
-
const [schemaLoading, setSchemaLoading] =
|
|
1293
|
-
const [formData, setFormData] =
|
|
1294
|
-
const initializeFormData = /* @__PURE__ */
|
|
1418
|
+
const [fields, setFields] = React26.useState(manualFields ?? []);
|
|
1419
|
+
const [schemaLoading, setSchemaLoading] = React26.useState(autoSchema);
|
|
1420
|
+
const [formData, setFormData] = React26.useState({});
|
|
1421
|
+
const initializeFormData = /* @__PURE__ */ chunk2HRO6CFU_js.__name((fields2) => {
|
|
1295
1422
|
const initial = {};
|
|
1296
1423
|
fields2.forEach((field) => {
|
|
1297
1424
|
if (field.defaultValue !== void 0) {
|
|
@@ -1306,14 +1433,14 @@ function ToolForm({ toolName, fields: manualFields, autoSchema = false, submitTe
|
|
|
1306
1433
|
});
|
|
1307
1434
|
setFormData(initial);
|
|
1308
1435
|
}, "initializeFormData");
|
|
1309
|
-
const resetForm = /* @__PURE__ */
|
|
1436
|
+
const resetForm = /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => {
|
|
1310
1437
|
initializeFormData(fields);
|
|
1311
1438
|
reset();
|
|
1312
1439
|
}, "resetForm");
|
|
1313
|
-
|
|
1440
|
+
React26.useEffect(() => {
|
|
1314
1441
|
if (autoSchema && app && isConnected) {
|
|
1315
1442
|
setSchemaLoading(true);
|
|
1316
|
-
const fetchSchema = /* @__PURE__ */
|
|
1443
|
+
const fetchSchema = /* @__PURE__ */ chunk2HRO6CFU_js.__name(async () => {
|
|
1317
1444
|
try {
|
|
1318
1445
|
console.warn("[ToolForm] Auto-schema not fully implemented, use manual fields");
|
|
1319
1446
|
if (manualFields) {
|
|
@@ -1338,7 +1465,7 @@ function ToolForm({ toolName, fields: manualFields, autoSchema = false, submitTe
|
|
|
1338
1465
|
manualFields,
|
|
1339
1466
|
toolName
|
|
1340
1467
|
]);
|
|
1341
|
-
const handleSubmit = /* @__PURE__ */
|
|
1468
|
+
const handleSubmit = /* @__PURE__ */ chunk2HRO6CFU_js.__name(async (e) => {
|
|
1342
1469
|
e.preventDefault();
|
|
1343
1470
|
const args = {};
|
|
1344
1471
|
fields.forEach((field) => {
|
|
@@ -1350,80 +1477,80 @@ function ToolForm({ toolName, fields: manualFields, autoSchema = false, submitTe
|
|
|
1350
1477
|
});
|
|
1351
1478
|
await call(args);
|
|
1352
1479
|
}, "handleSubmit");
|
|
1353
|
-
const handleChange = /* @__PURE__ */
|
|
1480
|
+
const handleChange = /* @__PURE__ */ chunk2HRO6CFU_js.__name((name, value) => {
|
|
1354
1481
|
setFormData((prev) => ({
|
|
1355
1482
|
...prev,
|
|
1356
1483
|
[name]: value
|
|
1357
1484
|
}));
|
|
1358
1485
|
}, "handleChange");
|
|
1359
|
-
const renderField = /* @__PURE__ */
|
|
1486
|
+
const renderField = /* @__PURE__ */ chunk2HRO6CFU_js.__name((field) => {
|
|
1360
1487
|
const value = formData[field.name];
|
|
1361
1488
|
switch (field.type) {
|
|
1362
1489
|
case "textarea":
|
|
1363
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ React26__namespace.createElement(Textarea, {
|
|
1364
1491
|
id: field.name,
|
|
1365
1492
|
placeholder: field.placeholder,
|
|
1366
1493
|
value: value ?? "",
|
|
1367
|
-
onChange: /* @__PURE__ */
|
|
1494
|
+
onChange: /* @__PURE__ */ chunk2HRO6CFU_js.__name((e) => handleChange(field.name, e.target.value), "onChange"),
|
|
1368
1495
|
disabled: field.disabled || loading,
|
|
1369
1496
|
required: field.required
|
|
1370
1497
|
});
|
|
1371
1498
|
case "select":
|
|
1372
|
-
return /* @__PURE__ */
|
|
1499
|
+
return /* @__PURE__ */ React26__namespace.createElement(Select, {
|
|
1373
1500
|
value: value ?? "",
|
|
1374
|
-
onValueChange: /* @__PURE__ */
|
|
1501
|
+
onValueChange: /* @__PURE__ */ chunk2HRO6CFU_js.__name((v) => handleChange(field.name, v), "onValueChange"),
|
|
1375
1502
|
disabled: field.disabled || loading
|
|
1376
|
-
}, /* @__PURE__ */
|
|
1503
|
+
}, /* @__PURE__ */ React26__namespace.createElement(SelectTrigger, null, /* @__PURE__ */ React26__namespace.createElement(SelectValue, {
|
|
1377
1504
|
placeholder: field.placeholder ?? "Select..."
|
|
1378
|
-
})), /* @__PURE__ */
|
|
1505
|
+
})), /* @__PURE__ */ React26__namespace.createElement(SelectContent, null, field.options?.map((option) => /* @__PURE__ */ React26__namespace.createElement(SelectItem, {
|
|
1379
1506
|
key: option.value,
|
|
1380
1507
|
value: option.value
|
|
1381
1508
|
}, option.label))));
|
|
1382
1509
|
case "checkbox":
|
|
1383
|
-
return /* @__PURE__ */
|
|
1510
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1384
1511
|
className: "flex items-center space-x-2"
|
|
1385
|
-
}, /* @__PURE__ */
|
|
1512
|
+
}, /* @__PURE__ */ React26__namespace.createElement(Checkbox, {
|
|
1386
1513
|
id: field.name,
|
|
1387
1514
|
checked: value ?? false,
|
|
1388
|
-
onCheckedChange: /* @__PURE__ */
|
|
1515
|
+
onCheckedChange: /* @__PURE__ */ chunk2HRO6CFU_js.__name((checked) => handleChange(field.name, checked), "onCheckedChange"),
|
|
1389
1516
|
disabled: field.disabled || loading
|
|
1390
|
-
}), /* @__PURE__ */
|
|
1517
|
+
}), /* @__PURE__ */ React26__namespace.createElement("label", {
|
|
1391
1518
|
htmlFor: field.name,
|
|
1392
1519
|
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
1393
1520
|
}, field.label));
|
|
1394
1521
|
case "switch":
|
|
1395
|
-
return /* @__PURE__ */
|
|
1522
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1396
1523
|
className: "flex items-center space-x-2"
|
|
1397
|
-
}, /* @__PURE__ */
|
|
1524
|
+
}, /* @__PURE__ */ React26__namespace.createElement(Switch, {
|
|
1398
1525
|
id: field.name,
|
|
1399
1526
|
checked: value ?? false,
|
|
1400
|
-
onCheckedChange: /* @__PURE__ */
|
|
1527
|
+
onCheckedChange: /* @__PURE__ */ chunk2HRO6CFU_js.__name((checked) => handleChange(field.name, checked), "onCheckedChange"),
|
|
1401
1528
|
disabled: field.disabled || loading
|
|
1402
|
-
}), /* @__PURE__ */
|
|
1529
|
+
}), /* @__PURE__ */ React26__namespace.createElement(Label2, {
|
|
1403
1530
|
htmlFor: field.name
|
|
1404
1531
|
}, field.label));
|
|
1405
1532
|
case "slider":
|
|
1406
|
-
return /* @__PURE__ */
|
|
1533
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1407
1534
|
className: "space-y-2"
|
|
1408
|
-
}, /* @__PURE__ */
|
|
1535
|
+
}, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1409
1536
|
className: "flex justify-between text-sm"
|
|
1410
|
-
}, /* @__PURE__ */
|
|
1537
|
+
}, /* @__PURE__ */ React26__namespace.createElement("span", null, field.min ?? 0), /* @__PURE__ */ React26__namespace.createElement("span", null, value ?? field.min ?? 0), /* @__PURE__ */ React26__namespace.createElement("span", null, field.max ?? 100)), /* @__PURE__ */ React26__namespace.createElement(Slider, {
|
|
1411
1538
|
value: [
|
|
1412
1539
|
value ?? field.min ?? 0
|
|
1413
1540
|
],
|
|
1414
|
-
onValueChange: /* @__PURE__ */
|
|
1541
|
+
onValueChange: /* @__PURE__ */ chunk2HRO6CFU_js.__name(([v]) => handleChange(field.name, v), "onValueChange"),
|
|
1415
1542
|
min: field.min ?? 0,
|
|
1416
1543
|
max: field.max ?? 100,
|
|
1417
1544
|
step: field.step ?? 1,
|
|
1418
1545
|
disabled: field.disabled || loading
|
|
1419
1546
|
}));
|
|
1420
1547
|
case "number":
|
|
1421
|
-
return /* @__PURE__ */
|
|
1548
|
+
return /* @__PURE__ */ React26__namespace.createElement(Input, {
|
|
1422
1549
|
id: field.name,
|
|
1423
1550
|
type: "number",
|
|
1424
1551
|
placeholder: field.placeholder,
|
|
1425
1552
|
value: value ?? "",
|
|
1426
|
-
onChange: /* @__PURE__ */
|
|
1553
|
+
onChange: /* @__PURE__ */ chunk2HRO6CFU_js.__name((e) => handleChange(field.name, e.target.value), "onChange"),
|
|
1427
1554
|
min: field.min,
|
|
1428
1555
|
max: field.max,
|
|
1429
1556
|
step: field.step,
|
|
@@ -1431,64 +1558,64 @@ function ToolForm({ toolName, fields: manualFields, autoSchema = false, submitTe
|
|
|
1431
1558
|
required: field.required
|
|
1432
1559
|
});
|
|
1433
1560
|
default:
|
|
1434
|
-
return /* @__PURE__ */
|
|
1561
|
+
return /* @__PURE__ */ React26__namespace.createElement(Input, {
|
|
1435
1562
|
id: field.name,
|
|
1436
1563
|
type: field.type ?? "text",
|
|
1437
1564
|
placeholder: field.placeholder,
|
|
1438
1565
|
value: value ?? "",
|
|
1439
|
-
onChange: /* @__PURE__ */
|
|
1566
|
+
onChange: /* @__PURE__ */ chunk2HRO6CFU_js.__name((e) => handleChange(field.name, e.target.value), "onChange"),
|
|
1440
1567
|
disabled: field.disabled || loading,
|
|
1441
1568
|
required: field.required
|
|
1442
1569
|
});
|
|
1443
1570
|
}
|
|
1444
1571
|
}, "renderField");
|
|
1445
1572
|
if (schemaLoading) {
|
|
1446
|
-
return /* @__PURE__ */
|
|
1573
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1447
1574
|
className: "flex items-center justify-center p-8"
|
|
1448
|
-
}, /* @__PURE__ */
|
|
1575
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
1449
1576
|
className: "h-6 w-6 animate-spin text-muted-foreground"
|
|
1450
1577
|
}));
|
|
1451
1578
|
}
|
|
1452
|
-
return /* @__PURE__ */
|
|
1579
|
+
return /* @__PURE__ */ React26__namespace.createElement("form", {
|
|
1453
1580
|
className: cn("space-y-4", className),
|
|
1454
1581
|
onSubmit: handleSubmit
|
|
1455
|
-
}, /* @__PURE__ */
|
|
1582
|
+
}, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1456
1583
|
className: cn("space-y-4", layout === "horizontal" && "grid grid-cols-2 gap-4")
|
|
1457
|
-
}, fields.map((field) => /* @__PURE__ */
|
|
1584
|
+
}, fields.map((field) => /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1458
1585
|
key: field.name,
|
|
1459
1586
|
className: "space-y-2"
|
|
1460
|
-
}, field.type !== "checkbox" && field.type !== "switch" && /* @__PURE__ */
|
|
1587
|
+
}, field.type !== "checkbox" && field.type !== "switch" && /* @__PURE__ */ React26__namespace.createElement(Label2, {
|
|
1461
1588
|
htmlFor: field.name
|
|
1462
|
-
}, field.label, field.required && /* @__PURE__ */
|
|
1589
|
+
}, field.label, field.required && /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
1463
1590
|
className: "text-destructive ml-1"
|
|
1464
|
-
}, "*")), renderField(field), field.description && /* @__PURE__ */
|
|
1591
|
+
}, "*")), renderField(field), field.description && /* @__PURE__ */ React26__namespace.createElement("p", {
|
|
1465
1592
|
className: "text-sm text-muted-foreground"
|
|
1466
|
-
}, field.description)))), /* @__PURE__ */
|
|
1593
|
+
}, field.description)))), /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1467
1594
|
className: "flex items-center gap-2"
|
|
1468
|
-
}, /* @__PURE__ */
|
|
1595
|
+
}, /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
1469
1596
|
type: "submit",
|
|
1470
1597
|
disabled: loading
|
|
1471
|
-
}, loading ? /* @__PURE__ */
|
|
1598
|
+
}, loading ? /* @__PURE__ */ React26__namespace.createElement(React26__namespace.Fragment, null, /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
1472
1599
|
className: "h-4 w-4 animate-spin mr-2"
|
|
1473
|
-
}), loadingText ?? "Submitting...") : submitText)), error && /* @__PURE__ */
|
|
1600
|
+
}), loadingText ?? "Submitting...") : submitText)), error && /* @__PURE__ */ React26__namespace.createElement(Alert, {
|
|
1474
1601
|
variant: "destructive"
|
|
1475
|
-
}, /* @__PURE__ */
|
|
1602
|
+
}, /* @__PURE__ */ React26__namespace.createElement(AlertDescription, null, error.message)), showResult && result !== null && /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1476
1603
|
className: "rounded-md bg-muted p-4"
|
|
1477
|
-
}, /* @__PURE__ */
|
|
1604
|
+
}, /* @__PURE__ */ React26__namespace.createElement("pre", {
|
|
1478
1605
|
className: "text-sm overflow-auto"
|
|
1479
1606
|
}, JSON.stringify(result, null, 2))));
|
|
1480
1607
|
}
|
|
1481
|
-
|
|
1608
|
+
chunk2HRO6CFU_js.__name(ToolForm, "ToolForm");
|
|
1482
1609
|
function useResource(uri, options = {}) {
|
|
1483
1610
|
const { app, isConnected } = useMcpApp();
|
|
1484
1611
|
const { refreshInterval, subscribe = false, transform, skip = false } = options;
|
|
1485
|
-
const [data, setData] =
|
|
1486
|
-
const [loading, setLoading] =
|
|
1487
|
-
const [error, setError] =
|
|
1488
|
-
const [lastUpdated, setLastUpdated] =
|
|
1489
|
-
const intervalRef =
|
|
1490
|
-
const mountedRef =
|
|
1491
|
-
const fetchResource =
|
|
1612
|
+
const [data, setData] = React26.useState(null);
|
|
1613
|
+
const [loading, setLoading] = React26.useState(!skip);
|
|
1614
|
+
const [error, setError] = React26.useState(null);
|
|
1615
|
+
const [lastUpdated, setLastUpdated] = React26.useState(null);
|
|
1616
|
+
const intervalRef = React26.useRef(null);
|
|
1617
|
+
const mountedRef = React26.useRef(true);
|
|
1618
|
+
const fetchResource = React26.useCallback(async () => {
|
|
1492
1619
|
if (!app || !isConnected) {
|
|
1493
1620
|
throw new Error("Not connected to MCP host");
|
|
1494
1621
|
}
|
|
@@ -1541,12 +1668,12 @@ function useResource(uri, options = {}) {
|
|
|
1541
1668
|
uri,
|
|
1542
1669
|
transform
|
|
1543
1670
|
]);
|
|
1544
|
-
const refresh =
|
|
1671
|
+
const refresh = React26.useCallback(async () => {
|
|
1545
1672
|
return fetchResource();
|
|
1546
1673
|
}, [
|
|
1547
1674
|
fetchResource
|
|
1548
1675
|
]);
|
|
1549
|
-
|
|
1676
|
+
React26.useEffect(() => {
|
|
1550
1677
|
mountedRef.current = true;
|
|
1551
1678
|
if (!skip && isConnected) {
|
|
1552
1679
|
fetchResource().catch(() => {
|
|
@@ -1561,7 +1688,7 @@ function useResource(uri, options = {}) {
|
|
|
1561
1688
|
skip,
|
|
1562
1689
|
fetchResource
|
|
1563
1690
|
]);
|
|
1564
|
-
|
|
1691
|
+
React26.useEffect(() => {
|
|
1565
1692
|
if (refreshInterval && refreshInterval > 0 && isConnected && !skip) {
|
|
1566
1693
|
intervalRef.current = setInterval(() => {
|
|
1567
1694
|
fetchResource().catch(() => {
|
|
@@ -1580,7 +1707,7 @@ function useResource(uri, options = {}) {
|
|
|
1580
1707
|
skip,
|
|
1581
1708
|
fetchResource
|
|
1582
1709
|
]);
|
|
1583
|
-
|
|
1710
|
+
React26.useEffect(() => {
|
|
1584
1711
|
if (subscribe) {
|
|
1585
1712
|
console.warn("[useResource] Subscription support not yet implemented");
|
|
1586
1713
|
}
|
|
@@ -1595,46 +1722,46 @@ function useResource(uri, options = {}) {
|
|
|
1595
1722
|
lastUpdated
|
|
1596
1723
|
};
|
|
1597
1724
|
}
|
|
1598
|
-
|
|
1725
|
+
chunk2HRO6CFU_js.__name(useResource, "useResource");
|
|
1599
1726
|
function Skeleton({ className, ...props }) {
|
|
1600
|
-
return /* @__PURE__ */
|
|
1727
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
1601
1728
|
"data-slot": "skeleton",
|
|
1602
1729
|
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
1603
1730
|
...props
|
|
1604
1731
|
});
|
|
1605
1732
|
}
|
|
1606
|
-
|
|
1733
|
+
chunk2HRO6CFU_js.__name(Skeleton, "Skeleton");
|
|
1607
1734
|
|
|
1608
1735
|
// src/mcp/ResourceView.tsx
|
|
1609
1736
|
function DefaultLoading() {
|
|
1610
|
-
return /* @__PURE__ */
|
|
1737
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1611
1738
|
className: "flex flex-col gap-3 p-4"
|
|
1612
|
-
}, /* @__PURE__ */
|
|
1739
|
+
}, /* @__PURE__ */ React26__namespace.createElement(Skeleton, {
|
|
1613
1740
|
className: "h-4 w-3/4"
|
|
1614
|
-
}), /* @__PURE__ */
|
|
1741
|
+
}), /* @__PURE__ */ React26__namespace.createElement(Skeleton, {
|
|
1615
1742
|
className: "h-4 w-1/2"
|
|
1616
|
-
}), /* @__PURE__ */
|
|
1743
|
+
}), /* @__PURE__ */ React26__namespace.createElement(Skeleton, {
|
|
1617
1744
|
className: "h-20 w-full"
|
|
1618
1745
|
}));
|
|
1619
1746
|
}
|
|
1620
|
-
|
|
1747
|
+
chunk2HRO6CFU_js.__name(DefaultLoading, "DefaultLoading");
|
|
1621
1748
|
function DefaultError({ error, onRetry }) {
|
|
1622
|
-
return /* @__PURE__ */
|
|
1749
|
+
return /* @__PURE__ */ React26__namespace.createElement(Alert, {
|
|
1623
1750
|
variant: "destructive"
|
|
1624
|
-
}, /* @__PURE__ */
|
|
1751
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.AlertCircle, {
|
|
1625
1752
|
className: "h-4 w-4"
|
|
1626
|
-
}), /* @__PURE__ */
|
|
1753
|
+
}), /* @__PURE__ */ React26__namespace.createElement(AlertTitle, null, "Error loading resource"), /* @__PURE__ */ React26__namespace.createElement(AlertDescription, {
|
|
1627
1754
|
className: "flex flex-col gap-2"
|
|
1628
|
-
}, /* @__PURE__ */
|
|
1755
|
+
}, /* @__PURE__ */ React26__namespace.createElement("span", null, error.message), /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
1629
1756
|
variant: "outline",
|
|
1630
1757
|
size: "sm",
|
|
1631
1758
|
onClick: onRetry,
|
|
1632
1759
|
className: "w-fit"
|
|
1633
|
-
}, /* @__PURE__ */
|
|
1760
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.RefreshCw, {
|
|
1634
1761
|
className: "h-4 w-4 mr-2"
|
|
1635
1762
|
}), "Retry")));
|
|
1636
1763
|
}
|
|
1637
|
-
|
|
1764
|
+
chunk2HRO6CFU_js.__name(DefaultError, "DefaultError");
|
|
1638
1765
|
function ResourceView({ uri, refreshInterval, subscribe, transform, loading: loadingContent, error: errorContent, children, className, skip = false }) {
|
|
1639
1766
|
const { data, loading, error, refresh, lastUpdated } = useResource(uri, {
|
|
1640
1767
|
refreshInterval,
|
|
@@ -1650,52 +1777,52 @@ function ResourceView({ uri, refreshInterval, subscribe, transform, loading: loa
|
|
|
1650
1777
|
};
|
|
1651
1778
|
if (loading && data === null) {
|
|
1652
1779
|
if (loadingContent) {
|
|
1653
|
-
return /* @__PURE__ */
|
|
1780
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1654
1781
|
className
|
|
1655
1782
|
}, loadingContent);
|
|
1656
1783
|
}
|
|
1657
|
-
return /* @__PURE__ */
|
|
1784
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1658
1785
|
className: cn("flex items-center justify-center p-8", className)
|
|
1659
|
-
}, /* @__PURE__ */
|
|
1786
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
1660
1787
|
className: "h-8 w-8 animate-spin text-muted-foreground"
|
|
1661
1788
|
}));
|
|
1662
1789
|
}
|
|
1663
1790
|
if (error && data === null) {
|
|
1664
1791
|
if (errorContent) {
|
|
1665
1792
|
if (typeof errorContent === "function") {
|
|
1666
|
-
return /* @__PURE__ */
|
|
1793
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1667
1794
|
className
|
|
1668
1795
|
}, errorContent(error, refresh));
|
|
1669
1796
|
}
|
|
1670
|
-
return /* @__PURE__ */
|
|
1797
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1671
1798
|
className
|
|
1672
1799
|
}, errorContent);
|
|
1673
1800
|
}
|
|
1674
|
-
return /* @__PURE__ */
|
|
1801
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1675
1802
|
className
|
|
1676
|
-
}, /* @__PURE__ */
|
|
1803
|
+
}, /* @__PURE__ */ React26__namespace.createElement(DefaultError, {
|
|
1677
1804
|
error,
|
|
1678
1805
|
onRetry: refresh
|
|
1679
1806
|
}));
|
|
1680
1807
|
}
|
|
1681
1808
|
if (data !== null) {
|
|
1682
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1683
1810
|
className
|
|
1684
1811
|
}, children(data, meta));
|
|
1685
1812
|
}
|
|
1686
|
-
return /* @__PURE__ */
|
|
1813
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1687
1814
|
className
|
|
1688
|
-
}, loadingContent ?? /* @__PURE__ */
|
|
1815
|
+
}, loadingContent ?? /* @__PURE__ */ React26__namespace.createElement(DefaultLoading, null));
|
|
1689
1816
|
}
|
|
1690
|
-
|
|
1817
|
+
chunk2HRO6CFU_js.__name(ResourceView, "ResourceView");
|
|
1691
1818
|
function useToolStream(options = {}) {
|
|
1692
1819
|
const { toolInputPartial, toolInput, toolResult } = useMcpApp();
|
|
1693
1820
|
const { onPartial, onComplete } = options;
|
|
1694
|
-
const [partial, setPartial] =
|
|
1695
|
-
const [complete, setComplete] =
|
|
1696
|
-
const [isStreaming, setIsStreaming] =
|
|
1697
|
-
const [isComplete, setIsComplete] =
|
|
1698
|
-
|
|
1821
|
+
const [partial, setPartial] = React26.useState(null);
|
|
1822
|
+
const [complete, setComplete] = React26.useState(null);
|
|
1823
|
+
const [isStreaming, setIsStreaming] = React26.useState(false);
|
|
1824
|
+
const [isComplete, setIsComplete] = React26.useState(false);
|
|
1825
|
+
React26.useEffect(() => {
|
|
1699
1826
|
if (toolInputPartial) {
|
|
1700
1827
|
setPartial(toolInputPartial);
|
|
1701
1828
|
setIsStreaming(true);
|
|
@@ -1706,7 +1833,7 @@ function useToolStream(options = {}) {
|
|
|
1706
1833
|
toolInputPartial,
|
|
1707
1834
|
onPartial
|
|
1708
1835
|
]);
|
|
1709
|
-
|
|
1836
|
+
React26.useEffect(() => {
|
|
1710
1837
|
if (toolInput) {
|
|
1711
1838
|
setComplete(toolInput);
|
|
1712
1839
|
setIsStreaming(false);
|
|
@@ -1717,7 +1844,7 @@ function useToolStream(options = {}) {
|
|
|
1717
1844
|
toolInput,
|
|
1718
1845
|
onComplete
|
|
1719
1846
|
]);
|
|
1720
|
-
|
|
1847
|
+
React26.useEffect(() => {
|
|
1721
1848
|
if (toolResult && !toolResult.isError) {
|
|
1722
1849
|
setIsStreaming(false);
|
|
1723
1850
|
setIsComplete(true);
|
|
@@ -1732,13 +1859,13 @@ function useToolStream(options = {}) {
|
|
|
1732
1859
|
isComplete
|
|
1733
1860
|
};
|
|
1734
1861
|
}
|
|
1735
|
-
|
|
1862
|
+
chunk2HRO6CFU_js.__name(useToolStream, "useToolStream");
|
|
1736
1863
|
function Progress({ className, value, ...props }) {
|
|
1737
|
-
return /* @__PURE__ */
|
|
1864
|
+
return /* @__PURE__ */ React26__namespace.createElement(ProgressPrimitive__namespace.Root, {
|
|
1738
1865
|
"data-slot": "progress",
|
|
1739
1866
|
className: cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className),
|
|
1740
1867
|
...props
|
|
1741
|
-
}, /* @__PURE__ */
|
|
1868
|
+
}, /* @__PURE__ */ React26__namespace.createElement(ProgressPrimitive__namespace.Indicator, {
|
|
1742
1869
|
"data-slot": "progress-indicator",
|
|
1743
1870
|
className: "bg-primary h-full w-full flex-1 transition-all",
|
|
1744
1871
|
style: {
|
|
@@ -1746,7 +1873,7 @@ function Progress({ className, value, ...props }) {
|
|
|
1746
1873
|
}
|
|
1747
1874
|
}));
|
|
1748
1875
|
}
|
|
1749
|
-
|
|
1876
|
+
chunk2HRO6CFU_js.__name(Progress, "Progress");
|
|
1750
1877
|
|
|
1751
1878
|
// src/mcp/StreamingContent.tsx
|
|
1752
1879
|
function StreamingContent({ fallback, showProgress = false, progress: externalProgress, onPartial, onComplete, children, className, streamingStyle = "opacity" }) {
|
|
@@ -1757,106 +1884,106 @@ function StreamingContent({ fallback, showProgress = false, progress: externalPr
|
|
|
1757
1884
|
const data = complete ?? partial;
|
|
1758
1885
|
if (!data) {
|
|
1759
1886
|
if (fallback) {
|
|
1760
|
-
return /* @__PURE__ */
|
|
1887
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1761
1888
|
className
|
|
1762
1889
|
}, fallback);
|
|
1763
1890
|
}
|
|
1764
|
-
return /* @__PURE__ */
|
|
1891
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1765
1892
|
className: cn("flex items-center justify-center p-8", className)
|
|
1766
|
-
}, /* @__PURE__ */
|
|
1893
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
1767
1894
|
className: "h-6 w-6 animate-spin text-muted-foreground"
|
|
1768
1895
|
}));
|
|
1769
1896
|
}
|
|
1770
1897
|
const streamingClasses = cn(streamingStyle === "opacity" && isStreaming && "opacity-70", streamingStyle === "blur" && isStreaming && "blur-[1px]");
|
|
1771
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1772
1899
|
className: cn("relative", className)
|
|
1773
|
-
}, showProgress && isStreaming && /* @__PURE__ */
|
|
1900
|
+
}, showProgress && isStreaming && /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1774
1901
|
className: "absolute top-0 left-0 right-0 z-10"
|
|
1775
|
-
}, externalProgress !== void 0 ? /* @__PURE__ */
|
|
1902
|
+
}, externalProgress !== void 0 ? /* @__PURE__ */ React26__namespace.createElement(Progress, {
|
|
1776
1903
|
value: externalProgress,
|
|
1777
1904
|
className: "h-1"
|
|
1778
|
-
}) : /* @__PURE__ */
|
|
1905
|
+
}) : /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1779
1906
|
className: "h-1 bg-primary/20 overflow-hidden"
|
|
1780
|
-
}, /* @__PURE__ */
|
|
1907
|
+
}, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1781
1908
|
className: "h-full w-1/3 bg-primary animate-[shimmer_1s_infinite]"
|
|
1782
|
-
}))), isStreaming && /* @__PURE__ */
|
|
1909
|
+
}))), isStreaming && /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1783
1910
|
className: "absolute top-2 right-2 z-10"
|
|
1784
|
-
}, /* @__PURE__ */
|
|
1911
|
+
}, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1785
1912
|
className: "flex items-center gap-1 px-2 py-1 rounded-full bg-muted text-muted-foreground text-xs"
|
|
1786
|
-
}, /* @__PURE__ */
|
|
1913
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
1787
1914
|
className: "h-3 w-3 animate-spin"
|
|
1788
|
-
}), /* @__PURE__ */
|
|
1915
|
+
}), /* @__PURE__ */ React26__namespace.createElement("span", null, "Streaming..."))), /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1789
1916
|
className: cn("transition-all duration-200", streamingClasses)
|
|
1790
1917
|
}, children(data, isComplete)));
|
|
1791
1918
|
}
|
|
1792
|
-
|
|
1919
|
+
chunk2HRO6CFU_js.__name(StreamingContent, "StreamingContent");
|
|
1793
1920
|
function Table({ className, ...props }) {
|
|
1794
|
-
return /* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1795
1922
|
"data-slot": "table-container",
|
|
1796
1923
|
className: "relative w-full overflow-x-auto"
|
|
1797
|
-
}, /* @__PURE__ */
|
|
1924
|
+
}, /* @__PURE__ */ React26__namespace.createElement("table", {
|
|
1798
1925
|
"data-slot": "table",
|
|
1799
1926
|
className: cn("w-full caption-bottom text-sm", className),
|
|
1800
1927
|
...props
|
|
1801
1928
|
}));
|
|
1802
1929
|
}
|
|
1803
|
-
|
|
1930
|
+
chunk2HRO6CFU_js.__name(Table, "Table");
|
|
1804
1931
|
function TableHeader({ className, ...props }) {
|
|
1805
|
-
return /* @__PURE__ */
|
|
1932
|
+
return /* @__PURE__ */ React26__namespace.createElement("thead", {
|
|
1806
1933
|
"data-slot": "table-header",
|
|
1807
1934
|
className: cn("[&_tr]:border-b", className),
|
|
1808
1935
|
...props
|
|
1809
1936
|
});
|
|
1810
1937
|
}
|
|
1811
|
-
|
|
1938
|
+
chunk2HRO6CFU_js.__name(TableHeader, "TableHeader");
|
|
1812
1939
|
function TableBody({ className, ...props }) {
|
|
1813
|
-
return /* @__PURE__ */
|
|
1940
|
+
return /* @__PURE__ */ React26__namespace.createElement("tbody", {
|
|
1814
1941
|
"data-slot": "table-body",
|
|
1815
1942
|
className: cn("[&_tr:last-child]:border-0", className),
|
|
1816
1943
|
...props
|
|
1817
1944
|
});
|
|
1818
1945
|
}
|
|
1819
|
-
|
|
1946
|
+
chunk2HRO6CFU_js.__name(TableBody, "TableBody");
|
|
1820
1947
|
function TableFooter({ className, ...props }) {
|
|
1821
|
-
return /* @__PURE__ */
|
|
1948
|
+
return /* @__PURE__ */ React26__namespace.createElement("tfoot", {
|
|
1822
1949
|
"data-slot": "table-footer",
|
|
1823
1950
|
className: cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className),
|
|
1824
1951
|
...props
|
|
1825
1952
|
});
|
|
1826
1953
|
}
|
|
1827
|
-
|
|
1954
|
+
chunk2HRO6CFU_js.__name(TableFooter, "TableFooter");
|
|
1828
1955
|
function TableRow({ className, ...props }) {
|
|
1829
|
-
return /* @__PURE__ */
|
|
1956
|
+
return /* @__PURE__ */ React26__namespace.createElement("tr", {
|
|
1830
1957
|
"data-slot": "table-row",
|
|
1831
1958
|
className: cn("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className),
|
|
1832
1959
|
...props
|
|
1833
1960
|
});
|
|
1834
1961
|
}
|
|
1835
|
-
|
|
1962
|
+
chunk2HRO6CFU_js.__name(TableRow, "TableRow");
|
|
1836
1963
|
function TableHead({ className, ...props }) {
|
|
1837
|
-
return /* @__PURE__ */
|
|
1964
|
+
return /* @__PURE__ */ React26__namespace.createElement("th", {
|
|
1838
1965
|
"data-slot": "table-head",
|
|
1839
1966
|
className: cn("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
1840
1967
|
...props
|
|
1841
1968
|
});
|
|
1842
1969
|
}
|
|
1843
|
-
|
|
1970
|
+
chunk2HRO6CFU_js.__name(TableHead, "TableHead");
|
|
1844
1971
|
function TableCell({ className, ...props }) {
|
|
1845
|
-
return /* @__PURE__ */
|
|
1972
|
+
return /* @__PURE__ */ React26__namespace.createElement("td", {
|
|
1846
1973
|
"data-slot": "table-cell",
|
|
1847
1974
|
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
1848
1975
|
...props
|
|
1849
1976
|
});
|
|
1850
1977
|
}
|
|
1851
|
-
|
|
1978
|
+
chunk2HRO6CFU_js.__name(TableCell, "TableCell");
|
|
1852
1979
|
function TableCaption({ className, ...props }) {
|
|
1853
|
-
return /* @__PURE__ */
|
|
1980
|
+
return /* @__PURE__ */ React26__namespace.createElement("caption", {
|
|
1854
1981
|
"data-slot": "table-caption",
|
|
1855
1982
|
className: cn("text-muted-foreground mt-4 text-sm", className),
|
|
1856
1983
|
...props
|
|
1857
1984
|
});
|
|
1858
1985
|
}
|
|
1859
|
-
|
|
1986
|
+
chunk2HRO6CFU_js.__name(TableCaption, "TableCaption");
|
|
1860
1987
|
function getNestedValue(obj, path) {
|
|
1861
1988
|
return path.split(".").reduce((current, key) => {
|
|
1862
1989
|
if (current && typeof current === "object" && key in current) {
|
|
@@ -1865,38 +1992,41 @@ function getNestedValue(obj, path) {
|
|
|
1865
1992
|
return void 0;
|
|
1866
1993
|
}, obj);
|
|
1867
1994
|
}
|
|
1868
|
-
|
|
1995
|
+
chunk2HRO6CFU_js.__name(getNestedValue, "getNestedValue");
|
|
1869
1996
|
function ToolDataGrid({ dataTool, columns, transformData, rowActions = [], pagination = true, pageSizes = [
|
|
1870
1997
|
10,
|
|
1871
1998
|
25,
|
|
1872
1999
|
50,
|
|
1873
2000
|
100
|
|
1874
2001
|
], defaultPageSize = 10, defaultSort, refreshInterval, showRefresh = true, onDataLoaded, onError, onRowClick, getRowKey, emptyContent, loadingContent, className }) {
|
|
2002
|
+
if (!dataTool) {
|
|
2003
|
+
throw new Error("ToolDataGrid: dataTool prop is required");
|
|
2004
|
+
}
|
|
1875
2005
|
const toolConfig = typeof dataTool === "string" ? {
|
|
1876
2006
|
name: dataTool
|
|
1877
2007
|
} : dataTool;
|
|
1878
|
-
const [data, setData] =
|
|
2008
|
+
const [data, setData] = React26.useState({
|
|
1879
2009
|
rows: [],
|
|
1880
2010
|
total: 0
|
|
1881
2011
|
});
|
|
1882
|
-
const [paginationState, setPaginationState] =
|
|
2012
|
+
const [paginationState, setPaginationState] = React26.useState({
|
|
1883
2013
|
page: 1,
|
|
1884
2014
|
pageSize: defaultPageSize
|
|
1885
2015
|
});
|
|
1886
|
-
const [sortState, setSortState] =
|
|
2016
|
+
const [sortState, setSortState] = React26.useState(defaultSort ?? {
|
|
1887
2017
|
column: null,
|
|
1888
2018
|
direction: "asc"
|
|
1889
2019
|
});
|
|
1890
2020
|
const { call, loading, error } = useTool(toolConfig.name, {
|
|
1891
2021
|
defaultArgs: toolConfig.args,
|
|
1892
|
-
onSuccess: /* @__PURE__ */
|
|
2022
|
+
onSuccess: /* @__PURE__ */ chunk2HRO6CFU_js.__name((result) => {
|
|
1893
2023
|
const gridData = transformData ? transformData(result) : result;
|
|
1894
2024
|
setData(gridData);
|
|
1895
2025
|
onDataLoaded?.(gridData);
|
|
1896
2026
|
}, "onSuccess"),
|
|
1897
2027
|
onError
|
|
1898
2028
|
});
|
|
1899
|
-
const fetchData =
|
|
2029
|
+
const fetchData = React26.useCallback(() => {
|
|
1900
2030
|
const args = {};
|
|
1901
2031
|
if (pagination) {
|
|
1902
2032
|
args.page = paginationState.page;
|
|
@@ -1916,12 +2046,12 @@ function ToolDataGrid({ dataTool, columns, transformData, rowActions = [], pagin
|
|
|
1916
2046
|
paginationState,
|
|
1917
2047
|
sortState
|
|
1918
2048
|
]);
|
|
1919
|
-
const initialFetchDone =
|
|
1920
|
-
const prevStateRef =
|
|
2049
|
+
const initialFetchDone = React26__namespace.useRef(false);
|
|
2050
|
+
const prevStateRef = React26__namespace.useRef({
|
|
1921
2051
|
pagination: paginationState,
|
|
1922
2052
|
sort: sortState
|
|
1923
2053
|
});
|
|
1924
|
-
|
|
2054
|
+
React26.useEffect(() => {
|
|
1925
2055
|
if (!initialFetchDone.current) {
|
|
1926
2056
|
initialFetchDone.current = true;
|
|
1927
2057
|
fetchData();
|
|
@@ -1941,7 +2071,7 @@ function ToolDataGrid({ dataTool, columns, transformData, rowActions = [], pagin
|
|
|
1941
2071
|
paginationState,
|
|
1942
2072
|
sortState
|
|
1943
2073
|
]);
|
|
1944
|
-
|
|
2074
|
+
React26.useEffect(() => {
|
|
1945
2075
|
if (refreshInterval && refreshInterval > 0) {
|
|
1946
2076
|
const interval = setInterval(fetchData, refreshInterval);
|
|
1947
2077
|
return () => clearInterval(interval);
|
|
@@ -1950,19 +2080,19 @@ function ToolDataGrid({ dataTool, columns, transformData, rowActions = [], pagin
|
|
|
1950
2080
|
refreshInterval,
|
|
1951
2081
|
fetchData
|
|
1952
2082
|
]);
|
|
1953
|
-
const handleSort =
|
|
2083
|
+
const handleSort = React26.useCallback((column) => {
|
|
1954
2084
|
setSortState((prev) => ({
|
|
1955
2085
|
column,
|
|
1956
2086
|
direction: prev.column === column && prev.direction === "asc" ? "desc" : "asc"
|
|
1957
2087
|
}));
|
|
1958
2088
|
}, []);
|
|
1959
|
-
const handlePageChange =
|
|
2089
|
+
const handlePageChange = React26.useCallback((page) => {
|
|
1960
2090
|
setPaginationState((prev) => ({
|
|
1961
2091
|
...prev,
|
|
1962
2092
|
page
|
|
1963
2093
|
}));
|
|
1964
2094
|
}, []);
|
|
1965
|
-
const handlePageSizeChange =
|
|
2095
|
+
const handlePageSizeChange = React26.useCallback((pageSize) => {
|
|
1966
2096
|
setPaginationState({
|
|
1967
2097
|
page: 1,
|
|
1968
2098
|
pageSize: parseInt(pageSize, 10)
|
|
@@ -1971,136 +2101,139 @@ function ToolDataGrid({ dataTool, columns, transformData, rowActions = [], pagin
|
|
|
1971
2101
|
const totalPages = Math.ceil(data.total / paginationState.pageSize);
|
|
1972
2102
|
const canPreviousPage = paginationState.page > 1;
|
|
1973
2103
|
const canNextPage = paginationState.page < totalPages;
|
|
1974
|
-
const getSortIcon = /* @__PURE__ */
|
|
2104
|
+
const getSortIcon = /* @__PURE__ */ chunk2HRO6CFU_js.__name((column) => {
|
|
1975
2105
|
if (sortState.column !== column) {
|
|
1976
|
-
return /* @__PURE__ */
|
|
2106
|
+
return /* @__PURE__ */ React26__namespace.createElement(lucideReact.ArrowUpDown, {
|
|
1977
2107
|
className: "h-4 w-4"
|
|
1978
2108
|
});
|
|
1979
2109
|
}
|
|
1980
|
-
return sortState.direction === "asc" ? /* @__PURE__ */
|
|
2110
|
+
return sortState.direction === "asc" ? /* @__PURE__ */ React26__namespace.createElement(lucideReact.ArrowUp, {
|
|
1981
2111
|
className: "h-4 w-4"
|
|
1982
|
-
}) : /* @__PURE__ */
|
|
2112
|
+
}) : /* @__PURE__ */ React26__namespace.createElement(lucideReact.ArrowDown, {
|
|
1983
2113
|
className: "h-4 w-4"
|
|
1984
2114
|
});
|
|
1985
2115
|
}, "getSortIcon");
|
|
1986
|
-
const renderLoading = /* @__PURE__ */
|
|
2116
|
+
const renderLoading = /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => {
|
|
1987
2117
|
if (loadingContent) return loadingContent;
|
|
1988
|
-
return /* @__PURE__ */
|
|
2118
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
1989
2119
|
className: "space-y-2"
|
|
1990
2120
|
}, Array.from({
|
|
1991
2121
|
length: 5
|
|
1992
|
-
}).map((_, i) => /* @__PURE__ */
|
|
2122
|
+
}).map((_, i) => /* @__PURE__ */ React26__namespace.createElement(Skeleton, {
|
|
1993
2123
|
key: i,
|
|
1994
2124
|
className: "h-12 w-full"
|
|
1995
2125
|
})));
|
|
1996
2126
|
}, "renderLoading");
|
|
1997
|
-
const renderEmpty = /* @__PURE__ */
|
|
2127
|
+
const renderEmpty = /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => {
|
|
1998
2128
|
if (emptyContent) return emptyContent;
|
|
1999
|
-
return /* @__PURE__ */
|
|
2129
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2000
2130
|
className: "flex flex-col items-center justify-center py-12 text-muted-foreground"
|
|
2001
|
-
}, /* @__PURE__ */
|
|
2131
|
+
}, /* @__PURE__ */ React26__namespace.createElement("p", {
|
|
2002
2132
|
className: "text-lg"
|
|
2003
|
-
}, "No data found"), /* @__PURE__ */
|
|
2133
|
+
}, "No data found"), /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
2004
2134
|
variant: "ghost",
|
|
2005
2135
|
size: "sm",
|
|
2006
2136
|
onClick: fetchData,
|
|
2007
2137
|
className: "mt-2"
|
|
2008
|
-
}, /* @__PURE__ */
|
|
2138
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.RefreshCw, {
|
|
2009
2139
|
className: "h-4 w-4 mr-2"
|
|
2010
2140
|
}), "Refresh"));
|
|
2011
2141
|
}, "renderEmpty");
|
|
2012
|
-
return /* @__PURE__ */
|
|
2142
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2013
2143
|
className: cn("space-y-4", className)
|
|
2014
|
-
}, showRefresh && /* @__PURE__ */
|
|
2144
|
+
}, showRefresh && /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2015
2145
|
className: "flex items-center justify-end gap-2"
|
|
2016
|
-
}, /* @__PURE__ */
|
|
2146
|
+
}, /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
2017
2147
|
variant: "outline",
|
|
2018
2148
|
size: "sm",
|
|
2019
2149
|
onClick: fetchData,
|
|
2020
2150
|
disabled: loading
|
|
2021
|
-
}, loading ? /* @__PURE__ */
|
|
2151
|
+
}, loading ? /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
2022
2152
|
className: "h-4 w-4 animate-spin"
|
|
2023
|
-
}) : /* @__PURE__ */
|
|
2153
|
+
}) : /* @__PURE__ */ React26__namespace.createElement(lucideReact.RefreshCw, {
|
|
2024
2154
|
className: "h-4 w-4"
|
|
2025
|
-
}), /* @__PURE__ */
|
|
2155
|
+
}), /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
2026
2156
|
className: "ml-2"
|
|
2027
|
-
}, "Refresh"))), /* @__PURE__ */
|
|
2157
|
+
}, "Refresh"))), /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2028
2158
|
className: "rounded-md border"
|
|
2029
|
-
}, loading && data.rows.length === 0 ? /* @__PURE__ */
|
|
2159
|
+
}, loading && data.rows.length === 0 ? /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2030
2160
|
className: "p-4"
|
|
2031
|
-
}, renderLoading()) : data.rows.length === 0 ? renderEmpty() : /* @__PURE__ */
|
|
2161
|
+
}, renderLoading()) : data.rows.length === 0 ? renderEmpty() : /* @__PURE__ */ React26__namespace.createElement(Table, null, /* @__PURE__ */ React26__namespace.createElement(TableHeader, null, /* @__PURE__ */ React26__namespace.createElement(TableRow, null, columns.map((column) => /* @__PURE__ */ React26__namespace.createElement(TableHead, {
|
|
2032
2162
|
key: column.key,
|
|
2033
2163
|
style: {
|
|
2034
2164
|
width: column.width
|
|
2035
2165
|
},
|
|
2036
2166
|
className: cn(column.align === "center" && "text-center", column.align === "right" && "text-right", column.hideMobile && "hidden md:table-cell")
|
|
2037
|
-
}, column.sortable ? /* @__PURE__ */
|
|
2167
|
+
}, column.sortable ? /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
2038
2168
|
variant: "ghost",
|
|
2039
2169
|
size: "sm",
|
|
2040
|
-
onClick: /* @__PURE__ */
|
|
2170
|
+
onClick: /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => handleSort(column.key), "onClick"),
|
|
2041
2171
|
className: "-ml-3"
|
|
2042
|
-
}, column.header, getSortIcon(column.key)) : column.header)), rowActions.length > 0 && /* @__PURE__ */
|
|
2172
|
+
}, column.header, getSortIcon(column.key)) : column.header)), rowActions.length > 0 && /* @__PURE__ */ React26__namespace.createElement(TableHead, {
|
|
2043
2173
|
className: "w-[100px]"
|
|
2044
|
-
}, "Actions"))), /* @__PURE__ */
|
|
2174
|
+
}, "Actions"))), /* @__PURE__ */ React26__namespace.createElement(TableBody, null, data.rows.map((row, index) => {
|
|
2045
2175
|
const key = getRowKey?.(row, index) ?? String(index);
|
|
2046
|
-
return /* @__PURE__ */
|
|
2176
|
+
return /* @__PURE__ */ React26__namespace.createElement(TableRow, {
|
|
2047
2177
|
key,
|
|
2048
|
-
onClick: /* @__PURE__ */
|
|
2178
|
+
onClick: /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => onRowClick?.(row, index), "onClick"),
|
|
2049
2179
|
className: onRowClick ? "cursor-pointer" : void 0
|
|
2050
2180
|
}, columns.map((column) => {
|
|
2051
2181
|
const value = getNestedValue(row, column.key);
|
|
2052
|
-
return /* @__PURE__ */
|
|
2182
|
+
return /* @__PURE__ */ React26__namespace.createElement(TableCell, {
|
|
2053
2183
|
key: column.key,
|
|
2054
2184
|
className: cn(column.align === "center" && "text-center", column.align === "right" && "text-right", column.hideMobile && "hidden md:table-cell")
|
|
2055
2185
|
}, column.render ? column.render(value, row, index) : String(value ?? ""));
|
|
2056
|
-
}), rowActions.length > 0 && /* @__PURE__ */
|
|
2186
|
+
}), rowActions.length > 0 && /* @__PURE__ */ React26__namespace.createElement(TableCell, null, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2057
2187
|
className: "flex items-center gap-1"
|
|
2058
|
-
}, rowActions.filter((action) => !action.hidden?.(row)).map((action, actionIndex) => /* @__PURE__ */
|
|
2188
|
+
}, rowActions.filter((action) => !action.hidden?.(row)).map((action, actionIndex) => /* @__PURE__ */ React26__namespace.createElement(RowActionButton, {
|
|
2059
2189
|
key: actionIndex,
|
|
2060
2190
|
action,
|
|
2061
2191
|
row,
|
|
2062
2192
|
onRefresh: fetchData
|
|
2063
2193
|
})))));
|
|
2064
|
-
})))), pagination && data.total > 0 && /* @__PURE__ */
|
|
2194
|
+
})))), pagination && data.total > 0 && /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2065
2195
|
className: "flex items-center justify-between"
|
|
2066
|
-
}, /* @__PURE__ */
|
|
2196
|
+
}, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2067
2197
|
className: "text-sm text-muted-foreground"
|
|
2068
|
-
}, "Showing ", (paginationState.page - 1) * paginationState.pageSize + 1, " to", " ", Math.min(paginationState.page * paginationState.pageSize, data.total), " of", " ", data.total, " results"), /* @__PURE__ */
|
|
2198
|
+
}, "Showing ", (paginationState.page - 1) * paginationState.pageSize + 1, " to", " ", Math.min(paginationState.page * paginationState.pageSize, data.total), " of", " ", data.total, " results"), /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2069
2199
|
className: "flex items-center gap-4"
|
|
2070
|
-
}, /* @__PURE__ */
|
|
2200
|
+
}, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2071
2201
|
className: "flex items-center gap-2"
|
|
2072
|
-
}, /* @__PURE__ */
|
|
2202
|
+
}, /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
2073
2203
|
className: "text-sm text-muted-foreground"
|
|
2074
|
-
}, "Rows per page"), /* @__PURE__ */
|
|
2204
|
+
}, "Rows per page"), /* @__PURE__ */ React26__namespace.createElement(Select, {
|
|
2075
2205
|
value: String(paginationState.pageSize),
|
|
2076
2206
|
onValueChange: handlePageSizeChange
|
|
2077
|
-
}, /* @__PURE__ */
|
|
2207
|
+
}, /* @__PURE__ */ React26__namespace.createElement(SelectTrigger, {
|
|
2078
2208
|
className: "w-[70px]"
|
|
2079
|
-
}, /* @__PURE__ */
|
|
2209
|
+
}, /* @__PURE__ */ React26__namespace.createElement(SelectValue, null)), /* @__PURE__ */ React26__namespace.createElement(SelectContent, null, pageSizes.map((size) => /* @__PURE__ */ React26__namespace.createElement(SelectItem, {
|
|
2080
2210
|
key: size,
|
|
2081
2211
|
value: String(size)
|
|
2082
|
-
}, size))))), /* @__PURE__ */
|
|
2212
|
+
}, size))))), /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2083
2213
|
className: "flex items-center gap-2"
|
|
2084
|
-
}, /* @__PURE__ */
|
|
2214
|
+
}, /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
2085
2215
|
variant: "outline",
|
|
2086
2216
|
size: "sm",
|
|
2087
|
-
onClick: /* @__PURE__ */
|
|
2217
|
+
onClick: /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => handlePageChange(paginationState.page - 1), "onClick"),
|
|
2088
2218
|
disabled: !canPreviousPage || loading
|
|
2089
|
-
}, /* @__PURE__ */
|
|
2219
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.ChevronLeft, {
|
|
2090
2220
|
className: "h-4 w-4"
|
|
2091
|
-
})), /* @__PURE__ */
|
|
2221
|
+
})), /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
2092
2222
|
className: "text-sm"
|
|
2093
|
-
}, "Page ", paginationState.page, " of ", totalPages), /* @__PURE__ */
|
|
2223
|
+
}, "Page ", paginationState.page, " of ", totalPages), /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
2094
2224
|
variant: "outline",
|
|
2095
2225
|
size: "sm",
|
|
2096
|
-
onClick: /* @__PURE__ */
|
|
2226
|
+
onClick: /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => handlePageChange(paginationState.page + 1), "onClick"),
|
|
2097
2227
|
disabled: !canNextPage || loading
|
|
2098
|
-
}, /* @__PURE__ */
|
|
2228
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.ChevronRight, {
|
|
2099
2229
|
className: "h-4 w-4"
|
|
2100
2230
|
}))))));
|
|
2101
2231
|
}
|
|
2102
|
-
|
|
2232
|
+
chunk2HRO6CFU_js.__name(ToolDataGrid, "ToolDataGrid");
|
|
2103
2233
|
function RowActionButton({ action, row, onRefresh }) {
|
|
2234
|
+
if (!action.tool) {
|
|
2235
|
+
throw new Error("ToolDataGrid: rowAction.tool is required");
|
|
2236
|
+
}
|
|
2104
2237
|
const toolConfig = typeof action.tool === "string" ? {
|
|
2105
2238
|
name: action.tool
|
|
2106
2239
|
} : action.tool;
|
|
@@ -2108,49 +2241,49 @@ function RowActionButton({ action, row, onRefresh }) {
|
|
|
2108
2241
|
id: row.id
|
|
2109
2242
|
};
|
|
2110
2243
|
const { call, loading } = useTool(toolConfig.name, {
|
|
2111
|
-
onSuccess: /* @__PURE__ */
|
|
2244
|
+
onSuccess: /* @__PURE__ */ chunk2HRO6CFU_js.__name((result) => {
|
|
2112
2245
|
action.onSuccess?.(result, row);
|
|
2113
2246
|
sonner.toast.success("Action completed");
|
|
2114
2247
|
onRefresh();
|
|
2115
2248
|
}, "onSuccess"),
|
|
2116
|
-
onError: /* @__PURE__ */
|
|
2249
|
+
onError: /* @__PURE__ */ chunk2HRO6CFU_js.__name((error) => {
|
|
2117
2250
|
sonner.toast.error(error.message);
|
|
2118
2251
|
}, "onError")
|
|
2119
2252
|
});
|
|
2120
|
-
const handleClick =
|
|
2253
|
+
const handleClick = React26.useCallback((e) => {
|
|
2121
2254
|
e.stopPropagation();
|
|
2122
2255
|
call(args);
|
|
2123
2256
|
}, [
|
|
2124
2257
|
call,
|
|
2125
2258
|
args
|
|
2126
2259
|
]);
|
|
2127
|
-
return /* @__PURE__ */
|
|
2260
|
+
return /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
2128
2261
|
variant: action.variant ?? "ghost",
|
|
2129
2262
|
size: "sm",
|
|
2130
2263
|
onClick: handleClick,
|
|
2131
2264
|
disabled: loading
|
|
2132
|
-
}, loading ? /* @__PURE__ */
|
|
2265
|
+
}, loading ? /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
2133
2266
|
className: "h-3 w-3 animate-spin"
|
|
2134
|
-
}) : /* @__PURE__ */
|
|
2267
|
+
}) : /* @__PURE__ */ React26__namespace.createElement(React26__namespace.Fragment, null, action.icon, /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
2135
2268
|
className: action.icon ? "ml-1" : ""
|
|
2136
2269
|
}, action.label)));
|
|
2137
2270
|
}
|
|
2138
|
-
|
|
2139
|
-
var Button2 = /* @__PURE__ */
|
|
2271
|
+
chunk2HRO6CFU_js.__name(RowActionButton, "RowActionButton");
|
|
2272
|
+
var Button2 = /* @__PURE__ */ React26.forwardRef(({ className, variant = "primary", size = "md", loading = false, disabled, asChild = false, leftIcon, rightIcon, children, ...props }, ref) => {
|
|
2140
2273
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
2141
|
-
return /* @__PURE__ */
|
|
2274
|
+
return /* @__PURE__ */ React26__namespace.default.createElement(Comp, {
|
|
2142
2275
|
ref,
|
|
2143
2276
|
className: clsx.clsx("lui-button", `lui-button--${variant}`, `lui-button--${size}`, loading && "lui-button--loading", className),
|
|
2144
2277
|
disabled: disabled || loading,
|
|
2145
2278
|
...props
|
|
2146
|
-
}, loading && /* @__PURE__ */
|
|
2279
|
+
}, loading && /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
2147
2280
|
className: "lui-button__spinner",
|
|
2148
2281
|
"aria-hidden": "true"
|
|
2149
|
-
}, /* @__PURE__ */
|
|
2282
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("svg", {
|
|
2150
2283
|
viewBox: "0 0 24 24",
|
|
2151
2284
|
fill: "none",
|
|
2152
2285
|
className: "lui-spinner-icon"
|
|
2153
|
-
}, /* @__PURE__ */
|
|
2286
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("circle", {
|
|
2154
2287
|
cx: "12",
|
|
2155
2288
|
cy: "12",
|
|
2156
2289
|
r: "10",
|
|
@@ -2159,11 +2292,11 @@ var Button2 = /* @__PURE__ */ React25.forwardRef(({ className, variant = "primar
|
|
|
2159
2292
|
strokeLinecap: "round",
|
|
2160
2293
|
strokeDasharray: "32",
|
|
2161
2294
|
strokeDashoffset: "12"
|
|
2162
|
-
}))), leftIcon && !loading && /* @__PURE__ */
|
|
2295
|
+
}))), leftIcon && !loading && /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
2163
2296
|
className: "lui-button__icon"
|
|
2164
|
-
}, leftIcon), /* @__PURE__ */
|
|
2297
|
+
}, leftIcon), /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
2165
2298
|
className: "lui-button__content"
|
|
2166
|
-
}, children), rightIcon && /* @__PURE__ */
|
|
2299
|
+
}, children), rightIcon && /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
2167
2300
|
className: "lui-button__icon"
|
|
2168
2301
|
}, rightIcon));
|
|
2169
2302
|
});
|
|
@@ -2172,8 +2305,8 @@ Button2.displayName = "Button";
|
|
|
2172
2305
|
// src/mcp/ActionButton.tsx
|
|
2173
2306
|
function ActionButton({ toolName, toolArgs = {}, onToolSuccess, onToolError, showResult = false, renderResult, children, ...buttonProps }) {
|
|
2174
2307
|
const { call, loading, result, error } = useTool(toolName);
|
|
2175
|
-
const [hasResult, setHasResult] =
|
|
2176
|
-
const handleClick = /* @__PURE__ */
|
|
2308
|
+
const [hasResult, setHasResult] = React26.useState(false);
|
|
2309
|
+
const handleClick = /* @__PURE__ */ chunk2HRO6CFU_js.__name(async () => {
|
|
2177
2310
|
try {
|
|
2178
2311
|
const res = await call(toolArgs);
|
|
2179
2312
|
setHasResult(true);
|
|
@@ -2182,110 +2315,119 @@ function ActionButton({ toolName, toolArgs = {}, onToolSuccess, onToolError, sho
|
|
|
2182
2315
|
onToolError?.(err instanceof Error ? err : new Error(String(err)));
|
|
2183
2316
|
}
|
|
2184
2317
|
}, "handleClick");
|
|
2185
|
-
return /* @__PURE__ */
|
|
2318
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
2186
2319
|
className: "lui-action-button-wrapper"
|
|
2187
|
-
}, /* @__PURE__ */
|
|
2320
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(Button2, {
|
|
2188
2321
|
...buttonProps,
|
|
2189
2322
|
loading,
|
|
2190
2323
|
onClick: handleClick
|
|
2191
|
-
}, children), showResult && hasResult && result !== null && /* @__PURE__ */
|
|
2324
|
+
}, children), showResult && hasResult && result !== null && /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
2192
2325
|
className: "lui-action-button-result"
|
|
2193
|
-
}, renderResult ? renderResult(result) : /* @__PURE__ */
|
|
2326
|
+
}, renderResult ? renderResult(result) : /* @__PURE__ */ React26__namespace.default.createElement("pre", null, JSON.stringify(result, null, 2))), error && /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
2194
2327
|
className: "lui-action-button-error"
|
|
2195
2328
|
}, error.message));
|
|
2196
2329
|
}
|
|
2197
|
-
|
|
2330
|
+
chunk2HRO6CFU_js.__name(ActionButton, "ActionButton");
|
|
2198
2331
|
function DefaultLoading2() {
|
|
2199
|
-
return /* @__PURE__ */
|
|
2332
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2200
2333
|
className: "flex items-center justify-center p-8"
|
|
2201
|
-
}, /* @__PURE__ */
|
|
2334
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.Loader2, {
|
|
2202
2335
|
className: "h-6 w-6 animate-spin text-muted-foreground"
|
|
2203
2336
|
}));
|
|
2204
2337
|
}
|
|
2205
|
-
|
|
2338
|
+
chunk2HRO6CFU_js.__name(DefaultLoading2, "DefaultLoading");
|
|
2206
2339
|
function DefaultDisconnected() {
|
|
2207
|
-
return /* @__PURE__ */
|
|
2340
|
+
return /* @__PURE__ */ React26__namespace.createElement(Alert, null, /* @__PURE__ */ React26__namespace.createElement(lucideReact.WifiOff, {
|
|
2208
2341
|
className: "h-4 w-4"
|
|
2209
|
-
}), /* @__PURE__ */
|
|
2342
|
+
}), /* @__PURE__ */ React26__namespace.createElement(AlertDescription, null, "Waiting for connection to MCP host..."));
|
|
2210
2343
|
}
|
|
2211
|
-
|
|
2344
|
+
chunk2HRO6CFU_js.__name(DefaultDisconnected, "DefaultDisconnected");
|
|
2212
2345
|
function DefaultError2({ error }) {
|
|
2213
|
-
return /* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ React26__namespace.createElement(Alert, {
|
|
2214
2347
|
variant: "destructive"
|
|
2215
|
-
}, /* @__PURE__ */
|
|
2348
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.AlertCircle, {
|
|
2216
2349
|
className: "h-4 w-4"
|
|
2217
|
-
}), /* @__PURE__ */
|
|
2350
|
+
}), /* @__PURE__ */ React26__namespace.createElement(AlertDescription, null, "Connection error: ", error.message));
|
|
2218
2351
|
}
|
|
2219
|
-
|
|
2352
|
+
chunk2HRO6CFU_js.__name(DefaultError2, "DefaultError");
|
|
2220
2353
|
function RequireConnection({ loading: loadingContent, error: errorContent, disconnected: disconnectedContent, children, className }) {
|
|
2221
2354
|
const { isConnected, error, app } = useMcpApp();
|
|
2355
|
+
console.log("[RequireConnection] State:", {
|
|
2356
|
+
hasApp: !!app,
|
|
2357
|
+
isConnected,
|
|
2358
|
+
hasError: !!error
|
|
2359
|
+
});
|
|
2222
2360
|
if (!app && !error && !isConnected) {
|
|
2361
|
+
console.log("[RequireConnection] Rendering: Initial Loading");
|
|
2223
2362
|
if (loadingContent) {
|
|
2224
|
-
return /* @__PURE__ */
|
|
2363
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2225
2364
|
className
|
|
2226
2365
|
}, loadingContent);
|
|
2227
2366
|
}
|
|
2228
|
-
return /* @__PURE__ */
|
|
2367
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2229
2368
|
className
|
|
2230
|
-
}, /* @__PURE__ */
|
|
2369
|
+
}, /* @__PURE__ */ React26__namespace.createElement(DefaultLoading2, null));
|
|
2231
2370
|
}
|
|
2232
2371
|
if (error) {
|
|
2372
|
+
console.log("[RequireConnection] Rendering: Error");
|
|
2233
2373
|
if (errorContent) {
|
|
2234
2374
|
if (typeof errorContent === "function") {
|
|
2235
|
-
return /* @__PURE__ */
|
|
2375
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2236
2376
|
className
|
|
2237
2377
|
}, errorContent(error));
|
|
2238
2378
|
}
|
|
2239
|
-
return /* @__PURE__ */
|
|
2379
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2240
2380
|
className
|
|
2241
2381
|
}, errorContent);
|
|
2242
2382
|
}
|
|
2243
|
-
return /* @__PURE__ */
|
|
2383
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2244
2384
|
className
|
|
2245
|
-
}, /* @__PURE__ */
|
|
2385
|
+
}, /* @__PURE__ */ React26__namespace.createElement(DefaultError2, {
|
|
2246
2386
|
error
|
|
2247
2387
|
}));
|
|
2248
2388
|
}
|
|
2249
2389
|
if (!isConnected) {
|
|
2390
|
+
console.log("[RequireConnection] Rendering: Disconnected/Loading");
|
|
2250
2391
|
if (disconnectedContent) {
|
|
2251
|
-
return /* @__PURE__ */
|
|
2392
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2252
2393
|
className
|
|
2253
2394
|
}, disconnectedContent);
|
|
2254
2395
|
}
|
|
2255
2396
|
if (loadingContent) {
|
|
2256
|
-
return /* @__PURE__ */
|
|
2397
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2257
2398
|
className
|
|
2258
2399
|
}, loadingContent);
|
|
2259
2400
|
}
|
|
2260
|
-
return /* @__PURE__ */
|
|
2401
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2261
2402
|
className
|
|
2262
|
-
}, /* @__PURE__ */
|
|
2403
|
+
}, /* @__PURE__ */ React26__namespace.createElement(DefaultDisconnected, null));
|
|
2263
2404
|
}
|
|
2264
|
-
|
|
2405
|
+
console.log("[RequireConnection] Rendering: Children (Connected)");
|
|
2406
|
+
return /* @__PURE__ */ React26__namespace.createElement(React26__namespace.Fragment, null, children);
|
|
2265
2407
|
}
|
|
2266
|
-
|
|
2408
|
+
chunk2HRO6CFU_js.__name(RequireConnection, "RequireConnection");
|
|
2267
2409
|
function DefaultFallback({ error, onRetry }) {
|
|
2268
|
-
return /* @__PURE__ */
|
|
2410
|
+
return /* @__PURE__ */ React26__namespace.createElement(Alert, {
|
|
2269
2411
|
variant: "destructive"
|
|
2270
|
-
}, /* @__PURE__ */
|
|
2412
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.AlertCircle, {
|
|
2271
2413
|
className: "h-4 w-4"
|
|
2272
|
-
}), /* @__PURE__ */
|
|
2414
|
+
}), /* @__PURE__ */ React26__namespace.createElement(AlertTitle, null, "Something went wrong"), /* @__PURE__ */ React26__namespace.createElement(AlertDescription, {
|
|
2273
2415
|
className: "flex flex-col gap-3"
|
|
2274
|
-
}, /* @__PURE__ */
|
|
2416
|
+
}, /* @__PURE__ */ React26__namespace.createElement("p", {
|
|
2275
2417
|
className: "text-sm"
|
|
2276
|
-
}, error.message), /* @__PURE__ */
|
|
2418
|
+
}, error.message), /* @__PURE__ */ React26__namespace.createElement(Button, {
|
|
2277
2419
|
variant: "outline",
|
|
2278
2420
|
size: "sm",
|
|
2279
2421
|
onClick: onRetry,
|
|
2280
2422
|
className: "w-fit"
|
|
2281
|
-
}, /* @__PURE__ */
|
|
2423
|
+
}, /* @__PURE__ */ React26__namespace.createElement(lucideReact.RefreshCw, {
|
|
2282
2424
|
className: "h-4 w-4 mr-2"
|
|
2283
2425
|
}), "Try Again")));
|
|
2284
2426
|
}
|
|
2285
|
-
|
|
2286
|
-
var ToolErrorBoundary = class extends
|
|
2427
|
+
chunk2HRO6CFU_js.__name(DefaultFallback, "DefaultFallback");
|
|
2428
|
+
var ToolErrorBoundary = class extends React26.Component {
|
|
2287
2429
|
static {
|
|
2288
|
-
|
|
2430
|
+
chunk2HRO6CFU_js.__name(this, "ToolErrorBoundary");
|
|
2289
2431
|
}
|
|
2290
2432
|
constructor(props) {
|
|
2291
2433
|
super(props);
|
|
@@ -2308,7 +2450,7 @@ var ToolErrorBoundary = class extends React25.Component {
|
|
|
2308
2450
|
this.reset();
|
|
2309
2451
|
}
|
|
2310
2452
|
}
|
|
2311
|
-
reset = /* @__PURE__ */
|
|
2453
|
+
reset = /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => {
|
|
2312
2454
|
this.setState({
|
|
2313
2455
|
hasError: false,
|
|
2314
2456
|
error: null
|
|
@@ -2324,7 +2466,7 @@ var ToolErrorBoundary = class extends React25.Component {
|
|
|
2324
2466
|
}
|
|
2325
2467
|
return fallback;
|
|
2326
2468
|
}
|
|
2327
|
-
return /* @__PURE__ */
|
|
2469
|
+
return /* @__PURE__ */ React26__namespace.createElement(DefaultFallback, {
|
|
2328
2470
|
error,
|
|
2329
2471
|
onRetry: this.reset
|
|
2330
2472
|
});
|
|
@@ -2334,9 +2476,9 @@ var ToolErrorBoundary = class extends React25.Component {
|
|
|
2334
2476
|
};
|
|
2335
2477
|
function useMessage() {
|
|
2336
2478
|
const { sendMessage: appSendMessage, isConnected } = useMcpApp();
|
|
2337
|
-
const [sending, setSending] =
|
|
2338
|
-
const [error, setError] =
|
|
2339
|
-
const send =
|
|
2479
|
+
const [sending, setSending] = React26.useState(false);
|
|
2480
|
+
const [error, setError] = React26.useState(null);
|
|
2481
|
+
const send = React26.useCallback(async (text) => {
|
|
2340
2482
|
if (!isConnected) {
|
|
2341
2483
|
console.warn("[useMessage] Not connected to host");
|
|
2342
2484
|
return;
|
|
@@ -2356,7 +2498,7 @@ function useMessage() {
|
|
|
2356
2498
|
appSendMessage,
|
|
2357
2499
|
isConnected
|
|
2358
2500
|
]);
|
|
2359
|
-
const sendContent =
|
|
2501
|
+
const sendContent = React26.useCallback(async (content) => {
|
|
2360
2502
|
if (!isConnected) {
|
|
2361
2503
|
console.warn("[useMessage] Not connected to host");
|
|
2362
2504
|
return;
|
|
@@ -2377,7 +2519,7 @@ function useMessage() {
|
|
|
2377
2519
|
appSendMessage,
|
|
2378
2520
|
isConnected
|
|
2379
2521
|
]);
|
|
2380
|
-
const requestTool =
|
|
2522
|
+
const requestTool = React26.useCallback(async (toolName, args) => {
|
|
2381
2523
|
let message = `Please call the "${toolName}" tool`;
|
|
2382
2524
|
if (args && Object.keys(args).length > 0) {
|
|
2383
2525
|
message += ` with arguments: ${JSON.stringify(args)}`;
|
|
@@ -2394,7 +2536,7 @@ function useMessage() {
|
|
|
2394
2536
|
error
|
|
2395
2537
|
};
|
|
2396
2538
|
}
|
|
2397
|
-
|
|
2539
|
+
chunk2HRO6CFU_js.__name(useMessage, "useMessage");
|
|
2398
2540
|
|
|
2399
2541
|
// src/mcp/useHostContext.ts
|
|
2400
2542
|
function useHostContext() {
|
|
@@ -2414,7 +2556,7 @@ function useHostContext() {
|
|
|
2414
2556
|
rawContext: hostContext
|
|
2415
2557
|
};
|
|
2416
2558
|
}
|
|
2417
|
-
|
|
2559
|
+
chunk2HRO6CFU_js.__name(useHostContext, "useHostContext");
|
|
2418
2560
|
|
|
2419
2561
|
// src/mcp/useToolResult.ts
|
|
2420
2562
|
function useToolResult() {
|
|
@@ -2443,7 +2585,7 @@ function useToolResult() {
|
|
|
2443
2585
|
textContent
|
|
2444
2586
|
};
|
|
2445
2587
|
}
|
|
2446
|
-
|
|
2588
|
+
chunk2HRO6CFU_js.__name(useToolResult, "useToolResult");
|
|
2447
2589
|
|
|
2448
2590
|
// src/mcp/useToolInput.ts
|
|
2449
2591
|
function useToolInput() {
|
|
@@ -2453,7 +2595,7 @@ function useToolInput() {
|
|
|
2453
2595
|
hasInput: toolInput !== null
|
|
2454
2596
|
};
|
|
2455
2597
|
}
|
|
2456
|
-
|
|
2598
|
+
chunk2HRO6CFU_js.__name(useToolInput, "useToolInput");
|
|
2457
2599
|
|
|
2458
2600
|
// src/mcp/useToolInputPartial.ts
|
|
2459
2601
|
function useToolInputPartial() {
|
|
@@ -2463,20 +2605,20 @@ function useToolInputPartial() {
|
|
|
2463
2605
|
isStreaming: toolInputPartial !== null
|
|
2464
2606
|
};
|
|
2465
2607
|
}
|
|
2466
|
-
|
|
2608
|
+
chunk2HRO6CFU_js.__name(useToolInputPartial, "useToolInputPartial");
|
|
2467
2609
|
function useToolSubscription(toolName, options = {}) {
|
|
2468
2610
|
const { interval = 1e4, enabled = true, args = {} } = options;
|
|
2469
2611
|
const toolHook = useTool(toolName);
|
|
2470
|
-
const intervalRef =
|
|
2471
|
-
const [isPolling, setIsPolling] =
|
|
2472
|
-
const stop =
|
|
2612
|
+
const intervalRef = React26.useRef(null);
|
|
2613
|
+
const [isPolling, setIsPolling] = React26.useState(false);
|
|
2614
|
+
const stop = React26.useCallback(() => {
|
|
2473
2615
|
if (intervalRef.current) {
|
|
2474
2616
|
clearInterval(intervalRef.current);
|
|
2475
2617
|
intervalRef.current = null;
|
|
2476
2618
|
}
|
|
2477
2619
|
setIsPolling(false);
|
|
2478
2620
|
}, []);
|
|
2479
|
-
const start =
|
|
2621
|
+
const start = React26.useCallback(() => {
|
|
2480
2622
|
stop();
|
|
2481
2623
|
setIsPolling(true);
|
|
2482
2624
|
toolHook.call(args).catch(() => {
|
|
@@ -2491,13 +2633,13 @@ function useToolSubscription(toolName, options = {}) {
|
|
|
2491
2633
|
interval,
|
|
2492
2634
|
stop
|
|
2493
2635
|
]);
|
|
2494
|
-
const refresh =
|
|
2636
|
+
const refresh = React26.useCallback(async () => {
|
|
2495
2637
|
return toolHook.call(args);
|
|
2496
2638
|
}, [
|
|
2497
2639
|
toolHook.call,
|
|
2498
2640
|
args
|
|
2499
2641
|
]);
|
|
2500
|
-
|
|
2642
|
+
React26.useEffect(() => {
|
|
2501
2643
|
if (enabled) {
|
|
2502
2644
|
start();
|
|
2503
2645
|
}
|
|
@@ -2517,7 +2659,7 @@ function useToolSubscription(toolName, options = {}) {
|
|
|
2517
2659
|
refresh
|
|
2518
2660
|
};
|
|
2519
2661
|
}
|
|
2520
|
-
|
|
2662
|
+
chunk2HRO6CFU_js.__name(useToolSubscription, "useToolSubscription");
|
|
2521
2663
|
|
|
2522
2664
|
// src/types/mcp-types.ts
|
|
2523
2665
|
function normalizeToolBinding(tool) {
|
|
@@ -2528,7 +2670,7 @@ function normalizeToolBinding(tool) {
|
|
|
2528
2670
|
}
|
|
2529
2671
|
return tool;
|
|
2530
2672
|
}
|
|
2531
|
-
|
|
2673
|
+
chunk2HRO6CFU_js.__name(normalizeToolBinding, "normalizeToolBinding");
|
|
2532
2674
|
var DEFAULT_RESULT_CONFIG = {
|
|
2533
2675
|
display: "none",
|
|
2534
2676
|
autoDismiss: 5e3
|
|
@@ -2541,33 +2683,33 @@ var INITIAL_TOOL_STATE = {
|
|
|
2541
2683
|
hasResult: false
|
|
2542
2684
|
};
|
|
2543
2685
|
function CardTitle({ className, ...props }) {
|
|
2544
|
-
return /* @__PURE__ */
|
|
2686
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2545
2687
|
"data-slot": "card-title",
|
|
2546
2688
|
className: cn("leading-none font-semibold", className),
|
|
2547
2689
|
...props
|
|
2548
2690
|
});
|
|
2549
2691
|
}
|
|
2550
|
-
|
|
2692
|
+
chunk2HRO6CFU_js.__name(CardTitle, "CardTitle");
|
|
2551
2693
|
function CardDescription({ className, ...props }) {
|
|
2552
|
-
return /* @__PURE__ */
|
|
2694
|
+
return /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2553
2695
|
"data-slot": "card-description",
|
|
2554
2696
|
className: cn("text-muted-foreground text-sm", className),
|
|
2555
2697
|
...props
|
|
2556
2698
|
});
|
|
2557
2699
|
}
|
|
2558
|
-
|
|
2700
|
+
chunk2HRO6CFU_js.__name(CardDescription, "CardDescription");
|
|
2559
2701
|
var Form = reactHookForm.FormProvider;
|
|
2560
|
-
var FormFieldContext = /* @__PURE__ */
|
|
2561
|
-
var FormField = /* @__PURE__ */
|
|
2562
|
-
return /* @__PURE__ */
|
|
2702
|
+
var FormFieldContext = /* @__PURE__ */ React26__namespace.createContext({});
|
|
2703
|
+
var FormField = /* @__PURE__ */ chunk2HRO6CFU_js.__name(({ ...props }) => {
|
|
2704
|
+
return /* @__PURE__ */ React26__namespace.createElement(FormFieldContext.Provider, {
|
|
2563
2705
|
value: {
|
|
2564
2706
|
name: props.name
|
|
2565
2707
|
}
|
|
2566
|
-
}, /* @__PURE__ */
|
|
2708
|
+
}, /* @__PURE__ */ React26__namespace.createElement(reactHookForm.Controller, props));
|
|
2567
2709
|
}, "FormField");
|
|
2568
|
-
var useFormField = /* @__PURE__ */
|
|
2569
|
-
const fieldContext =
|
|
2570
|
-
const itemContext =
|
|
2710
|
+
var useFormField = /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => {
|
|
2711
|
+
const fieldContext = React26__namespace.useContext(FormFieldContext);
|
|
2712
|
+
const itemContext = React26__namespace.useContext(FormItemContext);
|
|
2571
2713
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
2572
2714
|
const formState = reactHookForm.useFormState({
|
|
2573
2715
|
name: fieldContext.name
|
|
@@ -2586,23 +2728,23 @@ var useFormField = /* @__PURE__ */ chunk3PV26V5F_js.__name(() => {
|
|
|
2586
2728
|
...fieldState
|
|
2587
2729
|
};
|
|
2588
2730
|
}, "useFormField");
|
|
2589
|
-
var FormItemContext = /* @__PURE__ */
|
|
2731
|
+
var FormItemContext = /* @__PURE__ */ React26__namespace.createContext({});
|
|
2590
2732
|
function FormItem({ className, ...props }) {
|
|
2591
|
-
const id =
|
|
2592
|
-
return /* @__PURE__ */
|
|
2733
|
+
const id = React26__namespace.useId();
|
|
2734
|
+
return /* @__PURE__ */ React26__namespace.createElement(FormItemContext.Provider, {
|
|
2593
2735
|
value: {
|
|
2594
2736
|
id
|
|
2595
2737
|
}
|
|
2596
|
-
}, /* @__PURE__ */
|
|
2738
|
+
}, /* @__PURE__ */ React26__namespace.createElement("div", {
|
|
2597
2739
|
"data-slot": "form-item",
|
|
2598
2740
|
className: cn("grid gap-2", className),
|
|
2599
2741
|
...props
|
|
2600
2742
|
}));
|
|
2601
2743
|
}
|
|
2602
|
-
|
|
2744
|
+
chunk2HRO6CFU_js.__name(FormItem, "FormItem");
|
|
2603
2745
|
function FormLabel({ className, ...props }) {
|
|
2604
2746
|
const { error, formItemId } = useFormField();
|
|
2605
|
-
return /* @__PURE__ */
|
|
2747
|
+
return /* @__PURE__ */ React26__namespace.createElement(Label2, {
|
|
2606
2748
|
"data-slot": "form-label",
|
|
2607
2749
|
"data-error": !!error,
|
|
2608
2750
|
className: cn("data-[error=true]:text-destructive", className),
|
|
@@ -2610,10 +2752,10 @@ function FormLabel({ className, ...props }) {
|
|
|
2610
2752
|
...props
|
|
2611
2753
|
});
|
|
2612
2754
|
}
|
|
2613
|
-
|
|
2755
|
+
chunk2HRO6CFU_js.__name(FormLabel, "FormLabel");
|
|
2614
2756
|
function FormControl({ ...props }) {
|
|
2615
2757
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
2616
|
-
return /* @__PURE__ */
|
|
2758
|
+
return /* @__PURE__ */ React26__namespace.createElement(reactSlot.Slot, {
|
|
2617
2759
|
"data-slot": "form-control",
|
|
2618
2760
|
id: formItemId,
|
|
2619
2761
|
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
@@ -2621,31 +2763,31 @@ function FormControl({ ...props }) {
|
|
|
2621
2763
|
...props
|
|
2622
2764
|
});
|
|
2623
2765
|
}
|
|
2624
|
-
|
|
2766
|
+
chunk2HRO6CFU_js.__name(FormControl, "FormControl");
|
|
2625
2767
|
function FormDescription({ className, ...props }) {
|
|
2626
2768
|
const { formDescriptionId } = useFormField();
|
|
2627
|
-
return /* @__PURE__ */
|
|
2769
|
+
return /* @__PURE__ */ React26__namespace.createElement("p", {
|
|
2628
2770
|
"data-slot": "form-description",
|
|
2629
2771
|
id: formDescriptionId,
|
|
2630
2772
|
className: cn("text-muted-foreground text-sm", className),
|
|
2631
2773
|
...props
|
|
2632
2774
|
});
|
|
2633
2775
|
}
|
|
2634
|
-
|
|
2776
|
+
chunk2HRO6CFU_js.__name(FormDescription, "FormDescription");
|
|
2635
2777
|
function FormMessage({ className, ...props }) {
|
|
2636
2778
|
const { error, formMessageId } = useFormField();
|
|
2637
2779
|
const body = error ? String(error?.message ?? "") : props.children;
|
|
2638
2780
|
if (!body) {
|
|
2639
2781
|
return null;
|
|
2640
2782
|
}
|
|
2641
|
-
return /* @__PURE__ */
|
|
2783
|
+
return /* @__PURE__ */ React26__namespace.createElement("p", {
|
|
2642
2784
|
"data-slot": "form-message",
|
|
2643
2785
|
id: formMessageId,
|
|
2644
2786
|
className: cn("text-destructive text-sm", className),
|
|
2645
2787
|
...props
|
|
2646
2788
|
}, body);
|
|
2647
2789
|
}
|
|
2648
|
-
|
|
2790
|
+
chunk2HRO6CFU_js.__name(FormMessage, "FormMessage");
|
|
2649
2791
|
var badgeVariants = classVarianceAuthority.cva("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", {
|
|
2650
2792
|
variants: {
|
|
2651
2793
|
variant: {
|
|
@@ -2661,7 +2803,7 @@ var badgeVariants = classVarianceAuthority.cva("inline-flex items-center justify
|
|
|
2661
2803
|
});
|
|
2662
2804
|
function Badge({ className, variant, asChild = false, ...props }) {
|
|
2663
2805
|
const Comp = asChild ? reactSlot.Slot : "span";
|
|
2664
|
-
return /* @__PURE__ */
|
|
2806
|
+
return /* @__PURE__ */ React26__namespace.createElement(Comp, {
|
|
2665
2807
|
"data-slot": "badge",
|
|
2666
2808
|
className: cn(badgeVariants({
|
|
2667
2809
|
variant
|
|
@@ -2669,33 +2811,33 @@ function Badge({ className, variant, asChild = false, ...props }) {
|
|
|
2669
2811
|
...props
|
|
2670
2812
|
});
|
|
2671
2813
|
}
|
|
2672
|
-
|
|
2814
|
+
chunk2HRO6CFU_js.__name(Badge, "Badge");
|
|
2673
2815
|
function TabsList({ className, ...props }) {
|
|
2674
|
-
return /* @__PURE__ */
|
|
2816
|
+
return /* @__PURE__ */ React26__namespace.createElement(TabsPrimitive2__namespace.List, {
|
|
2675
2817
|
"data-slot": "tabs-list",
|
|
2676
2818
|
className: cn("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]", className),
|
|
2677
2819
|
...props
|
|
2678
2820
|
});
|
|
2679
2821
|
}
|
|
2680
|
-
|
|
2822
|
+
chunk2HRO6CFU_js.__name(TabsList, "TabsList");
|
|
2681
2823
|
function TabsTrigger({ className, ...props }) {
|
|
2682
|
-
return /* @__PURE__ */
|
|
2824
|
+
return /* @__PURE__ */ React26__namespace.createElement(TabsPrimitive2__namespace.Trigger, {
|
|
2683
2825
|
"data-slot": "tabs-trigger",
|
|
2684
2826
|
className: cn("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2685
2827
|
...props
|
|
2686
2828
|
});
|
|
2687
2829
|
}
|
|
2688
|
-
|
|
2830
|
+
chunk2HRO6CFU_js.__name(TabsTrigger, "TabsTrigger");
|
|
2689
2831
|
function TabsContent({ className, ...props }) {
|
|
2690
|
-
return /* @__PURE__ */
|
|
2832
|
+
return /* @__PURE__ */ React26__namespace.createElement(TabsPrimitive2__namespace.Content, {
|
|
2691
2833
|
"data-slot": "tabs-content",
|
|
2692
2834
|
className: cn("flex-1 outline-none", className),
|
|
2693
2835
|
...props
|
|
2694
2836
|
});
|
|
2695
2837
|
}
|
|
2696
|
-
|
|
2838
|
+
chunk2HRO6CFU_js.__name(TabsContent, "TabsContent");
|
|
2697
2839
|
function Separator2({ className, orientation = "horizontal", decorative = true, ...props }) {
|
|
2698
|
-
return /* @__PURE__ */
|
|
2840
|
+
return /* @__PURE__ */ React26__namespace.createElement(SeparatorPrimitive__namespace.Root, {
|
|
2699
2841
|
"data-slot": "separator",
|
|
2700
2842
|
decorative,
|
|
2701
2843
|
orientation,
|
|
@@ -2703,69 +2845,69 @@ function Separator2({ className, orientation = "horizontal", decorative = true,
|
|
|
2703
2845
|
...props
|
|
2704
2846
|
});
|
|
2705
2847
|
}
|
|
2706
|
-
|
|
2848
|
+
chunk2HRO6CFU_js.__name(Separator2, "Separator");
|
|
2707
2849
|
function ScrollArea({ className, children, ...props }) {
|
|
2708
|
-
return /* @__PURE__ */
|
|
2850
|
+
return /* @__PURE__ */ React26__namespace.createElement(ScrollAreaPrimitive__namespace.Root, {
|
|
2709
2851
|
"data-slot": "scroll-area",
|
|
2710
2852
|
className: cn("relative", className),
|
|
2711
2853
|
...props
|
|
2712
|
-
}, /* @__PURE__ */
|
|
2854
|
+
}, /* @__PURE__ */ React26__namespace.createElement(ScrollAreaPrimitive__namespace.Viewport, {
|
|
2713
2855
|
"data-slot": "scroll-area-viewport",
|
|
2714
2856
|
className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1"
|
|
2715
|
-
}, children), /* @__PURE__ */
|
|
2857
|
+
}, children), /* @__PURE__ */ React26__namespace.createElement(ScrollBar, null), /* @__PURE__ */ React26__namespace.createElement(ScrollAreaPrimitive__namespace.Corner, null));
|
|
2716
2858
|
}
|
|
2717
|
-
|
|
2859
|
+
chunk2HRO6CFU_js.__name(ScrollArea, "ScrollArea");
|
|
2718
2860
|
function ScrollBar({ className, orientation = "vertical", ...props }) {
|
|
2719
|
-
return /* @__PURE__ */
|
|
2861
|
+
return /* @__PURE__ */ React26__namespace.createElement(ScrollAreaPrimitive__namespace.ScrollAreaScrollbar, {
|
|
2720
2862
|
"data-slot": "scroll-area-scrollbar",
|
|
2721
2863
|
orientation,
|
|
2722
2864
|
className: cn("flex touch-none p-px transition-colors select-none", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent", className),
|
|
2723
2865
|
...props
|
|
2724
|
-
}, /* @__PURE__ */
|
|
2866
|
+
}, /* @__PURE__ */ React26__namespace.createElement(ScrollAreaPrimitive__namespace.ScrollAreaThumb, {
|
|
2725
2867
|
"data-slot": "scroll-area-thumb",
|
|
2726
2868
|
className: "bg-border relative flex-1 rounded-full"
|
|
2727
2869
|
}));
|
|
2728
2870
|
}
|
|
2729
|
-
|
|
2871
|
+
chunk2HRO6CFU_js.__name(ScrollBar, "ScrollBar");
|
|
2730
2872
|
function DropdownMenu({ ...props }) {
|
|
2731
|
-
return /* @__PURE__ */
|
|
2873
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Root, {
|
|
2732
2874
|
"data-slot": "dropdown-menu",
|
|
2733
2875
|
...props
|
|
2734
2876
|
});
|
|
2735
2877
|
}
|
|
2736
|
-
|
|
2878
|
+
chunk2HRO6CFU_js.__name(DropdownMenu, "DropdownMenu");
|
|
2737
2879
|
function DropdownMenuPortal({ ...props }) {
|
|
2738
|
-
return /* @__PURE__ */
|
|
2880
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Portal, {
|
|
2739
2881
|
"data-slot": "dropdown-menu-portal",
|
|
2740
2882
|
...props
|
|
2741
2883
|
});
|
|
2742
2884
|
}
|
|
2743
|
-
|
|
2885
|
+
chunk2HRO6CFU_js.__name(DropdownMenuPortal, "DropdownMenuPortal");
|
|
2744
2886
|
function DropdownMenuTrigger({ ...props }) {
|
|
2745
|
-
return /* @__PURE__ */
|
|
2887
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Trigger, {
|
|
2746
2888
|
"data-slot": "dropdown-menu-trigger",
|
|
2747
2889
|
...props
|
|
2748
2890
|
});
|
|
2749
2891
|
}
|
|
2750
|
-
|
|
2892
|
+
chunk2HRO6CFU_js.__name(DropdownMenuTrigger, "DropdownMenuTrigger");
|
|
2751
2893
|
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
2752
|
-
return /* @__PURE__ */
|
|
2894
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Content, {
|
|
2753
2895
|
"data-slot": "dropdown-menu-content",
|
|
2754
2896
|
sideOffset,
|
|
2755
2897
|
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", className),
|
|
2756
2898
|
...props
|
|
2757
2899
|
}));
|
|
2758
2900
|
}
|
|
2759
|
-
|
|
2901
|
+
chunk2HRO6CFU_js.__name(DropdownMenuContent, "DropdownMenuContent");
|
|
2760
2902
|
function DropdownMenuGroup({ ...props }) {
|
|
2761
|
-
return /* @__PURE__ */
|
|
2903
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Group, {
|
|
2762
2904
|
"data-slot": "dropdown-menu-group",
|
|
2763
2905
|
...props
|
|
2764
2906
|
});
|
|
2765
2907
|
}
|
|
2766
|
-
|
|
2908
|
+
chunk2HRO6CFU_js.__name(DropdownMenuGroup, "DropdownMenuGroup");
|
|
2767
2909
|
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
2768
|
-
return /* @__PURE__ */
|
|
2910
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Item, {
|
|
2769
2911
|
"data-slot": "dropdown-menu-item",
|
|
2770
2912
|
"data-inset": inset,
|
|
2771
2913
|
"data-variant": variant,
|
|
@@ -2773,127 +2915,127 @@ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
|
2773
2915
|
...props
|
|
2774
2916
|
});
|
|
2775
2917
|
}
|
|
2776
|
-
|
|
2918
|
+
chunk2HRO6CFU_js.__name(DropdownMenuItem, "DropdownMenuItem");
|
|
2777
2919
|
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
2778
|
-
return /* @__PURE__ */
|
|
2920
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.CheckboxItem, {
|
|
2779
2921
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
2780
2922
|
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2781
2923
|
checked,
|
|
2782
2924
|
...props
|
|
2783
|
-
}, /* @__PURE__ */
|
|
2925
|
+
}, /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
2784
2926
|
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"
|
|
2785
|
-
}, /* @__PURE__ */
|
|
2927
|
+
}, /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React26__namespace.createElement(lucideReact.CheckIcon, {
|
|
2786
2928
|
className: "size-4"
|
|
2787
2929
|
}))), children);
|
|
2788
2930
|
}
|
|
2789
|
-
|
|
2931
|
+
chunk2HRO6CFU_js.__name(DropdownMenuCheckboxItem, "DropdownMenuCheckboxItem");
|
|
2790
2932
|
function DropdownMenuRadioGroup({ ...props }) {
|
|
2791
|
-
return /* @__PURE__ */
|
|
2933
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.RadioGroup, {
|
|
2792
2934
|
"data-slot": "dropdown-menu-radio-group",
|
|
2793
2935
|
...props
|
|
2794
2936
|
});
|
|
2795
2937
|
}
|
|
2796
|
-
|
|
2938
|
+
chunk2HRO6CFU_js.__name(DropdownMenuRadioGroup, "DropdownMenuRadioGroup");
|
|
2797
2939
|
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
2798
|
-
return /* @__PURE__ */
|
|
2940
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.RadioItem, {
|
|
2799
2941
|
"data-slot": "dropdown-menu-radio-item",
|
|
2800
2942
|
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2801
2943
|
...props
|
|
2802
|
-
}, /* @__PURE__ */
|
|
2944
|
+
}, /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
2803
2945
|
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"
|
|
2804
|
-
}, /* @__PURE__ */
|
|
2946
|
+
}, /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React26__namespace.createElement(lucideReact.CircleIcon, {
|
|
2805
2947
|
className: "size-2 fill-current"
|
|
2806
2948
|
}))), children);
|
|
2807
2949
|
}
|
|
2808
|
-
|
|
2950
|
+
chunk2HRO6CFU_js.__name(DropdownMenuRadioItem, "DropdownMenuRadioItem");
|
|
2809
2951
|
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
2810
|
-
return /* @__PURE__ */
|
|
2952
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Label, {
|
|
2811
2953
|
"data-slot": "dropdown-menu-label",
|
|
2812
2954
|
"data-inset": inset,
|
|
2813
2955
|
className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
|
|
2814
2956
|
...props
|
|
2815
2957
|
});
|
|
2816
2958
|
}
|
|
2817
|
-
|
|
2959
|
+
chunk2HRO6CFU_js.__name(DropdownMenuLabel, "DropdownMenuLabel");
|
|
2818
2960
|
function DropdownMenuSeparator({ className, ...props }) {
|
|
2819
|
-
return /* @__PURE__ */
|
|
2961
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Separator, {
|
|
2820
2962
|
"data-slot": "dropdown-menu-separator",
|
|
2821
2963
|
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
2822
2964
|
...props
|
|
2823
2965
|
});
|
|
2824
2966
|
}
|
|
2825
|
-
|
|
2967
|
+
chunk2HRO6CFU_js.__name(DropdownMenuSeparator, "DropdownMenuSeparator");
|
|
2826
2968
|
function DropdownMenuShortcut({ className, ...props }) {
|
|
2827
|
-
return /* @__PURE__ */
|
|
2969
|
+
return /* @__PURE__ */ React26__namespace.createElement("span", {
|
|
2828
2970
|
"data-slot": "dropdown-menu-shortcut",
|
|
2829
2971
|
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
|
|
2830
2972
|
...props
|
|
2831
2973
|
});
|
|
2832
2974
|
}
|
|
2833
|
-
|
|
2975
|
+
chunk2HRO6CFU_js.__name(DropdownMenuShortcut, "DropdownMenuShortcut");
|
|
2834
2976
|
function DropdownMenuSub({ ...props }) {
|
|
2835
|
-
return /* @__PURE__ */
|
|
2977
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.Sub, {
|
|
2836
2978
|
"data-slot": "dropdown-menu-sub",
|
|
2837
2979
|
...props
|
|
2838
2980
|
});
|
|
2839
2981
|
}
|
|
2840
|
-
|
|
2982
|
+
chunk2HRO6CFU_js.__name(DropdownMenuSub, "DropdownMenuSub");
|
|
2841
2983
|
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
2842
|
-
return /* @__PURE__ */
|
|
2984
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.SubTrigger, {
|
|
2843
2985
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
2844
2986
|
"data-inset": inset,
|
|
2845
2987
|
className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2846
2988
|
...props
|
|
2847
|
-
}, children, /* @__PURE__ */
|
|
2989
|
+
}, children, /* @__PURE__ */ React26__namespace.createElement(lucideReact.ChevronRightIcon, {
|
|
2848
2990
|
className: "ml-auto size-4"
|
|
2849
2991
|
}));
|
|
2850
2992
|
}
|
|
2851
|
-
|
|
2993
|
+
chunk2HRO6CFU_js.__name(DropdownMenuSubTrigger, "DropdownMenuSubTrigger");
|
|
2852
2994
|
function DropdownMenuSubContent({ className, ...props }) {
|
|
2853
|
-
return /* @__PURE__ */
|
|
2995
|
+
return /* @__PURE__ */ React26__namespace.createElement(DropdownMenuPrimitive__namespace.SubContent, {
|
|
2854
2996
|
"data-slot": "dropdown-menu-sub-content",
|
|
2855
2997
|
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", className),
|
|
2856
2998
|
...props
|
|
2857
2999
|
});
|
|
2858
3000
|
}
|
|
2859
|
-
|
|
3001
|
+
chunk2HRO6CFU_js.__name(DropdownMenuSubContent, "DropdownMenuSubContent");
|
|
2860
3002
|
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
2861
|
-
return /* @__PURE__ */
|
|
3003
|
+
return /* @__PURE__ */ React26__namespace.createElement(TooltipPrimitive__namespace.Provider, {
|
|
2862
3004
|
"data-slot": "tooltip-provider",
|
|
2863
3005
|
delayDuration,
|
|
2864
3006
|
...props
|
|
2865
3007
|
});
|
|
2866
3008
|
}
|
|
2867
|
-
|
|
3009
|
+
chunk2HRO6CFU_js.__name(TooltipProvider, "TooltipProvider");
|
|
2868
3010
|
function Tooltip({ ...props }) {
|
|
2869
|
-
return /* @__PURE__ */
|
|
3011
|
+
return /* @__PURE__ */ React26__namespace.createElement(TooltipProvider, null, /* @__PURE__ */ React26__namespace.createElement(TooltipPrimitive__namespace.Root, {
|
|
2870
3012
|
"data-slot": "tooltip",
|
|
2871
3013
|
...props
|
|
2872
3014
|
}));
|
|
2873
3015
|
}
|
|
2874
|
-
|
|
3016
|
+
chunk2HRO6CFU_js.__name(Tooltip, "Tooltip");
|
|
2875
3017
|
function TooltipTrigger({ ...props }) {
|
|
2876
|
-
return /* @__PURE__ */
|
|
3018
|
+
return /* @__PURE__ */ React26__namespace.createElement(TooltipPrimitive__namespace.Trigger, {
|
|
2877
3019
|
"data-slot": "tooltip-trigger",
|
|
2878
3020
|
...props
|
|
2879
3021
|
});
|
|
2880
3022
|
}
|
|
2881
|
-
|
|
3023
|
+
chunk2HRO6CFU_js.__name(TooltipTrigger, "TooltipTrigger");
|
|
2882
3024
|
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
2883
|
-
return /* @__PURE__ */
|
|
3025
|
+
return /* @__PURE__ */ React26__namespace.createElement(TooltipPrimitive__namespace.Portal, null, /* @__PURE__ */ React26__namespace.createElement(TooltipPrimitive__namespace.Content, {
|
|
2884
3026
|
"data-slot": "tooltip-content",
|
|
2885
3027
|
sideOffset,
|
|
2886
3028
|
className: cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", className),
|
|
2887
3029
|
...props
|
|
2888
|
-
}, children, /* @__PURE__ */
|
|
3030
|
+
}, children, /* @__PURE__ */ React26__namespace.createElement(TooltipPrimitive__namespace.Arrow, {
|
|
2889
3031
|
className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"
|
|
2890
3032
|
})));
|
|
2891
3033
|
}
|
|
2892
|
-
|
|
3034
|
+
chunk2HRO6CFU_js.__name(TooltipContent, "TooltipContent");
|
|
2893
3035
|
function DataGrid({ data, columns, searchable = false, searchPlaceholder = "Search...", onRowClick, loading = false, emptyMessage = "No data", className }) {
|
|
2894
|
-
const [sorting, setSorting] =
|
|
2895
|
-
const [globalFilter, setGlobalFilter] =
|
|
2896
|
-
const tableColumns =
|
|
3036
|
+
const [sorting, setSorting] = React26.useState([]);
|
|
3037
|
+
const [globalFilter, setGlobalFilter] = React26.useState("");
|
|
3038
|
+
const tableColumns = React26.useMemo(() => columns.map((col) => ({
|
|
2897
3039
|
id: String(col.key),
|
|
2898
3040
|
accessorKey: col.key,
|
|
2899
3041
|
header: col.header,
|
|
@@ -2916,49 +3058,49 @@ function DataGrid({ data, columns, searchable = false, searchPlaceholder = "Sear
|
|
|
2916
3058
|
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
2917
3059
|
getFilteredRowModel: reactTable.getFilteredRowModel()
|
|
2918
3060
|
});
|
|
2919
|
-
return /* @__PURE__ */
|
|
3061
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
2920
3062
|
className: clsx.clsx("lui-datagrid", className)
|
|
2921
|
-
}, searchable && /* @__PURE__ */
|
|
3063
|
+
}, searchable && /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
2922
3064
|
className: "lui-datagrid-search"
|
|
2923
|
-
}, /* @__PURE__ */
|
|
3065
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("input", {
|
|
2924
3066
|
type: "text",
|
|
2925
3067
|
value: globalFilter,
|
|
2926
|
-
onChange: /* @__PURE__ */
|
|
3068
|
+
onChange: /* @__PURE__ */ chunk2HRO6CFU_js.__name((e) => setGlobalFilter(e.target.value), "onChange"),
|
|
2927
3069
|
placeholder: searchPlaceholder,
|
|
2928
3070
|
className: "lui-datagrid-search-input"
|
|
2929
|
-
})), /* @__PURE__ */
|
|
3071
|
+
})), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
2930
3072
|
className: "lui-datagrid-container"
|
|
2931
|
-
}, /* @__PURE__ */
|
|
3073
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("table", {
|
|
2932
3074
|
className: "lui-datagrid-table"
|
|
2933
|
-
}, /* @__PURE__ */
|
|
3075
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ React26__namespace.default.createElement("tr", {
|
|
2934
3076
|
key: headerGroup.id
|
|
2935
|
-
}, headerGroup.headers.map((header) => /* @__PURE__ */
|
|
3077
|
+
}, headerGroup.headers.map((header) => /* @__PURE__ */ React26__namespace.default.createElement("th", {
|
|
2936
3078
|
key: header.id,
|
|
2937
3079
|
className: clsx.clsx("lui-datagrid-th", header.column.getCanSort() && "lui-datagrid-th--sortable"),
|
|
2938
3080
|
onClick: header.column.getToggleSortingHandler(),
|
|
2939
3081
|
style: {
|
|
2940
3082
|
width: header.column.getSize()
|
|
2941
3083
|
}
|
|
2942
|
-
}, /* @__PURE__ */
|
|
3084
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
2943
3085
|
className: "lui-datagrid-th-content"
|
|
2944
|
-
}, reactTable.flexRender(header.column.columnDef.header, header.getContext()), header.column.getIsSorted() && /* @__PURE__ */
|
|
3086
|
+
}, reactTable.flexRender(header.column.columnDef.header, header.getContext()), header.column.getIsSorted() && /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
2945
3087
|
className: "lui-datagrid-sort-icon"
|
|
2946
|
-
}, header.column.getIsSorted() === "asc" ? "\u2191" : "\u2193"))))))), /* @__PURE__ */
|
|
3088
|
+
}, header.column.getIsSorted() === "asc" ? "\u2191" : "\u2193"))))))), /* @__PURE__ */ React26__namespace.default.createElement("tbody", null, loading ? /* @__PURE__ */ React26__namespace.default.createElement("tr", null, /* @__PURE__ */ React26__namespace.default.createElement("td", {
|
|
2947
3089
|
colSpan: columns.length,
|
|
2948
3090
|
className: "lui-datagrid-loading"
|
|
2949
|
-
}, "Loading...")) : table.getRowModel().rows.length === 0 ? /* @__PURE__ */
|
|
3091
|
+
}, "Loading...")) : table.getRowModel().rows.length === 0 ? /* @__PURE__ */ React26__namespace.default.createElement("tr", null, /* @__PURE__ */ React26__namespace.default.createElement("td", {
|
|
2950
3092
|
colSpan: columns.length,
|
|
2951
3093
|
className: "lui-datagrid-empty"
|
|
2952
|
-
}, emptyMessage)) : table.getRowModel().rows.map((row) => /* @__PURE__ */
|
|
3094
|
+
}, emptyMessage)) : table.getRowModel().rows.map((row) => /* @__PURE__ */ React26__namespace.default.createElement("tr", {
|
|
2953
3095
|
key: row.id,
|
|
2954
3096
|
className: clsx.clsx("lui-datagrid-row", onRowClick && "lui-datagrid-row--clickable"),
|
|
2955
|
-
onClick: /* @__PURE__ */
|
|
2956
|
-
}, row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
3097
|
+
onClick: /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => onRowClick?.(row.original), "onClick")
|
|
3098
|
+
}, row.getVisibleCells().map((cell) => /* @__PURE__ */ React26__namespace.default.createElement("td", {
|
|
2957
3099
|
key: cell.id,
|
|
2958
3100
|
className: "lui-datagrid-td"
|
|
2959
3101
|
}, reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())))))))));
|
|
2960
3102
|
}
|
|
2961
|
-
|
|
3103
|
+
chunk2HRO6CFU_js.__name(DataGrid, "DataGrid");
|
|
2962
3104
|
chart_js.Chart.register(chart_js.CategoryScale, chart_js.LinearScale, chart_js.PointElement, chart_js.LineElement, chart_js.BarElement, chart_js.ArcElement, chart_js.Title, chart_js.Tooltip, chart_js.Legend);
|
|
2963
3105
|
function Chart({ type, data, options, height = 300, width = "100%", className }) {
|
|
2964
3106
|
const defaultOptions = {
|
|
@@ -3012,29 +3154,29 @@ function Chart({ type, data, options, height = 300, width = "100%", className })
|
|
|
3012
3154
|
...options?.plugins
|
|
3013
3155
|
}
|
|
3014
3156
|
};
|
|
3015
|
-
return /* @__PURE__ */
|
|
3157
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3016
3158
|
className: clsx.clsx("lui-chart", className),
|
|
3017
3159
|
style: {
|
|
3018
3160
|
height,
|
|
3019
3161
|
width
|
|
3020
3162
|
}
|
|
3021
|
-
}, /* @__PURE__ */
|
|
3163
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(reactChartjs2.Chart, {
|
|
3022
3164
|
type,
|
|
3023
3165
|
data,
|
|
3024
3166
|
options: mergedOptions
|
|
3025
3167
|
}));
|
|
3026
3168
|
}
|
|
3027
|
-
|
|
3169
|
+
chunk2HRO6CFU_js.__name(Chart, "Chart");
|
|
3028
3170
|
function AppShell({ header, sidebar, footer, sidebarPosition = "left", sidebarWidth = 240, autoResize = true, padding = "md", className, children, ...props }) {
|
|
3029
|
-
const containerRef =
|
|
3171
|
+
const containerRef = React26.useRef(null);
|
|
3030
3172
|
const { app } = useMcpApp();
|
|
3031
|
-
|
|
3173
|
+
React26.useEffect(() => {
|
|
3032
3174
|
if (!autoResize || !containerRef.current) return;
|
|
3033
3175
|
if (!app) return;
|
|
3034
3176
|
let lastWidth = 0;
|
|
3035
3177
|
let lastHeight = 0;
|
|
3036
3178
|
let scheduled = false;
|
|
3037
|
-
const sendSizeChanged = /* @__PURE__ */
|
|
3179
|
+
const sendSizeChanged = /* @__PURE__ */ chunk2HRO6CFU_js.__name(() => {
|
|
3038
3180
|
if (scheduled) return;
|
|
3039
3181
|
scheduled = true;
|
|
3040
3182
|
requestAnimationFrame(() => {
|
|
@@ -3067,222 +3209,234 @@ function AppShell({ header, sidebar, footer, sidebarPosition = "left", sidebarWi
|
|
|
3067
3209
|
width: typeof sidebarWidth === "number" ? `${sidebarWidth}px` : sidebarWidth,
|
|
3068
3210
|
flexShrink: 0
|
|
3069
3211
|
};
|
|
3070
|
-
return /* @__PURE__ */
|
|
3212
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3071
3213
|
ref: containerRef,
|
|
3072
3214
|
className: clsx.clsx("lui-app-shell", `lui-app-shell--padding-${padding}`, className),
|
|
3073
3215
|
...props
|
|
3074
|
-
}, header && /* @__PURE__ */
|
|
3216
|
+
}, header && /* @__PURE__ */ React26__namespace.default.createElement("header", {
|
|
3075
3217
|
className: "lui-app-shell-header"
|
|
3076
|
-
}, header), /* @__PURE__ */
|
|
3218
|
+
}, header), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3077
3219
|
className: "lui-app-shell-body"
|
|
3078
|
-
}, sidebar && sidebarPosition === "left" && /* @__PURE__ */
|
|
3220
|
+
}, sidebar && sidebarPosition === "left" && /* @__PURE__ */ React26__namespace.default.createElement("aside", {
|
|
3079
3221
|
className: "lui-app-shell-sidebar",
|
|
3080
3222
|
style: sidebarStyle
|
|
3081
|
-
}, sidebar), /* @__PURE__ */
|
|
3223
|
+
}, sidebar), /* @__PURE__ */ React26__namespace.default.createElement("main", {
|
|
3082
3224
|
className: "lui-app-shell-main"
|
|
3083
|
-
}, children), sidebar && sidebarPosition === "right" && /* @__PURE__ */
|
|
3225
|
+
}, children), sidebar && sidebarPosition === "right" && /* @__PURE__ */ React26__namespace.default.createElement("aside", {
|
|
3084
3226
|
className: "lui-app-shell-sidebar",
|
|
3085
3227
|
style: sidebarStyle
|
|
3086
|
-
}, sidebar)), footer && /* @__PURE__ */
|
|
3228
|
+
}, sidebar)), footer && /* @__PURE__ */ React26__namespace.default.createElement("footer", {
|
|
3087
3229
|
className: "lui-app-shell-footer"
|
|
3088
3230
|
}, footer));
|
|
3089
3231
|
}
|
|
3090
|
-
|
|
3232
|
+
chunk2HRO6CFU_js.__name(AppShell, "AppShell");
|
|
3091
3233
|
function Tabs2({ tabs, defaultValue, value, onValueChange, children, className }) {
|
|
3092
3234
|
const defaultTab = defaultValue || tabs[0]?.value;
|
|
3093
|
-
return /* @__PURE__ */
|
|
3235
|
+
return /* @__PURE__ */ React26__namespace.default.createElement(TabsPrimitive2__namespace.Root, {
|
|
3094
3236
|
className: clsx.clsx("lui-tabs", className),
|
|
3095
3237
|
defaultValue: defaultTab,
|
|
3096
3238
|
value,
|
|
3097
3239
|
onValueChange
|
|
3098
|
-
}, /* @__PURE__ */
|
|
3240
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(TabsPrimitive2__namespace.List, {
|
|
3099
3241
|
className: "lui-tabs-list"
|
|
3100
|
-
}, tabs.map((tab) => /* @__PURE__ */
|
|
3242
|
+
}, tabs.map((tab) => /* @__PURE__ */ React26__namespace.default.createElement(TabsPrimitive2__namespace.Trigger, {
|
|
3101
3243
|
key: tab.value,
|
|
3102
3244
|
value: tab.value,
|
|
3103
3245
|
disabled: tab.disabled,
|
|
3104
3246
|
className: "lui-tabs-trigger"
|
|
3105
3247
|
}, tab.label))), children);
|
|
3106
3248
|
}
|
|
3107
|
-
|
|
3249
|
+
chunk2HRO6CFU_js.__name(Tabs2, "Tabs");
|
|
3108
3250
|
function TabContent({ value, children, className }) {
|
|
3109
|
-
return /* @__PURE__ */
|
|
3251
|
+
return /* @__PURE__ */ React26__namespace.default.createElement(TabsPrimitive2__namespace.Content, {
|
|
3110
3252
|
value,
|
|
3111
3253
|
className: clsx.clsx("lui-tabs-content", className)
|
|
3112
3254
|
}, children);
|
|
3113
3255
|
}
|
|
3114
|
-
|
|
3256
|
+
chunk2HRO6CFU_js.__name(TabContent, "TabContent");
|
|
3115
3257
|
function Modal({ open, defaultOpen, onOpenChange, title, description, children, className, trigger }) {
|
|
3116
|
-
return /* @__PURE__ */
|
|
3258
|
+
return /* @__PURE__ */ React26__namespace.default.createElement(DialogPrimitive__namespace.Root, {
|
|
3117
3259
|
open,
|
|
3118
3260
|
defaultOpen,
|
|
3119
3261
|
onOpenChange
|
|
3120
|
-
}, trigger && /* @__PURE__ */
|
|
3262
|
+
}, trigger && /* @__PURE__ */ React26__namespace.default.createElement(DialogPrimitive__namespace.Trigger, {
|
|
3121
3263
|
asChild: true
|
|
3122
|
-
}, trigger), /* @__PURE__ */
|
|
3264
|
+
}, trigger), /* @__PURE__ */ React26__namespace.default.createElement(DialogPrimitive__namespace.Portal, null, /* @__PURE__ */ React26__namespace.default.createElement(DialogPrimitive__namespace.Overlay, {
|
|
3123
3265
|
className: "lui-modal-overlay"
|
|
3124
|
-
}), /* @__PURE__ */
|
|
3266
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(DialogPrimitive__namespace.Content, {
|
|
3125
3267
|
className: clsx.clsx("lui-modal-content", className)
|
|
3126
|
-
}, title && /* @__PURE__ */
|
|
3268
|
+
}, title && /* @__PURE__ */ React26__namespace.default.createElement(DialogPrimitive__namespace.Title, {
|
|
3127
3269
|
className: "lui-modal-title"
|
|
3128
|
-
}, title), description && /* @__PURE__ */
|
|
3270
|
+
}, title), description && /* @__PURE__ */ React26__namespace.default.createElement(DialogPrimitive__namespace.Description, {
|
|
3129
3271
|
className: "lui-modal-description"
|
|
3130
|
-
}, description), children, /* @__PURE__ */
|
|
3272
|
+
}, description), children, /* @__PURE__ */ React26__namespace.default.createElement(DialogPrimitive__namespace.Close, {
|
|
3131
3273
|
className: "lui-modal-close",
|
|
3132
3274
|
"aria-label": "Close"
|
|
3133
|
-
}, /* @__PURE__ */
|
|
3275
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(CloseIcon, null)))));
|
|
3134
3276
|
}
|
|
3135
|
-
|
|
3277
|
+
chunk2HRO6CFU_js.__name(Modal, "Modal");
|
|
3136
3278
|
function CloseIcon() {
|
|
3137
|
-
return /* @__PURE__ */
|
|
3279
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("svg", {
|
|
3138
3280
|
width: "14",
|
|
3139
3281
|
height: "14",
|
|
3140
3282
|
viewBox: "0 0 14 14",
|
|
3141
3283
|
fill: "none"
|
|
3142
|
-
}, /* @__PURE__ */
|
|
3284
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("path", {
|
|
3143
3285
|
d: "M3.5 3.5L10.5 10.5M10.5 3.5L3.5 10.5",
|
|
3144
3286
|
stroke: "currentColor",
|
|
3145
3287
|
strokeWidth: "1.5",
|
|
3146
3288
|
strokeLinecap: "round"
|
|
3147
3289
|
}));
|
|
3148
3290
|
}
|
|
3149
|
-
|
|
3291
|
+
chunk2HRO6CFU_js.__name(CloseIcon, "CloseIcon");
|
|
3150
3292
|
function CodeBlock({ code, language = "text", showLineNumbers = false, copyable = true, className }) {
|
|
3151
|
-
const [copied, setCopied] =
|
|
3152
|
-
const handleCopy = /* @__PURE__ */
|
|
3293
|
+
const [copied, setCopied] = React26__namespace.default.useState(false);
|
|
3294
|
+
const handleCopy = /* @__PURE__ */ chunk2HRO6CFU_js.__name(async () => {
|
|
3153
3295
|
await navigator.clipboard.writeText(code);
|
|
3154
3296
|
setCopied(true);
|
|
3155
3297
|
setTimeout(() => setCopied(false), 2e3);
|
|
3156
3298
|
}, "handleCopy");
|
|
3157
|
-
return /* @__PURE__ */
|
|
3299
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3158
3300
|
className: clsx.clsx("lui-code-block", className)
|
|
3159
|
-
}, copyable && /* @__PURE__ */
|
|
3301
|
+
}, copyable && /* @__PURE__ */ React26__namespace.default.createElement("button", {
|
|
3160
3302
|
type: "button",
|
|
3161
3303
|
className: "lui-code-block-copy",
|
|
3162
3304
|
onClick: handleCopy,
|
|
3163
3305
|
"aria-label": copied ? "Copied!" : "Copy code"
|
|
3164
|
-
}, copied ? /* @__PURE__ */
|
|
3306
|
+
}, copied ? /* @__PURE__ */ React26__namespace.default.createElement("svg", {
|
|
3165
3307
|
viewBox: "0 0 24 24",
|
|
3166
3308
|
fill: "none",
|
|
3167
3309
|
stroke: "currentColor",
|
|
3168
3310
|
strokeWidth: "2"
|
|
3169
|
-
}, /* @__PURE__ */
|
|
3311
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("polyline", {
|
|
3170
3312
|
points: "20,6 9,17 4,12"
|
|
3171
|
-
})) : /* @__PURE__ */
|
|
3313
|
+
})) : /* @__PURE__ */ React26__namespace.default.createElement("svg", {
|
|
3172
3314
|
viewBox: "0 0 24 24",
|
|
3173
3315
|
fill: "none",
|
|
3174
3316
|
stroke: "currentColor",
|
|
3175
3317
|
strokeWidth: "2"
|
|
3176
|
-
}, /* @__PURE__ */
|
|
3318
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("rect", {
|
|
3177
3319
|
x: "9",
|
|
3178
3320
|
y: "9",
|
|
3179
3321
|
width: "13",
|
|
3180
3322
|
height: "13",
|
|
3181
3323
|
rx: "2",
|
|
3182
3324
|
ry: "2"
|
|
3183
|
-
}), /* @__PURE__ */
|
|
3325
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement("path", {
|
|
3184
3326
|
d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
|
|
3185
|
-
}))), /* @__PURE__ */
|
|
3327
|
+
}))), /* @__PURE__ */ React26__namespace.default.createElement(prismReactRenderer.Highlight, {
|
|
3186
3328
|
theme: prismReactRenderer.themes.nightOwl,
|
|
3187
3329
|
code: code.trim(),
|
|
3188
3330
|
language
|
|
3189
|
-
}, ({ className: hlClassName, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */
|
|
3331
|
+
}, ({ className: hlClassName, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ React26__namespace.default.createElement("pre", {
|
|
3190
3332
|
className: clsx.clsx("lui-code-block-pre", hlClassName),
|
|
3191
3333
|
style
|
|
3192
|
-
}, tokens.map((line, i) => /* @__PURE__ */
|
|
3334
|
+
}, tokens.map((line, i) => /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3193
3335
|
key: i,
|
|
3194
3336
|
...getLineProps({
|
|
3195
3337
|
line
|
|
3196
3338
|
})
|
|
3197
|
-
}, showLineNumbers && /* @__PURE__ */
|
|
3339
|
+
}, showLineNumbers && /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
3198
3340
|
className: "lui-code-block-line-number"
|
|
3199
|
-
}, i + 1), line.map((token, key) => /* @__PURE__ */
|
|
3341
|
+
}, i + 1), line.map((token, key) => /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
3200
3342
|
key,
|
|
3201
3343
|
...getTokenProps({
|
|
3202
3344
|
token
|
|
3203
3345
|
})
|
|
3204
3346
|
})))))));
|
|
3205
3347
|
}
|
|
3206
|
-
|
|
3207
|
-
var Card2 = /* @__PURE__ */
|
|
3208
|
-
return /* @__PURE__ */
|
|
3348
|
+
chunk2HRO6CFU_js.__name(CodeBlock, "CodeBlock");
|
|
3349
|
+
var Card2 = /* @__PURE__ */ React26.forwardRef(({ className, variant = "default", padding = "md", interactive = false, children, ...props }, ref) => {
|
|
3350
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3209
3351
|
ref,
|
|
3210
3352
|
className: clsx.clsx("lui-card", `lui-card--${variant}`, `lui-card--padding-${padding}`, interactive && "lui-card--interactive", className),
|
|
3211
3353
|
...props
|
|
3212
3354
|
}, children);
|
|
3213
3355
|
});
|
|
3214
3356
|
Card2.displayName = "Card";
|
|
3215
|
-
var CardHeader2 = /* @__PURE__ */
|
|
3216
|
-
return /* @__PURE__ */
|
|
3357
|
+
var CardHeader2 = /* @__PURE__ */ React26.forwardRef(({ className, title, description, action, children, ...props }, ref) => {
|
|
3358
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3217
3359
|
ref,
|
|
3218
3360
|
className: clsx.clsx("lui-card-header", className),
|
|
3219
3361
|
...props
|
|
3220
|
-
}, (title || description) && /* @__PURE__ */
|
|
3362
|
+
}, (title || description) && /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3221
3363
|
className: "lui-card-header__text"
|
|
3222
|
-
}, title && /* @__PURE__ */
|
|
3364
|
+
}, title && /* @__PURE__ */ React26__namespace.default.createElement("h3", {
|
|
3223
3365
|
className: "lui-card-header__title"
|
|
3224
|
-
}, title), description && /* @__PURE__ */
|
|
3366
|
+
}, title), description && /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
3225
3367
|
className: "lui-card-header__description"
|
|
3226
|
-
}, description)), action && /* @__PURE__ */
|
|
3368
|
+
}, description)), action && /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3227
3369
|
className: "lui-card-header__action"
|
|
3228
3370
|
}, action), children);
|
|
3229
3371
|
});
|
|
3230
3372
|
CardHeader2.displayName = "CardHeader";
|
|
3231
|
-
var CardContent2 = /* @__PURE__ */
|
|
3232
|
-
return /* @__PURE__ */
|
|
3373
|
+
var CardContent2 = /* @__PURE__ */ React26.forwardRef(({ className, children, ...props }, ref) => {
|
|
3374
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3233
3375
|
ref,
|
|
3234
3376
|
className: clsx.clsx("lui-card-content", className),
|
|
3235
3377
|
...props
|
|
3236
3378
|
}, children);
|
|
3237
3379
|
});
|
|
3238
3380
|
CardContent2.displayName = "CardContent";
|
|
3239
|
-
var CardFooter2 = /* @__PURE__ */
|
|
3240
|
-
return /* @__PURE__ */
|
|
3381
|
+
var CardFooter2 = /* @__PURE__ */ React26.forwardRef(({ className, children, ...props }, ref) => {
|
|
3382
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3241
3383
|
ref,
|
|
3242
3384
|
className: clsx.clsx("lui-card-footer", className),
|
|
3243
3385
|
...props
|
|
3244
3386
|
}, children);
|
|
3245
3387
|
});
|
|
3246
3388
|
CardFooter2.displayName = "CardFooter";
|
|
3247
|
-
var Input2 = /* @__PURE__ */
|
|
3389
|
+
var Input2 = /* @__PURE__ */ React26.forwardRef(({ className, label, helperText, error, size = "md", leftElement, rightElement, fullWidth = false, id, ...props }, ref) => {
|
|
3248
3390
|
const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
|
|
3249
3391
|
const hasError = Boolean(error);
|
|
3250
|
-
return /* @__PURE__ */
|
|
3392
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3251
3393
|
className: clsx.clsx("lui-input-wrapper", fullWidth && "lui-input-wrapper--full-width", className)
|
|
3252
|
-
}, label && /* @__PURE__ */
|
|
3394
|
+
}, label && /* @__PURE__ */ React26__namespace.default.createElement("label", {
|
|
3253
3395
|
htmlFor: inputId,
|
|
3254
3396
|
className: "lui-input-label"
|
|
3255
|
-
}, label), /* @__PURE__ */
|
|
3397
|
+
}, label), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
3256
3398
|
className: clsx.clsx("lui-input-container", `lui-input-container--${size}`, hasError && "lui-input-container--error", leftElement && "lui-input-container--has-left", rightElement && "lui-input-container--has-right")
|
|
3257
|
-
}, leftElement && /* @__PURE__ */
|
|
3399
|
+
}, leftElement && /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
3258
3400
|
className: "lui-input-element lui-input-element--left"
|
|
3259
|
-
}, leftElement), /* @__PURE__ */
|
|
3401
|
+
}, leftElement), /* @__PURE__ */ React26__namespace.default.createElement("input", {
|
|
3260
3402
|
ref,
|
|
3261
3403
|
id: inputId,
|
|
3262
3404
|
className: "lui-input",
|
|
3263
3405
|
"aria-invalid": hasError,
|
|
3264
3406
|
"aria-describedby": error ? `${inputId}-error` : helperText ? `${inputId}-helper` : void 0,
|
|
3265
3407
|
...props
|
|
3266
|
-
}), rightElement && /* @__PURE__ */
|
|
3408
|
+
}), rightElement && /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
3267
3409
|
className: "lui-input-element lui-input-element--right"
|
|
3268
|
-
}, rightElement)), (error || helperText) && /* @__PURE__ */
|
|
3410
|
+
}, rightElement)), (error || helperText) && /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
3269
3411
|
id: error ? `${inputId}-error` : `${inputId}-helper`,
|
|
3270
3412
|
className: clsx.clsx("lui-input-message", error && "lui-input-message--error")
|
|
3271
3413
|
}, error || helperText));
|
|
3272
3414
|
});
|
|
3273
3415
|
Input2.displayName = "Input";
|
|
3274
3416
|
|
|
3417
|
+
Object.defineProperty(exports, "GPTApp", {
|
|
3418
|
+
enumerable: true,
|
|
3419
|
+
get: function () { return chunk2HRO6CFU_js.GPTApp; }
|
|
3420
|
+
});
|
|
3275
3421
|
Object.defineProperty(exports, "UIApp", {
|
|
3276
3422
|
enumerable: true,
|
|
3277
|
-
get: function () { return
|
|
3423
|
+
get: function () { return chunk2HRO6CFU_js.UIApp; }
|
|
3424
|
+
});
|
|
3425
|
+
Object.defineProperty(exports, "getGPTAppMetadata", {
|
|
3426
|
+
enumerable: true,
|
|
3427
|
+
get: function () { return chunk2HRO6CFU_js.getGPTAppMetadata; }
|
|
3428
|
+
});
|
|
3429
|
+
Object.defineProperty(exports, "getGPTAppUri", {
|
|
3430
|
+
enumerable: true,
|
|
3431
|
+
get: function () { return chunk2HRO6CFU_js.getGPTAppUri; }
|
|
3278
3432
|
});
|
|
3279
3433
|
Object.defineProperty(exports, "getUIAppMetadata", {
|
|
3280
3434
|
enumerable: true,
|
|
3281
|
-
get: function () { return
|
|
3435
|
+
get: function () { return chunk2HRO6CFU_js.getUIAppMetadata; }
|
|
3282
3436
|
});
|
|
3283
3437
|
Object.defineProperty(exports, "getUIAppUri", {
|
|
3284
3438
|
enumerable: true,
|
|
3285
|
-
get: function () { return
|
|
3439
|
+
get: function () { return chunk2HRO6CFU_js.getUIAppUri; }
|
|
3286
3440
|
});
|
|
3287
3441
|
Object.defineProperty(exports, "App", {
|
|
3288
3442
|
enumerable: true,
|
|
@@ -3292,6 +3446,30 @@ Object.defineProperty(exports, "PostMessageTransport", {
|
|
|
3292
3446
|
enumerable: true,
|
|
3293
3447
|
get: function () { return extApps.PostMessageTransport; }
|
|
3294
3448
|
});
|
|
3449
|
+
Object.defineProperty(exports, "RESOURCE_MIME_TYPE", {
|
|
3450
|
+
enumerable: true,
|
|
3451
|
+
get: function () { return extApps.RESOURCE_MIME_TYPE; }
|
|
3452
|
+
});
|
|
3453
|
+
Object.defineProperty(exports, "RESOURCE_URI_META_KEY", {
|
|
3454
|
+
enumerable: true,
|
|
3455
|
+
get: function () { return extApps.RESOURCE_URI_META_KEY; }
|
|
3456
|
+
});
|
|
3457
|
+
Object.defineProperty(exports, "applyDocumentTheme", {
|
|
3458
|
+
enumerable: true,
|
|
3459
|
+
get: function () { return extApps.applyDocumentTheme; }
|
|
3460
|
+
});
|
|
3461
|
+
Object.defineProperty(exports, "applyHostFonts", {
|
|
3462
|
+
enumerable: true,
|
|
3463
|
+
get: function () { return extApps.applyHostFonts; }
|
|
3464
|
+
});
|
|
3465
|
+
Object.defineProperty(exports, "applyHostStyleVariables", {
|
|
3466
|
+
enumerable: true,
|
|
3467
|
+
get: function () { return extApps.applyHostStyleVariables; }
|
|
3468
|
+
});
|
|
3469
|
+
Object.defineProperty(exports, "getDocumentTheme", {
|
|
3470
|
+
enumerable: true,
|
|
3471
|
+
get: function () { return extApps.getDocumentTheme; }
|
|
3472
|
+
});
|
|
3295
3473
|
Object.defineProperty(exports, "AppBridge", {
|
|
3296
3474
|
enumerable: true,
|
|
3297
3475
|
get: function () { return appBridge.AppBridge; }
|
|
@@ -3356,6 +3534,7 @@ exports.FormField = FormField;
|
|
|
3356
3534
|
exports.FormItem = FormItem;
|
|
3357
3535
|
exports.FormLabel = FormLabel;
|
|
3358
3536
|
exports.FormMessage = FormMessage;
|
|
3537
|
+
exports.GPTAppProvider = GPTAppProvider;
|
|
3359
3538
|
exports.INITIAL_TOOL_STATE = INITIAL_TOOL_STATE;
|
|
3360
3539
|
exports.Input = Input2;
|
|
3361
3540
|
exports.Label = Label2;
|
|
@@ -3415,6 +3594,8 @@ exports.buttonVariants = buttonVariants;
|
|
|
3415
3594
|
exports.cn = cn;
|
|
3416
3595
|
exports.normalizeToolBinding = normalizeToolBinding;
|
|
3417
3596
|
exports.useFormField = useFormField;
|
|
3597
|
+
exports.useGptApp = useGptApp;
|
|
3598
|
+
exports.useGptTool = useGptTool;
|
|
3418
3599
|
exports.useHostContext = useHostContext;
|
|
3419
3600
|
exports.useMcpApp = useMcpApp;
|
|
3420
3601
|
exports.useMessage = useMessage;
|