import { defineComponent as g, ref as a, computed as v, createElementBlock as o, openBlock as n, Fragment as i, createElementVNode as f, createCommentVNode as I, toDisplayString as l, unref as p, renderList as b, createVNode as j } from "vue";
import { t as r } from "../../../locale/useLocale.js";
import A from "../FeedFoundItem/FeedFoundItem.vue.js";
const B = { style: { "padding-left": "12px" } }, C = ["onClick"], O = {
  key: 1,
  class: "feed-found-objects__placeholder"
}, q = /* @__PURE__ */ g({
  __name: "FeedFoundObjects",
  props: {
    objects: {
      type: Array,
      required: !0
    },
    foundAmount: {
      type: Number,
      default: 0
    },
    notFound: {
      type: Boolean,
      required: !1,
      default: !1
    }
  },
  emits: ["clickedSearch", "loadMore"],
  setup(t, { emit: F }) {
    const d = F, s = t, u = a(), m = a(null), h = v(() => s.notFound ? r("component.FeedFoundObjects.notFound") : s.notFound ? "" : r("component.FeedFoundObjects.notSearched")), k = (e) => {
      e.messageId && (d("clickedSearch", e.messageId), m.value = e);
    }, y = () => {
      const e = p(u);
      e.scrollHeight - e.scrollTop - e.clientHeight <= 0 && d("loadMore");
    };
    return (e, _) => (n(), o(i, null, [
      f("h3", B, l(p(r)("component.FeedFoundObjects.results")) + ": " + l(t.foundAmount), 1),
      t.foundAmount > 0 ? (n(), o("div", {
        key: 0,
        ref_key: "refItems",
        ref: u,
        class: "feed-found-objects__items",
        onScroll: y
      }, [
        (n(!0), o(i, null, b(t.objects, (c) => (n(), o("div", {
          key: c.messageId,
          onClick: (S) => k(c)
        }, [
          j(A, {
            object: c,
            selected: c == m.value
          }, null, 8, ["object", "selected"])
        ], 8, C))), 128))
      ], 544)) : t.foundAmount == 0 ? (n(), o("div", O, [
        f("p", null, l(h.value), 1)
      ])) : I("", !0)
    ], 64));
  }
});
export {
  q as default
};
