'use strict';

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

function findFieldNestedField(fields, fieldId) {
  if (fieldId.includes('.')) {
    const nestedFieldId = fieldId.split('.')[0];
    return fields.find(field => field.id === nestedFieldId);
  }
  return undefined;
}
function findField(fields, fieldId) {
  if (fieldId === 'name') {
    return new index.TextField('name', '');
  }
  return fields.find(field => field.id === fieldId) || findFieldNestedField(fields, fieldId);
}

exports.findField = findField;
