mcp-use 1.3.3-canary.2 → 1.3.3-canary.4

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/index.cjs CHANGED
@@ -584,6 +584,8 @@ __export(index_exports, {
584
584
  StdioConnector: () => StdioConnector,
585
585
  Telemetry: () => Telemetry,
586
586
  WebSocketConnector: () => WebSocketConnector,
587
+ WidgetDebugger: () => WidgetDebugger,
588
+ WidgetFullscreenWrapper: () => WidgetFullscreenWrapper,
587
589
  createOAuthMCPConfig: () => createOAuthMCPConfig,
588
590
  createReadableStreamFromGenerator: () => createReadableStreamFromGenerator,
589
591
  loadConfigFile: () => loadConfigFile,
@@ -6116,11 +6118,43 @@ function useOpenAiGlobal(key) {
6116
6118
  }
6117
6119
  __name(useOpenAiGlobal, "useOpenAiGlobal");
6118
6120
  function useWidget(defaultProps) {
6119
- console.log(window?.location?.search, window.openai);
6120
- const isOpenAiAvailable = (0, import_react2.useMemo)(
6121
- () => typeof window !== "undefined" && !!window.openai,
6122
- []
6121
+ const [isOpenAiAvailable, setIsOpenAiAvailable] = (0, import_react2.useState)(
6122
+ () => typeof window !== "undefined" && !!window.openai
6123
6123
  );
6124
+ (0, import_react2.useEffect)(() => {
6125
+ if (typeof window !== "undefined" && window.openai) {
6126
+ setIsOpenAiAvailable(true);
6127
+ return;
6128
+ }
6129
+ const checkInterval = setInterval(() => {
6130
+ if (typeof window !== "undefined" && window.openai) {
6131
+ setIsOpenAiAvailable(true);
6132
+ clearInterval(checkInterval);
6133
+ }
6134
+ }, 100);
6135
+ const handleSetGlobals = /* @__PURE__ */ __name(() => {
6136
+ if (typeof window !== "undefined" && window.openai) {
6137
+ setIsOpenAiAvailable(true);
6138
+ clearInterval(checkInterval);
6139
+ }
6140
+ }, "handleSetGlobals");
6141
+ if (typeof window !== "undefined") {
6142
+ window.addEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobals);
6143
+ }
6144
+ const timeout = setTimeout(() => {
6145
+ clearInterval(checkInterval);
6146
+ if (typeof window !== "undefined") {
6147
+ window.removeEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobals);
6148
+ }
6149
+ }, 5e3);
6150
+ return () => {
6151
+ clearInterval(checkInterval);
6152
+ clearTimeout(timeout);
6153
+ if (typeof window !== "undefined") {
6154
+ window.removeEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobals);
6155
+ }
6156
+ };
6157
+ }, []);
6124
6158
  const provider = (0, import_react2.useMemo)(() => {
6125
6159
  return isOpenAiAvailable ? "openai" : "mcp-ui";
6126
6160
  }, [isOpenAiAvailable]);
@@ -6135,7 +6169,6 @@ function useWidget(defaultProps) {
6135
6169
  toolId: ""
6136
6170
  };
6137
6171
  }, [window?.location?.search]);
6138
- console.log(urlParams);
6139
6172
  const toolInput = provider === "openai" ? useOpenAiGlobal("toolInput") : urlParams.toolInput;
6140
6173
  const toolOutput = provider === "openai" ? useOpenAiGlobal("toolOutput") : urlParams.toolOutput;
6141
6174
  const toolResponseMetadata = useOpenAiGlobal("toolResponseMetadata");
@@ -6243,3 +6276,1213 @@ function useWidgetState(defaultState) {
6243
6276
  return [state, setState];
6244
6277
  }
6245
6278
  __name(useWidgetState, "useWidgetState");
