import { c as create_ssr_component, a as compute_rest_props, b as spread, e as escape_attribute_value, d as escape_object, f as escape, n as getContext, v as validate_component, g as add_attribute, i as add_classes, m as missing_component, k as compute_slots, j as createEventDispatcher, l as each } from "./index-27250121.js";
import { T as Tag, L as Link, S as StructuredList, c as StructuredListBody, d as StructuredListRow, e as StructuredListCell } from "./PreviousNextPage-aa1b7b9e.js";
import { isNullableType, isListType, isNonNullType, isNamedType } from "graphql";
import { b as base } from "./paths-b9644fda.js";
import { u as urlUtils } from "./pages-a57618e2.js";
import _ from "lodash";
const ButtonSkeleton = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let $$restProps = compute_rest_props($$props, ["href", "size"]);
  let { href = void 0 } = $$props;
  let { size = "default" } = $$props;
  if ($$props.href === void 0 && $$bindings.href && href !== void 0)
    $$bindings.href(href);
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  return `
${href ? `<a${spread(
    [
      { href: escape_attribute_value(href) },
      {
        rel: escape_attribute_value($$restProps.target === "_blank" ? "noopener noreferrer" : void 0)
      },
      { role: "button" },
      escape_object($$restProps)
    ],
    {
      classes: "bx--skeleton bx--btn " + (size === "field" ? "bx--btn--field" : "") + " " + (size === "small" ? "bx--btn--sm" : "") + " " + (size === "lg" ? "bx--btn--lg" : "") + " " + (size === "xl" ? "bx--btn--xl" : "")
    }
  )}>${escape("")}</a>` : `<div${spread([escape_object($$restProps)], {
    classes: "bx--skeleton bx--btn " + (size === "field" ? "bx--btn--field" : "") + " " + (size === "small" ? "bx--btn--sm" : "") + " " + (size === "lg" ? "bx--btn--lg" : "") + " " + (size === "xl" ? "bx--btn--xl" : "")
  })}></div>`}`;
});
const ButtonSkeleton$1 = ButtonSkeleton;
const Button = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let hasIconOnly;
  let buttonProps;
  let $$restProps = compute_rest_props($$props, [
    "kind",
    "size",
    "expressive",
    "isSelected",
    "icon",
    "iconDescription",
    "tooltipAlignment",
    "tooltipPosition",
    "as",
    "skeleton",
    "disabled",
    "href",
    "tabindex",
    "type",
    "ref"
  ]);
  let $$slots = compute_slots(slots);
  let { kind = "primary" } = $$props;
  let { size = "default" } = $$props;
  let { expressive = false } = $$props;
  let { isSelected = false } = $$props;
  let { icon = void 0 } = $$props;
  let { iconDescription = void 0 } = $$props;
  let { tooltipAlignment = "center" } = $$props;
  let { tooltipPosition = "bottom" } = $$props;
  let { as = false } = $$props;
  let { skeleton = false } = $$props;
  let { disabled = false } = $$props;
  let { href = void 0 } = $$props;
  let { tabindex = "0" } = $$props;
  let { type = "button" } = $$props;
  let { ref = null } = $$props;
  const ctx = getContext("ComposedModal");
  if ($$props.kind === void 0 && $$bindings.kind && kind !== void 0)
    $$bindings.kind(kind);
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  if ($$props.expressive === void 0 && $$bindings.expressive && expressive !== void 0)
    $$bindings.expressive(expressive);
  if ($$props.isSelected === void 0 && $$bindings.isSelected && isSelected !== void 0)
    $$bindings.isSelected(isSelected);
  if ($$props.icon === void 0 && $$bindings.icon && icon !== void 0)
    $$bindings.icon(icon);
  if ($$props.iconDescription === void 0 && $$bindings.iconDescription && iconDescription !== void 0)
    $$bindings.iconDescription(iconDescription);
  if ($$props.tooltipAlignment === void 0 && $$bindings.tooltipAlignment && tooltipAlignment !== void 0)
    $$bindings.tooltipAlignment(tooltipAlignment);
  if ($$props.tooltipPosition === void 0 && $$bindings.tooltipPosition && tooltipPosition !== void 0)
    $$bindings.tooltipPosition(tooltipPosition);
  if ($$props.as === void 0 && $$bindings.as && as !== void 0)
    $$bindings.as(as);
  if ($$props.skeleton === void 0 && $$bindings.skeleton && skeleton !== void 0)
    $$bindings.skeleton(skeleton);
  if ($$props.disabled === void 0 && $$bindings.disabled && disabled !== void 0)
    $$bindings.disabled(disabled);
  if ($$props.href === void 0 && $$bindings.href && href !== void 0)
    $$bindings.href(href);
  if ($$props.tabindex === void 0 && $$bindings.tabindex && tabindex !== void 0)
    $$bindings.tabindex(tabindex);
  if ($$props.type === void 0 && $$bindings.type && type !== void 0)
    $$bindings.type(type);
  if ($$props.ref === void 0 && $$bindings.ref && ref !== void 0)
    $$bindings.ref(ref);
  {
    if (ctx && ref) {
      ctx.declareRef(ref);
    }
  }
  hasIconOnly = icon && !$$slots.default;
  buttonProps = {
    type: href && !disabled ? void 0 : type,
    tabindex,
    disabled: disabled === true ? true : void 0,
    href,
    "aria-pressed": hasIconOnly && kind === "ghost" && !href ? isSelected : void 0,
    ...$$restProps,
    class: [
      "bx--btn",
      expressive && "bx--btn--expressive",
      (size === "small" && !expressive || size === "sm" && !expressive || size === "small" && !expressive) && "bx--btn--sm",
      size === "field" && !expressive || size === "md" && !expressive && "bx--btn--md",
      size === "field" && "bx--btn--field",
      size === "small" && "bx--btn--sm",
      size === "lg" && "bx--btn--lg",
      size === "xl" && "bx--btn--xl",
      kind && `bx--btn--${kind}`,
      disabled && "bx--btn--disabled",
      hasIconOnly && "bx--btn--icon-only",
      hasIconOnly && "bx--tooltip__trigger",
      hasIconOnly && "bx--tooltip--a11y",
      hasIconOnly && tooltipPosition && `bx--btn--icon-only--${tooltipPosition}`,
      hasIconOnly && tooltipAlignment && `bx--tooltip--align-${tooltipAlignment}`,
      hasIconOnly && isSelected && kind === "ghost" && "bx--btn--selected",
      $$restProps.class
    ].filter(Boolean).join(" ")
  };
  return `
${skeleton ? `${validate_component(ButtonSkeleton$1, "ButtonSkeleton").$$render($$result, Object.assign({ href }, { size }, $$restProps, { style: hasIconOnly && "width: 3rem;" }), {}, {})}` : `${as ? `${slots.default ? slots.default({ props: buttonProps }) : ``}` : `${href && !disabled ? `
  <a${spread([escape_object(buttonProps)], {})}${add_attribute("this", ref, 0)}>${hasIconOnly ? `<span${add_classes("bx--assistive-text".trim())}>${escape(iconDescription)}</span>` : ``}
    ${slots.default ? slots.default({}) : ``}${validate_component(icon || missing_component, "svelte:component").$$render(
    $$result,
    {
      "aria-hidden": "true",
      class: "bx--btn__icon",
      "aria-label": iconDescription
    },
    {},
    {}
  )}</a>` : `<button${spread([escape_object(buttonProps)], {})}${add_attribute("this", ref, 0)}>${hasIconOnly ? `<span${add_classes("bx--assistive-text".trim())}>${escape(iconDescription)}</span>` : ``}
    ${slots.default ? slots.default({}) : ``}${validate_component(icon || missing_component, "svelte:component").$$render(
    $$result,
    {
      "aria-hidden": "true",
      class: "bx--btn__icon",
      "aria-label": iconDescription
    },
    {},
    {}
  )}</button>`}`}`}`;
});
const Button$1 = Button;
const DefaultValueDisplay = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { value } = $$props;
  if ($$props.value === void 0 && $$bindings.value && value !== void 0)
    $$bindings.value(value);
  return `${typeof value == "string" ? `&quot;${escape(value)}&quot;` : `${typeof value === "object" ? `${escape(JSON.stringify(value, null, 2))}` : `${escape(value ?? "-")}`}`}`;
});
const TooltipDefinition = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let $$restProps = compute_rest_props($$props, ["tooltipText", "open", "align", "direction", "id", "ref"]);
  let { tooltipText = "" } = $$props;
  let { open = false } = $$props;
  let { align = "center" } = $$props;
  let { direction = "bottom" } = $$props;
  let { id = "ccs-" + Math.random().toString(36) } = $$props;
  let { ref = null } = $$props;
  const dispatch = createEventDispatcher();
  if ($$props.tooltipText === void 0 && $$bindings.tooltipText && tooltipText !== void 0)
    $$bindings.tooltipText(tooltipText);
  if ($$props.open === void 0 && $$bindings.open && open !== void 0)
    $$bindings.open(open);
  if ($$props.align === void 0 && $$bindings.align && align !== void 0)
    $$bindings.align(align);
  if ($$props.direction === void 0 && $$bindings.direction && direction !== void 0)
    $$bindings.direction(direction);
  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);
  {
    dispatch(open ? "open" : "close");
  }
  return `

<span${spread([escape_object($$restProps)], {
    classes: "bx--tooltip--definition bx--tooltip--a11y"
  })}><button type="${"button"}"${add_attribute("aria-describedby", id, 0)}${add_classes(("bx--tooltip--a11y bx--tooltip__trigger bx--tooltip__trigger--definition " + (!open ? "bx--tooltip--hidden" : "") + " " + (open ? "bx--tooltip--visible" : "") + " " + (direction === "top" ? "bx--tooltip--top" : "") + " " + (direction === "bottom" ? "bx--tooltip--bottom" : "") + " " + (align === "start" ? "bx--tooltip--align-start" : "") + " " + (align === "center" ? "bx--tooltip--align-center" : "") + " " + (align === "end" ? "bx--tooltip--align-end" : "")).trim())}${add_attribute("this", ref, 0)}>${slots.default ? slots.default({}) : ``}</button>
  <div role="${"tooltip"}"${add_attribute("id", id, 0)}${add_classes("bx--assistive-text".trim())}>${slots.tooltip ? slots.tooltip({}) : `${escape(tooltipText)}`}</div></span>`;
});
const TooltipDefinition$1 = TooltipDefinition;
const DeprecatedTag = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { reason } = $$props;
  if ($$props.reason === void 0 && $$bindings.reason && reason !== void 0)
    $$bindings.reason(reason);
  return `${reason ? `${validate_component(Tag, "Tag").$$render($$result, { type: "red" }, {}, {
    default: () => {
      return `${validate_component(TooltipDefinition$1, "TooltipDefinition").$$render($$result, { tooltipText: reason }, {}, {
        default: () => {
          return `Deprecated`;
        }
      })}`;
    }
  })}` : ``}`;
});
const NullableTag = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { type } = $$props;
  if ($$props.type === void 0 && $$bindings.type && type !== void 0)
    $$bindings.type(type);
  return `${!isNullableType(type) ? `${validate_component(Tag, "Tag").$$render($$result, { type: "purple" }, {}, {
    default: () => {
      return `Non-null`;
    }
  })}` : ``}`;
});
const TypeLink = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { type } = $$props;
  if ($$props.type === void 0 && $$bindings.type && type !== void 0)
    $$bindings.type(type);
  return `${isListType(type) ? `[${validate_component(TypeLink, "svelte:self").$$render($$result, { type: type.ofType }, {}, {})}]` : `${isNonNullType(type) ? `${validate_component(TypeLink, "svelte:self").$$render($$result, { type: type.ofType }, {}, {})}!` : `${isNamedType(type) ? `${validate_component(Link, "Link").$$render(
    $$result,
    {
      href: urlUtils.joinUrlPaths(base, `/types/${String(type.name)}`)
    },
    {},
    {
      default: () => {
        return `${escape(type.name)}`;
      }
    }
  )}` : ``}`}`}`;
});
const TypeLinkTag = 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: "blue" }, {}, {
    default: () => {
      return `${validate_component(TypeLink, "TypeLink").$$render($$result, { type }, {}, {})}`;
    }
  })}`;
});
const ArgsList = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let items;
  let { data } = $$props;
  if ($$props.data === void 0 && $$bindings.data && data !== void 0)
    $$bindings.data(data);
  items = _.sortBy(
    data.map((arg) => ({
      id: arg.name,
      deprecationReason: arg.deprecationReason,
      name: arg.name,
      description: arg.description,
      default: arg.defaultValue,
      type: arg.type
    })),
    (item) => item.name
  ) || [];
  return `${validate_component(StructuredList, "StructuredList").$$render($$result, { condensed: true }, {}, {
    default: () => {
      return `${validate_component(StructuredListBody, "StructuredListBody").$$render($$result, {}, {}, {
        default: () => {
          return `${each(items, (item) => {
            return `${validate_component(StructuredListRow, "StructuredListRow").$$render($$result, {}, {}, {
              default: () => {
                return `${validate_component(StructuredListCell, "StructuredListCell").$$render($$result, {}, {}, {
                  default: () => {
                    return `<p><span style="${"font-weight: bold"}">${escape(item.name)}</span>
            ${validate_component(TypeLinkTag, "TypeLinkTag").$$render($$result, { type: item.type }, {}, {})}
            ${validate_component(DeprecatedTag, "DeprecatedTag").$$render($$result, { reason: item.deprecationReason }, {}, {})}
            ${validate_component(NullableTag, "NullableTag").$$render($$result, { type: item.type }, {}, {})}</p>
          ${item.description ? `<p>${escape(item.description)}</p>` : ``}
          ${item.default ? `Default: ${validate_component(DefaultValueDisplay, "DefaultValueDisplay").$$render($$result, { value: item.default }, {}, {})}` : ``}
        `;
                  }
                })}
      `;
              }
            })}`;
          })}`;
        }
      })}`;
    }
  })}`;
});
export {
  ArgsList as A,
  Button$1 as B,
  DeprecatedTag as D,
  NullableTag as N,
  TypeLink as T,
  TypeLinkTag as a,
  DefaultValueDisplay as b
};
