"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _reactIntl = require("react-intl");

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var _default = configContext => {
  const {
    AutocompleteInput,
    CompoundInput,
    HierarchyInput,
    OptionPickerInput,
    TextInput,
    TermPickerInput,
    CheckboxInput,
    StructuredDateInput
  } = configContext.inputComponents;
  const {
    configKey: config
  } = configContext.configHelpers;
  const {
    DATA_TYPE_BOOL,
    DATA_TYPE_FLOAT,
    DATA_TYPE_INT
  } = configContext.dataTypes;
  const {
    extensions
  } = configContext.config;
  return {
    document: _objectSpread({
      [config]: {
        view: {
          type: CompoundInput,
          props: {
            defaultChildSubpath: 'ns2:places_common'
          }
        }
      },
      'rel:relations-common-list': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/relation'
          }
        },
        'relation-list-item': {
          [config]: {
            view: {
              type: HierarchyInput,
              props: {
                messages: (0, _reactIntl.defineMessages)({
                  parent: {
                    "id": "hierarchyInput.place.parent",
                    "defaultMessage": "Broader place"
                  },
                  children: {
                    "id": "hierarchyInput.place.children",
                    "defaultMessage": "Narrower places"
                  },
                  siblings: {
                    "id": "hierarchyInput.place.siblings",
                    "defaultMessage": "Adjacent places"
                  }
                })
              }
            }
          }
        }
      }
    }, extensions.core.fields, {
      'ns2:places_common': _objectSpread({
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/place'
          }
        },
        csid: {
          [config]: {
            cloneable: false
          }
        },
        inAuthority: {
          [config]: {
            cloneable: false
          }
        },
        refName: {
          [config]: {
            cloneable: false
          }
        },
        shortIdentifier: {
          [config]: {
            cloneable: false
          }
        },
        placeTermGroupList: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              required: {
                "id": "field.places_common.placeTermGroupList.required",
                "defaultMessage": "At least one term display name is required. Please enter a value."
              }
            }),
            required: true,
            view: {
              type: CompoundInput
            }
          },
          placeTermGroup: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  "id": "field.places_common.placeTermGroup.name",
                  "defaultMessage": "Term"
                }
              }),
              repeating: true,
              view: {
                type: CompoundInput
              }
            },
            termDisplayName: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termDisplayName.name",
                    "defaultMessage": "Display name"
                  }
                }),
                required: true,
                view: {
                  type: TextInput
                }
              }
            },
            termName: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termName.name",
                    "defaultMessage": "Name"
                  }
                }),
                view: {
                  type: TextInput,
                  props: {
                    // Suppress Chrome autofill
                    autoComplete: 'cspace-name'
                  }
                }
              }
            },
            termType: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termType.name",
                    "defaultMessage": "Type"
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'placeTermTypes'
                  }
                }
              }
            },
            termFlag: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.places_common.termFlag.fullName",
                    "defaultMessage": "Term flag"
                  },
                  name: {
                    "id": "field.places_common.termFlag.name",
                    "defaultMessage": "Flag"
                  }
                }),
                view: {
                  type: TermPickerInput,
                  props: {
                    source: 'placetermflag'
                  }
                }
              }
            },
            termStatus: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termStatus.name",
                    "defaultMessage": "Status"
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'placeTermStatuses'
                  }
                }
              }
            },
            termQualifier: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termQualifier.name",
                    "defaultMessage": "Qualifier"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            termLanguage: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.places_common.termLanguage.fullName",
                    "defaultMessage": "Term language"
                  },
                  name: {
                    "id": "field.places_common.termLanguage.name",
                    "defaultMessage": "Language"
                  }
                }),
                view: {
                  type: TermPickerInput,
                  props: {
                    source: 'languages'
                  }
                }
              }
            },
            termPrefForLang: {
              [config]: {
                dataType: DATA_TYPE_BOOL,
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termPrefForLang.name",
                    "defaultMessage": "Preferred for lang"
                  }
                }),
                view: {
                  type: CheckboxInput
                }
              }
            },
            termSource: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termSource.name",
                    "defaultMessage": "Name"
                  },
                  fullName: {
                    "id": "field.places_common.termSource.fullName",
                    "defaultMessage": "Source name"
                  }
                }),
                view: {
                  type: AutocompleteInput,
                  props: {
                    source: 'citation/local,citation/shared,citation/worldcat'
                  }
                }
              }
            },
            termSourceDetail: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termSourceDetail.name",
                    "defaultMessage": "Detail"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            termSourceID: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termSourceID.name",
                    "defaultMessage": "ID"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            termSourceNote: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.termSourceNote.name",
                    "defaultMessage": "Note"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            historicalStatus: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.historicalStatus.name",
                    "defaultMessage": "Historical status"
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'placeHistoricalStatuses'
                  }
                }
              }
            },
            nameAbbrev: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.nameAbbrev.name",
                    "defaultMessage": "Abbreviation"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            nameNote: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.nameNote.name",
                    "defaultMessage": "Note"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            nameDateGroup: _objectSpread({
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.places_common.nameDateGroup.fullName",
                    "defaultMessage": "Name date"
                  },
                  name: {
                    "id": "field.places_common.nameDateGroup.name",
                    "defaultMessage": "Date"
                  }
                }),
                view: {
                  type: StructuredDateInput
                }
              }
            }, extensions.structuredDate.fields)
          }
        },
        placeType: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.placeType.name",
                "defaultMessage": "Place type"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'placeTypes'
              }
            }
          }
        },
        placeSource: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.placeSource.name",
                "defaultMessage": "Place source"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        placeNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.placeNote.name",
                "defaultMessage": "Place note"
              }
            }),
            searchView: {
              type: TextInput
            },
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        placeOwnerGroupList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          placeOwnerGroup: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  "id": "field.places_common.placeOwnerGroup.name",
                  "defaultMessage": "Ownership"
                }
              }),
              repeating: true,
              view: {
                type: CompoundInput,
                props: {
                  tabular: true
                }
              }
            },
            owner: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.owner.name",
                    "defaultMessage": "Owner"
                  }
                }),
                view: {
                  type: AutocompleteInput,
                  props: {
                    source: 'person/local,person/shared,organization/local,organization/shared'
                  }
                }
              }
            },
            ownershipDateGroup: _objectSpread({
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.places_common.ownershipDateGroup.fullName",
                    "defaultMessage": "Ownership date"
                  },
                  name: {
                    "id": "field.places_common.ownershipDateGroup.name",
                    "defaultMessage": "Date"
                  }
                }),
                view: {
                  type: StructuredDateInput
                }
              }
            }, extensions.structuredDate.fields),
            ownershipNote: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.ownershipNote.name",
                    "defaultMessage": "Note"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            }
          }
        }
      }, extensions.address.fields, {
        vCoordinates: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vCoordinates.name",
                "defaultMessage": "Verbatim coords"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        vLatitude: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vLatitude.name",
                "defaultMessage": "Verbatim latitude"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        vLongitude: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vLongitude.name",
                "defaultMessage": "Verbatim longitude"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        vCoordSys: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vCoordSys.name",
                "defaultMessage": "Coordinate system"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'coordinateSystems'
              }
            }
          }
        },
        vSpatialReferenceSystem: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vSpatialReferenceSystem.name",
                "defaultMessage": "Spatial ref system"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'spatialRefSystems'
              }
            }
          }
        },
        vCoordSource: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vCoordSource.name",
                "defaultMessage": "Coordinate source"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        vCoordSourceRefId: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vCoordSourceRefId.name",
                "defaultMessage": "Coordinate source detail"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        vUnitofMeasure: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vUnitofMeasure.name",
                "defaultMessage": "Unit of measure"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'localityUnits'
              }
            }
          }
        },
        vElevation: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vElevation.name",
                "defaultMessage": "Elevation"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        minElevationInMeters: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.minElevationInMeters.name",
                "defaultMessage": "Min elevation (m)"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        maxElevationInMeters: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.maxElevationInMeters.name",
                "defaultMessage": "Max elevation (m)"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        vDepth: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vDepth.name",
                "defaultMessage": "Depth"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        minDepthInMeters: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.minDepthInMeters.name",
                "defaultMessage": "Min depth (m)"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        maxDepthInMeters: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.maxDepthInMeters.name",
                "defaultMessage": "Max depth (m)"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        vDistanceAboveSurface: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.vDistanceAboveSurface.name",
                "defaultMessage": "Distance above surface"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        minDistanceAboveSurfaceInMeters: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.minDistanceAboveSurfaceInMeters.name",
                "defaultMessage": "Min distance above surface (m)"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        maxDistanceAboveSurfaceInMeters: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.places_common.maxDistanceAboveSurfaceInMeters.name",
                "defaultMessage": "Max distance above surface (m)"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        placeGeoRefGroupList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          placeGeoRefGroup: {
            [config]: {
              repeating: true,
              view: {
                type: CompoundInput
              }
            },
            decimalLatitude: {
              [config]: {
                dataType: DATA_TYPE_FLOAT,
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.decimalLatitude.name",
                    "defaultMessage": "Decimal latitude"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            decimalLongitude: {
              [config]: {
                dataType: DATA_TYPE_FLOAT,
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.decimalLongitude.name",
                    "defaultMessage": "Decimal longitude"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            geodeticDatum: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.geodeticDatum.name",
                    "defaultMessage": "Datum"
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'geodeticDatums'
                  }
                }
              }
            },
            coordUncertaintyInMeters: {
              [config]: {
                dataType: DATA_TYPE_INT,
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.coordUncertaintyInMeters.name",
                    "defaultMessage": "Uncertainty (m)"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            coordPrecision: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.coordPrecision.name",
                    "defaultMessage": "Precision"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            pointRadiusSpatialFit: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.pointRadiusSpatialFit.name",
                    "defaultMessage": "Point radius spatial fit"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            footprintWKT: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.footprintWKT.name",
                    "defaultMessage": "Footprint WKT"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            footprintSRS: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.footprintSRS.name",
                    "defaultMessage": "Footprint SRS"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            footprintSpatialFit: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.footprintSpatialFit.name",
                    "defaultMessage": "Footprint spatial fit"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            geoReferencedBy: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.geoReferencedBy.name",
                    "defaultMessage": "Georeferenced by"
                  }
                }),
                view: {
                  type: AutocompleteInput,
                  props: {
                    source: 'person/local,person/shared,organization/local,organization/shared'
                  }
                }
              }
            },
            geoRefDateGroup: _objectSpread({
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.places_common.geoRefDateGroup.fullName",
                    "defaultMessage": "Georeference date"
                  },
                  name: {
                    "id": "field.places_common.geoRefDateGroup.name",
                    "defaultMessage": "Date"
                  }
                }),
                view: {
                  type: StructuredDateInput
                }
              }
            }, extensions.structuredDate.fields),
            geoRefProtocol: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.geoRefProtocol.name",
                    "defaultMessage": "Protocol"
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'geoRefProtocols'
                  }
                }
              }
            },
            geoRefSource: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.geoRefSource.name",
                    "defaultMessage": "Source"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            geoRefVerificationStatus: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.geoRefVerificationStatus.name",
                    "defaultMessage": "Verification"
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'geoRefVerificationStatuses'
                  }
                }
              }
            },
            geoRefRemarks: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.geoRefRemarks.name",
                    "defaultMessage": "Remarks"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            geoRefPlaceName: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    "id": "field.places_common.geoRefPlaceName.name",
                    "defaultMessage": "Georeference place name"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            }
          }
        }
      })
    })
  };
};

exports.default = _default;