import { useModal as P } from "@scalar/components";
import { ScalarIconArrowSquareIn as _, ScalarIconPackage as A, ScalarIconFolder as R, ScalarIconArrowUpRight as b, ScalarIconPuzzlePiece as q, ScalarIconBracketsCurly as x, ScalarIconCookie as E, ScalarIconSlidersHorizontal as L } from "@scalar/icons";
import u from "fuse.js";
import { ref as p, shallowRef as $, computed as o, toValue as a } from "vue";
import f from "../components/CommandPaletteExample.vue.js";
import z from "../components/CommandPaletteImport.vue.js";
import F from "../components/CommandPaletteImportCurl.vue.js";
import O from "../components/CommandPaletteOpenApiDocument.vue.js";
import U from "../components/CommandPaletteRequest.vue.js";
import v from "../components/CommandPaletteTag.vue.js";
const W = (m = T, l = Q) => {
  const c = P(), n = p(""), i = $(null), s = p(null), C = o(() => c.open), g = o(
    () => new u(a(m), {
      keys: ["name"],
      threshold: 0.2
    })
  ), h = o(
    () => new u(a(l), {
      keys: ["name"],
      threshold: 0.2
    })
  ), S = o(() => {
    const e = n.value.toLowerCase().trim();
    return (e ? g.value.search(e).map((t) => t.item) : a(m)).filter((t) => !t.hidden);
  }), w = o(() => {
    const e = n.value.toLowerCase().trim();
    return e ? h.value.search(e).map((r) => r.item) : a(l);
  }), I = (e, ...r) => {
    e && (i.value = a(m).find((t) => t.id === e) ?? null, s.value = r[0] ?? null), c.show();
  }, k = () => {
    c.hide(), d();
  }, y = (e) => {
    n.value = e;
  }, d = () => {
    n.value = "", i.value = null, s.value = null;
  };
  return {
    isOpen: C,
    activeCommand: i,
    activeCommandProps: s,
    filterQuery: n,
    filteredCommands: o(() => [
      {
        label: "",
        commands: S.value
      },
      {
        label: "Pages",
        commands: w.value
      }
    ]),
    open: I,
    close: k,
    setFilterQuery: y,
    reset: d
  };
}, Q = [
  {
    type: "route",
    id: "environment",
    name: "Environment",
    icon: x,
    to: {
      name: "workspace.environment"
    }
  },
  {
    type: "route",
    id: "cookies",
    name: "Cookies",
    icon: E,
    to: {
      name: "workspace.cookies"
    }
  },
  {
    type: "route",
    id: "settings",
    name: "Settings",
    icon: L,
    to: {
      name: "workspace.settings"
    }
  }
], T = [
  {
    id: "import-from-openapi-swagger-postman-curl",
    name: "Import from OpenAPI/Swagger/Postman/cURL",
    component: z,
    icon: _
  },
  {
    id: "create-openapi-document",
    name: "Create OpenAPI Document",
    component: O,
    icon: A
  },
  {
    id: "add-tag",
    name: "Add Tag",
    component: v,
    icon: R
  },
  {
    id: "create-request",
    name: "Create Request",
    component: U,
    icon: b
  },
  {
    id: "add-example",
    name: "Add Example",
    component: f,
    icon: q
  },
  {
    id: "import-curl-command",
    name: "Import cURL Command",
    hidden: !0,
    component: F
  },
  {
    id: "edit-tag",
    name: "Edit Tag",
    hidden: !0,
    component: v
  },
  {
    id: "edit-example",
    name: "Edit Example",
    hidden: !0,
    component: f
  }
];
export {
  T as baseClientActions,
  Q as baseRoutes,
  W as useCommandPaletteState
};
