require("../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_const = require("../const.js");
let _pisell_utils = require("@pisell/utils");
//#region src/components/eftposPay/windcave/const.tsx
const _excluded = [
	"order_id",
	"name",
	"symbol",
	"amount",
	"mode",
	"number",
	"pay",
	"device",
	"net",
	"client"
];
/**
* @title: 初始化 windcave 数据
* @return store 全局数据管理
* @Author: hongbing.wang
* @Date: 2024-08-12 10:42
*/
var const_default = (params) => {
	const _ref = params || { mode: require_const.ModeEnum.Pay }, { order_id, name, symbol, amount, mode, number, pay, device, net, client } = _ref, other = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
	return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
		order_id,
		name,
		symbol,
		amount,
		mode,
		eftpos: require_const.EftposEnum.Windcave,
		key: Date.now(),
		warn: "",
		step: 0,
		type: require_const.PayRouteEnum.Step,
		title: _pisell_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
		component: "",
		status: require_const.StatusEnum.Loading,
		steps: [],
		render: true,
		client: client !== "undefined" && client !== void 0 ? client : require_const.ClientEnum.Merchant,
		custom: other ? require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, other), {}, {
			list: [],
			step: StepStatusEnum.Free
		}) : {
			list: [],
			step: StepStatusEnum.Free
		}
	}, typeof net !== "undefined" ? { net } : {}), typeof number !== "undefined" ? { number } : {}), typeof pay !== "undefined" ? { pay } : {}), typeof device !== "undefined" ? { device } : {});
};
let StepStatusEnum = /* @__PURE__ */ function(StepStatusEnum) {
	/**  空闲 */
	StepStatusEnum[StepStatusEnum["Free"] = 1] = "Free";
	/** 提交或插入卡 */
	StepStatusEnum[StepStatusEnum["Card"] = 2] = "Card";
	/** 选择账户 */
	StepStatusEnum[StepStatusEnum["Account"] = 3] = "Account";
	/** 选择应用 */
	StepStatusEnum[StepStatusEnum["Application"] = 4] = "Application";
	/** 输入PIN码 */
	StepStatusEnum[StepStatusEnum["Pin"] = 5] = "Pin";
	/** 处理中 */
	StepStatusEnum[StepStatusEnum["Processing"] = 6] = "Processing";
	/** 验证签名 */
	StepStatusEnum[StepStatusEnum["Receipt"] = 7] = "Receipt";
	/** 显示结果 */
	StepStatusEnum[StepStatusEnum["Wait"] = 8] = "Wait";
	return StepStatusEnum;
}({});
let StemTypeEnum = /* @__PURE__ */ function(StemTypeEnum) {
	/** 主动查询 */
	StemTypeEnum["Active"] = "active";
	/** 被动提交 */
	StemTypeEnum["Passive"] = "passive";
	return StemTypeEnum;
}({});
/**
* @title: windcave 步骤信息
* @description: 步骤对应配置信息
* @return 步骤配置信息
* @Author: hongbing.wang
* @Date: 2024-08-12 10:44
*/
const getStepMapping = (type, { money, mode = require_const.ModeEnum.Pay }) => {
	switch (type) {
		case StepStatusEnum.Free: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: _pisell_utils.locales.getText("page.eftpos-pay.text.wait")(money || "", mode),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Card: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: _pisell_utils.locales.getText("page.eftpos-pay.text.card"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Account: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: _pisell_utils.locales.getText("page.eftpos-pay.text.account"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Application: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: _pisell_utils.locales.getText("page.eftpos-pay.text.application"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Pin: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: _pisell_utils.locales.getText("page.eftpos-pay.text.pin"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Processing: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: _pisell_utils.locales.getText("page.eftpos-pay.text.transaction.processing"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Receipt: return {
			type: StemTypeEnum.Passive,
			status: "pedding",
			pedding: `${_pisell_utils.locales.getText("page.eftpos-pay.text.receipt.again.title")}\n${_pisell_utils.locales.getText("page.eftpos-pay.text.receipt.again.text")}`,
			resolve: _pisell_utils.locales.getText("page.eftpos-pay.text.receipt.again.title"),
			reject: _pisell_utils.locales.getText("page.eftpos-pay.text.receipt.again.title"),
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Wait: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: _pisell_utils.locales.getText("page.eftpos-pay.text.waiting.processing"),
			resolve: _pisell_utils.locales.getText("page.eftpos-pay.text.approved"),
			index: type,
			peddingStyle: {}
		};
		default: return null;
	}
};
//#endregion
exports.StemTypeEnum = StemTypeEnum;
exports.StepStatusEnum = StepStatusEnum;
exports.default = const_default;
exports.getStepMapping = getStepMapping;
