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