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/components/list/utils/getText.ts
var getText_exports = {};
__export(getText_exports, {
  createGetText: () => createGetText,
  default: () => getText_default,
  useGetText: () => useGetText
});
module.exports = __toCommonJS(getText_exports);
var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
var useGetText = (locales) => {
  const context = (0, import_useEngineContext.default)();
  const getCurrentLanguage = () => {
    var _a, _b, _c, _d, _e, _f, _g, _h, _i;
    return ((_f = (_e = (_d = (_c = (_b = (_a = context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.getApp) == null ? void 0 : _c.call(_b)) == null ? void 0 : _d.locales) == null ? void 0 : _e.getLocale) == null ? void 0 : _f.call(_e)) || ((_i = (_h = (_g = context.appHelper) == null ? void 0 : _g.utils) == null ? void 0 : _h.storage) == null ? void 0 : _i.get("umi_locale")) || "zh-CN";
  };
  const getText = (key, fallback) => {
    var _a;
    const currentLang = getCurrentLanguage();
    const localText = (_a = locales[currentLang]) == null ? void 0 : _a[key];
    if (typeof localText === "string") {
      return localText;
    }
    return fallback || "";
  };
  const getTextFunc = (key) => {
    var _a;
    const currentLang = getCurrentLanguage();
    const localText = (_a = locales[currentLang]) == null ? void 0 : _a[key];
    return localText;
  };
  return {
    getText,
    getTextFunc,
    getCurrentLanguage
  };
};
var createGetText = (locales) => {
  const getCurrentLanguage = () => {
    return (typeof window !== "undefined" ? localStorage.getItem("umi_locale") : null) || "zh-CN";
  };
  const getText = (key, fallback) => {
    var _a;
    const currentLang = getCurrentLanguage();
    const localText = (_a = locales[currentLang]) == null ? void 0 : _a[key];
    if (typeof localText === "string") {
      return localText;
    }
    return fallback || "";
  };
  const getTextFunc = (key) => {
    var _a;
    const currentLang = getCurrentLanguage();
    const localText = (_a = locales[currentLang]) == null ? void 0 : _a[key];
    return localText;
  };
  return {
    getText,
    getTextFunc,
    getCurrentLanguage
  };
};
var getText_default = createGetText;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  createGetText,
  useGetText
});
