import { defineComponent as _, inject as y, ref as v, computed as S, watch as k, onMounted as F, unref as o, createBlock as g, openBlock as m, Transition as L, withCtx as w, createElementVNode as r, withDirectives as C, createElementBlock as I, createCommentVNode as B, toDisplayString as D, vModelText as M, normalizeStyle as V } from "vue";
import { t as d } from "../../../locale/useLocale.js";
import { useDelayDebouncedRef as b } from "../../../hooks/useDelayDebouncedRef.js";
import "../../../hooks/useMessageDraft.js";
import { useSearchModel as A } from "../../../hooks/useSearchModel.js";
import "../../../hooks/useTheme.js";
/* empty css                              */
/* empty css                                              */
import "../../../node_modules/linkifyjs/dist/linkify.js";
import "../../../node_modules/linkify-string/dist/linkify-string.js";
import "../../../functions/parseMarkdown.js";
const E = { class: "feed-search__container" }, N = { style: { "line-height": "40px" } }, T = ["placeholder"], O = /* @__PURE__ */ _({
  __name: "FeedSearch",
  props: {
    isFeedLocation: {
      type: Boolean,
      default: !1
    }
  },
  emits: ["search", "cancel", "switch"],
  setup(a, { emit: u }) {
    const f = y("chatAppId"), { getModel: e } = A(f), c = u, l = a, i = v(), s = b("", 500), h = S(() => l.isFeedLocation ? "40px" : (l.isFeedLocation, "20px"));
    k(
      () => [e().text, s.value],
      () => {
        s.value == e().text ? c("search", e().text) : s.value = e().text;
      }
    );
    const x = () => {
      const t = o(i);
      t && (t.value = ""), e().text = "", c("cancel");
    };
    return F(() => {
      const t = o(i);
      t == null || t.focus();
    }), (t, n) => (m(), g(L, null, {
      default: w(() => [
        r("div", E, [
          r("span", N, D(o(d)("component.FeedSearch.SearchLabel")), 1),
          C(r("input", {
            ref_key: "refInput",
            ref: i,
            "onUpdate:modelValue": n[0] || (n[0] = (p) => o(e)().text = p),
            class: "feed-search__input",
            type: "text",
            placeholder: o(d)("component.FeedSearch.SearchPlaceholder")
          }, null, 8, T), [
            [M, o(e)().text]
          ]),
          r("i", {
            class: "pi pi-times",
            style: V({ right: h.value }),
            onClick: x
          }, null, 4),
          a.isFeedLocation ? (m(), I("span", {
            key: 0,
            class: "pi pi-refresh",
            style: { "margin-left": "5px", "margin-top": "10px", cursor: "pointer" },
            onClick: n[1] || (n[1] = (p) => c("switch"))
          })) : B("", !0)
        ])
      ]),
      _: 1
    }));
  }
});
export {
  O as default
};
