(()=>{function e(v,e,t){n.$inject=["$q","$injector"],r.$inject=["gettextCatalog","c8yWizardModal","$injector","$location","c8yAlert","c8yModal","c8yBase","$q"];var o="deviceprotocols",f={parent:{name:v("Device types"),icon:"c8y-device-protocols"},name:v("Device protocols"),path:o,icon:"c8y-device-protocols",template:"<c8y-device-protocol-view></c8y-device-protocol-view>",showIf:n},g=[];return{$get:r,register:h,initUi:function(){t.when(o,f),e.addNavigation(f)}};function n(e,t){t=_.map(g,_.partial(m,t,e));return e.all(t).then(_.some)}function m(e,t,o){o=e.get(o.service),e=!!_.isUndefined(o.showIf)||e.invoke(o.showIf);return t.resolve(e)}function r(r,e,t,o,c,i,n,a){var l=_.partial(m,t,a);return{register:h,listProtocols:function(){return s().then(_.partialRight(_.map,u)).then(a.all).then(_.compact).then(n.combineLists)},edit:function(e){e=p(e).detailPath(e.data);o.path(e)},remove:function(e){var t=p(e),o=v("Delete protocol"),n={protocolType:e.name,protocolName:d(e)},n=r.getString('You are about to delete device protocol {{protocolType}} "{{protocolName}}". Do you want to proceed?',n),o={status:"warning",title:o,body:n,size:"sm",labels:{ok:v("Delete"),cancel:v("Cancel")}};return i(o).then(function(){return t.remove(e.data)}).then(function(){return c.success(v("Device protocol removed."))})},addWithWizard:function(){return e.open({component:"c8yAddDeviceProtocolWizard",backdrop:"static",keyboard:!1}).result},VIEW_CONFIG:f,getProtocols:s,getService:p,getProtocolName:d,getProtocolRowInfoComponent:function(e){{var t;void 0!==e&&(t=p(e),t=t.listRowInfoComponent||"c8yDeviceProtocolRow".concat(_.capitalize(e.id)))}return t},getActionsForProtocol:function(e){e=p(e);if(e.getListActions)return e.getListActions();return[]}};function u(o){var e=p(o),t=n.createListMapper(function(e){return _.assign({},o,{data:e})});return e.list().then(t).catch(function(e){var t=r.getString('Could not get device protocols of type "{{name}}".',o);c.danger(t,n.getResErrorMessage(e))})}function s(){var e=_.map(g,function(t){return l(t).then(function(e){return e?_.clone(t):void 0})});return a.all(e).then(_.filter)}function d(e){return p(e).getName(e.data)}function p(e){return t.get(e.service)}}function h(e){g.push(e)}}e.$inject=["gettext","c8yNavigatorProvider","c8yViewsProvider"],angular.module("c8y.deviceProtocols").provider("c8yDeviceProtocolUi",e)})();