/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","./fieldUtils"],(function(e,i){"use strict";function t(e){return"date"===e.type||"esriFieldTypeDate"===e.type}function s(e){return"oid"===e.type||"esriFieldTypeOID"===e.type}function l(e){return"global-id"===e.type||"esriFieldTypeGlobalID"===e.type}function n(e){return e.toLowerCase().trim()}return function(){function r(e){if(this.fields=e,this._fieldsMap=new Map,this._dateFieldsSet=new Set,this._numericFieldsSet=new Set,this.dateFields=[],this.numericFields=[],this._requiredFields=null,!e)return;const r=[];for(const u of e){const e=u&&u.name;if(e){const d=n(e);this._fieldsMap.set(e,u),this._fieldsMap.set(d,u),r.push(d),t(u)?(this.dateFields.push(u),this._dateFieldsSet.add(u)):i.isNumericField(u)&&(this._numericFieldsSet.add(u),this.numericFields.push(u)),s(u)||l(u)||(u.editable=null==u.editable||!!u.editable,u.nullable=null==u.nullable||!!u.nullable)}}r.sort(),this.uid=r.join(",")}var u=r.prototype;return u.destroy=function(){this._fieldsMap.clear()},u.has=function(e){return null!=this.get(e)},u.get=function(e){return null!=e?this._fieldsMap.get(e)||this._fieldsMap.get(n(e)):void 0},u.isDateField=function(e){return this._dateFieldsSet.has(this.get(e))},u.isNumericField=function(e){return this._numericFieldsSet.has(this.get(e))},u.normalizeFieldName=function(e){const i=this.get(e);if(i)return i.name},e._createClass(r,[{key:"requiredFields",get:function(){if(!this._requiredFields){this._requiredFields=[];for(const e of this.fields)s(e)||l(e)||e.nullable||void 0!==i.getFieldDefaultValue(e)||this._requiredFields.push(e)}return this._requiredFields}}]),r}()}));
