(()=>{a.$inject=["c8yUiUtil","c8yNavigator"],e.$inject=["c8yNavigatorProvider","c8yViewsProvider","c8yBreadcrumbsProvider","smartRulesTemplateBasePath","gettext"],angular.module("c8y.smartRulesUI",["c8y.smartRules"]).config(e).run(a);var c="rules";function e(e,a,t,n,i){s.$inject=["$q","c8yPermissions","c8ySmartRulesAvailability"];var r=n,n="/device/:deviceId",l=[n];function o(e){a.when(e,{priority:1e3,name:i("Smart rules"),icon:"c8y-smart-rules",showIf:["c8ySmartRulesAvailability",function(e){return e.shouldShowLocalSmartRules()}],templateUrl:"".concat(r,"list.html"),featureId:"smartRules"})}function s(e,a,t){a={hasInventoryReadAdminCreate:a.isAllowed({anyRole:["ROLE_INVENTORY_READ","ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE","ROLE_MANAGED_OBJECT_ADMIN","ROLE_MANAGED_OBJECT_CREATE","ROLE_MANAGED_OBJECT_READ"]}),hasSmartRuleReadAdmin:a.isAllowed({anyRole:["ROLE_SMARTRULE_READ","ROLE_SMARTRULE_ADMIN"]}),hasCepManagementAdmin:a.isAllowed({anyRole:["ROLE_CEP_MANAGEMENT_ADMIN"]}),isApplicationAvailable:t.isApplicationAvailable()};return e.all(a).then(function(e){return e.hasInventoryReadAdminCreate&&e.isApplicationAvailable&&(e.hasSmartRuleReadAdmin||e.hasCepManagementAdmin)})}a.when("/".concat(c),{templateUrl:"".concat(r,"list.html")}),l.forEach(o),e.addNavigation({parent:{name:i("Configuration"),icon:"c8y-tools"},name:i("Global smart rules"),path:c,icon:"c8y-smart-rules",showIf:s,featureId:"globalSmartRules"}),t.addBreadcrumbs(n,{data:["$routeParams","c8yDevices",function(e,a){e=e.deviceId;return a.getBreadcrumbsData(e)}]})}function a(e,a){e.shouldShowSmartRules().then(function(e){e||a.removeNavigation(a.findNode(function(e){return e.path===c}))})}})();