'use strict';

const index = require('./index-1141a245.js');

const fieldTypeMap = new Map();
function registerField(fieldType, inputGenerator) {
  fieldTypeMap.set(fieldType, inputGenerator);
}
function generateField(field, value, errors = [], disabled, onFieldChange, onFieldBlur) {
  if (field.render) {
    return field.render(field, value, errors, disabled, onFieldChange, onFieldBlur);
  }
  if (field.customViewTag) {
    const Tag = field.customViewTag;
    return index.h(Tag, { disabled: disabled, field: field, errors: errors, onChange: onFieldChange, onBlur: onFieldBlur, value: value });
  }
  const generator = fieldTypeMap.get(field.type);
  if (generator) {
    return generator(field, value, errors, disabled, onFieldChange, onFieldBlur);
  }
  return null;
}

exports.generateField = generateField;
exports.registerField = registerField;