6279
+
6280
+ // src/react/WidgetFullscreenWrapper.tsx
6281
+ var import_react3 = __toESM(require("react"), 1);
6282
+ function WidgetFullscreenWrapper({
6283
+ children,
6284
+ className = "",
6285
+ position = "top-right",
6286
+ attachTo,
6287
+ showLabels = true
6288
+ }) {
6289
+ const { displayMode, requestDisplayMode, theme, safeArea, isAvailable } = useWidget();
6290
+ const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
6291
+ const containerRef = (0, import_react3.useRef)(null);
6292
+ const isFullscreen = displayMode === "fullscreen" && isAvailable;
6293
+ const isPip = displayMode === "pip" && isAvailable;
6294
+ const isDark = theme === "dark";
6295
+ const buttonBg = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.7)";
6296
+ const buttonBgHover = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.9)";
6297
+ const buttonColor = "white";
6298
+ const getPositionStyles = /* @__PURE__ */ __name(() => {
6299
+ const baseOffset = 16;
6300
+ const topOffset = safeArea?.insets?.top ? `${Math.max(baseOffset, safeArea.insets.top + 8)}px` : `${baseOffset}px`;
6301
+ const rightOffset = safeArea?.insets?.right ? `${Math.max(baseOffset, safeArea.insets.right + 8)}px` : `${baseOffset}px`;
6302
+ const bottomOffset = safeArea?.insets?.bottom ? `${Math.max(baseOffset, safeArea.insets.bottom + 8)}px` : `${baseOffset}px`;
6303
+ const leftOffset = safeArea?.insets?.left ? `${Math.max(baseOffset, safeArea.insets.left + 8)}px` : `${baseOffset}px`;
6304
+ const styles = {
6305
+ position: "absolute",
6306
+ zIndex: 1e3,
6307
+ display: "flex",
6308
+ gap: "8px",
6309
+ opacity: isHovered ? 1 : 0,
6310
+ transition: "opacity 0.2s ease-in-out",
6311
+ pointerEvents: isHovered ? "auto" : "none"
6312
+ };
6313
+ switch (position) {
6314
+ case "top-left":
6315
+ styles.top = topOffset;
6316
+ styles.left = leftOffset;
6317
+ break;
6318
+ case "top-center":
6319
+ styles.top = topOffset;
6320
+ styles.left = "50%";
6321
+ styles.transform = "translateX(-50%)";
6322
+ break;
6323
+ case "top-right":
6324
+ styles.top = topOffset;
6325
+ styles.right = rightOffset;
6326
+ break;
6327
+ case "center-left":
6328
+ styles.top = "50%";
6329
+ styles.left = leftOffset;
6330
+ styles.transform = "translateY(-50%)";
6331
+ break;
6332
+ case "center-right":
6333
+ styles.top = "50%";
6334
+ styles.right = rightOffset;
6335
+ styles.transform = "translateY(-50%)";
6336
+ break;
6337
+ case "bottom-left":
6338
+ styles.bottom = bottomOffset;
6339
+ styles.left = leftOffset;
6340
+ break;
6341
+ case "bottom-center":
6342
+ styles.bottom = bottomOffset;
6343
+ styles.left = "50%";
6344
+ styles.transform = "translateX(-50%)";
6345
+ break;
6346
+ case "bottom-right":
6347
+ styles.bottom = bottomOffset;
6348
+ styles.right = rightOffset;
6349
+ break;
6350
+ default:
6351
+ styles.top = topOffset;
6352
+ styles.right = rightOffset;
6353
+ break;
6354
+ }
6355
+ return styles;
6356
+ }, "getPositionStyles");
6357
+ (0, import_react3.useEffect)(() => {
6358
+ if (!attachTo) return;
6359
+ const handleMouseEnter = /* @__PURE__ */ __name(() => setIsHovered(true), "handleMouseEnter");
6360
+ const handleMouseLeave = /* @__PURE__ */ __name(() => setIsHovered(false), "handleMouseLeave");
6361
+ attachTo.addEventListener("mouseenter", handleMouseEnter);
6362
+ attachTo.addEventListener("mouseleave", handleMouseLeave);
6363
+ return () => {
6364
+ attachTo.removeEventListener("mouseenter", handleMouseEnter);
6365
+ attachTo.removeEventListener("mouseleave", handleMouseLeave);
6366
+ };
6367
+ }, [attachTo]);
6368
+ const handleFullscreen = /* @__PURE__ */ __name(async () => {
6369
+ try {
6370
+ await requestDisplayMode("fullscreen");
6371
+ } catch (error) {
6372
+ console.error("Failed to go fullscreen:", error);
6373
+ }
6374
+ }, "handleFullscreen");
6375
+ const handlePip = /* @__PURE__ */ __name(async () => {
6376
+ try {
6377
+ await requestDisplayMode("pip");
6378
+ } catch (error) {
6379
+ console.error("Failed to go pip:", error);
6380
+ }
6381
+ }, "handlePip");
6382
+ const getTooltipStyles = /* @__PURE__ */ __name(() => {
6383
+ const baseStyles = {
6384
+ position: "absolute",
6385
+ padding: "4px 8px",
6386
+ backgroundColor: isDark ? "rgba(0, 0, 0, 0.9)" : "rgba(0, 0, 0, 0.9)",
6387
+ color: "white",
6388
+ borderRadius: "4px",
6389
+ fontSize: "12px",
6390
+ whiteSpace: "nowrap",
6391
+ pointerEvents: "none",
6392
+ transition: "opacity 0.2s ease-in-out"
6393
+ };
6394
+ switch (position) {
6395
+ case "top-right":
6396
+ return {
6397
+ ...baseStyles,
6398
+ top: "100%",
6399
+ right: "0",
6400
+ marginTop: "8px"
6401
+ };
6402
+ case "top-left":
6403
+ return {
6404
+ ...baseStyles,
6405
+ top: "100%",
6406
+ left: "0",
6407
+ marginTop: "8px"
6408
+ };
6409
+ case "top-center":
6410
+ return {
6411
+ ...baseStyles,
6412
+ top: "100%",
6413
+ left: "50%",
6414
+ transform: "translateX(-50%)",
6415
+ marginTop: "8px"
6416
+ };
6417
+ case "bottom-right":
6418
+ return {
6419
+ ...baseStyles,
6420
+ bottom: "100%",
6421
+ right: "0",
6422
+ marginBottom: "8px"
6423
+ };
6424
+ case "bottom-left":
6425
+ return {
6426
+ ...baseStyles,
6427
+ bottom: "100%",
6428
+ left: "0",
6429
+ marginBottom: "8px"
6430
+ };
6431
+ case "bottom-center":
6432
+ return {
6433
+ ...baseStyles,
6434
+ bottom: "100%",
6435
+ left: "50%",
6436
+ transform: "translateX(-50%)",
6437
+ marginBottom: "8px"
6438
+ };
6439
+ case "center-left":
6440
+ return {
6441
+ ...baseStyles,
6442
+ left: "100%",
6443
+ top: "50%",
6444
+ transform: "translateY(-50%)",
6445
+ marginLeft: "8px"
6446
+ };
6447
+ case "center-right":
6448
+ return {
6449
+ ...baseStyles,
6450
+ right: "100%",
6451
+ top: "50%",
6452
+ transform: "translateY(-50%)",
6453
+ marginRight: "8px"
6454
+ };
6455
+ default:
6456
+ return {
6457
+ ...baseStyles,
6458
+ top: "100%",
6459
+ right: "0",
6460
+ marginTop: "8px"
6461
+ };
6462
+ }
6463
+ }, "getTooltipStyles");
6464
+ const IconButton = /* @__PURE__ */ __name(({
6465
+ onClick,
6466
+ label,
6467
+ children: icon
6468
+ }) => {
6469
+ const [isButtonHovered, setIsButtonHovered] = (0, import_react3.useState)(false);
6470
+ const tooltipStyles = getTooltipStyles();
6471
+ return /* @__PURE__ */ import_react3.default.createElement(
6472
+ "button",
6473
+ {
6474
+ style: {
6475
+ padding: "8px",
6476
+ backgroundColor: buttonBg,
6477
+ color: buttonColor,
6478
+ border: "none",
6479
+ borderRadius: "8px",
6480
+ cursor: "pointer",
6481
+ display: "flex",
6482
+ alignItems: "center",
6483
+ justifyContent: "center",
6484
+ width: "32px",
6485
+ height: "32px",
6486
+ transition: "background-color 0.2s",
6487
+ backdropFilter: "blur(8px)",
6488
+ WebkitBackdropFilter: "blur(8px)",
6489
+ boxShadow: isDark ? "0 2px 8px rgba(0, 0, 0, 0.3)" : "0 2px 8px rgba(0, 0, 0, 0.2)",
6490
+ position: "relative"
6491
+ },
6492
+ onMouseEnter: (e) => {
6493
+ e.currentTarget.style.backgroundColor = buttonBgHover;
6494
+ setIsButtonHovered(true);
6495
+ },
6496
+ onMouseLeave: (e) => {
6497
+ e.currentTarget.style.backgroundColor = buttonBg;
6498
+ setIsButtonHovered(false);
6499
+ },
6500
+ onClick,
6501
+ "aria-label": label
6502
+ },
6503
+ /* @__PURE__ */ import_react3.default.createElement(
6504
+ "svg",
6505
+ {
6506
+ xmlns: "http://www.w3.org/2000/svg",
6507
+ width: "16",
6508
+ height: "16",
6509
+ viewBox: "0 0 24 24",
6510
+ fill: "none",
6511
+ stroke: "currentColor",
6512
+ strokeWidth: "2",
6513
+ strokeLinecap: "round",
6514
+ strokeLinejoin: "round",
6515
+ style: { display: "block" }
6516
+ },
6517
+ icon
6518
+ ),
6519
+ showLabels && /* @__PURE__ */ import_react3.default.createElement(
6520
+ "span",
6521
+ {
6522
+ style: {
6523
+ ...tooltipStyles,
6524
+ opacity: isButtonHovered ? 1 : 0
6525
+ }
6526
+ },
6527
+ label
6528
+ )
6529
+ );
6530
+ }, "IconButton");
6531
+ return /* @__PURE__ */ import_react3.default.createElement(
6532
+ "div",
6533
+ {
6534
+ ref: containerRef,
6535
+ className,
6536
+ style: {
6537
+ position: "relative",
6538
+ height: "fit-content"
6539
+ },
6540
+ onMouseEnter: () => !attachTo && setIsHovered(true),
6541
+ onMouseLeave: () => !attachTo && setIsHovered(false)
6542
+ },
6543
+ !isFullscreen && !isPip && /* @__PURE__ */ import_react3.default.createElement("div", { style: getPositionStyles() }, /* @__PURE__ */ import_react3.default.createElement(IconButton, { onClick: handleFullscreen, label: "Fullscreen" }, /* @__PURE__ */ import_react3.default.createElement("path", { d: "M15 3h6v6" }), /* @__PURE__ */ import_react3.default.createElement("path", { d: "m21 3-7 7" }), /* @__PURE__ */ import_react3.default.createElement("path", { d: "m3 21 7-7" }), /* @__PURE__ */ import_react3.default.createElement("path", { d: "M9 21H3v-6" })), /* @__PURE__ */ import_react3.default.createElement(IconButton, { onClick: handlePip, label: "Picture in Picture" }, /* @__PURE__ */ import_react3.default.createElement("path", { d: "M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4" }), /* @__PURE__ */ import_react3.default.createElement("rect", { width: "10", height: "7", x: "12", y: "13", rx: "2" }))),
6544
+ children
6545
+ );
6546
+ }
6547
+ __name(WidgetFullscreenWrapper, "WidgetFullscreenWrapper");
6548
+
6549
+ // src/react/WidgetDebugger.tsx
6550
+ var import_react4 = __toESM(require("react"), 1);
6551
+ function WidgetDebugger({
6552
+ children,
6553
+ className = "",
6554
+ position = "top-right",
6555
+ attachTo,
6556
+ showLabels = true
6557
+ }) {
6558
+ const {
6559
+ props,
6560
+ output,
6561
+ metadata,
6562
+ state,
6563
+ theme,
6564
+ displayMode,
6565
+ safeArea,
6566
+ maxHeight,
6567
+ userAgent,
6568
+ locale,
6569
+ isAvailable,
6570
+ callTool,
6571
+ sendFollowUpMessage,
6572
+ openExternal,
6573
+ requestDisplayMode,
6574
+ setState
6575
+ } = useWidget();
6576
+ const [isHovered, setIsHovered] = (0, import_react4.useState)(false);
6577
+ const [isOverlayOpen, setIsOverlayOpen] = (0, import_react4.useState)(false);
6578
+ const containerRef = (0, import_react4.useRef)(null);
6579
+ const overlayRef = (0, import_react4.useRef)(null);
6580
+ const [windowOpenAiKeys, setWindowOpenAiKeys] = (0, import_react4.useState)([]);
6581
+ const [actionResult, setActionResult] = (0, import_react4.useState)("");
6582
+ const [toolName, setToolName] = (0, import_react4.useState)("get-my-city");
6583
+ const [toolArgs, setToolArgs] = (0, import_react4.useState)("{}");
6584
+ const [followUpMessage, setFollowUpMessage] = (0, import_react4.useState)(
6585
+ "Test follow-up message"
6586
+ );
6587
+ const [externalUrl, setExternalUrl] = (0, import_react4.useState)(
6588
+ "https://docs.mcp-use.com"
6589
+ );
6590
+ const isFullscreen = displayMode === "fullscreen" && isAvailable;
6591
+ const isPip = displayMode === "pip" && isAvailable;
6592
+ (0, import_react4.useEffect)(() => {
6593
+ const timeoutId = setTimeout(() => {
6594
+ if (typeof window !== "undefined" && window.openai) {
6595
+ try {
6596
+ const keys = Object.keys(window.openai);
6597
+ setWindowOpenAiKeys(keys);
6598
+ } catch (e) {
6599
+ setWindowOpenAiKeys([]);
6600
+ }
6601
+ } else {
6602
+ setWindowOpenAiKeys([]);
6603
+ }
6604
+ }, 100);
6605
+ return () => clearTimeout(timeoutId);
6606
+ }, []);
6607
+ const isDark = theme === "dark";
6608
+ const buttonBg = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.7)";
6609
+ const buttonBgHover = isDark ? "rgba(255, 255, 255, 0.2)" : "rgba(0, 0, 0, 0.9)";
6610
+ const buttonColor = "white";
6611
+ const getPositionStyles = /* @__PURE__ */ __name(() => {
6612
+ const baseOffset = 16;
6613
+ const topOffset = safeArea?.insets?.top ? `${Math.max(baseOffset, safeArea.insets.top + 8)}px` : `${baseOffset}px`;
6614
+ const rightOffset = safeArea?.insets?.right ? `${Math.max(baseOffset, safeArea.insets.right + 8)}px` : `${baseOffset}px`;
6615
+ const bottomOffset = safeArea?.insets?.bottom ? `${Math.max(baseOffset, safeArea.insets.bottom + 8)}px` : `${baseOffset}px`;
6616
+ const leftOffset = safeArea?.insets?.left ? `${Math.max(baseOffset, safeArea.insets.left + 8)}px` : `${baseOffset}px`;
6617
+ const styles = {
6618
+ position: "absolute",
6619
+ zIndex: 1e3,
6620
+ display: "flex",
6621
+ gap: "8px",
6622
+ opacity: isHovered ? 1 : 0,
6623
+ transition: "opacity 0.2s ease-in-out",
6624
+ pointerEvents: isHovered ? "auto" : "none"
6625
+ };
6626
+ switch (position) {
6627
+ case "top-left":
6628
+ styles.top = topOffset;
6629
+ styles.left = leftOffset;
6630
+ break;
6631
+ case "top-center":
6632
+ styles.top = topOffset;
6633
+ styles.left = "50%";
6634
+ styles.transform = "translateX(-50%)";
6635
+ break;
6636
+ case "top-right":
6637
+ styles.top = topOffset;
6638
+ styles.right = rightOffset;
6639
+ if (!isFullscreen && !isPip) {
6640
+ styles.right = `calc(${rightOffset} + 80px)`;
6641
+ }
6642
+ break;
6643
+ case "center-left":
6644
+ styles.top = "50%";
6645
+ styles.left = leftOffset;
6646
+ styles.transform = "translateY(-50%)";
6647
+ break;
6648
+ case "center-right":
6649
+ styles.top = "50%";
6650
+ styles.right = rightOffset;
6651
+ styles.transform = "translateY(-50%)";
6652
+ break;
6653
+ case "bottom-left":
6654
+ styles.bottom = bottomOffset;
6655
+ styles.left = leftOffset;
6656
+ break;
6657
+ case "bottom-center":
6658
+ styles.bottom = bottomOffset;
6659
+ styles.left = "50%";
6660
+ styles.transform = "translateX(-50%)";
6661
+ break;
6662
+ case "bottom-right":
6663
+ styles.bottom = bottomOffset;
6664
+ styles.right = rightOffset;
6665
+ break;
6666
+ default:
6667
+ styles.top = topOffset;
6668
+ styles.right = rightOffset;
6669
+ break;
6670
+ }
6671
+ return styles;
6672
+ }, "getPositionStyles");
6673
+ (0, import_react4.useEffect)(() => {
6674
+ if (!attachTo) return;
6675
+ const handleMouseEnter = /* @__PURE__ */ __name(() => setIsHovered(true), "handleMouseEnter");
6676
+ const handleMouseLeave = /* @__PURE__ */ __name(() => setIsHovered(false), "handleMouseLeave");
6677
+ attachTo.addEventListener("mouseenter", handleMouseEnter);
6678
+ attachTo.addEventListener("mouseleave", handleMouseLeave);
6679
+ return () => {
6680
+ attachTo.removeEventListener("mouseenter", handleMouseEnter);
6681
+ attachTo.removeEventListener("mouseleave", handleMouseLeave);
6682
+ };
6683
+ }, [attachTo]);
6684
+ (0, import_react4.useEffect)(() => {
6685
+ if (!isOverlayOpen) return;
6686
+ const handleClickOutside = /* @__PURE__ */ __name((event) => {
6687
+ if (overlayRef.current && !overlayRef.current.contains(event.target)) {
6688
+ setIsOverlayOpen(false);
6689
+ }
6690
+ }, "handleClickOutside");
6691
+ document.addEventListener("mousedown", handleClickOutside);
6692
+ return () => {
6693
+ document.removeEventListener("mousedown", handleClickOutside);
6694
+ };
6695
+ }, [isOverlayOpen]);
6696
+ (0, import_react4.useEffect)(() => {
6697
+ if (isOverlayOpen) {
6698
+ document.body.style.overflow = "hidden";
6699
+ } else {
6700
+ document.body.style.overflow = "";
6701
+ }
6702
+ return () => {
6703
+ document.body.style.overflow = "";
6704
+ };
6705
+ }, [isOverlayOpen]);
6706
+ const handleToggleOverlay = /* @__PURE__ */ __name(() => {
6707
+ setIsOverlayOpen(!isOverlayOpen);
6708
+ }, "handleToggleOverlay");
6709
+ const handleCallTool = /* @__PURE__ */ __name(async () => {
6710
+ try {
6711
+ setActionResult("Calling tool...");
6712
+ const args = toolArgs.trim() ? JSON.parse(toolArgs) : {};
6713
+ const result = await callTool(toolName, args);
6714
+ setActionResult(`Success: ${JSON.stringify(result, null, 2)}`);
6715
+ } catch (error) {
6716
+ setActionResult(`Error: ${error.message}`);
6717
+ }
6718
+ }, "handleCallTool");
6719
+ const handleSendFollowUpMessage = /* @__PURE__ */ __name(async () => {
6720
+ try {
6721
+ setActionResult("Sending follow-up message...");
6722
+ await sendFollowUpMessage(followUpMessage);
6723
+ setActionResult("Follow-up message sent successfully");
6724
+ } catch (error) {
6725
+ setActionResult(`Error: ${error.message}`);
6726
+ }
6727
+ }, "handleSendFollowUpMessage");
6728
+ const handleOpenExternal = /* @__PURE__ */ __name(() => {
6729
+ try {
6730
+ openExternal(externalUrl);
6731
+ setActionResult(`Opened external link: ${externalUrl}`);
6732
+ } catch (error) {
6733
+ setActionResult(`Error: ${error.message}`);
6734
+ }
6735
+ }, "handleOpenExternal");
6736
+ const handleRequestDisplayMode = /* @__PURE__ */ __name(async (mode) => {
6737
+ try {
6738
+ setActionResult(`Requesting display mode: ${mode}...`);
6739
+ const result = await requestDisplayMode(mode);
6740
+ setActionResult(`Display mode granted: ${result.mode}`);
6741
+ } catch (error) {
6742
+ setActionResult(`Error: ${error.message}`);
6743
+ }
6744
+ }, "handleRequestDisplayMode");
6745
+ const handleSetState = /* @__PURE__ */ __name(async () => {
6746
+ try {
6747
+ const newState = state ? { ...state, debugTimestamp: (/* @__PURE__ */ new Date()).toISOString() } : { debugTimestamp: (/* @__PURE__ */ new Date()).toISOString() };
6748
+ setActionResult("Setting state...");
6749
+ await setState(newState);
6750
+ setActionResult(`State updated: ${JSON.stringify(newState, null, 2)}`);
6751
+ } catch (error) {
6752
+ setActionResult(`Error: ${error.message}`);
6753
+ }
6754
+ }, "handleSetState");
6755
+ const getTooltipStyles = /* @__PURE__ */ __name(() => {
6756
+ const baseStyles = {
6757
+ position: "absolute",
6758
+ padding: "4px 8px",
6759
+ backgroundColor: "rgba(0, 0, 0, 0.9)",
6760
+ color: "white",
6761
+ borderRadius: "4px",
6762
+ fontSize: "12px",
6763
+ whiteSpace: "nowrap",
6764
+ pointerEvents: "none",
6765
+ transition: "opacity 0.2s ease-in-out"
6766
+ };
6767
+ switch (position) {
6768
+ case "top-right":
6769
+ return {
6770
+ ...baseStyles,
6771
+ top: "100%",
6772
+ right: "0",
6773
+ marginTop: "8px"
6774
+ };
6775
+ case "top-left":
6776
+ return {
6777
+ ...baseStyles,
6778
+ top: "100%",
6779
+ left: "0",
6780
+ marginTop: "8px"
6781
+ };
6782
+ case "top-center":
6783
+ return {
6784
+ ...baseStyles,
6785
+ top: "100%",
6786
+ left: "50%",
6787
+ transform: "translateX(-50%)",
6788
+ marginTop: "8px"
6789
+ };
6790
+ case "bottom-right":
6791
+ return {
6792
+ ...baseStyles,
6793
+ bottom: "100%",
6794
+ right: "0",
6795
+ marginBottom: "8px"
6796
+ };
6797
+ case "bottom-left":
6798
+ return {
6799
+ ...baseStyles,
6800
+ bottom: "100%",
6801
+ left: "0",
6802
+ marginBottom: "8px"
6803
+ };
6804
+ case "bottom-center":
6805
+ return {
6806
+ ...baseStyles,
6807
+ bottom: "100%",
6808
+ left: "50%",
6809
+ transform: "translateX(-50%)",
6810
+ marginBottom: "8px"
6811
+ };
6812
+ case "center-left":
6813
+ return {
6814
+ ...baseStyles,
6815
+ left: "100%",
6816
+ top: "50%",
6817
+ transform: "translateY(-50%)",
6818
+ marginLeft: "8px"
6819
+ };
6820
+ case "center-right":
6821
+ return {
6822
+ ...baseStyles,
6823
+ right: "100%",
6824
+ top: "50%",
6825
+ transform: "translateY(-50%)",
6826
+ marginRight: "8px"
6827
+ };
6828
+ default:
6829
+ return {
6830
+ ...baseStyles,
6831
+ top: "100%",
6832
+ right: "0",
6833
+ marginTop: "8px"
6834
+ };
6835
+ }
6836
+ }, "getTooltipStyles");
6837
+ const IconButton = /* @__PURE__ */ __name(({
6838
+ onClick,
6839
+ label,
6840
+ children: icon
6841
+ }) => {
6842
+ const [isButtonHovered, setIsButtonHovered] = (0, import_react4.useState)(false);
6843
+ const tooltipStyles = getTooltipStyles();
6844
+ return /* @__PURE__ */ import_react4.default.createElement(
6845
+ "button",
6846
+ {
6847
+ style: {
6848
+ padding: "8px",
6849
+ backgroundColor: buttonBg,
6850
+ color: buttonColor,
6851
+ border: "none",
6852
+ borderRadius: "8px",
6853
+ cursor: "pointer",
6854
+ display: "flex",
6855
+ alignItems: "center",
6856
+ justifyContent: "center",
6857
+ width: "32px",
6858
+ height: "32px",
6859
+ transition: "background-color 0.2s",
6860
+ backdropFilter: "blur(8px)",
6861
+ WebkitBackdropFilter: "blur(8px)",
6862
+ boxShadow: isDark ? "0 2px 8px rgba(0, 0, 0, 0.3)" : "0 2px 8px rgba(0, 0, 0, 0.2)",
6863
+ position: "relative"
6864
+ },
6865
+ onMouseEnter: (e) => {
6866
+ e.currentTarget.style.backgroundColor = buttonBgHover;
6867
+ setIsButtonHovered(true);
6868
+ },
6869
+ onMouseLeave: (e) => {
6870
+ e.currentTarget.style.backgroundColor = buttonBg;
6871
+ setIsButtonHovered(false);
6872
+ },
6873
+ onClick,
6874
+ "aria-label": label
6875
+ },
6876
+ /* @__PURE__ */ import_react4.default.createElement(
6877
+ "svg",
6878
+ {
6879
+ xmlns: "http://www.w3.org/2000/svg",
6880
+ width: "16",
6881
+ height: "16",
6882
+ viewBox: "0 0 24 24",
6883
+ fill: "none",
6884
+ stroke: "currentColor",
6885
+ strokeWidth: "2",
6886
+ strokeLinecap: "round",
6887
+ strokeLinejoin: "round",
6888
+ style: { display: "block" }
6889
+ },
6890
+ icon
6891
+ ),
6892
+ showLabels && /* @__PURE__ */ import_react4.default.createElement(
6893
+ "span",
6894
+ {
6895
+ style: {
6896
+ ...tooltipStyles,
6897
+ opacity: isButtonHovered ? 1 : 0
6898
+ }
6899
+ },
6900
+ label
6901
+ )
6902
+ );
6903
+ }, "IconButton");
6904
+ const formatValue = /* @__PURE__ */ __name((value) => {
6905
+ if (value === null) return "null";
6906
+ if (value === void 0) return "undefined";
6907
+ if (typeof value === "object") {
6908
+ try {
6909
+ return JSON.stringify(value, null, 2);
6910
+ } catch {
6911
+ return String(value);
6912
+ }
6913
+ }
6914
+ return String(value);
6915
+ }, "formatValue");
6916
+ const formatUserAgent = /* @__PURE__ */ __name((ua) => {
6917
+ if (!ua) return "N/A";
6918
+ return `${ua.device?.type || "unknown"}`;
6919
+ }, "formatUserAgent");
6920
+ const formatSafeArea = /* @__PURE__ */ __name((sa) => {
6921
+ if (!sa?.insets) return "N/A";
6922
+ const { top, bottom, left, right } = sa.insets;
6923
+ return `T:${top} B:${bottom} L:${left} R:${right}`;
6924
+ }, "formatSafeArea");
6925
+ return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(
6926
+ "div",
6927
+ {
6928
+ ref: containerRef,
6929
+ className,
6930
+ style: {
6931
+ position: "relative",
6932
+ height: "fit-content"
6933
+ },
6934
+ onMouseEnter: () => !attachTo && setIsHovered(true),
6935
+ onMouseLeave: () => !attachTo && setIsHovered(false)
6936
+ },
6937
+ /* @__PURE__ */ import_react4.default.createElement("div", { style: getPositionStyles() }, /* @__PURE__ */ import_react4.default.createElement(IconButton, { onClick: handleToggleOverlay, label: "Debug Info" }, /* @__PURE__ */ import_react4.default.createElement("path", { d: "M12 20v-9" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M14.12 3.88 16 2" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M21 21a4 4 0 0 0-3.81-4" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M21 5a4 4 0 0 1-3.55 3.97" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M22 13h-4" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M3 21a4 4 0 0 1 3.81-4" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M3 5a4 4 0 0 0 3.55 3.97" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M6 13H2" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "m8 2 1.88 1.88" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M9 7.13V6a3 3 0 1 1 6 0v1.13" }))),
6938
+ children
6939
+ ), isOverlayOpen && /* @__PURE__ */ import_react4.default.createElement(
6940
+ "div",
6941
+ {
6942
+ ref: overlayRef,
6943
+ style: {
6944
+ position: "fixed",
6945
+ top: 0,
6946
+ left: 0,
6947
+ right: 0,
6948
+ bottom: 0,
6949
+ backgroundColor: "#000000",
6950
+ color: "#ffffff",
6951
+ fontFamily: "monospace",
6952
+ fontSize: "12px",
6953
+ zIndex: 1e4,
6954
+ overflow: "auto",
6955
+ padding: "16px"
6956
+ },
6957
+ onClick: (e) => {
6958
+ if (e.target === overlayRef.current) {
6959
+ setIsOverlayOpen(false);
6960
+ }
6961
+ }
6962
+ },
6963
+ /* @__PURE__ */ import_react4.default.createElement(
6964
+ "button",
6965
+ {
6966
+ onClick: () => setIsOverlayOpen(false),
6967
+ style: {
6968
+ position: "absolute",
6969
+ top: "16px",
6970
+ right: "16px",
6971
+ backgroundColor: "rgba(255, 255, 255, 0.1)",
6972
+ color: "#ffffff",
6973
+ border: "none",
6974
+ borderRadius: "4px",
6975
+ width: "32px",
6976
+ height: "32px",
6977
+ cursor: "pointer",
6978
+ display: "flex",
6979
+ alignItems: "center",
6980
+ justifyContent: "center",
6981
+ fontSize: "18px",
6982
+ lineHeight: 1
6983
+ },
6984
+ "aria-label": "Close"
6985
+ },
6986
+ "\xD7"
6987
+ ),
6988
+ /* @__PURE__ */ import_react4.default.createElement(
6989
+ "div",
6990
+ {
6991
+ style: { maxWidth: "1200px", margin: "0 auto", paddingTop: "40px" }
6992
+ },
6993
+ /* @__PURE__ */ import_react4.default.createElement(
6994
+ "h1",
6995
+ {
6996
+ style: {
6997
+ fontSize: "18px",
6998
+ fontWeight: "bold",
6999
+ marginBottom: "16px",
7000
+ borderBottom: "1px solid #333",
7001
+ paddingBottom: "8px"
7002
+ }
7003
+ },
7004
+ "Debug Info"
7005
+ ),
7006
+ /* @__PURE__ */ import_react4.default.createElement(
7007
+ "table",
7008
+ {
7009
+ style: {
7010
+ width: "100%",
7011
+ borderCollapse: "collapse",
7012
+ borderSpacing: 0
7013
+ }
7014
+ },
7015
+ /* @__PURE__ */ import_react4.default.createElement("tbody", null, /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7016
+ "td",
7017
+ {
7018
+ style: {
7019
+ padding: "8px",
7020
+ fontWeight: "bold",
7021
+ width: "200px",
7022
+ verticalAlign: "top"
7023
+ }
7024
+ },
7025
+ "Props"
7026
+ ), /* @__PURE__ */ import_react4.default.createElement(
7027
+ "td",
7028
+ {
7029
+ style: {
7030
+ padding: "8px",
7031
+ whiteSpace: "pre-wrap",
7032
+ wordBreak: "break-all"
7033
+ }
7034
+ },
7035
+ formatValue(props)
7036
+ )), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7037
+ "td",
7038
+ {
7039
+ style: {
7040
+ padding: "8px",
7041
+ fontWeight: "bold",
7042
+ width: "200px",
7043
+ verticalAlign: "top"
7044
+ }
7045
+ },
7046
+ "Output"
7047
+ ), /* @__PURE__ */ import_react4.default.createElement(
7048
+ "td",
7049
+ {
7050
+ style: {
7051
+ padding: "8px",
7052
+ whiteSpace: "pre-wrap",
7053
+ wordBreak: "break-all"
7054
+ }
7055
+ },
7056
+ formatValue(output)
7057
+ )), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7058
+ "td",
7059
+ {
7060
+ style: {
7061
+ padding: "8px",
7062
+ fontWeight: "bold",
7063
+ width: "200px",
7064
+ verticalAlign: "top"
7065
+ }
7066
+ },
7067
+ "Metadata"
7068
+ ), /* @__PURE__ */ import_react4.default.createElement(
7069
+ "td",
7070
+ {
7071
+ style: {
7072
+ padding: "8px",
7073
+ whiteSpace: "pre-wrap",
7074
+ wordBreak: "break-all"
7075
+ }
7076
+ },
7077
+ formatValue(metadata)
7078
+ )), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7079
+ "td",
7080
+ {
7081
+ style: {
7082
+ padding: "8px",
7083
+ fontWeight: "bold",
7084
+ width: "200px",
7085
+ verticalAlign: "top"
7086
+ }
7087
+ },
7088
+ "State"
7089
+ ), /* @__PURE__ */ import_react4.default.createElement(
7090
+ "td",
7091
+ {
7092
+ style: {
7093
+ padding: "8px",
7094
+ whiteSpace: "pre-wrap",
7095
+ wordBreak: "break-all"
7096
+ }
7097
+ },
7098
+ formatValue(state)
7099
+ )), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7100
+ "td",
7101
+ {
7102
+ style: {
7103
+ padding: "8px",
7104
+ fontWeight: "bold",
7105
+ width: "200px",
7106
+ verticalAlign: "top"
7107
+ }
7108
+ },
7109
+ "Theme"
7110
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, theme)), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7111
+ "td",
7112
+ {
7113
+ style: {
7114
+ padding: "8px",
7115
+ fontWeight: "bold",
7116
+ width: "200px",
7117
+ verticalAlign: "top"
7118
+ }
7119
+ },
7120
+ "Display Mode"
7121
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, displayMode)), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7122
+ "td",
7123
+ {
7124
+ style: {
7125
+ padding: "8px",
7126
+ fontWeight: "bold",
7127
+ width: "200px",
7128
+ verticalAlign: "top"
7129
+ }
7130
+ },
7131
+ "Locale"
7132
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, locale)), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7133
+ "td",
7134
+ {
7135
+ style: {
7136
+ padding: "8px",
7137
+ fontWeight: "bold",
7138
+ width: "200px",
7139
+ verticalAlign: "top"
7140
+ }
7141
+ },
7142
+ "Max Height"
7143
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, maxHeight, "px")), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7144
+ "td",
7145
+ {
7146
+ style: {
7147
+ padding: "8px",
7148
+ fontWeight: "bold",
7149
+ width: "200px",
7150
+ verticalAlign: "top"
7151
+ }
7152
+ },
7153
+ "User Agent"
7154
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, formatUserAgent(userAgent))), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7155
+ "td",
7156
+ {
7157
+ style: {
7158
+ padding: "8px",
7159
+ fontWeight: "bold",
7160
+ width: "200px",
7161
+ verticalAlign: "top"
7162
+ }
7163
+ },
7164
+ "Safe Area"
7165
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, formatSafeArea(safeArea))), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7166
+ "td",
7167
+ {
7168
+ style: {
7169
+ padding: "8px",
7170
+ fontWeight: "bold",
7171
+ width: "200px",
7172
+ verticalAlign: "top"
7173
+ }
7174
+ },
7175
+ "API Available"
7176
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, isAvailable ? "Yes" : "No")), /* @__PURE__ */ import_react4.default.createElement("tr", { style: { borderBottom: "1px solid #333" } }, /* @__PURE__ */ import_react4.default.createElement(
7177
+ "td",
7178
+ {
7179
+ style: {
7180
+ padding: "8px",
7181
+ fontWeight: "bold",
7182
+ width: "200px",
7183
+ verticalAlign: "top"
7184
+ }
7185
+ },
7186
+ "window.openai Keys"
7187
+ ), /* @__PURE__ */ import_react4.default.createElement("td", { style: { padding: "8px" } }, windowOpenAiKeys.length > 0 ? windowOpenAiKeys.join(", ") : "N/A")))
7188
+ ),
7189
+ /* @__PURE__ */ import_react4.default.createElement(
7190
+ "h2",
7191
+ {
7192
+ style: {
7193
+ fontSize: "16px",
7194
+ fontWeight: "bold",
7195
+ marginTop: "32px",
7196
+ marginBottom: "16px",
7197
+ borderBottom: "1px solid #333",
7198
+ paddingBottom: "8px"
7199
+ }
7200
+ },
7201
+ "Actions"
7202
+ ),
7203
+ /* @__PURE__ */ import_react4.default.createElement(
7204
+ "div",
7205
+ {
7206
+ style: { display: "flex", flexDirection: "column", gap: "12px" }
7207
+ },
7208
+ /* @__PURE__ */ import_react4.default.createElement(
7209
+ "div",
7210
+ {
7211
+ style: { display: "flex", gap: "8px", alignItems: "center" }
7212
+ },
7213
+ /* @__PURE__ */ import_react4.default.createElement(
7214
+ "input",
7215
+ {
7216
+ type: "text",
7217
+ value: toolName,
7218
+ onChange: (e) => setToolName(e.target.value),
7219
+ placeholder: "Tool name",
7220
+ style: {
7221
+ padding: "6px 8px",
7222
+ backgroundColor: "#1a1a1a",
7223
+ color: "#ffffff",
7224
+ border: "1px solid #333",
7225
+ borderRadius: "4px",
7226
+ fontFamily: "monospace",
7227
+ fontSize: "12px",
7228
+ width: "150px"
7229
+ }
7230
+ }
7231
+ ),
7232
+ /* @__PURE__ */ import_react4.default.createElement(
7233
+ "input",
7234
+ {
7235
+ type: "text",
7236
+ value: toolArgs,
7237
+ onChange: (e) => setToolArgs(e.target.value),
7238
+ placeholder: '{"key": "value"}',
7239
+ style: {
7240
+ padding: "6px 8px",
7241
+ backgroundColor: "#1a1a1a",
7242
+ color: "#ffffff",
7243
+ border: "1px solid #333",
7244
+ borderRadius: "4px",
7245
+ fontFamily: "monospace",
7246
+ fontSize: "12px",
7247
+ flex: 1
7248
+ }
7249
+ }
7250
+ ),
7251
+ /* @__PURE__ */ import_react4.default.createElement(
7252
+ "button",
7253
+ {
7254
+ onClick: handleCallTool,
7255
+ style: {
7256
+ padding: "6px 12px",
7257
+ backgroundColor: "#333",
7258
+ color: "#ffffff",
7259
+ border: "1px solid #555",
7260
+ borderRadius: "4px",
7261
+ cursor: "pointer",
7262
+ fontFamily: "monospace",
7263
+ fontSize: "12px"
7264
+ }
7265
+ },
7266
+ "Call Tool"
7267
+ )
7268
+ ),
7269
+ /* @__PURE__ */ import_react4.default.createElement(
7270
+ "div",
7271
+ {
7272
+ style: { display: "flex", gap: "8px", alignItems: "center" }
7273
+ },
7274
+ /* @__PURE__ */ import_react4.default.createElement(
7275
+ "input",
7276
+ {
7277
+ type: "text",
7278
+ value: followUpMessage,
7279
+ onChange: (e) => setFollowUpMessage(e.target.value),
7280
+ placeholder: "Follow-up message",
7281
+ style: {
7282
+ padding: "6px 8px",
7283
+ backgroundColor: "#1a1a1a",
7284
+ color: "#ffffff",
7285
+ border: "1px solid #333",
7286
+ borderRadius: "4px",
7287
+ fontFamily: "monospace",
7288
+ fontSize: "12px",
7289
+ flex: 1
7290
+ }
7291
+ }
7292
+ ),
7293
+ /* @__PURE__ */ import_react4.default.createElement(
7294
+ "button",
7295
+ {
7296
+ onClick: handleSendFollowUpMessage,
7297
+ style: {
7298
+ padding: "6px 12px",
7299
+ backgroundColor: "#333",
7300
+ color: "#ffffff",
7301
+ border: "1px solid #555",
7302
+ borderRadius: "4px",
7303
+ cursor: "pointer",
7304
+ fontFamily: "monospace",
7305
+ fontSize: "12px"
7306
+ }
7307
+ },
7308
+ "Send Follow-Up"
7309
+ )
7310
+ ),
7311
+ /* @__PURE__ */ import_react4.default.createElement(
7312
+ "div",
7313
+ {
7314
+ style: { display: "flex", gap: "8px", alignItems: "center" }
7315
+ },
7316
+ /* @__PURE__ */ import_react4.default.createElement(
7317
+ "input",
7318
+ {
7319
+ type: "text",
7320
+ value: externalUrl,
7321
+ onChange: (e) => setExternalUrl(e.target.value),
7322
+ placeholder: "External URL",
7323
+ style: {
7324
+ padding: "6px 8px",
7325
+ backgroundColor: "#1a1a1a",
7326
+ color: "#ffffff",
7327
+ border: "1px solid #333",
7328
+ borderRadius: "4px",
7329
+ fontFamily: "monospace",
7330
+ fontSize: "12px",
7331
+ flex: 1
7332
+ }
7333
+ }
7334
+ ),
7335
+ /* @__PURE__ */ import_react4.default.createElement(
7336
+ "button",
7337
+ {
7338
+ onClick: handleOpenExternal,
7339
+ style: {
7340
+ padding: "6px 12px",
7341
+ backgroundColor: "#333",
7342
+ color: "#ffffff",
7343
+ border: "1px solid #555",
7344
+ borderRadius: "4px",
7345
+ cursor: "pointer",
7346
+ fontFamily: "monospace",
7347
+ fontSize: "12px"
7348
+ }
7349
+ },
7350
+ "Open Link"
7351
+ )
7352
+ ),
7353
+ /* @__PURE__ */ import_react4.default.createElement(
7354
+ "div",
7355
+ {
7356
+ style: { display: "flex", gap: "8px", alignItems: "center" }
7357
+ },
7358
+ /* @__PURE__ */ import_react4.default.createElement("span", { style: { width: "150px", fontSize: "12px" } }, "Display Mode:"),
7359
+ /* @__PURE__ */ import_react4.default.createElement(
7360
+ "button",
7361
+ {
7362
+ onClick: () => handleRequestDisplayMode("inline"),
7363
+ style: {
7364
+ padding: "6px 12px",
7365
+ backgroundColor: "#333",
7366
+ color: "#ffffff",
7367
+ border: "1px solid #555",
7368
+ borderRadius: "4px",
7369
+ cursor: "pointer",
7370
+ fontFamily: "monospace",
7371
+ fontSize: "12px",
7372
+ flex: 1
7373
+ }
7374
+ },
7375
+ "Inline"
7376
+ ),
7377
+ /* @__PURE__ */ import_react4.default.createElement(
7378
+ "button",
7379
+ {
7380
+ onClick: () => handleRequestDisplayMode("pip"),
7381
+ style: {
7382
+ padding: "6px 12px",
7383
+ backgroundColor: "#333",
7384
+ color: "#ffffff",
7385
+ border: "1px solid #555",
7386
+ borderRadius: "4px",
7387
+ cursor: "pointer",
7388
+ fontFamily: "monospace",
7389
+ fontSize: "12px",
7390
+ flex: 1
7391
+ }
7392
+ },
7393
+ "PiP"
7394
+ ),
7395
+ /* @__PURE__ */ import_react4.default.createElement(
7396
+ "button",
7397
+ {
7398
+ onClick: () => handleRequestDisplayMode("fullscreen"),
7399
+ style: {
7400
+ padding: "6px 12px",
7401
+ backgroundColor: "#333",
7402
+ color: "#ffffff",
7403
+ border: "1px solid #555",
7404
+ borderRadius: "4px",
7405
+ cursor: "pointer",
7406
+ fontFamily: "monospace",
7407
+ fontSize: "12px",
7408
+ flex: 1
7409
+ }
7410
+ },
7411
+ "Fullscreen"
7412
+ )
7413
+ ),
7414
+ /* @__PURE__ */ import_react4.default.createElement(
7415
+ "div",
7416
+ {
7417
+ style: { display: "flex", gap: "8px", alignItems: "center" }
7418
+ },
7419
+ /* @__PURE__ */ import_react4.default.createElement(
7420
+ "button",
7421
+ {
7422
+ onClick: handleSetState,
7423
+ style: {
7424
+ padding: "6px 12px",
7425
+ backgroundColor: "#333",
7426
+ color: "#ffffff",
7427
+ border: "1px solid #555",
7428
+ borderRadius: "4px",
7429
+ cursor: "pointer",
7430
+ fontFamily: "monospace",
7431
+ fontSize: "12px"
7432
+ }
7433
+ },
7434
+ "Set State (Add Timestamp)"
7435
+ )
7436
+ ),
7437
+ actionResult && /* @__PURE__ */ import_react4.default.createElement(
7438
+ "div",
7439
+ {
7440
+ style: {
7441
+ marginTop: "8px",
7442
+ padding: "8px",
7443
+ backgroundColor: "#1a1a1a",
7444
+ border: "1px solid #333",
7445
+ borderRadius: "4px",
7446
+ whiteSpace: "pre-wrap",
7447
+ wordBreak: "break-all",
7448
+ fontSize: "11px",
7449
+ maxHeight: "200px",
7450
+ overflow: "auto"
7451
+ }
7452
+ },
7453
+ /* @__PURE__ */ import_react4.default.createElement(
7454
+ "div",
7455
+ {
7456
+ style: {
7457
+ fontWeight: "bold",
7458
+ marginBottom: "4px",
7459
+ color: "#aaa"
7460
+ }
7461
+ },
7462
+ "Result:"
7463
+ ),
7464
+ actionResult,
7465
+ /* @__PURE__ */ import_react4.default.createElement(
7466
+ "button",
7467
+ {
7468
+ onClick: () => setActionResult(""),
7469
+ style: {
7470
+ marginTop: "8px",
7471
+ padding: "4px 8px",
7472
+ backgroundColor: "#333",
7473
+ color: "#ffffff",
7474
+ border: "1px solid #555",
7475
+ borderRadius: "4px",
7476
+ cursor: "pointer",
7477
+ fontFamily: "monospace",
7478
+ fontSize: "11px"
7479
+ }
7480
+ },
7481
+ "Clear"
7482
+ )
7483
+ )
7484
+ )
7485
+ )
7486
+ ));
7487
+ }
7488
+ __name(WidgetDebugger, "WidgetDebugger");