import useEngineContext from "../../../../hooks/useEngineContext.js";
import locales_default from "../../locales.js";
import React from "react";
import { Iconfont } from "@pisell/materials";
import "./EmptyState.less";
//#region src/components/list/components/EmptyState/EmptyState.tsx
const EmptyState = ({ config = {
	show: true,
	text: "",
	icon: null,
	description: ""
}, hasData = false }) => {
	const context = useEngineContext();
	const getCurrentLanguage = () => {
		var _context$appHelper, _context$appHelper$ge, _context$appHelper$ge2, _context$appHelper2;
		const appLocale = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getApp) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.call(_context$appHelper)) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.locales) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge2 = _context$appHelper$ge.getLocale) === null || _context$appHelper$ge2 === void 0 ? void 0 : _context$appHelper$ge2.call(_context$appHelper$ge);
		const storageLocale = (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 || (_context$appHelper2 = _context$appHelper2.utils) === null || _context$appHelper2 === void 0 || (_context$appHelper2 = _context$appHelper2.storage) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.get("umi_locale");
		let finalLang = appLocale || storageLocale;
		if (!finalLang && typeof window !== "undefined") finalLang = localStorage.getItem("umi_locale");
		return finalLang || "en";
	};
	const getLocalText = (key, fallback) => {
		var _listLocales;
		const localText = (_listLocales = locales_default[getCurrentLanguage()]) === null || _listLocales === void 0 ? void 0 : _listLocales[key];
		if (typeof localText === "string") return localText;
		return fallback || "";
	};
	const displayText = config.text || getLocalText("pisell-list-empty-text-default", "No data available");
	if (!(config === null || config === void 0 ? void 0 : config.show) || hasData) return null;
	const defaultIcon = /* @__PURE__ */ React.createElement("div", { className: "empty-icon-wrapper" }, /* @__PURE__ */ React.createElement(Iconfont, {
		type: "pisell2-inbox-01",
		className: "empty-default-icon"
	}));
	return /* @__PURE__ */ React.createElement("div", { className: "pisell-list-empty-state" }, /* @__PURE__ */ React.createElement("div", { className: "empty-content" }, /* @__PURE__ */ React.createElement("div", { className: "empty-inner" }, config.icon || defaultIcon, /* @__PURE__ */ React.createElement("div", { className: "empty-text" }, displayText), config.description && /* @__PURE__ */ React.createElement("div", { className: "empty-description" }, config.description))));
};
//#endregion
export { EmptyState as default };
