import { ref as d, watch as s, computed as n } from "vue";
import { updateLocalReactionsToggle as m, updateLocalReactionsRemove as f, updateLocalReactionsAdd as p } from "./useReactions.js";
function g(o) {
  const t = d(o.value);
  s(o, (e) => {
    t.value = e ? { ...e } : void 0;
  }, { deep: !0, immediate: !0 });
  const a = n(() => {
    var e;
    return (e = t.value) != null && e.items ? t.value.items.filter((l) => l.count > 0) : [];
  }), c = n(() => a.value.length > 0);
  function u(e) {
    p(t, e);
  }
  function i(e) {
    f(t, e);
  }
  function r(e) {
    m(t, e);
  }
  return {
    localReactions: t,
    displayedReactions: a,
    hasReactions: c,
    addReaction: u,
    removeReaction: i,
    toggleReaction: r
  };
}
export {
  g as useReactionsState
};
