// 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(["../../baUtil/ObjectUtil","esri/dijit/geoenrichment/utils/ObjectUtil","esri/dijit/geoenrichment/utils/SortUtil"],function(p,n,q){var g=Object.assign({},p,n,q);g.getPrototypeOf=function(a){try{return Object.getPrototypeOf?Object.getPrototypeOf(a):a.__proto__||a.constructor&&a.constructor.prototype}catch(b){return null}};g.isJson=function(a){return"object"===typeof a&&g.getPrototypeOf(a)===Object.prototype};g.copyJson=function(a){return void 0===a||null===a?null:JSON.parse(JSON.stringify({object:a})).object};
g.convert=function(a,b,d){var c=b||function(){};b=c(a);if("undefined"!==typeof b)return b;if(Array.isArray(a)){var e=[];a.forEach(function(l){e.push(g.convert(l,c,d))},this);return e}if(!g.isJson(a))return a;b={};for(var f in a){var k=a[f],h=d?c(f):f;"undefined"===typeof h&&(h=f);b[h]=g.convert(k,c,d)}return b};g.getDeepCopy=function(a){return g.convert(a)};g.getRange=function(a,b,d){b="function"===typeof b?b.bind(null==d?null:d):null;var c,e;for(e in a)if(d=a[e],d=Number(null===b?d:b(d,e)),!isNaN(d))if(void 0===
f)var f=c=d;else f=Math.min(f,d),c=Math.max(c,d);return void 0===f?{}:{min:f,max:c}};g.removeEmptyObjects=function(a){function b(c){c&&"object"===typeof c&&Object.keys(c).forEach(function(e){var f=c[e];!f||"object"!==typeof f||Array.isArray(f)||Object.keys(f).length?b(f):(d=!0,delete c[e])})}for(var d=!0;d;)d=!1,b(a);return a};g.removeValues=function(a,b){function d(c){c&&"object"===typeof c&&Object.keys(c).forEach(function(e){b(e,c[e])?d(c[e]):delete c[e]})}d(a);return a};g.isEqual=function(a,b){if(null===
a||"object"!==typeof a||null===b||"object"!==typeof b)return a===b;if(Object.keys(a).length!==Object.keys(b).length)return!1;var d={},c;for(c in a)d[c]=!0;for(c in b)if(void 0!==d[c])delete d[c];else return!1;for(c in a)if(!g.isEqual(a[c],b[c]))return!1;return!0};g.getObject=function(a,b){if(!b)return a;b=b.split(".");for(var d=0;d<b.length;d++)a=a&&a[b[d]];return a};g.formatNumber=function(a,b){b="number"===typeof b?{places:b}:b||{};if(null==b.places||0>b.places)b.places=g.getPlaces(a,!0),b.maxPlaces&&
b.places>b.maxPlaces&&(b.places=b.maxPlaces);return n.formatNumber(a,b)};g.getPlaces=function(a,b){function d(h,l){var m=a.indexOf(h,c);if(0>m)return e;h=a.charAt(m+h.length);return!h||0>l.indexOf(h)?e:m-c}a=+a;if(isNaN(a))return-1;a+="";var c=a.indexOf(".")+1,e=c?a.length-c:0;if(2>=e||!b)return e;b=0;if(!+a.substr(0,c-1))for(;"0"===a.charAt(c);)c++,b++,e--;for(var f=e-1;2<=f;f--){var k=Math.min(d("000000000000000".substr(0,f),"01234"),d("999999999999999".substr(0,f),"56789"));if(k!==e){e=k;break}}return e+
b};return g});