(()=>{function i(c,a,e,l,i){var t=[function(a,n){n.anyRole&&a.push(l.hasAnyRole(n.anyRole))},function(a,n){n.allRoles&&a.push(l.hasAllRoles(n.allRoles))},function(a,n){n.readMOs&&a.push(l.canReadMOs(n.readMOs))},function(a,n){n.adminMOs&&a.push(l.canAdminMOs(n.adminMOs))},function(a,n){n.allApps&&a.push(i.areAllAvailable(n.allApps))},function(a,n){n.anyApp&&a.push(i.isAnyAvailable(n.anyApp))}];function r(l,a,i){var n=[],t=a||{};_.isArray(a)?a.forEach(function(a){return s(n,a)}):s(n,t),e.all(n).then(function(a){return(n=l).allowed=_.every(a,o),n.allowed;var n}).then(function(a){var n;n=i,a=a,"A"===c&&(a?n.show():n.hide())})}function s(n,l){t.forEach(function(a){return a(n,l)})}function o(a){return!!a}return"E"===c?{restrict:"E",transclude:!0,template:a?'<span ng-if="!allowed" ng-transclude></span>':'<span ng-if="allowed" ng-transclude></span>',scope:{cfg:"<?cfg",anyRole:"<?",allRoles:"<?",readMOs:"<?readMos",adminMOs:"<?adminMos",allApps:"<?",anyApp:"<?"},link:function(a,n){a.$watch("cfg",_.partial(r,a,a.cfg,n),!0),a.$watch("anyRole",_.partial(r,a,a,n),!0),a.$watch("allRoles",_.partial(r,a,a,n),!0),a.$watch("readMOs",_.partial(r,a,a,n),!0),a.$watch("adminMOs",_.partial(r,a,a,n),!0),a.$watch("allApps",_.partial(r,a,a,n),!0),a.$watch("anyApp",_.partial(r,a,a,n),!0)}}:{restrict:"A",scope:{cfg:"<?cfg",anyRole:"<?",allRoles:"<?",readMOs:"<?readMos",adminMOs:"<?adminMos",allApps:"<?",anyApp:"<?"},link:function(a,n){a.$watch("cfg",_.partial(r,a,a.cfg,n),!0),a.$watch("anyRole",_.partial(r,a,a,n),!0),a.$watch("allRoles",_.partial(r,a,a,n),!0),a.$watch("readMOs",_.partial(r,a,a,n),!0),a.$watch("adminMOs",_.partial(r,a,a,n),!0),a.$watch("allApps",_.partial(r,a,a,n),!0),a.$watch("anyApp",_.partial(r,a,a,n),!0)}}}angular.module("c8y.ui").directive("c8yIfAllowed",["$q","c8yPermissions","c8yApplication",function(a,n,l){return i("E",!1,a,n,l)}]).directive("c8yIfAllowed",["$q","c8yPermissions","c8yApplication",function(a,n,l){return i("A",!1,a,n,l)}]).directive("c8yIfNotAllowed",["$q","c8yPermissions","c8yApplication",function(a,n,l){return i("E",!0,a,n,l)}]).directive("c8yIfNotAllowed",["$q","c8yPermissions","c8yApplication",function(a,n,l){return i("A",!0,a,n,l)}])})();