import { ref as N, resolveComponent as S, createElementBlock as c, openBlock as n, normalizeStyle as C, unref as e, createElementVNode as t, createTextVNode as _, createCommentVNode as y, toDisplayString as u, withModifiers as $, normalizeClass as V, Fragment as B, renderList as P, createBlock as z, withCtx as E, createVNode as F } from "vue";
import { useColor as O, useGun as R, useUser as j, useDictRecordsFor as G, langParts as I, dictRecord as d } from "./composables-BAZQlC3e.js";
import { DictWordCard as J } from "./components.js";
import { _export_sfc as L } from "./_plugin-vue_export-helper-DueaC3du.js";
const M = { class: "flex flex-col mb-4" }, T = { class: "flex" }, U = { class: "inline-flex text-sm gap-2" }, W = { class: "font-bold" }, q = { class: "flex flex-wrap gap-2" }, A = {
  __name: "DictDefPage",
  props: {
    hash: {
      type: String,
      default: ""
    }
  },
  emits: ["word", "close"],
  setup(s) {
    const f = s, x = O("light"), D = R(), { user: w } = j(), o = N();
    D.get("dict").get("#def").get(f.hash).once((i) => {
      o.value = JSON.parse(i);
    });
    const m = G(f.hash);
    return (i, l) => {
      var v, p, h, k, g;
      const b = S("dict-link-list");
      return n(), c("div", {
        class: "flex flex-col rounded-xl text-xl p-4",
        style: C({ backgroundColor: e(x).hex(s.hash) })
      }, [
        t("div", M, [
          t("div", {
            class: "text-xl flex flex-wrap items-center",
            style: C([{ "text-decoration-line": "underline" }, { textDecorationStyle: (p = e(I)[(v = o.value) == null ? void 0 : v.part]) == null ? void 0 : p.underline, textDecorationColor: e(x).hex(s.hash) }])
          }, [
            _(u((h = o.value) == null ? void 0 : h.text), 1),
            e(w).is ? (n(), c("div", {
              key: 0,
              class: V(["i-la-link link", { active: e(d).def == s.hash || e(m)[e(d).word] }]),
              onClick: l[0] || (l[0] = $((r) => e(d).def = e(d).def == s.hash ? null : s.hash, ["stop", "prevent"]))
            }, null, 2)) : y("", !0),
            l[3] || (l[3] = t("div", { class: "flex-1" }, null, -1)),
            t("button", {
              class: "cursor-pointer p-2",
              onClick: l[1] || (l[1] = (r) => i.$emit("close"))
            }, l[2] || (l[2] = [
              t("div", { class: "i-la-times text-xl" }, null, -1)
            ]))
          ], 4),
          t("div", T, [
            t("div", U, [
              t("div", W, u((k = o.value) == null ? void 0 : k.lang), 1),
              t("p", null, u((g = o.value) == null ? void 0 : g.part), 1)
            ])
          ])
        ]),
        t("div", q, [
          (n(!0), c(B, null, P(e(m), (r, a) => (n(), c("div", {
            class: "p-0",
            key: a
          }, [
            Object.keys(r).length > 0 ? (n(), z(e(J), {
              key: 0,
              class: "cursor-pointer",
              hash: a,
              onClick: (H) => i.$emit("word", a)
            }, {
              default: E(() => [
                F(b, {
                  links: { [a]: r },
                  avatar: !0
                }, null, 8, ["links"])
              ]),
              _: 2
            }, 1032, ["hash", "onClick"])) : y("", !0)
          ]))), 128))
        ])
      ], 4);
    };
  }
}, Z = /* @__PURE__ */ L(A, [["__scopeId", "data-v-731d254c"]]);
export {
  Z as default
};
//# sourceMappingURL=DictDefPage-C_7TYULZ.js.map
