import { resolveComponent as p, openBlock as d, createElementBlock as l, createElementVNode as s, createVNode as k, Transition as x, withCtx as h, unref as t, createBlock as a, createCommentVNode as g, withDirectives as b, isRef as D, vModelText as V, TransitionGroup as W, Fragment as v, renderList as w, normalizeStyle as B } from "vue";
import { useUser as E, useWords as N, dictRecord as u } from "./composables-5f691338.js";
const T = { class: "flex flex-col gap-2" }, L = { class: "flex gap-2" }, R = { class: "flex flex-wrap gap-2" }, F = {
  __name: "DictWordList",
  emits: ["word", "root", "def"],
  setup(U) {
    const { user: m } = E(), { input: i, found: y, linked: C, addWord: _ } = N();
    return (r, e) => {
      const $ = p("dict-def-card"), f = p("dict-word-card");
      return d(), l("div", T, [
        s("div", {
          class: "font-bold text-xl mb-2 cursor-pointer",
          onClick: e[0] || (e[0] = (o) => r.$emit("root", "words"))
        }, "Words"),
        k(x, {
          name: "fade",
          mode: "out-in"
        }, {
          default: h(() => [
            t(u).def ? (d(), a($, {
              key: t(u).def,
              hash: t(u).def
            }, null, 8, ["hash"])) : g("", !0)
          ]),
          _: 1
        }),
        s("div", L, [
          b(s("input", {
            class: "p-2 rounded-lg flex-1 dark-bg-dark-400",
            "onUpdate:modelValue": e[1] || (e[1] = (o) => D(i) ? i.value = o : null),
            placeholder: "Enter a word"
          }, null, 512), [
            [V, t(i)]
          ]),
          s("button", {
            class: "button",
            onClick: e[2] || (e[2] = (o) => t(m).is ? t(_)() : t(m).auth = !0)
          }, "Add")
        ]),
        s("div", R, [
          k(W, { name: "list" }, {
            default: h(() => [
              t(i) ? (d(!0), l(v, { key: 1 }, w(t(y), (o) => (d(), a(f, {
                key: o.item.hash,
                style: B({ opacity: 1 - o.score }),
                hash: o.item.hash,
                onDef: e[4] || (e[4] = (n) => r.$emit("def", n)),
                onClick: (n) => r.$emit("word", o.item.hash)
              }, null, 8, ["style", "hash", "onClick"]))), 128)) : (d(!0), l(v, { key: 0 }, w(t(C), (o, n) => (d(), a(f, {
                key: n,
                hash: n,
                onDef: e[3] || (e[3] = (c) => r.$emit("def", c)),
                onClick: (c) => r.$emit("word", n)
              }, null, 8, ["hash", "onClick"]))), 128))
            ]),
            _: 1
          })
        ])
      ]);
    };
  }
};
export {
  F as default
};
//# sourceMappingURL=DictWordList-955e5fe7.js.map
