var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/wallet/utils/formatUtils.ts
var formatUtils_exports = {};
__export(formatUtils_exports, {
  calculateTotalValue: () => calculateTotalValue,
  createStatusMap: () => createStatusMap,
  findCardById: () => findCardById,
  formatDataToGroups: () => formatDataToGroups,
  hasAvailableCards: () => hasAvailableCards
});
module.exports = __toCommonJS(formatUtils_exports);
var import_utils = require("@pisell/utils");
var formatDataToGroups = (dataList) => {
  const available = {
    title: import_utils.locales.getText("page.wallet.available"),
    dataSource: dataList.filter(
      (item) => item.limit_status === "enable"
    )
  };
  const unavailable = {
    title: import_utils.locales.getText("page.wallet.unavailable"),
    dataSource: dataList.filter(
      (item) => item.limit_status === "disable"
    )
  };
  return [available, unavailable];
};
var calculateTotalValue = (dataList, valueField = "balance") => {
  const enabledCards = dataList.filter(
    (item) => item.limit_status === "enable" && item.tag !== "good_pass"
  );
  return enabledCards.reduce(
    (sum, item) => sum + Number(item[valueField] || 0),
    0
  );
};
var hasAvailableCards = (dataList) => {
  return dataList.some((item) => item.limit_status === "enable");
};
var findCardById = (dataList, id) => {
  if (!id) return void 0;
  return dataList.find((item) => item.id === id);
};
var createStatusMap = (translations) => {
  return (status) => {
    return translations[status] || status;
  };
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  calculateTotalValue,
  createStatusMap,
  findCardById,
  formatDataToGroups,
  hasAvailableCards
});
