// 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("esri/request esri/geometry/geometryEngine dojo/Deferred dojo/_base/lang jimu/dijit/Message dojo/_base/array jimu/utils dijit/focus".split(" "),function(l,f,m,g,n,k,h,p){var d={};d.units={feet:{lengthUnit:"feet",areaUnit:"square-feet",bufferUnit:"UNIT_FOOT",lengthAbbr:window.jimuNls.units.feetAbbr,areaAbbr:window.jimuNls.units.squareFeetAbbr},meters:{lengthUnit:"meters",areaUnit:"square-meters",bufferUnit:"UNIT_METER",lengthAbbr:window.jimuNls.units.metersAbbr,areaAbbr:window.jimuNls.units.squareMetersAbbr},
miles:{lengthUnit:"miles",areaUnit:"square-miles",bufferUnit:"UNIT_STATUTE_MILE",lengthAbbr:window.jimuNls.units.milesAbbr,areaAbbr:window.jimuNls.units.squareMilesAbbr},yards:{lengthUnit:"yards",areaUnit:"square-yards",bufferUnit:"UNIT_SURVEY_YARD",lengthAbbr:window.jimuNls.units.yardsAbbr,areaAbbr:window.jimuNls.units.squareYardsAbbr},kilometers:{lengthUnit:"kilometers",areaUnit:"square-kilometers",bufferUnit:"UNIT_KILOMETER",lengthAbbr:window.jimuNls.units.kilometersAbbr,areaAbbr:window.jimuNls.units.squareKilometerAbbr}};
d.switchToTab=function(c,b){c.selectTab(b)};d.removeNegativeExponents=function(c){return 1<c.toString().toLowerCase().split("e-").length?0:c};d.applyRounding=function(c,b){if(isNaN(b)||null===b)b=2;var a=Math.pow(10,b);c=Math.round(c*a)/a;c=c.toFixed(b);return h.localizeNumber(c)};d.getLengthOfGeometry=function(c,b){var a;var e=0;(a=f.simplify(c))&&(e=c.spatialReference.isWebMercator()||4326===c.spatialReference.wkid?f.geodesicLength(a,b):f.planarLength(a,b));return e};d.getAreaOfGeometry=function(c,
b){var a=f.simplify(c);var e=0;a&&(e=c.spatialReference.isWebMercator()||4326===c.spatialReference.wkid?f.geodesicArea(a,b):f.planarArea(a,b));return e};d.deleteFeatures=function(c,b){var a=new m;l({url:c+"/deleteFeatures",content:{where:b,f:"json"}},{usePost:!0}).then(g.hitch(this,function(e){a.resolve(e)}),function(){a.reject(!1)});return a.promise};d.getUnitsAbbreviation=function(c,b){var a="";if("esriGeometryPolygon"===c||"polygon"===c)a=d.units[b].areaAbbr;else if("esriGeometryPolyline"===c||
"polyline"===c)a=d.units[b].lengthAbbr;return a};d.roundProjectCostValue=function(c,b){var a=0;b=parseFloat(b);switch(c){case "nearestWholeNumber":a=b.toFixed();break;case "nearestTen":a=eval(b.toFixed())/10;a=10*eval(a.toFixed());break;case "nearestHundred":a=eval(b.toFixed())/100;a=100*eval(a.toFixed());break;case "nearestThousand":a=eval(b.toFixed())/1E3;a=1E3*eval(a.toFixed());break;case "nearestTenThousands":a=eval(b.toFixed())/1E4;a=1E4*eval(a.toFixed());break;default:a=b.toFixed(2)}return h.localizeNumber(a)};
d.getPrjAssetTableFields=function(c){var b={};k.forEach(c.fields,g.hitch(this,function(a){"ASSETGUID"===a.name.toUpperCase()?b.ASSETGUID=a.name:"COSTEQUATION"===a.name.toUpperCase()?b.COSTEQUATION=a.name:"SCENARIO"===a.name.toUpperCase()?b.SCENARIO=a.name:"TEMPLATENAME"===a.name.toUpperCase()?b.TEMPLATENAME=a.name:"GEOGRAPHYGUID"===a.name.toUpperCase()?b.GEOGRAPHYGUID=a.name:"PROJECTGUID"===a.name.toUpperCase()&&(b.PROJECTGUID=a.name)}));b.OBJECTID=c.objectIdField;return b};d.getPrjLayerFields=function(c){var b=
{};k.forEach(c.fields,g.hitch(this,function(a){"PROJECTNAME"===a.name.toUpperCase()?b.PROJECTNAME=a.name:"DESCRIPTION"===a.name.toUpperCase()?b.DESCRIPTION=a.name:"TOTALASSETCOST"===a.name.toUpperCase()?b.TOTALASSETCOST=a.name:"GROSSPROJECTCOST"===a.name.toUpperCase()?b.GROSSPROJECTCOST=a.name:"GLOBALID"===a.name.toUpperCase()&&(b.GLOBALID=a.name)}));return b};d.getPrjMultiplierFields=function(c){var b={};k.forEach(c.fields,g.hitch(this,function(a){"DESCRIPTION"===a.name.toUpperCase()?b.DESCRIPTION=
a.name:"TYPE"===a.name.toUpperCase()?b.TYPE=a.name:"VALUE"===a.name.toUpperCase()?b.VALUE=a.name:"COSTINDEX"===a.name.toUpperCase()?b.COSTINDEX=a.name:"PROJECTGUID"===a.name.toUpperCase()&&(b.PROJECTGUID=a.name)}));b.OBJECTID=c.objectIdField;return b};d.showMessage=function(c){var b=new n({message:c});b.message=c;return b};d.evaluate=function(c){return(new Function("return "+c))()};d.validateEquation=function(c){if(""===c||-1<c.indexOf("\x26")||-1<c.indexOf("|")||-1<c.indexOf(","))return!1;c=c.replace(/{measure}/ig,
1);c=c.replace(/{totalmeasure}/ig,1);c=c.replace(/{totalcount}/ig,1);if(-1!==c.indexOf("{")||-1!==c.indexOf("}"))return!1;try{var b=d.evaluate(c);return isFinite(b)?!0:!1}catch(a){return!1}};d.setFirstAndLastWBFocusNode=function(c,b,a){h.initFirstFocusNode(c,b);p.focus(b);h.initLastFocusNode(c,a)};return d});