// 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/declare","dojo/_base/lang","dojo/_base/array","esri/lang"],function(d,e,f,b){return d([],{userRole:null,portalSelf:null,constructor:function(a,c){this.userRole=a;this.portalSelf=c},canPerformAnalysis:function(){var a=!1;this.userRole&&(this.userRole.isAdmin()||this.userRole.isPublisher())?a=!0:this.userRole&&this.userRole.isCustom()&&(a=this.userRole.canCreateItem()&&this.userRole.canPublishFeatures()&&this.userRole.canUseSpatialAnalysis());this.portalSelf&&this.portalSelf.isPortal&&
(a=a&&b.isDefined(this.portalSelf.helperServices.analysis)&&b.isDefined(this.portalSelf.helperServices.analysis.url));return a},hasPrivileges:function(a){return e.isArray(a)?f.every(a,function(c){return"networkanalysis"===c?this._canPerformNetworkAnalysis():"geoenrichment"===c?this._canPerformGeoEnrichment():"elevation"===c?this._canPerformElevationAnalysis():"drivetimearea"===c?this._canPerformDriveAnalysis():"planroutes"===c?this._canPerformPlanRoutesAnalysis():"od"===c?this._canPerformODAnalysis():
!1},this):!0},_canPerformNetworkAnalysis:function(){var a=b.isDefined(this.portalSelf.helperServices.asyncClosestFacility)&&b.isDefined(this.portalSelf.helperServices.asyncServiceArea)&&b.isDefined(this.portalSelf.helperServices.asyncVRP);return this.canPerformAnalysis()&&a&&this.userRole.canUseNetworkAnalysis()},_canPerformGeoEnrichment:function(){var a=b.isDefined(this.portalSelf.helperServices.geoenrichment);return this.canPerformAnalysis()&&a&&this.userRole.canUseGeoenrichment()},_canPerformElevationAnalysis:function(){var a=
b.isDefined(this.portalSelf.helperServices.elevation);return this.canPerformAnalysis()&&a&&this.userRole.canUseElevation()},_canPerformPlanRoutesAnalysis:function(){var a=b.isDefined(this.portalSelf.helperServices.routingUtilities)&&b.isDefined(this.portalSelf.helperServices.asyncVRP);return this.canPerformAnalysis()&&a&&this.userRole.canUseNetworkAnalysis()},_canPerformODAnalysis:function(){var a=b.isDefined(this.portalSelf.helperServices.routingUtilities)&&b.isDefined(this.portalSelf.helperServices.asyncRoute);
return this.canPerformAnalysis()&&a&&this.userRole.canUseNetworkAnalysis()},_canPerformDriveAnalysis:function(){var a=b.isDefined(this.portalSelf.helperServices.routingUtilities)&&b.isDefined(this.portalSelf.helperServices.asyncServiceArea);return this.canPerformAnalysis()&&a&&this.userRole.canUseNetworkAnalysis()},_canPerformNearestAnalysis:function(){var a=b.isDefined(this.portalSelf.helperServices.routingUtilities)&&b.isDefined(this.portalSelf.helperServices.asyncClosestFacility);return this.canPerformAnalysis()&&
a&&this.userRole.canUseNetworkAnalysis()}})});