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