import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { syncPayGroupToStorage } from "./payGroup.js";
import { miniRedux } from "@pisell/utils";
//#region src/components/pay/toC/model.tsx
const defaultState = {
	platform: void 0,
	order: null,
	status: "init",
	payCallback: () => {},
	history: null,
	walletSetting: {
		name: "",
		popup_status: null
	},
	payGroup: { wait_amount: 0 }
};
const { Provider, Context } = miniRedux({
	namespace: "state",
	state: defaultState,
	reducers: {
		setState(state, payload) {
			return _objectSpread2(_objectSpread2({}, state), payload);
		},
		setPayGroup(state, payload) {
			let res = _objectSpread2(_objectSpread2({}, state.payGroup), payload);
			syncPayGroupToStorage(res);
			return _objectSpread2(_objectSpread2({}, state), {}, { payGroup: res });
		},
		setWalletSetting(state, payload) {
			return _objectSpread2(_objectSpread2({}, state), {}, { walletSetting: _objectSpread2(_objectSpread2({}, state.walletSetting), payload) });
		},
		init(state, payload) {
			return _objectSpread2(_objectSpread2({}, defaultState), payload);
		},
		setMiniProgramPayment(state, payload) {
			return _objectSpread2(_objectSpread2({}, state), {}, { miniProgramPayment: _objectSpread2(_objectSpread2({}, state.miniProgramPayment), payload) });
		}
	}
});
//#endregion
export { Context, Provider };
