var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/eftpos/form/index.tsx
var form_exports = {};
__export(form_exports, {
  default: () => form_default,
  helpMapping: () => helpMapping
});
module.exports = __toCommonJS(form_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_group = require("../group");
var import_surcharge = __toESM(require("../surcharge"));
var import_receipt = __toESM(require("../receipt"));
var import_deviceList = __toESM(require("../deviceList"));
var Mapping = {
  Input: import_antd.Input,
  InputNumber: import_antd.InputNumber,
  Checkbox: import_antd.Checkbox,
  "Checkbox.Group": import_group.CheckboxGroup,
  Radio: import_antd.Radio,
  "Radio.Group": import_group.RadioGroup,
  "Radio.Button": import_antd.Radio.Button,
  Cascader: import_antd.Cascader,
  DatePicker: import_antd.DatePicker,
  Select: import_antd.Select,
  Slider: import_antd.Slider,
  Switch: import_antd.Switch,
  TimePicker: import_antd.TimePicker,
  Transfer: import_antd.Transfer,
  TreeSelect: import_antd.TreeSelect,
  Upload: import_antd.Upload
};
var CustomMapping = {
  Surcharge: import_surcharge.default,
  DeviceList: import_deviceList.default,
  Receipt: import_receipt.default
};
var CustomFormItem = ({
  formItemList,
  level = 0,
  onChange
}) => {
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, formItemList.map(({ __sourceName, Component, ...item }, index) => {
    if (Array.isArray(item.children)) {
      return /* @__PURE__ */ import_react.default.createElement(
        CustomFormItem,
        {
          formItemList: item.children,
          onChange,
          key: item.name ? `${item.name}${level}` : `${Component}${index}${level}`,
          level: level + 1
        }
      );
    }
    if (typeof Component === "object") {
      return /* @__PURE__ */ import_react.default.createElement(Component, { ...item, key: `${item.name}${level}` });
    }
    if (Mapping[Component]) {
      const Comm = Mapping[Component];
      const { input, ...formItemProps } = item;
      return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { ...formItemProps, key: `${item.name}${level}` }, /* @__PURE__ */ import_react.default.createElement(Comm, { ...input }));
    }
    if (Mapping[Component]) {
      const Comm = Mapping[Component];
      const { input, ...formItemProps } = item;
      return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { ...formItemProps, key: `${item.name}${level}` }, /* @__PURE__ */ import_react.default.createElement(Comm, { ...input }));
    }
    if (CustomMapping[Component]) {
      const Comm = CustomMapping[Component];
      return /* @__PURE__ */ import_react.default.createElement(Comm, { ...item, key: `${item.name}${level}` });
    }
    throw TypeError(
      `pos物料库 输入组件类型 ${Component} 无法映射,请正确传入组件类型`
    );
  }));
};
var form_default = CustomFormItem;
var helpMapping = {
  Surcharge: {
    getCommName: import_surcharge.getCommName,
    getCommDefaultVal: import_surcharge.getCommDefaultVal
  },
  Receipt: {
    getCommName: import_receipt.getCommName,
    getCommDefaultVal: import_receipt.getCommDefaultVal
  }
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  helpMapping
});
