"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const index = require("../../../locales/index.js");
function useUserInfo() {
  const { t } = index.useI18n();
  const userInfoRef = Vue.ref();
  const showUserControl = Vue.ref(false);
  function handleUserControl() {
    showUserControl.value = !showUserControl.value;
  }
  function hideUserControl(event) {
    var _a;
    if (!((_a = userInfoRef.value) == null ? void 0 : _a.contains(event.target))) {
      showUserControl.value = false;
    }
  }
  Vue.onMounted(() => {
    window.addEventListener("click", hideUserControl);
  });
  Vue.onUnmounted(() => {
    window.removeEventListener("click", hideUserControl);
  });
  return {
    t,
    showUserControl,
    userInfoRef,
    handleUserControl
  };
}
exports.default = useUserInfo;
