import { useEditorRef as a, getPlugin as c } from "@udecode/plate-core";
import { KEY_EMOJI as u, useEmojiDropdownMenuState as d } from "@udecode/plate-emoji";
import { withoutNormalizing as n, insertText as s, withoutMergingHistory as g, deleteText as l } from "@udecode/slate";
import { focusEditor as p } from "@udecode/slate-react";
const j = () => {
  const t = a(), {
    options: { createEmoji: r, emojiTriggeringController: m }
  } = c(t, u), { emojiPickerState: i } = d();
  return { selectEmojiFromDropdown: (e) => {
    n(t, () => {
      p(t);
      const o = r({
        key: e.id,
        text: e.name,
        data: {
          id: e.id,
          emoji: e.skins[0].native,
          name: e.name,
          text: e.name
        }
      });
      i.emojiLibrary.updateFrequentCategory(e.id), s(t, o);
    });
  }, selectEmojiFromCombobox: (e) => {
    n(t, () => {
      g(
        t,
        () => l(t, {
          distance: m.setIsTriggering(!1).getTextSize(),
          reverse: !0
        })
      );
      const o = r(e);
      s(t, o), i.emojiLibrary.updateFrequentCategory(e.key);
    });
  } };
};
export {
  j as useEmojiSelect
};
//# sourceMappingURL=useEmojiSelect.es.js.map
