import { useMd as E, computed as S, useColor as z, usePost as H, usePosts as T, openBlock as l, createElementBlock as i, createBaseVNode as t, Fragment as A, renderList as F, createBlock as u, unref as e, toDisplayString as m, createCommentVNode as a, normalizeStyle as Q, createVNode as M } from "./composables-Ci32s3jE.js";
import { PostLine as Y, UiLink as q, QrShare as G, PostActionUpdate as I, EmbedYoutube as J, PostList as K } from "./components.js";
const O = { class: "rounded-lg max-w-65ch flex flex-col items-stretch justify-center w-full overscroll-contain bg-light-200 dark-bg-dark-500" }, R = { class: "flex flex-wrap" }, W = { class: "z-30 flex flex-wrap items-center w-full px-4 py-2 sticky top-0 shadow-xl filter grayscale-70 hover-grayscale-0 transition duration-400ms" }, X = /* @__PURE__ */ t("div", { class: "p-0" }, "#", -1), Z = [
  X
], ee = { class: "ml-1 break-all font-bold" }, te = /* @__PURE__ */ t("div", { class: "flex-1" }, null, -1), se = /* @__PURE__ */ t("div", { class: "i-la-angle-left" }, null, -1), le = [
  se
], oe = /* @__PURE__ */ t("div", { class: "i-la-times" }, null, -1), ie = [
  oe
], ne = {
  class: "flex-1 flex flex-col items-stretch",
  style: { flex: "10 1 300px" }
}, ae = {
  key: 0,
  class: "z-1 max-w-100vw"
}, re = ["src"], de = { class: "flex flex-wrap items-start w-full justify-start" }, ce = { class: "w-full flex flex-col items-stretch" }, ue = { class: "p-2" }, he = ["src"], me = {
  key: 1,
  class: "text-2xl font-bold m-2"
}, fe = {
  key: 3,
  class: "m-2"
}, xe = /* @__PURE__ */ t("div", { class: "flex-auto" }, null, -1), ke = { class: "flex flex-wrap p-4 bg-dark-50 bg-opacity-25 dark-bg-dark-400 w-full items-center gap-1 text-sm" }, ve = {
  key: 0,
  class: "i-la-file-download"
}, pe = {
  key: 1,
  class: "i-la-redo-alt animate-spin"
}, ye = ["innerHTML"], we = {
  __name: "PostPage",
  props: {
    tag: { type: String, default: "" },
    hash: { type: String, default: "" }
  },
  emits: ["close", "browse", "user"],
  setup(d) {
    const N = E(), c = d;
    S(() => z("light").hex(c.hash));
    const U = S(() => z("deep").hex(c.hash)), { post: s, download: V, downloading: j } = H({ hash: c.hash }), { posts: _e, backlinks: D } = T(c.hash);
    return (r, o) => {
      var f, x, k, v, p, y, _, g, b, w, $, C, P, L;
      return l(), i("div", O, [
        t("div", R, [
          (l(!0), i(A, null, F(e(D), (n, h) => (l(), u(e(Y), {
            key: h,
            style: { flex: "1 1 220px" },
            hash: h,
            tag: d.tag,
            authors: n,
            back: !0,
            onUser: o[0] || (o[0] = (B) => r.$emit("user", B)),
            onClick: (B) => r.$emit("browse", h)
          }, null, 8, ["hash", "tag", "authors", "onClick"]))), 128))
        ]),
        t("div", W, [
          t("div", {
            class: "hover-underline text-md cursor-pointer font-bold flex",
            onClick: o[1] || (o[1] = (n) => r.$emit("close"))
          }, Z),
          t("div", ee, m((f = e(s)) == null ? void 0 : f.title), 1),
          te,
          t("button", {
            class: "p-2",
            onClick: o[2] || (o[2] = (n) => r.$router.back())
          }, le),
          t("button", {
            class: "p-2",
            onClick: o[3] || (o[3] = (n) => r.$emit("close"))
          }, ie)
        ]),
        t("div", ne, [
          (x = e(s)) != null && x.cover || (k = e(s)) != null && k.youtube || (v = e(s)) != null && v.text ? (l(), i("div", ae, [
            t("img", {
              class: "sticky top-0",
              src: e(s).cover
            }, null, 8, re)
          ])) : a("", !0),
          t("div", de, [
            t("div", ce, [
              t("div", ue, [
                e(s).icon ? (l(), i("img", {
                  key: 0,
                  class: "w-20 h-20 rounded-full m-2",
                  style: Q([{ flex: "0 1 40px" }, { borderColor: U.value }]),
                  src: e(s).icon
                }, null, 12, he)) : a("", !0),
                (p = e(s)) != null && p.title ? (l(), i("div", me, m((y = e(s)) == null ? void 0 : y.title), 1)) : a("", !0),
                (_ = e(s)) != null && _.link ? (l(), u(e(q), {
                  key: 2,
                  url: (g = e(s)) == null ? void 0 : g.link
                }, null, 8, ["url"])) : a("", !0),
                (b = e(s)) != null && b.statement ? (l(), i("div", fe, m((w = e(s)) == null ? void 0 : w.statement), 1)) : a("", !0)
              ]),
              xe,
              t("div", ke, [
                M(e(G)),
                M(e(I), { hash: d.hash }, null, 8, ["hash"]),
                t("button", {
                  class: "button flex items-center",
                  onClick: o[4] || (o[4] = (n) => e(V)())
                }, [
                  e(j) ? (l(), i("div", pe)) : (l(), i("div", ve))
                ])
              ])
            ])
          ]),
          ($ = e(s)) != null && $.youtube ? (l(), u(e(J), {
            key: 1,
            class: "mb-6 shadow-xl flex-1",
            video: (C = e(s)) == null ? void 0 : C.youtube
          }, null, 8, ["video"])) : a("", !0),
          (P = e(s)) != null && P.text ? (l(), i("div", {
            key: 2,
            class: "text-md markdown-body m-1 px-4 py-4 leading-relaxed",
            innerHTML: e(N).render((L = e(s)) == null ? void 0 : L.text)
          }, null, 8, ye)) : a("", !0),
          (l(), u(e(K), {
            key: d.tag,
            tag: d.hash,
            header: !1,
            onBrowse: o[5] || (o[5] = (n) => r.$emit("browse", n))
          }, null, 8, ["tag"]))
        ])
      ]);
    };
  }
};
export {
  we as default
};
//# sourceMappingURL=PostPage-CWoVu8jc.js.map
