import { jsx, jsxs } from "react/jsx-runtime";
import { c } from "react-compiler-runtime";
import { useEffect, useState, Children } from "react";
import { Tooltip, GraphiQLProvider, useEditorStore, useExecutionStore, useSchemaStore, useStorage, usePluginStore, useThemeStore, useDragResize, cn, Dialog, VisuallyHidden, ButtonGroup, Button, ChevronUpIcon, ChevronDownIcon, UnStyledButton, ReloadIcon, KeyboardShortcutIcon, SettingsIcon, QueryEditor, ExecuteButton, VariableEditor, HeaderEditor, Tab, Tabs, PlusIcon, Spinner, ResponseEditor } from "@graphiql/react";
import { HISTORY_PLUGIN, HistoryStore } from "@graphiql/plugin-history";
import { DOC_EXPLORER_PLUGIN, DocExplorerStore } from "@graphiql/plugin-doc-explorer";
import { GraphiQLFooter } from "./ui/footer.js";
import { GraphiQLToolbar } from "./ui/toolbar.js";
import { GraphiQLLogo } from "./ui/logo.js";
import { ShortKeys } from "./ui/short-keys.js";
const GraphiQL_ = (t0) => {
  var _a, _b;
  const $ = c(45);
  let children;
  let className;
  let confirmCloseTab;
  let defaultEditorToolsVisibility;
  let forcedTheme;
  let isHeadersEditorEnabled;
  let maxHistoryLength;
  let onEditHeaders;
  let onEditQuery;
  let onEditVariables;
  let props;
  let readOnly;
  let responseTooltip;
  let showPersistHeadersSettings;
  let t1;
  let t2;
  if ($[0] !== t0) {
    ({
      maxHistoryLength,
      plugins: t1,
      referencePlugin: t2,
      readOnly,
      onEditQuery,
      onEditVariables,
      onEditHeaders,
      responseTooltip,
      defaultEditorToolsVisibility,
      isHeadersEditorEnabled,
      showPersistHeadersSettings,
      forcedTheme,
      confirmCloseTab,
      className,
      children,
      ...props
    } = t0);
    $[0] = t0;
    $[1] = children;
    $[2] = className;
    $[3] = confirmCloseTab;
    $[4] = defaultEditorToolsVisibility;
    $[5] = forcedTheme;
    $[6] = isHeadersEditorEnabled;
    $[7] = maxHistoryLength;
    $[8] = onEditHeaders;
    $[9] = onEditQuery;
    $[10] = onEditVariables;
    $[11] = props;
    $[12] = readOnly;
    $[13] = responseTooltip;
    $[14] = showPersistHeadersSettings;
    $[15] = t1;
    $[16] = t2;
  } else {
    children = $[1];
    className = $[2];
    confirmCloseTab = $[3];
    defaultEditorToolsVisibility = $[4];
    forcedTheme = $[5];
    isHeadersEditorEnabled = $[6];
    maxHistoryLength = $[7];
    onEditHeaders = $[8];
    onEditQuery = $[9];
    onEditVariables = $[10];
    props = $[11];
    readOnly = $[12];
    responseTooltip = $[13];
    showPersistHeadersSettings = $[14];
    t1 = $[15];
    t2 = $[16];
  }
  let t3;
  if ($[17] !== t1) {
    t3 = t1 === void 0 ? [] : t1;
    $[17] = t1;
    $[18] = t3;
  } else {
    t3 = $[18];
  }
  const plugins = t3;
  const referencePlugin = t2 === void 0 ? DOC_EXPLORER_PLUGIN : t2;
  if ((_a = props.toolbar) == null ? void 0 : _a.additionalContent) {
    throw new TypeError("`toolbar.additionalContent` was removed. Use render props on `GraphiQL.Toolbar` component instead.");
  }
  if ((_b = props.toolbar) == null ? void 0 : _b.additionalComponent) {
    throw new TypeError("`toolbar.additionalComponent` was removed. Use render props on `GraphiQL.Toolbar` component instead.");
  }
  if (props.keyMap) {
    throw new TypeError("`keyMap` was removed. To use Vim or Emacs keybindings in Monaco, you can use community plugins. Monaco Vim: https://github.com/brijeshb42/monaco-vim. Monaco Emacs: https://github.com/aioutecism/monaco-emacs");
  }
  const t4 = showPersistHeadersSettings ?? props.shouldPersistHeaders !== false;
  const t5 = isHeadersEditorEnabled ?? true;
  const t6 = forcedTheme && THEMES.includes(forcedTheme) ? forcedTheme : void 0;
  let t7;
  if ($[19] !== className || $[20] !== confirmCloseTab || $[21] !== defaultEditorToolsVisibility || $[22] !== onEditHeaders || $[23] !== onEditQuery || $[24] !== onEditVariables || $[25] !== readOnly || $[26] !== responseTooltip || $[27] !== t4 || $[28] !== t5 || $[29] !== t6) {
    t7 = {
      showPersistHeadersSettings: t4,
      readOnly,
      onEditQuery,
      onEditVariables,
      onEditHeaders,
      responseTooltip,
      defaultEditorToolsVisibility,
      isHeadersEditorEnabled: t5,
      forcedTheme: t6,
      confirmCloseTab,
      className
    };
    $[19] = className;
    $[20] = confirmCloseTab;
    $[21] = defaultEditorToolsVisibility;
    $[22] = onEditHeaders;
    $[23] = onEditQuery;
    $[24] = onEditVariables;
    $[25] = readOnly;
    $[26] = responseTooltip;
    $[27] = t4;
    $[28] = t5;
    $[29] = t6;
    $[30] = t7;
  } else {
    t7 = $[30];
  }
  const interfaceProps = t7;
  let t8;
  if ($[31] !== plugins || $[32] !== referencePlugin) {
    t8 = [referencePlugin, HISTORY_PLUGIN, ...plugins];
    $[31] = plugins;
    $[32] = referencePlugin;
    $[33] = t8;
  } else {
    t8 = $[33];
  }
  let t9;
  if ($[34] !== children || $[35] !== interfaceProps) {
    t9 = /* @__PURE__ */ jsx(DocExplorerStore, { children: /* @__PURE__ */ jsx(Tooltip.Provider, { children: /* @__PURE__ */ jsx(GraphiQLInterface, { ...interfaceProps, children }) }) });
    $[34] = children;
    $[35] = interfaceProps;
    $[36] = t9;
  } else {
    t9 = $[36];
  }
  let t10;
  if ($[37] !== maxHistoryLength || $[38] !== t9) {
    t10 = /* @__PURE__ */ jsx(HistoryStore, { maxHistoryLength, children: t9 });
    $[37] = maxHistoryLength;
    $[38] = t9;
    $[39] = t10;
  } else {
    t10 = $[39];
  }
  let t11;
  if ($[40] !== props || $[41] !== referencePlugin || $[42] !== t10 || $[43] !== t8) {
    t11 = /* @__PURE__ */ jsx(GraphiQLProvider, { plugins: t8, referencePlugin, ...props, children: t10 });
    $[40] = props;
    $[41] = referencePlugin;
    $[42] = t10;
    $[43] = t8;
    $[44] = t11;
  } else {
    t11 = $[44];
  }
  return t11;
};
const THEMES = ["light", "dark", "system"];
const TAB_CLASS_PREFIX = "graphiql-session-tab-";
const GraphiQLInterface = (t0) => {
  const $ = c(215);
  const {
    forcedTheme,
    isHeadersEditorEnabled,
    defaultEditorToolsVisibility,
    children,
    confirmCloseTab,
    className,
    onEditQuery,
    readOnly,
    onEditVariables,
    onEditHeaders,
    responseTooltip,
    showPersistHeadersSettings
  } = t0;
  const {
    initialVariables,
    initialHeaders,
    setShouldPersistHeaders,
    addTab,
    moveTab,
    closeTab,
    changeTab,
    shouldPersistHeaders,
    tabs,
    activeTabIndex
  } = useEditorStore();
  const isExecutionFetching = useExecutionStore(_temp);
  const {
    isFetching: isSchemaFetching,
    introspect
  } = useSchemaStore();
  const storageContext = useStorage();
  const {
    visiblePlugin,
    setVisiblePlugin,
    plugins
  } = usePluginStore();
  const {
    theme,
    setTheme
  } = useThemeStore();
  let t1;
  let t2;
  if ($[0] !== forcedTheme || $[1] !== setTheme) {
    t1 = () => {
      if (forcedTheme === "system") {
        setTheme(null);
      } else {
        if (forcedTheme === "light" || forcedTheme === "dark") {
          setTheme(forcedTheme);
        }
      }
    };
    t2 = [forcedTheme, setTheme];
    $[0] = forcedTheme;
    $[1] = setTheme;
    $[2] = t1;
    $[3] = t2;
  } else {
    t1 = $[2];
    t2 = $[3];
  }
  useEffect(t1, t2);
  const PluginContent = visiblePlugin == null ? void 0 : visiblePlugin.content;
  const t3 = visiblePlugin ? void 0 : "first";
  let t4;
  if ($[4] !== setVisiblePlugin || $[5] !== t3) {
    t4 = {
      defaultSizeRelation: 0.3333333333333333,
      direction: "horizontal",
      initiallyHidden: t3,
      onHiddenElementChange(resizableElement) {
        if (resizableElement === "first") {
          setVisiblePlugin(null);
        }
      },
      sizeThresholdSecond: 200,
      storageKey: "docExplorerFlex"
    };
    $[4] = setVisiblePlugin;
    $[5] = t3;
    $[6] = t4;
  } else {
    t4 = $[6];
  }
  const pluginResize = useDragResize(t4);
  let t5;
  if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
    t5 = {
      direction: "horizontal",
      storageKey: "editorFlex"
    };
    $[7] = t5;
  } else {
    t5 = $[7];
  }
  const editorResize = useDragResize(t5);
  let t6;
  if ($[8] !== initialHeaders || $[9] !== initialVariables) {
    t6 = (d) => {
      if (d === "variables" || d === "headers") {
        return;
      }
      if (typeof d === "boolean") {
        return d ? void 0 : "second";
      }
      return initialVariables || initialHeaders ? void 0 : "second";
    };
    $[8] = initialHeaders;
    $[9] = initialVariables;
    $[10] = t6;
  } else {
    t6 = $[10];
  }
  let t7;
  if ($[11] !== defaultEditorToolsVisibility || $[12] !== t6) {
    t7 = t6(defaultEditorToolsVisibility);
    $[11] = defaultEditorToolsVisibility;
    $[12] = t6;
    $[13] = t7;
  } else {
    t7 = $[13];
  }
  let t8;
  if ($[14] !== t7) {
    t8 = {
      defaultSizeRelation: 3,
      direction: "vertical",
      initiallyHidden: t7,
      sizeThresholdSecond: 60,
      storageKey: "secondaryEditorFlex"
    };
    $[14] = t7;
    $[15] = t8;
  } else {
    t8 = $[15];
  }
  const editorToolsResize = useDragResize(t8);
  let t9;
  if ($[16] !== defaultEditorToolsVisibility || $[17] !== initialHeaders || $[18] !== initialVariables || $[19] !== isHeadersEditorEnabled) {
    t9 = () => {
      if (defaultEditorToolsVisibility === "variables" || defaultEditorToolsVisibility === "headers") {
        return defaultEditorToolsVisibility;
      }
      return !initialVariables && initialHeaders && isHeadersEditorEnabled ? "headers" : "variables";
    };
    $[16] = defaultEditorToolsVisibility;
    $[17] = initialHeaders;
    $[18] = initialVariables;
    $[19] = isHeadersEditorEnabled;
    $[20] = t9;
  } else {
    t9 = $[20];
  }
  const [activeSecondaryEditor, setActiveSecondaryEditor] = useState(t9);
  const [showDialog, setShowDialog] = useState(null);
  const [clearStorageStatus, setClearStorageStatus] = useState(null);
  let t10;
  if ($[21] !== children) {
    let t112;
    let t122;
    if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
      t112 = /* @__PURE__ */ jsx(GraphiQL.Logo, {});
      t122 = /* @__PURE__ */ jsx(GraphiQL.Toolbar, {});
      $[23] = t112;
      $[24] = t122;
    } else {
      t112 = $[23];
      t122 = $[24];
    }
    t10 = Children.toArray(children).reduce(_temp2, {
      logo: t112,
      toolbar: t122
    });
    $[21] = children;
    $[22] = t10;
  } else {
    t10 = $[22];
  }
  const {
    logo,
    toolbar,
    footer
  } = t10;
  let t11;
  if ($[25] !== pluginResize) {
    t11 = function onClickReference2() {
      if (pluginResize.hiddenElement === "first") {
        pluginResize.setHiddenElement(null);
      }
    };
    $[25] = pluginResize;
    $[26] = t11;
  } else {
    t11 = $[26];
  }
  const onClickReference = t11;
  let t12;
  if ($[27] !== storageContext) {
    t12 = function handleClearData2() {
      try {
        storageContext.clear();
        setClearStorageStatus("success");
      } catch {
        setClearStorageStatus("error");
      }
    };
    $[27] = storageContext;
    $[28] = t12;
  } else {
    t12 = $[28];
  }
  const handleClearData = t12;
  let t13;
  if ($[29] !== setShouldPersistHeaders) {
    t13 = (event) => {
      setShouldPersistHeaders(event.currentTarget.dataset.value === "true");
    };
    $[29] = setShouldPersistHeaders;
    $[30] = t13;
  } else {
    t13 = $[30];
  }
  const handlePersistHeaders = t13;
  let t14;
  if ($[31] !== setTheme) {
    t14 = (event_0) => {
      const selectedTheme = event_0.currentTarget.dataset.theme;
      setTheme(selectedTheme || null);
    };
    $[31] = setTheme;
    $[32] = t14;
  } else {
    t14 = $[32];
  }
  const handleChangeTheme = t14;
  let t15;
  if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
    t15 = (event_1) => {
      setShowDialog(event_1.currentTarget.dataset.value);
    };
    $[33] = t15;
  } else {
    t15 = $[33];
  }
  const handleShowDialog = t15;
  let t16;
  if ($[34] !== pluginResize || $[35] !== plugins || $[36] !== setVisiblePlugin || $[37] !== visiblePlugin) {
    t16 = (event_2) => {
      const pluginIndex = Number(event_2.currentTarget.dataset.index);
      const plugin = plugins.find((_, index) => pluginIndex === index);
      const isVisible = plugin === visiblePlugin;
      if (isVisible) {
        setVisiblePlugin(null);
        pluginResize.setHiddenElement("first");
      } else {
        setVisiblePlugin(plugin);
        pluginResize.setHiddenElement(null);
      }
    };
    $[34] = pluginResize;
    $[35] = plugins;
    $[36] = setVisiblePlugin;
    $[37] = visiblePlugin;
    $[38] = t16;
  } else {
    t16 = $[38];
  }
  const handlePluginClick = t16;
  let t17;
  if ($[39] !== editorToolsResize) {
    t17 = (event_3) => {
      if (editorToolsResize.hiddenElement === "second") {
        editorToolsResize.setHiddenElement(null);
      }
      const tabName = event_3.currentTarget.dataset.name;
      setActiveSecondaryEditor(tabName);
    };
    $[39] = editorToolsResize;
    $[40] = t17;
  } else {
    t17 = $[40];
  }
  const handleToolsTabClick = t17;
  let t18;
  if ($[41] !== editorToolsResize) {
    t18 = () => {
      editorToolsResize.setHiddenElement(editorToolsResize.hiddenElement === "second" ? null : "second");
    };
    $[41] = editorToolsResize;
    $[42] = t18;
  } else {
    t18 = $[42];
  }
  const toggleEditorTools = t18;
  let t19;
  if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
    t19 = function handleOpenShortKeysDialog2(isOpen) {
      if (!isOpen) {
        setShowDialog(null);
      }
    };
    $[43] = t19;
  } else {
    t19 = $[43];
  }
  const handleOpenShortKeysDialog = t19;
  let t20;
  if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
    t20 = function handleOpenSettingsDialog2(isOpen_0) {
      if (!isOpen_0) {
        setShowDialog(null);
        setClearStorageStatus(null);
      }
    };
    $[44] = t20;
  } else {
    t20 = $[44];
  }
  const handleOpenSettingsDialog = t20;
  let t21;
  if ($[45] !== closeTab || $[46] !== confirmCloseTab) {
    t21 = async (event_4) => {
      const tabButton = event_4.currentTarget.previousSibling;
      const index_0 = Number(tabButton.id.replace(TAB_CLASS_PREFIX, ""));
      const shouldCloseTab = confirmCloseTab ? await confirmCloseTab(index_0) : true;
      if (!shouldCloseTab) {
        return;
      }
      closeTab(index_0);
    };
    $[45] = closeTab;
    $[46] = confirmCloseTab;
    $[47] = t21;
  } else {
    t21 = $[47];
  }
  const handleTabClose = t21;
  let t22;
  if ($[48] !== changeTab) {
    t22 = (event_5) => {
      const index_1 = Number(event_5.currentTarget.id.replace(TAB_CLASS_PREFIX, ""));
      changeTab(index_1);
    };
    $[48] = changeTab;
    $[49] = t22;
  } else {
    t22 = $[49];
  }
  const handleTabClick = t22;
  let t23;
  if ($[50] !== handlePluginClick || $[51] !== plugins || $[52] !== visiblePlugin) {
    let t242;
    if ($[54] !== handlePluginClick || $[55] !== visiblePlugin) {
      t242 = (plugin_0, index_2) => {
        const isVisible_0 = plugin_0 === visiblePlugin;
        const label = `${isVisible_0 ? "Hide" : "Show"} ${plugin_0.title}`;
        return /* @__PURE__ */ jsx(Tooltip, { label, children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", className: cn(isVisible_0 && "active"), onClick: handlePluginClick, "data-index": index_2, "aria-label": label, children: /* @__PURE__ */ jsx(plugin_0.icon, { "aria-hidden": "true" }) }) }, plugin_0.title);
      };
      $[54] = handlePluginClick;
      $[55] = visiblePlugin;
      $[56] = t242;
    } else {
      t242 = $[56];
    }
    t23 = plugins.map(t242);
    $[50] = handlePluginClick;
    $[51] = plugins;
    $[52] = visiblePlugin;
    $[53] = t23;
  } else {
    t23 = $[53];
  }
  let t24;
  if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
    t24 = {
      marginTop: "auto"
    };
    $[57] = t24;
  } else {
    t24 = $[57];
  }
  const t25 = isSchemaFetching && "graphiql-spin";
  let t26;
  if ($[58] !== t25) {
    t26 = cn(t25);
    $[58] = t25;
    $[59] = t26;
  } else {
    t26 = $[59];
  }
  let t27;
  if ($[60] !== t26) {
    t27 = /* @__PURE__ */ jsx(ReloadIcon, { className: t26, "aria-hidden": "true" });
    $[60] = t26;
    $[61] = t27;
  } else {
    t27 = $[61];
  }
  let t28;
  if ($[62] !== introspect || $[63] !== isSchemaFetching || $[64] !== t27) {
    t28 = /* @__PURE__ */ jsx(Tooltip, { label: "Re-fetch GraphQL schema", children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", disabled: isSchemaFetching, onClick: introspect, "aria-label": "Re-fetch GraphQL schema", style: t24, children: t27 }) });
    $[62] = introspect;
    $[63] = isSchemaFetching;
    $[64] = t27;
    $[65] = t28;
  } else {
    t28 = $[65];
  }
  let t29;
  if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
    t29 = /* @__PURE__ */ jsx(Tooltip, { label: "Open short keys dialog", children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", "data-value": "short-keys", onClick: handleShowDialog, "aria-label": "Open short keys dialog", children: /* @__PURE__ */ jsx(KeyboardShortcutIcon, { "aria-hidden": "true" }) }) });
    $[66] = t29;
  } else {
    t29 = $[66];
  }
  let t30;
  if ($[67] === Symbol.for("react.memo_cache_sentinel")) {
    t30 = /* @__PURE__ */ jsx(Tooltip, { label: "Open settings dialog", children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", "data-value": "settings", onClick: handleShowDialog, "aria-label": "Open settings dialog", children: /* @__PURE__ */ jsx(SettingsIcon, { "aria-hidden": "true" }) }) });
    $[67] = t30;
  } else {
    t30 = $[67];
  }
  const t31 = showDialog === "short-keys";
  let t32;
  if ($[68] === Symbol.for("react.memo_cache_sentinel")) {
    t32 = /* @__PURE__ */ jsx(Dialog.Title, { className: "graphiql-dialog-title", children: "Short Keys" });
    $[68] = t32;
  } else {
    t32 = $[68];
  }
  let t33;
  if ($[69] === Symbol.for("react.memo_cache_sentinel")) {
    t33 = /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-header", children: [
      t32,
      /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(Dialog.Description, { children: "This modal provides a list of available keyboard shortcuts and their functions." }) }),
      /* @__PURE__ */ jsx(Dialog.Close, {})
    ] });
    $[69] = t33;
  } else {
    t33 = $[69];
  }
  let t34;
  if ($[70] === Symbol.for("react.memo_cache_sentinel")) {
    t34 = /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section", children: /* @__PURE__ */ jsx(ShortKeys, {}) });
    $[70] = t34;
  } else {
    t34 = $[70];
  }
  let t35;
  if ($[71] !== t31) {
    t35 = /* @__PURE__ */ jsxs(Dialog, { open: t31, onOpenChange: handleOpenShortKeysDialog, children: [
      t33,
      t34
    ] });
    $[71] = t31;
    $[72] = t35;
  } else {
    t35 = $[72];
  }
  const t36 = showDialog === "settings";
  let t37;
  if ($[73] === Symbol.for("react.memo_cache_sentinel")) {
    t37 = /* @__PURE__ */ jsx(Dialog.Title, { className: "graphiql-dialog-title", children: "Settings" });
    $[73] = t37;
  } else {
    t37 = $[73];
  }
  let t38;
  if ($[74] === Symbol.for("react.memo_cache_sentinel")) {
    t38 = /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-header", children: [
      t37,
      /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(Dialog.Description, { children: "This modal lets you adjust header persistence, interface theme, and clear local storage." }) }),
      /* @__PURE__ */ jsx(Dialog.Close, {})
    ] });
    $[74] = t38;
  } else {
    t38 = $[74];
  }
  let t39;
  if ($[75] !== handlePersistHeaders || $[76] !== shouldPersistHeaders || $[77] !== showPersistHeadersSettings) {
    t39 = showPersistHeadersSettings ? /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-section", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-title", children: "Persist headers" }),
        /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-section-caption", children: [
          "Save headers upon reloading.",
          " ",
          /* @__PURE__ */ jsx("span", { className: "graphiql-warning-text", children: "Only enable if you trust this device." })
        ] })
      ] }),
      /* @__PURE__ */ jsxs(ButtonGroup, { children: [
        /* @__PURE__ */ jsx(Button, { type: "button", id: "enable-persist-headers", className: cn(shouldPersistHeaders && "active"), "data-value": "true", onClick: handlePersistHeaders, children: "On" }),
        /* @__PURE__ */ jsx(Button, { type: "button", id: "disable-persist-headers", className: cn(!shouldPersistHeaders && "active"), onClick: handlePersistHeaders, children: "Off" })
      ] })
    ] }) : null;
    $[75] = handlePersistHeaders;
    $[76] = shouldPersistHeaders;
    $[77] = showPersistHeadersSettings;
    $[78] = t39;
  } else {
    t39 = $[78];
  }
  let t40;
  if ($[79] !== forcedTheme || $[80] !== handleChangeTheme || $[81] !== theme) {
    t40 = !forcedTheme && /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-section", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-title", children: "Theme" }),
        /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-caption", children: "Adjust how the interface appears." })
      ] }),
      /* @__PURE__ */ jsxs(ButtonGroup, { children: [
        /* @__PURE__ */ jsx(Button, { type: "button", className: cn(theme === null && "active"), onClick: handleChangeTheme, children: "System" }),
        /* @__PURE__ */ jsx(Button, { type: "button", className: cn(theme === "light" && "active"), "data-theme": "light", onClick: handleChangeTheme, children: "Light" }),
        /* @__PURE__ */ jsx(Button, { type: "button", className: cn(theme === "dark" && "active"), "data-theme": "dark", onClick: handleChangeTheme, children: "Dark" })
      ] })
    ] });
    $[79] = forcedTheme;
    $[80] = handleChangeTheme;
    $[81] = theme;
    $[82] = t40;
  } else {
    t40 = $[82];
  }
  let t41;
  if ($[83] === Symbol.for("react.memo_cache_sentinel")) {
    t41 = /* @__PURE__ */ jsxs("div", { children: [
      /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-title", children: "Clear storage" }),
      /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-caption", children: "Remove all locally stored data and start fresh." })
    ] });
    $[83] = t41;
  } else {
    t41 = $[83];
  }
  const t42 = clearStorageStatus || void 0;
  const t43 = clearStorageStatus === "success";
  let t44;
  if ($[84] !== clearStorageStatus) {
    t44 = {
      success: "Cleared data",
      error: "Failed"
    }[clearStorageStatus] || "Clear data";
    $[84] = clearStorageStatus;
    $[85] = t44;
  } else {
    t44 = $[85];
  }
  let t45;
  if ($[86] !== handleClearData || $[87] !== t42 || $[88] !== t43 || $[89] !== t44) {
    t45 = /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-section", children: [
      t41,
      /* @__PURE__ */ jsx(Button, { type: "button", state: t42, disabled: t43, onClick: handleClearData, children: t44 })
    ] });
    $[86] = handleClearData;
    $[87] = t42;
    $[88] = t43;
    $[89] = t44;
    $[90] = t45;
  } else {
    t45 = $[90];
  }
  let t46;
  if ($[91] !== t36 || $[92] !== t39 || $[93] !== t40 || $[94] !== t45) {
    t46 = /* @__PURE__ */ jsxs(Dialog, { open: t36, onOpenChange: handleOpenSettingsDialog, children: [
      t38,
      t39,
      t40,
      t45
    ] });
    $[91] = t36;
    $[92] = t39;
    $[93] = t40;
    $[94] = t45;
    $[95] = t46;
  } else {
    t46 = $[95];
  }
  let t47;
  if ($[96] !== t23 || $[97] !== t28 || $[98] !== t35 || $[99] !== t46) {
    t47 = /* @__PURE__ */ jsxs("div", { className: "graphiql-sidebar", children: [
      t23,
      t28,
      t29,
      t30,
      t35,
      t46
    ] });
    $[96] = t23;
    $[97] = t28;
    $[98] = t35;
    $[99] = t46;
    $[100] = t47;
  } else {
    t47 = $[100];
  }
  const sidebar = t47;
  const editorToolsText = `${editorToolsResize.hiddenElement === "second" ? "Show" : "Hide"} editor tools`;
  const EditorToolsIcon = editorToolsResize.hiddenElement === "second" ? ChevronUpIcon : ChevronDownIcon;
  const t48 = editorResize.firstRef;
  let t49;
  if ($[101] !== onClickReference || $[102] !== onEditQuery || $[103] !== readOnly) {
    t49 = /* @__PURE__ */ jsx(QueryEditor, { onClickReference, onEdit: onEditQuery, readOnly });
    $[101] = onClickReference;
    $[102] = onEditQuery;
    $[103] = readOnly;
    $[104] = t49;
  } else {
    t49 = $[104];
  }
  let t50;
  if ($[105] === Symbol.for("react.memo_cache_sentinel")) {
    t50 = /* @__PURE__ */ jsx(ExecuteButton, {});
    $[105] = t50;
  } else {
    t50 = $[105];
  }
  let t51;
  if ($[106] !== toolbar) {
    t51 = /* @__PURE__ */ jsxs("div", { className: "graphiql-toolbar", role: "toolbar", "aria-label": "Editor Commands", children: [
      t50,
      toolbar
    ] });
    $[106] = toolbar;
    $[107] = t51;
  } else {
    t51 = $[107];
  }
  let t52;
  if ($[108] !== editorToolsResize.firstRef || $[109] !== t49 || $[110] !== t51) {
    t52 = /* @__PURE__ */ jsxs("section", { className: "graphiql-query-editor", "aria-label": "Query Editor", ref: editorToolsResize.firstRef, children: [
      t49,
      t51
    ] });
    $[108] = editorToolsResize.firstRef;
    $[109] = t49;
    $[110] = t51;
    $[111] = t52;
  } else {
    t52 = $[111];
  }
  const t53 = editorToolsResize.dragBarRef;
  const t54 = activeSecondaryEditor === "variables" && editorToolsResize.hiddenElement !== "second" && "active";
  let t55;
  if ($[112] !== t54) {
    t55 = cn(t54);
    $[112] = t54;
    $[113] = t55;
  } else {
    t55 = $[113];
  }
  let t56;
  if ($[114] !== handleToolsTabClick || $[115] !== t55) {
    t56 = /* @__PURE__ */ jsx(UnStyledButton, { type: "button", className: t55, onClick: handleToolsTabClick, "data-name": "variables", children: "Variables" });
    $[114] = handleToolsTabClick;
    $[115] = t55;
    $[116] = t56;
  } else {
    t56 = $[116];
  }
  let t57;
  if ($[117] !== activeSecondaryEditor || $[118] !== editorToolsResize.hiddenElement || $[119] !== handleToolsTabClick || $[120] !== isHeadersEditorEnabled) {
    t57 = isHeadersEditorEnabled && /* @__PURE__ */ jsx(UnStyledButton, { type: "button", className: cn(activeSecondaryEditor === "headers" && editorToolsResize.hiddenElement !== "second" && "active"), onClick: handleToolsTabClick, "data-name": "headers", children: "Headers" });
    $[117] = activeSecondaryEditor;
    $[118] = editorToolsResize.hiddenElement;
    $[119] = handleToolsTabClick;
    $[120] = isHeadersEditorEnabled;
    $[121] = t57;
  } else {
    t57 = $[121];
  }
  let t58;
  if ($[122] !== EditorToolsIcon) {
    t58 = /* @__PURE__ */ jsx(EditorToolsIcon, { className: "graphiql-chevron-icon", "aria-hidden": "true" });
    $[122] = EditorToolsIcon;
    $[123] = t58;
  } else {
    t58 = $[123];
  }
  let t59;
  if ($[124] !== editorToolsText || $[125] !== t58 || $[126] !== toggleEditorTools) {
    t59 = /* @__PURE__ */ jsx(UnStyledButton, { type: "button", onClick: toggleEditorTools, "aria-label": editorToolsText, className: "graphiql-toggle-editor-tools", children: t58 });
    $[124] = editorToolsText;
    $[125] = t58;
    $[126] = toggleEditorTools;
    $[127] = t59;
  } else {
    t59 = $[127];
  }
  let t60;
  if ($[128] !== editorToolsText || $[129] !== t59) {
    t60 = /* @__PURE__ */ jsx(Tooltip, { label: editorToolsText, children: t59 });
    $[128] = editorToolsText;
    $[129] = t59;
    $[130] = t60;
  } else {
    t60 = $[130];
  }
  let t61;
  if ($[131] !== editorToolsResize.dragBarRef || $[132] !== t56 || $[133] !== t57 || $[134] !== t60) {
    t61 = /* @__PURE__ */ jsxs("div", { ref: t53, className: "graphiql-editor-tools", children: [
      t56,
      t57,
      t60
    ] });
    $[131] = editorToolsResize.dragBarRef;
    $[132] = t56;
    $[133] = t57;
    $[134] = t60;
    $[135] = t61;
  } else {
    t61 = $[135];
  }
  const t62 = activeSecondaryEditor === "variables" ? "Variables" : "Headers";
  const t63 = activeSecondaryEditor === "variables" ? "" : "hidden";
  let t64;
  if ($[136] !== onClickReference || $[137] !== onEditVariables || $[138] !== readOnly || $[139] !== t63) {
    t64 = /* @__PURE__ */ jsx(VariableEditor, { className: t63, onEdit: onEditVariables, onClickReference, readOnly });
    $[136] = onClickReference;
    $[137] = onEditVariables;
    $[138] = readOnly;
    $[139] = t63;
    $[140] = t64;
  } else {
    t64 = $[140];
  }
  let t65;
  if ($[141] !== activeSecondaryEditor || $[142] !== isHeadersEditorEnabled || $[143] !== onEditHeaders || $[144] !== readOnly) {
    t65 = isHeadersEditorEnabled && /* @__PURE__ */ jsx(HeaderEditor, { className: activeSecondaryEditor === "headers" ? "" : "hidden", onEdit: onEditHeaders, readOnly });
    $[141] = activeSecondaryEditor;
    $[142] = isHeadersEditorEnabled;
    $[143] = onEditHeaders;
    $[144] = readOnly;
    $[145] = t65;
  } else {
    t65 = $[145];
  }
  let t66;
  if ($[146] !== editorToolsResize.secondRef || $[147] !== t62 || $[148] !== t64 || $[149] !== t65) {
    t66 = /* @__PURE__ */ jsxs("section", { className: "graphiql-editor-tool", "aria-label": t62, ref: editorToolsResize.secondRef, children: [
      t64,
      t65
    ] });
    $[146] = editorToolsResize.secondRef;
    $[147] = t62;
    $[148] = t64;
    $[149] = t65;
    $[150] = t66;
  } else {
    t66 = $[150];
  }
  let t67;
  if ($[151] !== editorResize.firstRef || $[152] !== t52 || $[153] !== t61 || $[154] !== t66) {
    t67 = /* @__PURE__ */ jsxs("div", { className: "graphiql-editors", ref: t48, children: [
      t52,
      t61,
      t66
    ] });
    $[151] = editorResize.firstRef;
    $[152] = t52;
    $[153] = t61;
    $[154] = t66;
    $[155] = t67;
  } else {
    t67 = $[155];
  }
  const editors = t67;
  let t68;
  if ($[156] !== className) {
    t68 = cn("graphiql-container", className);
    $[156] = className;
    $[157] = t68;
  } else {
    t68 = $[157];
  }
  let t69;
  if ($[158] === Symbol.for("react.memo_cache_sentinel")) {
    t69 = {
      minWidth: "200px"
    };
    $[158] = t69;
  } else {
    t69 = $[158];
  }
  let t70;
  if ($[159] !== PluginContent) {
    t70 = PluginContent ? /* @__PURE__ */ jsx(PluginContent, {}) : null;
    $[159] = PluginContent;
    $[160] = t70;
  } else {
    t70 = $[160];
  }
  let t71;
  if ($[161] !== pluginResize.firstRef || $[162] !== t70) {
    t71 = /* @__PURE__ */ jsx("div", { ref: pluginResize.firstRef, className: "graphiql-plugin", style: t69, children: t70 });
    $[161] = pluginResize.firstRef;
    $[162] = t70;
    $[163] = t71;
  } else {
    t71 = $[163];
  }
  let t72;
  if ($[164] !== pluginResize.dragBarRef || $[165] !== visiblePlugin) {
    t72 = visiblePlugin && /* @__PURE__ */ jsx("div", { className: "graphiql-horizontal-drag-bar", ref: pluginResize.dragBarRef });
    $[164] = pluginResize.dragBarRef;
    $[165] = visiblePlugin;
    $[166] = t72;
  } else {
    t72 = $[166];
  }
  const t73 = pluginResize.secondRef;
  let t74;
  if ($[167] !== activeTabIndex || $[168] !== handleTabClick || $[169] !== handleTabClose || $[170] !== tabs) {
    let t752;
    if ($[172] !== activeTabIndex || $[173] !== handleTabClick || $[174] !== handleTabClose) {
      t752 = (tab, index_3, arr) => /* @__PURE__ */ jsxs(Tab, { value: tab, isActive: index_3 === activeTabIndex, children: [
        /* @__PURE__ */ jsx(Tab.Button, { "aria-controls": "graphiql-session", id: `graphiql-session-tab-${index_3}`, title: tab.title, onClick: handleTabClick, children: tab.title }),
        arr.length > 1 && /* @__PURE__ */ jsx(Tab.Close, { onClick: handleTabClose })
      ] }, tab.id);
      $[172] = activeTabIndex;
      $[173] = handleTabClick;
      $[174] = handleTabClose;
      $[175] = t752;
    } else {
      t752 = $[175];
    }
    t74 = tabs.map(t752);
    $[167] = activeTabIndex;
    $[168] = handleTabClick;
    $[169] = handleTabClose;
    $[170] = tabs;
    $[171] = t74;
  } else {
    t74 = $[171];
  }
  let t75;
  if ($[176] !== moveTab || $[177] !== t74 || $[178] !== tabs) {
    t75 = /* @__PURE__ */ jsx(Tabs, { values: tabs, onReorder: moveTab, "aria-label": "Select active operation", className: "no-scrollbar", children: t74 });
    $[176] = moveTab;
    $[177] = t74;
    $[178] = tabs;
    $[179] = t75;
  } else {
    t75 = $[179];
  }
  let t76;
  if ($[180] === Symbol.for("react.memo_cache_sentinel")) {
    t76 = /* @__PURE__ */ jsx(PlusIcon, { "aria-hidden": "true" });
    $[180] = t76;
  } else {
    t76 = $[180];
  }
  let t77;
  if ($[181] !== addTab) {
    t77 = /* @__PURE__ */ jsx(Tooltip, { label: "New tab", children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", className: "graphiql-tab-add", onClick: addTab, "aria-label": "New tab", children: t76 }) });
    $[181] = addTab;
    $[182] = t77;
  } else {
    t77 = $[182];
  }
  let t78;
  if ($[183] !== logo || $[184] !== t75 || $[185] !== t77) {
    t78 = /* @__PURE__ */ jsxs("div", { className: "graphiql-session-header", children: [
      t75,
      t77,
      logo
    ] });
    $[183] = logo;
    $[184] = t75;
    $[185] = t77;
    $[186] = t78;
  } else {
    t78 = $[186];
  }
  const t79 = `${TAB_CLASS_PREFIX}${activeTabIndex}`;
  let t80;
  if ($[187] !== editorResize.dragBarRef) {
    t80 = /* @__PURE__ */ jsx("div", { className: "graphiql-horizontal-drag-bar", ref: editorResize.dragBarRef });
    $[187] = editorResize.dragBarRef;
    $[188] = t80;
  } else {
    t80 = $[188];
  }
  let t81;
  if ($[189] !== isExecutionFetching) {
    t81 = isExecutionFetching && /* @__PURE__ */ jsx(Spinner, {});
    $[189] = isExecutionFetching;
    $[190] = t81;
  } else {
    t81 = $[190];
  }
  let t82;
  if ($[191] !== responseTooltip) {
    t82 = /* @__PURE__ */ jsx(ResponseEditor, { responseTooltip });
    $[191] = responseTooltip;
    $[192] = t82;
  } else {
    t82 = $[192];
  }
  let t83;
  if ($[193] !== editorResize.secondRef || $[194] !== footer || $[195] !== t81 || $[196] !== t82) {
    t83 = /* @__PURE__ */ jsxs("div", { className: "graphiql-response", ref: editorResize.secondRef, children: [
      t81,
      t82,
      footer
    ] });
    $[193] = editorResize.secondRef;
    $[194] = footer;
    $[195] = t81;
    $[196] = t82;
    $[197] = t83;
  } else {
    t83 = $[197];
  }
  let t84;
  if ($[198] !== editors || $[199] !== t79 || $[200] !== t80 || $[201] !== t83) {
    t84 = /* @__PURE__ */ jsxs("div", { role: "tabpanel", id: "graphiql-session", "aria-labelledby": t79, children: [
      editors,
      t80,
      t83
    ] });
    $[198] = editors;
    $[199] = t79;
    $[200] = t80;
    $[201] = t83;
    $[202] = t84;
  } else {
    t84 = $[202];
  }
  let t85;
  if ($[203] !== pluginResize.secondRef || $[204] !== t78 || $[205] !== t84) {
    t85 = /* @__PURE__ */ jsxs("div", { ref: t73, className: "graphiql-sessions", children: [
      t78,
      t84
    ] });
    $[203] = pluginResize.secondRef;
    $[204] = t78;
    $[205] = t84;
    $[206] = t85;
  } else {
    t85 = $[206];
  }
  let t86;
  if ($[207] !== t71 || $[208] !== t72 || $[209] !== t85) {
    t86 = /* @__PURE__ */ jsxs("div", { className: "graphiql-main", children: [
      t71,
      t72,
      t85
    ] });
    $[207] = t71;
    $[208] = t72;
    $[209] = t85;
    $[210] = t86;
  } else {
    t86 = $[210];
  }
  let t87;
  if ($[211] !== sidebar || $[212] !== t68 || $[213] !== t86) {
    t87 = /* @__PURE__ */ jsxs("div", { className: t68, children: [
      sidebar,
      t86
    ] });
    $[211] = sidebar;
    $[212] = t68;
    $[213] = t86;
    $[214] = t87;
  } else {
    t87 = $[214];
  }
  return t87;
};
function getChildComponentType(child) {
  if (child && typeof child === "object" && "type" in child && typeof child.type === "function") {
    return child.type;
  }
}
const GraphiQL = Object.assign(GraphiQL_, {
  Logo: GraphiQLLogo,
  Toolbar: GraphiQLToolbar,
  Footer: GraphiQLFooter
});
function _temp(store) {
  return store.isFetching;
}
function _temp2(acc, curr) {
  bb70: switch (getChildComponentType(curr)) {
    case GraphiQL.Logo: {
      acc.logo = curr;
      break bb70;
    }
    case GraphiQL.Toolbar: {
      acc.toolbar = curr;
      break bb70;
    }
    case GraphiQL.Footer: {
      acc.footer = curr;
    }
  }
  return acc;
}
export {
  GraphiQL
};
//# sourceMappingURL=GraphiQL.js.map
