// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
define(["dojo/_base/lang","dojo/_base/array","jimu/utils"],function(k,f,l){function g(a,d){var c=null;a&&a.fields&&f.some(a.fields,function(b){if(b.name.toLowerCase()===d.toLowerCase())return c=b,!0});return c}function h(a,d,c){var b=null;if(a&&a.attributes)for(var e in a.attributes)if(a.attributes.hasOwnProperty(e)&&"function"!==typeof a.attributes[e]&&e.toLowerCase()===d.toLowerCase()){b=c?a.attributes[e]=c:a.attributes[e];break}return b}return{getFieldInfosFromWebmap:function(a,d){var c=null;(a=
d.getLayerInfoByTopLayerId(a))&&(a=a.getPopupInfo())&&a.fieldInfos&&(c=k.clone(a.fieldInfos));c&&f.forEach(c,function(b){b.format&&b.format.dateFormat&&(b.format.dateFormat.toLowerCase&&0>b.format.dateFormat.toLowerCase().indexOf("time")?b.format.time=!1:b.format.time=!0)});return c},getEditCapabilities:function(a,d,c){var b={};c=a.getEditCapabilities(c);b.canCreate=c.canCreate;b.canDelete=c.canDelete;b.canUpdateGeometry=a.allowGeometryUpdates;d&&(b.canCreate=d.allowCreate&&b.canCreate,b.canDelete=
d.allowDelete&&b.canDelete,b.canUpdateGeometry=!d.disableGeometryUpdate&&b.canUpdateGeometry);return b},getLocaleDateTime:function(a){return l.localizeDate(new Date(a),{fullYear:!0,formatLength:"medium"})},getAttrByFieldKey:function(a,d){return h(a,d)},setAttrByFieldKey:function(a,d,c){return h(a,d,c)},ignoreCaseToGetFieldKey:function(a,d){var c=null;if(a=g(a,d))c=a.name;return c},ignoreCaseToGetFieldObject:function(a,d){return g(a,d)}}});