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/model.tsx
var model_exports = {};
__export(model_exports, {
  Context: () => Context,
  Provider: () => Provider
});
module.exports = __toCommonJS(model_exports);
var import_utils = require("@pisell/utils");
var DEFAULT_STATE = {
  // 卡列表默认值
  gift_card: [],
  product_voucher: [],
  point_card: [],
  product_discount_card: [],
  // UI状态默认值
  isShowMenu: true,
  setup: "menu",
  addModalOpen: false,
  dropMenuModalOpen: false,
  rechargeModalOpen: false,
  // 选中状态默认值
  currentId: "",
  currentTag: "gift_card",
  addWalletCode: "",
  //新增wallet 卡的code 用于匹配list对应的卡片
  currentDetail: {},
  // 搜索相关默认值
  searchList: [],
  currentSearchListItemCode: ""
};
var { Provider, Context } = (0, import_utils.miniRedux)({
  namespace: "global_wallet",
  state: DEFAULT_STATE,
  reducers: {
    /**
     * 设置状态
     * @param state 当前状态
     * @param payload 需要更新的状态
     */
    setState(state, payload) {
      return { ...state, ...payload };
    },
    /**
     * 设置当前ID
     * @param state 当前状态
     * @param payload 需要设置的ID
     */
    setCurrentId(state, payload) {
      return { ...state, currentId: payload };
    },
    /**
     * 设置当前标签
     * @param state 当前状态
     * @param payload 需要设置的标签
     */
    setCurrentTag(state, payload) {
      return { ...state, currentTag: payload };
    },
    /**
     * 初始化状态
     * @param state 当前状态
     * @param payload 初始化参数
     */
    init(state, payload) {
      return { ...DEFAULT_STATE, ...payload };
    }
  }
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Context,
  Provider
});
