var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/plus/webPosLogin/components/UserFooter/index.tsx
var UserFooter_exports = {};
__export(UserFooter_exports, {
  default: () => UserFooter_default
});
module.exports = __toCommonJS(UserFooter_exports);
var import_react = __toESM(require("react"));
var import_utils = require("@pisell/utils");
var import_materials = require("@pisell/materials");
var import_index = require("./index.less");
var DEFAULT_USER_AVATAR = "https://pisell2-dev.s3.cn-north-1.amazonaws.com.cn/static/default-avatar.png";
var DEFAULT_STORE_ICON = "https://pisell2-dev.s3.cn-north-1.amazonaws.com.cn/static/default-store-icon.png";
var getStoreName = (store, locale = "en") => {
  var _a;
  if (!store) return "";
  const name = (_a = store == null ? void 0 : store.tenant) == null ? void 0 : _a.name;
  if (!name) return "";
  return name[locale] || name.original || "";
};
var UserFooter = (0, import_react.memo)((props) => {
  var _a;
  const {
    userInfo,
    selectedStore,
    step = "store",
    locale = "en",
    onChangeAccount,
    onChangeStore,
    isShowChangeStore = false
  } = props;
  const userAvatar = (userInfo == null ? void 0 : userInfo.avatar) || DEFAULT_USER_AVATAR;
  const userName = (userInfo == null ? void 0 : userInfo.name) || "";
  const storeIcon = ((_a = selectedStore == null ? void 0 : selectedStore.tenant) == null ? void 0 : _a.logo) || DEFAULT_STORE_ICON;
  const storeName = (0, import_react.useMemo)(
    () => getStoreName(selectedStore, locale),
    [selectedStore, locale]
  );
  const showStoreInfo = (step === "device" || step === "channel") && selectedStore && isShowChangeStore;
  if (!userInfo) return null;
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "user-footer" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "user-footer__user" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "user-footer__avatar" }, /* @__PURE__ */ import_react.default.createElement(
    import_materials.Image,
    {
      src: userAvatar,
      alt: userName,
      preview: false,
      width: 44,
      height: 44,
      fallbackType: "avatar"
    }
  )), /* @__PURE__ */ import_react.default.createElement("div", { className: "user-footer__info" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "user-footer__name" }, userName), /* @__PURE__ */ import_react.default.createElement("a", { className: "user-footer__action", onClick: onChangeAccount }, import_utils.locales.getText("webpos-login-change-account")))), showStoreInfo && /* @__PURE__ */ import_react.default.createElement("div", { className: "user-footer__store" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "user-footer__avatar" }, /* @__PURE__ */ import_react.default.createElement(
    import_materials.Image,
    {
      src: storeIcon,
      alt: storeName,
      preview: false,
      width: 44,
      height: 44,
      fallbackType: "avatar"
    }
  )), /* @__PURE__ */ import_react.default.createElement("div", { className: "user-footer__info" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "user-footer__name", title: storeName }, storeName), /* @__PURE__ */ import_react.default.createElement("a", { className: "user-footer__action", onClick: onChangeStore }, import_utils.locales.getText("webpos-login-change-store")))));
});
UserFooter.displayName = "UserFooter";
var UserFooter_default = UserFooter;
