import { c as create_ssr_component, a as compute_rest_props, n as getContext, h as subscribe, b as spread, d as escape_object, g as add_attribute, i as add_classes, f as escape, e as escape_attribute_value, j as createEventDispatcher, s as setContext, x as tick, v as validate_component } from "./index-27250121.js";
import { w as writable, b as get, j as derived } from "./pages-a57618e2.js";
import { NullGenerationStrategy, generateGraphQLQuery, generateGraphQLResponse, MissingCustomScalarException } from "@magidoc/plugin-query-generator";
import { templates } from "@magidoc/plugin-starter-variables";
import _ from "lodash";
import { gql } from "graphql-tag";
import { visit } from "graphql/language/visitor.mjs";
import { C as ChevronDown } from "./ChevronDown-0d44df84.js";
import { a as Prism_1, T as Tag, I as InlineNotification, C as CarbonMarkdown, A as AnchorHeader, b as CodeSpan } from "./PreviousNextPage-aa1b7b9e.js";
import "./prism-json-f6ca42ec.js";
import { B as Button, A as ArgsList, T as TypeLink } from "./ArgsList-5cf1bc5a.js";
import { C as ContentSwitcher, S as Switch } from "./Switch-303c7246.js";
function printJS(ast, options = {}, simplified = true) {
  const str = visit(ast, printDocASTReducer$1(simplified)(options));
  return str;
}
const printDocASTReducer$1 = (simplified) => {
  const importList = /* @__PURE__ */ new Set();
  return ({
    clientVarName = "client",
    transformVariableName = (x) => x,
    thenCode
  }) => ({
    Name: { leave: (node) => node.value },
    Variable: { leave: (node) => transformVariableName(node.name) },
    NamedType: {
      leave: ({ name }) => {
        importList.add(name);
        return name;
      }
    },
    ListType: { leave: ({ type }) => type + "[]" },
    NonNullType: { leave: ({ type }) => type },
    Directive: { leave: ({ name, arguments: args }) => "" },
    IntValue: { leave: ({ value }) => value },
    FloatValue: { leave: ({ value }) => value },
    StringValue: {
      leave: ({ value, block: isBlockString }, key) => JSON.stringify(value)
    },
    BooleanValue: { leave: ({ value }) => value ? "true" : "false" },
    NullValue: { leave: () => "null" },
    EnumValue: { leave: ({ value }) => `'${value}'` },
    ListValue: {
      leave: ({ values }) => "[" + join$1(values.slice(), ", ") + "]"
    },
    ObjectValue: {
      leave: ({ fields }) => "{" + join$1(fields.slice(), ", ") + "}"
    },
    ObjectField: { leave: ({ name, value }) => name + ": " + value },
    Document: {
      leave: (node) => join$1(node.definitions.slice(), "\n\n") + "\n"
    },
    OperationDefinition: {
      leave: (node) => {
        const selectionSet = node.selectionSet;
        let code = join$1((node.variableDefinitions || []).slice(), "\n");
        if ((node.variableDefinitions || []).length) {
          code = `import { ${[...importList].join(
            ", "
          )} } from "@cognite/fdm-client";

// arguments
` + code;
          code += "\n\n";
        }
        code += `${clientVarName}.${node.operation}(` + selectionSet + ")";
        if (thenCode) {
          code += `.then(${thenCode})`;
        }
        return code;
      }
    },
    VariableDefinition: {
      leave: ({ variable, type, defaultValue, directives }) => {
        return "let " + variable.replace("$", "") + `: ${type}`;
      }
    },
    SelectionSet: {
      leave: ({ selections }) => block$1(selections.slice())
    },
    Field: {
      leave: ({ alias, name, arguments: args, directives, selectionSet }) => {
        if (args.length === 0 && !join$1(selectionSet ? [selectionSet] : [])) {
          return name + ": true";
        }
        if (args.length === 0) {
          console.log(name, args, selectionSet);
          return simplified && !(selectionSet == null ? void 0 : selectionSet.includes("{ ...everything }")) ? `${name}: { ...everything }` : name + ": " + join$1(selectionSet ? [selectionSet] : []);
        }
        const argsAndFields = join$1([
          block$1((args || []).slice()),
          ",",
          selectionSet || ""
        ]);
        return name + ": " + wrap$1("[", argsAndFields, "]");
      }
    },
    Argument: {
      leave: ({ name, value = "" }) => {
        if (typeof value === "string") {
          return name + ": " + transformVariableName(value.replace("$", ""));
        }
        console.error(
          `unhandled type, received ${JSON.stringify(value)} as Argument`
        );
        return "";
      }
    },
    FragmentSpread: {
      leave: ({ name, directives }) => {
        return "..." + name + ",";
      }
    },
    InlineFragment: {
      leave: ({ typeCondition, directives, selectionSet }) => {
        console.log({ selectionSet, directives, typeCondition });
        return join$1(["", wrap$1("on_", typeCondition), ":", selectionSet], " ");
      }
    },
    FragmentDefinition: {
      leave: ({
        name,
        typeCondition,
        variableDefinitions,
        directives,
        selectionSet
      }) => {
        return `const ${name} = ` + selectionSet;
      }
    }
  });
};
function join$1(maybeArray, separator = "") {
  return (maybeArray == null ? void 0 : maybeArray.filter((x) => x).join(separator)) ?? "";
}
function block$1(array) {
  return array && array.length !== 0 ? "{\n" + indent(join$1(array, ",\n")) + "\n}" : "";
}
function wrap$1(start, maybeString, end = "") {
  return maybeString ? start + maybeString + end : "";
}
function indent(maybeString) {
  return maybeString && "  " + maybeString.replace(/\n/g, "\n  ");
}
function printPython(ast, options = {}, simplified = true) {
  const str = visit(ast, printDocASTReducer(simplified)(options));
  return str;
}
const printDocASTReducer = (simplified) => {
  const importList = /* @__PURE__ */ new Set();
  return ({
    queryName = "query",
    transformVariableName = (x) => x,
    thenCode
  }) => ({
    Name: { leave: (node) => node.value },
    Variable: { leave: (node) => transformVariableName(node.name) },
    NamedType: {
      leave: ({ name }) => {
        importList.add(name);
        return name;
      }
    },
    ListType: { leave: ({ type }) => `list[${type}]` },
    NonNullType: { leave: ({ type }) => type },
    Directive: { leave: ({ name, arguments: args }) => "" },
    IntValue: { leave: ({ value }) => value },
    FloatValue: { leave: ({ value }) => value },
    StringValue: {
      leave: ({ value, block: isBlockString }, key) => JSON.stringify(value)
    },
    BooleanValue: { leave: ({ value }) => value ? "True" : "False" },
    NullValue: { leave: () => "None" },
    EnumValue: { leave: ({ value }) => `'${value}'` },
    ListValue: {
      leave: ({ values }) => "[" + join(values.slice(), ", ") + "]"
    },
    ObjectValue: {
      leave: ({ fields }) => "{" + join(fields.slice(), ", ") + "}"
    },
    ObjectField: { leave: ({ name, value }) => `'${name}': ` + value },
    Document: {
      leave: (node) => join(node.definitions.slice(), "\n\n") + "\n"
    },
    OperationDefinition: {
      leave: (node) => {
        var _a;
        const selectionSet = node.selectionSet;
        let code = join((node.variableDefinitions || []).slice(), "\n");
        if ((_a = node.variableDefinitions) == null ? void 0 : _a.length) {
          code = `from schema import ${Array.from(importList).map((el) => el).join(", ")}

# arguments
${code}`;
          code += "\n\n";
        }
        code += "query = client.start_query()\n\n";
        code += selectionSet.split("\n").map((el) => `${transformVariableName(queryName)}.${el}`).join("\n");
        code += `

response = client.run_query(query)`;
        return code.replaceAll("{...everything}", "()");
      }
    },
    VariableDefinition: {
      leave: ({ variable, type, defaultValue, directives }) => {
        return variable.replace("$", "") + `: ${type}`;
      }
    },
    SelectionSet: {
      leave: ({ selections }) => join(selections.slice(), "\n")
    },
    Field: {
      leave: ({ alias, name, arguments: args, directives, selectionSet }) => {
        if (args.length === 0 && !join(selectionSet ? [selectionSet] : [])) {
          return transformVariableName(name) + "()";
        }
        if (args.length === 0) {
          console.log(name, args, selectionSet);
          return simplified && !(selectionSet == null ? void 0 : selectionSet.includes("{...everything}")) ? `${transformVariableName(name)}{...everything}` : join(
            selectionSet ? selectionSet.split("\n").map((el) => `${transformVariableName(name)}.${el}`) : [],
            "\n"
          );
        }
        const argsString = transformVariableName(name) + block((args || []).slice());
        return join(
          [
            argsString,
            ...(selectionSet || "").split("\n").map((el) => `${transformVariableName(name)}.${el}`)
          ],
          "\n"
        );
      }
    },
    Argument: {
      leave: ({ name, value = "" }) => {
        if (typeof value === "string") {
          return name + "=" + transformVariableName(value.replace("$", ""));
        }
        console.error(
          `unhandled type, received ${JSON.stringify(value)} as Argument`
        );
        return "";
      }
    },
    FragmentSpread: {
      leave: ({ name, directives }) => {
        return "__as__(" + name + ")";
      }
    },
    InlineFragment: {
      leave: ({ typeCondition, directives, selectionSet }) => {
        return join(
          ["", wrap("__as__(", typeCondition), ")", selectionSet],
          " "
        );
      }
    },
    FragmentDefinition: {
      leave: ({
        name,
        typeCondition,
        variableDefinitions,
        directives,
        selectionSet
      }) => {
        return `${name} = ` + selectionSet;
      }
    }
  });
};
function join(maybeArray, separator = "") {
  return (maybeArray == null ? void 0 : maybeArray.filter((x) => x).join(separator)) ?? "";
}
function block(array) {
  return array && array.length !== 0 ? "(" + join(array, ", ") + ")" : "";
}
function wrap(start, maybeString, end = "") {
  return maybeString ? start + maybeString + end : "";
}
const MAX_DEPTH = 8;
const MIN_DEPTH = 2;
const DEFAULT_DEPTH = 3;
const currentQuery = writable();
const generateQuery = (expected) => {
  const context = {
    queryType: expected.type,
    maxDepth: expected.depth,
    nullGenerationStrategy: expected.nullGenerationStrategy,
    factories: _.reduce(
      get(templates.QUERY_GENERATION_FACTORIES),
      (prev, curr, key) => ({
        ...prev,
        [key]: () => curr
      }),
      {}
    )
  };
  try {
    const request = generateGraphQLQuery(expected.field, context);
    const response = generateGraphQLResponse(expected.field, context);
    const jsQuery = generateJSCode(request);
    const pythonQuery = generatePythonCode(request);
    return {
      value: request ?? null,
      response,
      jsQuery,
      pythonQuery,
      depth: expected.depth,
      field: expected.field,
      type: expected.type,
      nullGenerationStrategy: expected.nullGenerationStrategy
    };
  } catch (error) {
    if (error instanceof MissingCustomScalarException) {
      throw new Error(`
Cannot generate a random value for scalar '${error.type.name}'. 
The random generator is not able to randomly generate a value for non-standard GraphQL scalars. 
You have to provide a custom factory by providing this in your magidoc config:
{
  website: {
    options: {
      queryGenerationFactories: {
        '${error.type.name}': '<an-example-of-scalar-value>'
      }
    }
  }
}

To learn more about how to generate a custom scalar value, see: https://magidoc-org.github.io/magidoc/cli/magidoc-configuration#querygenerationfactories
`);
    }
    throw error;
  }
};
const graphqlQuery = {
  subscribe: currentQuery.subscribe,
  increaseDepth: () => currentQuery.update((current) => {
    if (current && current.depth < MAX_DEPTH) {
      return generateQuery({ ...current, depth: current.depth + 1 });
    }
    return current;
  }),
  decreaseDepth: () => currentQuery.update((current) => {
    if (current && current.depth > MIN_DEPTH) {
      return generateQuery({ ...current, depth: current.depth - 1 });
    }
    return current;
  }),
  toggleNullGenerationStrategy: () => currentQuery.update((current) => {
    return generateQuery({
      ...current,
      nullGenerationStrategy: current.nullGenerationStrategy === NullGenerationStrategy.NEVER_NULL ? NullGenerationStrategy.ALWAYS_NULL : NullGenerationStrategy.NEVER_NULL
    });
  }),
  setField: (field, type) => currentQuery.update(
    (current) => generateQuery({
      field,
      type,
      depth: DEFAULT_DEPTH,
      nullGenerationStrategy: (current == null ? void 0 : current.nullGenerationStrategy) ?? NullGenerationStrategy.NEVER_NULL
    })
  )
};
const generateJSCode = (result) => {
  if (result) {
    const { query, variables } = result;
    return { query: printJS(gql(query), {}), variables };
  }
  return null;
};
const generatePythonCode = (result) => {
  if (result) {
    const { query, variables } = result;
    return { query: printPython(gql(query), { transformVariableName: (name) => name.replace(
      /[A-Z]/g,
      (letter) => `_${letter.toLowerCase()}`
    ) }), variables };
  }
  return null;
};
const Tab = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let selected;
  let $$restProps = compute_rest_props($$props, ["label", "href", "disabled", "tabindex", "id", "ref"]);
  let $selectedTab, $$unsubscribe_selectedTab;
  let $useAutoWidth, $$unsubscribe_useAutoWidth;
  let { label = "" } = $$props;
  let { href = "#" } = $$props;
  let { disabled = false } = $$props;
  let { tabindex = "0" } = $$props;
  let { id = "ccs-" + Math.random().toString(36) } = $$props;
  let { ref = null } = $$props;
  const { selectedTab, useAutoWidth, add, update, change } = getContext("Tabs");
  $$unsubscribe_selectedTab = subscribe(selectedTab, (value) => $selectedTab = value);
  $$unsubscribe_useAutoWidth = subscribe(useAutoWidth, (value) => $useAutoWidth = value);
  add({ id, label, disabled });
  if ($$props.label === void 0 && $$bindings.label && label !== void 0)
    $$bindings.label(label);
  if ($$props.href === void 0 && $$bindings.href && href !== void 0)
    $$bindings.href(href);
  if ($$props.disabled === void 0 && $$bindings.disabled && disabled !== void 0)
    $$bindings.disabled(disabled);
  if ($$props.tabindex === void 0 && $$bindings.tabindex && tabindex !== void 0)
    $$bindings.tabindex(tabindex);
  if ($$props.id === void 0 && $$bindings.id && id !== void 0)
    $$bindings.id(id);
  if ($$props.ref === void 0 && $$bindings.ref && ref !== void 0)
    $$bindings.ref(ref);
  selected = $selectedTab === id;
  $$unsubscribe_selectedTab();
  $$unsubscribe_useAutoWidth();
  return `
<li${spread([{ tabindex: "-1" }, { role: "presentation" }, escape_object($$restProps)], {
    classes: "bx--tabs__nav-item " + (disabled ? "bx--tabs__nav-item--disabled" : "") + " " + (selected ? "bx--tabs__nav-item--selected" : "")
  })}><a role="${"tab"}"${add_attribute("tabindex", disabled ? "-1" : tabindex, 0)}${add_attribute("aria-selected", selected, 0)}${add_attribute("aria-disabled", disabled, 0)}${add_attribute("id", id, 0)}${add_attribute("href", href, 0)}${add_attribute("style", $useAutoWidth ? "width: auto" : void 0, 0)}${add_classes("bx--tabs__nav-link".trim())}${add_attribute("this", ref, 0)}>${slots.default ? slots.default({}) : `${escape(label)}`}</a></li>`;
});
const Tab$1 = Tab;
const TabContent = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let selected;
  let index;
  let tabId;
  let $$restProps = compute_rest_props($$props, ["id"]);
  let $tabs, $$unsubscribe_tabs;
  let $contentById, $$unsubscribe_contentById;
  let $selectedContent, $$unsubscribe_selectedContent;
  let { id = "ccs-" + Math.random().toString(36) } = $$props;
  const { selectedContent, addContent, tabs, contentById } = getContext("Tabs");
  $$unsubscribe_selectedContent = subscribe(selectedContent, (value) => $selectedContent = value);
  $$unsubscribe_tabs = subscribe(tabs, (value) => $tabs = value);
  $$unsubscribe_contentById = subscribe(contentById, (value) => $contentById = value);
  addContent({ id });
  if ($$props.id === void 0 && $$bindings.id && id !== void 0)
    $$bindings.id(id);
  selected = $selectedContent === id;
  index = $contentById[id].index;
  tabId = $tabs[index].id;
  $$unsubscribe_tabs();
  $$unsubscribe_contentById();
  $$unsubscribe_selectedContent();
  return `<div${spread(
    [
      { role: "tabpanel" },
      {
        "aria-labelledby": escape_attribute_value(tabId)
      },
      {
        "aria-hidden": escape_attribute_value(!selected)
      },
      {
        hidden: (selected ? void 0 : "") || null
      },
      { id: escape_attribute_value(id) },
      escape_object($$restProps)
    ],
    { classes: "bx--tab-content" }
  )}>${slots.default ? slots.default({}) : ``}</div>`;
});
const TabContent$1 = TabContent;
const Tabs = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let currentTab;
  let currentContent;
  let $$restProps = compute_rest_props($$props, ["selected", "type", "autoWidth", "iconDescription", "triggerHref"]);
  let $selectedTab, $$unsubscribe_selectedTab;
  let $content, $$unsubscribe_content;
  let $tabs, $$unsubscribe_tabs;
  let $tabsById, $$unsubscribe_tabsById;
  let { selected = 0 } = $$props;
  let { type = "default" } = $$props;
  let { autoWidth = false } = $$props;
  let { iconDescription = "Show menu options" } = $$props;
  let { triggerHref = "#" } = $$props;
  createEventDispatcher();
  const tabs = writable([]);
  $$unsubscribe_tabs = subscribe(tabs, (value) => $tabs = value);
  const tabsById = derived(tabs, (_2) => _2.reduce((a, c) => ({ ...a, [c.id]: c }), {}));
  $$unsubscribe_tabsById = subscribe(tabsById, (value) => $tabsById = value);
  const useAutoWidth = writable(autoWidth);
  const selectedTab = writable(void 0);
  $$unsubscribe_selectedTab = subscribe(selectedTab, (value) => $selectedTab = value);
  const content = writable([]);
  $$unsubscribe_content = subscribe(content, (value) => $content = value);
  const contentById = derived(content, (_2) => _2.reduce((a, c) => ({ ...a, [c.id]: c }), {}));
  const selectedContent = writable(void 0);
  let refTabList = null;
  setContext("Tabs", {
    tabs,
    contentById,
    selectedTab,
    selectedContent,
    useAutoWidth,
    add: (data) => {
      tabs.update((_2) => [..._2, { ...data, index: _2.length }]);
    },
    addContent: (data) => {
      content.update((_2) => [..._2, { ...data, index: _2.length }]);
    },
    update: (id) => {
      currentIndex = $tabsById[id].index;
    },
    change: async (direction) => {
      let index = currentIndex + direction;
      if (index < 0) {
        index = $tabs.length - 1;
      } else if (index >= $tabs.length) {
        index = 0;
      }
      let disabled = $tabs[index].disabled;
      while (disabled) {
        index = index + direction;
        if (index < 0) {
          index = $tabs.length - 1;
        } else if (index >= $tabs.length) {
          index = 0;
        }
        disabled = $tabs[index].disabled;
      }
      currentIndex = index;
      await tick();
      const activeTab = refTabList == null ? void 0 : refTabList.querySelectorAll("[role='tab']")[currentIndex];
      activeTab == null ? void 0 : activeTab.focus();
    }
  });
  let dropdownHidden = true;
  let currentIndex = selected;
  if ($$props.selected === void 0 && $$bindings.selected && selected !== void 0)
    $$bindings.selected(selected);
  if ($$props.type === void 0 && $$bindings.type && type !== void 0)
    $$bindings.type(type);
  if ($$props.autoWidth === void 0 && $$bindings.autoWidth && autoWidth !== void 0)
    $$bindings.autoWidth(autoWidth);
  if ($$props.iconDescription === void 0 && $$bindings.iconDescription && iconDescription !== void 0)
    $$bindings.iconDescription(iconDescription);
  if ($$props.triggerHref === void 0 && $$bindings.triggerHref && triggerHref !== void 0)
    $$bindings.triggerHref(triggerHref);
  currentIndex = selected;
  currentTab = $tabs[currentIndex] || void 0;
  currentContent = $content[currentIndex] || void 0;
  {
    {
      if (currentTab) {
        selectedTab.set(currentTab.id);
      }
      if (currentContent) {
        selectedContent.set(currentContent.id);
      }
    }
  }
  {
    if ($selectedTab) {
      dropdownHidden = true;
    }
  }
  {
    useAutoWidth.set(autoWidth);
  }
  $$unsubscribe_selectedTab();
  $$unsubscribe_content();
  $$unsubscribe_tabs();
  $$unsubscribe_tabsById();
  return `<div${spread([{ role: "navigation" }, escape_object($$restProps)], {
    classes: "bx--tabs " + (type === "container" ? "bx--tabs--container" : "")
  })}><div role="${"listbox"}" tabindex="${"0"}"${add_attribute("aria-label", $$props["aria-label"] || "listbox", 0)}${add_classes("bx--tabs-trigger".trim())}><a tabindex="${"-1"}"${add_attribute("href", triggerHref, 0)}${add_classes("bx--tabs-trigger-text".trim())}>${currentTab ? `${escape(currentTab.label)}` : ``}</a>
    ${validate_component(ChevronDown, "ChevronDown").$$render(
    $$result,
    {
      "aria-hidden": "true",
      title: iconDescription
    },
    {},
    {}
  )}</div>
  <ul role="${"tablist"}"${add_classes(("bx--tabs__nav " + (dropdownHidden ? "bx--tabs__nav--hidden" : "")).trim())}${add_attribute("this", refTabList, 0)}>${slots.default ? slots.default({}) : ``}</ul></div>
${slots.content ? slots.content({}) : ``}`;
});
const Tabs$1 = Tabs;
const Rule = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let labelled;
  let attributes;
  let $$restProps = compute_rest_props($$props, ["size", "title"]);
  let { size = 16 } = $$props;
  let { title = void 0 } = $$props;
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  if ($$props.title === void 0 && $$bindings.title && title !== void 0)
    $$bindings.title(title);
  labelled = $$props["aria-label"] || $$props["aria-labelledby"] || title;
  attributes = {
    "aria-hidden": labelled ? void 0 : true,
    role: labelled ? "img" : void 0,
    focusable: Number($$props["tabindex"]) === 0 ? true : void 0
  };
  return `<svg${spread(
    [
      { xmlns: "http://www.w3.org/2000/svg" },
      { viewBox: "0 0 32 32" },
      { fill: "currentColor" },
      { preserveAspectRatio: "xMidYMid meet" },
      { width: escape_attribute_value(size) },
      { height: escape_attribute_value(size) },
      escape_object(attributes),
      escape_object($$restProps)
    ],
    {}
  )}>${title ? `<title>${escape(title)}</title>` : ``}<path d="${"M10 16H22V18H10zM10 10H22V12H10z"}"></path><path d="${"M16,30,9.8242,26.7071A10.9815,10.9815,0,0,1,4,17V4A2.0022,2.0022,0,0,1,6,2H26a2.0022,2.0022,0,0,1,2,2V17a10.9815,10.9815,0,0,1-5.8242,9.7069ZM6,4V17a8.9852,8.9852,0,0,0,4.7656,7.9423L16,27.7333l5.2344-2.791A8.9852,8.9852,0,0,0,26,17V4Z"}"></path></svg>`;
});
const RuleFilled = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let labelled;
  let attributes;
  let $$restProps = compute_rest_props($$props, ["size", "title"]);
  let { size = 16 } = $$props;
  let { title = void 0 } = $$props;
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  if ($$props.title === void 0 && $$bindings.title && title !== void 0)
    $$bindings.title(title);
  labelled = $$props["aria-label"] || $$props["aria-labelledby"] || title;
  attributes = {
    "aria-hidden": labelled ? void 0 : true,
    role: labelled ? "img" : void 0,
    focusable: Number($$props["tabindex"]) === 0 ? true : void 0
  };
  return `<svg${spread(
    [
      { xmlns: "http://www.w3.org/2000/svg" },
      { viewBox: "0 0 32 32" },
      { fill: "currentColor" },
      { preserveAspectRatio: "xMidYMid meet" },
      { width: escape_attribute_value(size) },
      { height: escape_attribute_value(size) },
      escape_object(attributes),
      escape_object($$restProps)
    ],
    {}
  )}>${title ? `<title>${escape(title)}</title>` : ``}<path fill="${"none"}" d="${"M9 16H23V18H9z"}" data-icon-path="${"inner-path"}"></path><path fill="${"none"}" d="${"M9 10H23V12H9z"}"></path><path d="${"M26,2H6A2.0023,2.0023,0,0,0,4,4V17a10.9814,10.9814,0,0,0,5.8242,9.707L16,30l6.1758-3.293A10.9814,10.9814,0,0,0,28,17V4A2.0023,2.0023,0,0,0,26,2ZM23,18H9V16H23Zm0-6H9V10H23Z"}"></path></svg>`;
});
const Add = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let labelled;
  let attributes;
  let $$restProps = compute_rest_props($$props, ["size", "title"]);
  let { size = 16 } = $$props;
  let { title = void 0 } = $$props;
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  if ($$props.title === void 0 && $$bindings.title && title !== void 0)
    $$bindings.title(title);
  labelled = $$props["aria-label"] || $$props["aria-labelledby"] || title;
  attributes = {
    "aria-hidden": labelled ? void 0 : true,
    role: labelled ? "img" : void 0,
    focusable: Number($$props["tabindex"]) === 0 ? true : void 0
  };
  return `<svg${spread(
    [
      { xmlns: "http://www.w3.org/2000/svg" },
      { viewBox: "0 0 32 32" },
      { fill: "currentColor" },
      { preserveAspectRatio: "xMidYMid meet" },
      { width: escape_attribute_value(size) },
      { height: escape_attribute_value(size) },
      escape_object(attributes),
      escape_object($$restProps)
    ],
    {}
  )}>${title ? `<title>${escape(title)}</title>` : ``}<path d="${"M17 15L17 8 15 8 15 15 8 15 8 17 15 17 15 24 17 24 17 17 24 17 24 15z"}"></path></svg>`;
});
const Copy = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let labelled;
  let attributes;
  let $$restProps = compute_rest_props($$props, ["size", "title"]);
  let { size = 16 } = $$props;
  let { title = void 0 } = $$props;
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  if ($$props.title === void 0 && $$bindings.title && title !== void 0)
    $$bindings.title(title);
  labelled = $$props["aria-label"] || $$props["aria-labelledby"] || title;
  attributes = {
    "aria-hidden": labelled ? void 0 : true,
    role: labelled ? "img" : void 0,
    focusable: Number($$props["tabindex"]) === 0 ? true : void 0
  };
  return `<svg${spread(
    [
      { xmlns: "http://www.w3.org/2000/svg" },
      { viewBox: "0 0 32 32" },
      { fill: "currentColor" },
      { preserveAspectRatio: "xMidYMid meet" },
      { width: escape_attribute_value(size) },
      { height: escape_attribute_value(size) },
      escape_object(attributes),
      escape_object($$restProps)
    ],
    {}
  )}>${title ? `<title>${escape(title)}</title>` : ``}<path d="${"M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z"}"></path><path d="${"M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z"}"></path></svg>`;
});
const Subtract = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let labelled;
  let attributes;
  let $$restProps = compute_rest_props($$props, ["size", "title"]);
  let { size = 16 } = $$props;
  let { title = void 0 } = $$props;
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  if ($$props.title === void 0 && $$bindings.title && title !== void 0)
    $$bindings.title(title);
  labelled = $$props["aria-label"] || $$props["aria-labelledby"] || title;
  attributes = {
    "aria-hidden": labelled ? void 0 : true,
    role: labelled ? "img" : void 0,
    focusable: Number($$props["tabindex"]) === 0 ? true : void 0
  };
  return `<svg${spread(
    [
      { xmlns: "http://www.w3.org/2000/svg" },
      { viewBox: "0 0 32 32" },
      { fill: "currentColor" },
      { preserveAspectRatio: "xMidYMid meet" },
      { width: escape_attribute_value(size) },
      { height: escape_attribute_value(size) },
      escape_object(attributes),
      escape_object($$restProps)
    ],
    {}
  )}>${title ? `<title>${escape(title)}</title>` : ``}<path d="${"M8 15H24V17H8z"}"></path></svg>`;
});
const AppQueryGenerator_svelte_svelte_type_style_lang = "";
const css$1 = {
  code: ".wrapper.svelte-1gk78cu{display:flex;justify-content:flex-start}.code-section.svelte-1gk78cu{width:100%;overflow:hidden}.button-bar.svelte-1gk78cu{display:flex;flex-direction:column}",
  map: null
};
const AppQueryGenerator = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let $graphqlQuery, $$unsubscribe_graphqlQuery;
  $$unsubscribe_graphqlQuery = subscribe(graphqlQuery, (value) => $graphqlQuery = value);
  let { code } = $$props;
  let { language } = $$props;
  let copyButtonText = "Copy query";
  let { copy = async (text) => {
    try {
      copyButtonText = "Copied!";
      await navigator.clipboard.writeText(text);
      setTimeout(
        () => {
          copyButtonText = "Copy query";
        },
        1500
      );
    } catch (e) {
      console.log(e);
    }
  } } = $$props;
  if ($$props.code === void 0 && $$bindings.code && code !== void 0)
    $$bindings.code(code);
  if ($$props.language === void 0 && $$bindings.language && language !== void 0)
    $$bindings.language(language);
  if ($$props.copy === void 0 && $$bindings.copy && copy !== void 0)
    $$bindings.copy(copy);
  $$result.css.add(css$1);
  $$unsubscribe_graphqlQuery();
  return `<div class="${"wrapper svelte-1gk78cu"}"><div class="${"code-section svelte-1gk78cu"}">${validate_component(Prism_1, "Prism").$$render(
    $$result,
    {
      source: code,
      language,
      maxHeight: "20rem",
      minHeight: "12rem"
    },
    {},
    {}
  )}</div>
  <div class="${"button-bar svelte-1gk78cu"}">${validate_component(Button, "Button").$$render(
    $$result,
    {
      kind: "ghost",
      icon: Copy,
      iconDescription: copyButtonText,
      tooltipPosition: "left",
      size: "field"
    },
    {},
    {}
  )}
    ${validate_component(Button, "Button").$$render(
    $$result,
    {
      kind: "ghost",
      icon: $graphqlQuery.nullGenerationStrategy === NullGenerationStrategy.NEVER_NULL ? RuleFilled : Rule,
      iconDescription: $graphqlQuery.nullGenerationStrategy === NullGenerationStrategy.NEVER_NULL ? "Never null fields" : "Always null fields",
      tooltipPosition: "left",
      size: "field"
    },
    {},
    {}
  )}
    ${validate_component(Button, "Button").$$render(
    $$result,
    {
      kind: "ghost",
      icon: Add,
      iconDescription: "Increase query depth",
      tooltipPosition: "left",
      size: "field"
    },
    {},
    {}
  )}
    <p style="${"text-align:center"}">${escape($graphqlQuery.depth)}</p>
    ${validate_component(Button, "Button").$$render(
    $$result,
    {
      kind: "ghost",
      icon: Subtract,
      iconDescription: "Decrease query depth",
      tooltipPosition: "left",
      size: "field"
    },
    {},
    {}
  )}</div>
</div>`;
});
const AppQueryTabs = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let $graphqlQuery, $$unsubscribe_graphqlQuery;
  $$unsubscribe_graphqlQuery = subscribe(graphqlQuery, (value) => $graphqlQuery = value);
  let { type } = $$props;
  let { field } = $$props;
  let selectedTab = 0;
  if ($$props.type === void 0 && $$bindings.type && type !== void 0)
    $$bindings.type(type);
  if ($$props.field === void 0 && $$bindings.field && field !== void 0)
    $$bindings.field(field);
  let $$settled;
  let $$rendered;
  do {
    $$settled = true;
    {
      {
        graphqlQuery.setField(field, type);
      }
    }
    $$rendered = `${validate_component(Tabs$1, "Tabs").$$render(
      $$result,
      { autoWidth: true, selected: selectedTab },
      {
        selected: ($$value) => {
          selectedTab = $$value;
          $$settled = false;
        }
      },
      {
        content: () => {
          return `${validate_component(TabContent$1, "TabContent").$$render($$result, { style: "padding:0" }, {}, {
            default: () => {
              var _a;
              return `${selectedTab === 0 ? `${validate_component(AppQueryGenerator, "AppPrism").$$render(
                $$result,
                {
                  code: ((_a = $graphqlQuery.value) == null ? void 0 : _a.query) ?? "# No query generated. Try increasing the depth",
                  language: "graphql"
                },
                {},
                {}
              )}` : ``}`;
            }
          })}
    ${validate_component(TabContent$1, "TabContent").$$render($$result, { style: "padding:0" }, {}, {
            default: () => {
              var _a, _b;
              return `${selectedTab === 1 ? `${validate_component(AppQueryGenerator, "AppPrism").$$render(
                $$result,
                {
                  code: ((_a = $graphqlQuery.value) == null ? void 0 : _a.variables) ? JSON.stringify(((_b = $graphqlQuery.value) == null ? void 0 : _b.variables) || {}, null, 2) : "",
                  language: "json"
                },
                {},
                {}
              )}` : ``}`;
            }
          })}
    ${validate_component(TabContent$1, "TabContent").$$render($$result, { style: "padding:0" }, {}, {
            default: () => {
              return `${selectedTab === 2 ? `${validate_component(AppQueryGenerator, "AppPrism").$$render(
                $$result,
                {
                  code: $graphqlQuery.response ? JSON.stringify($graphqlQuery.response || {}, null, 2) : "",
                  language: "json"
                },
                {},
                {}
              )}` : ``}`;
            }
          })}
  `;
        },
        default: () => {
          return `${validate_component(Tab$1, "Tab").$$render($$result, { label: "Query" }, {}, {})}
  ${validate_component(Tab$1, "Tab").$$render($$result, { label: "Variables" }, {}, {})}
  ${validate_component(Tab$1, "Tab").$$render($$result, { label: "Response" }, {}, {})}`;
        }
      }
    )}`;
  } while (!$$settled);
  $$unsubscribe_graphqlQuery();
  return $$rendered;
});
const QueryTypeTag = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { type } = $$props;
  if ($$props.type === void 0 && $$bindings.type && type !== void 0)
    $$bindings.type(type);
  return `${validate_component(Tag, "Tag").$$render($$result, { type: "green" }, {}, {
    default: () => {
      return `${escape(_.capitalize(type.toLowerCase()))}`;
    }
  })}`;
});
const DeprecationNotice = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { deprecationReason } = $$props;
  if ($$props.deprecationReason === void 0 && $$bindings.deprecationReason && deprecationReason !== void 0)
    $$bindings.deprecationReason(deprecationReason);
  return `${deprecationReason ? `${validate_component(InlineNotification, "InlineNotification").$$render(
    $$result,
    {
      hideCloseButton: true,
      lowContrast: true,
      kind: "warning"
    },
    {},
    {
      default: () => {
        return `${validate_component(CarbonMarkdown, "CarbonMarkdown").$$render(
          $$result,
          {
            source: `**Deprecated**: ${String(deprecationReason)}`
          },
          {},
          {}
        )}`;
      }
    }
  )}` : ``}`;
});
const FieldDetails_svelte_svelte_type_style_lang = "";
const css = {
  code: ".wrapper.svelte-1xxaho6{display:flex}.content.svelte-1xxaho6{flex:1}.sample.svelte-1xxaho6{width:700px}",
  map: null
};
const FieldDetails = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  var _a, _b;
  let $graphqlQuery, $$unsubscribe_graphqlQuery;
  $$unsubscribe_graphqlQuery = subscribe(graphqlQuery, (value) => $graphqlQuery = value);
  let { type } = $$props;
  let { field } = $$props;
  let selectedTab = 0;
  if ($$props.type === void 0 && $$bindings.type && type !== void 0)
    $$bindings.type(type);
  if ($$props.field === void 0 && $$bindings.field && field !== void 0)
    $$bindings.field(field);
  $$result.css.add(css);
  let $$settled;
  let $$rendered;
  do {
    $$settled = true;
    {
      {
        graphqlQuery.setField(field, type);
      }
    }
    $$rendered = `<section>${validate_component(DeprecationNotice, "DeprecationNotice").$$render(
      $$result,
      {
        deprecationReason: field.deprecationReason
      },
      {},
      {}
    )}

  ${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "title", depth: 1 }, {}, {
      default: () => {
        return `${escape(field.name)}${validate_component(QueryTypeTag, "QueryTypeTag").$$render($$result, { type }, {}, {})}`;
      }
    })}

  <div class="${"wrapper svelte-1xxaho6"}"><div class="${"content svelte-1xxaho6"}">${validate_component(CarbonMarkdown, "CarbonMarkdown").$$render($$result, { source: field.description }, {}, {})}

      ${field.args.length > 0 ? `${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "arguments", depth: 2 }, {}, {
      default: () => {
        return `Arguments`;
      }
    })}
        ${validate_component(ArgsList, "ArgsList").$$render($$result, { data: field.args }, {}, {})}` : ``}

      ${field.type ? `${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "response", depth: 2 }, {}, {
      default: () => {
        return `Response`;
      }
    })}
        <p>Returns ${validate_component(TypeLink, "TypeLink").$$render($$result, { type: field.type }, {}, {})}.
        </p>` : ``}</div>
    <div class="${"sample svelte-1xxaho6"}">${validate_component(ContentSwitcher, "ContentSwitcher").$$render(
      $$result,
      { selectedIndex: selectedTab },
      {
        selectedIndex: ($$value) => {
          selectedTab = $$value;
          $$settled = false;
        }
      },
      {
        default: () => {
          return `${validate_component(Switch, "Switch").$$render($$result, { text: "GraphQL" }, {}, {})}
        ${validate_component(Switch, "Switch").$$render($$result, { text: "JS (Autogenerated SDK)" }, {}, {})}
        ${validate_component(Switch, "Switch").$$render($$result, { text: "Python (Autogenerated SDK)" }, {}, {})}`;
        }
      }
    )}
      <div>${selectedTab === 0 ? `${validate_component(AppQueryTabs, "AppQueryGenerator").$$render($$result, { type, field }, {}, {})}` : ``}
        ${selectedTab === 1 ? `${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "installing", depth: 4 }, {}, {
      default: () => {
        return `Setting up the SDK`;
      }
    })}
          <p style="${"margin-bottom:12px"}">To use queries in JavaScript / TypeScript directly in your code,
            make sure you have already built the <a href="${"/getting-started#javascript--typescript-autogenerated-sdk"}">Autogenerated JS SDK via the CLI</a></p>
          ${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "installing", depth: 4 }, {}, {
      default: () => {
        return `Running the query`;
      }
    })}
          <p style="${"margin-bottom:12px"}">In the below code, we assume the ${validate_component(CodeSpan, "CodeSpan").$$render($$result, {}, {}, {
      default: () => {
        return `client`;
      }
    })}
            is already authenticated instance of ${validate_component(CodeSpan, "CodeSpan").$$render($$result, {}, {}, {
      default: () => {
        return `FDMQueryClient`;
      }
    })}
            .
          </p>
          <p style="${"margin-bottom:12px"}">As well, the code below assumes that you have already imported ${validate_component(CodeSpan, "CodeSpan").$$render($$result, {}, {}, {
      default: () => {
        return `everything`;
      }
    })}. This is a built in functionality to help you fetch all immediate
            &quot;scalar&quot; values (non-nested values). Hence feel free to adjust the
            &quot;depth&quot; on the right hand side to see how nested values looks.
          </p>
          ${validate_component(AppQueryGenerator, "AppPrism").$$render(
      $$result,
      {
        code: ((_a = $graphqlQuery.jsQuery) == null ? void 0 : _a.query) ?? "# No query generated. Try increasing the depth",
        language: "typescript"
      },
      {},
      {}
    )}` : ``}
        ${selectedTab === 2 ? `${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "installing", depth: 4 }, {}, {
      default: () => {
        return `Setting up the SDK`;
      }
    })}
          <p style="${"margin-bottom:12px"}">To use queries in Python directly in your code, make sure you have
            already built the <a href="${"/getting-started#python-autogenerated-sdk"}">Autogenerated Python SDK via the CLI</a></p>
          ${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "installing", depth: 4 }, {}, {
      default: () => {
        return `Running the query`;
      }
    })}
          <p style="${"margin-bottom:12px"}">In the below code, we assume the ${validate_component(CodeSpan, "CodeSpan").$$render($$result, {}, {}, {
      default: () => {
        return `client`;
      }
    })}
            is already authenticated instance of ${validate_component(CodeSpan, "CodeSpan").$$render($$result, {}, {}, {
      default: () => {
        return `FDMQueryClient`;
      }
    })}
            .
          </p>
          ${validate_component(AppQueryGenerator, "AppPrism").$$render(
      $$result,
      {
        code: ((_b = $graphqlQuery.pythonQuery) == null ? void 0 : _b.query) ?? "# No query generated. Try increasing the depth",
        language: "python"
      },
      {},
      {}
    )}` : ``}</div></div></div>
</section>`;
  } while (!$$settled);
  $$unsubscribe_graphqlQuery();
  return $$rendered;
});
export {
  FieldDetails as F
};
