function _regenerator(){var v,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",t=e.toStringTag||"@@toStringTag";function n(e,r,t,n){var o,i,a,c,u,f,p,l,s,r=r&&r.prototype instanceof d?r:d,r=Object.create(r.prototype);return _regeneratorDefine2(r,"_invoke",(o=e,i=t,p=n||[],l=!1,s={p:f=0,n:0,v:v,a:g,f:g.bind(v,4),d:function(e,r){return a=e,c=0,u=v,s.n=r,y}},function(e,r,t){if(1<f)throw TypeError("Generator is already running");for(l&&1===r&&g(r,t),c=r,u=t;(_=c<2?v:u)||!l;){a||(c?c<3?(1<c&&(s.n=-1),g(c,u)):s.n=u:s.v=u);try{if(f=2,a){if(_=a[e=c?e:"next"]){if(!(_=_.call(a,u)))throw TypeError("iterator result is not an object");if(!_.done)return _;u=_.value,c<2&&(c=0)}else 1===c&&(_=a.return)&&_.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);a=v}else if((_=(l=s.n<0)?u:o.call(i,s))!==y)break}catch(e){a=v,c=1,u=e}finally{f=1}}return{value:_,done:l}}),!0),r;function g(e,r){for(c=e,u=r,_=0;!l&&f&&!t&&_<p.length;_++){var t,n=p[_],o=s.p,i=n[2];3<e?(t=i===r)&&(u=n[(c=n[4])?5:c=3],n[4]=n[5]=v):n[0]<=o&&((t=e<2&&o<n[1])?(c=0,s.v=r,s.n=n[1]):o<i&&(t=e<3||n[0]>r||i<r)&&(n[4]=e,n[5]=r,s.n=i,c=0))}if(t||1<e)return y;throw l=!0,r}}var y={};function d(){}function o(){}function i(){}var _=Object.getPrototypeOf,e=[][r]?_(_([][r]())):(_regeneratorDefine2(_={},r,function(){return this}),_),a=i.prototype=d.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_regeneratorDefine2(e,t,"GeneratorFunction")),e.prototype=Object.create(a),e}return _regeneratorDefine2(a,"constructor",o.prototype=i),_regeneratorDefine2(i,"constructor",o),_regeneratorDefine2(i,t,o.displayName="GeneratorFunction"),_regeneratorDefine2(a),_regeneratorDefine2(a,t,"Generator"),_regeneratorDefine2(a,r,function(){return this}),_regeneratorDefine2(a,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:n,m:c}})()}function _regeneratorDefine2(e,r,t,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(_regeneratorDefine2=function(e,r,t,n){function o(r,t){_regeneratorDefine2(e,r,function(e){return this._invoke(r,t,e)})}r?i?i(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(o("next",0),o("throw",1),o("return",2))})(e,r,t,n)}function asyncGeneratorStep(e,r,t,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(r,t){var n=c.apply(e,a);function o(e){asyncGeneratorStep(n,r,t,o,i,"next",e)}function i(e){asyncGeneratorStep(n,r,t,o,i,"throw",e)}o(void 0)})}}(()=>{function e(n,o,i,a,c){var u=this;function e(){return(e=_asyncToGenerator(_regenerator().m(function e(){var t;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,n.importDeviceTypeWithUI();case 1:t=e.v,a.success(c("New device protocol imported.")),u.onImported({importedProtocol:t}),e.n=3;break;case 2:e.p=2,r=e.v,_.isObjectLike(r)&&((r=r.errorMessage)?a.danger(o.getString('Could not import device protocol due to: "{{errorMessage | translate}}".',{errorMessage:r})):a.danger(c("Could not import device protocol.")));case 3:i.$apply();case 4:return e.a(2)}var r},e,null,[[0,2]])}))).apply(this,arguments)}_.assign(u,{importDeviceType:function(){return e.apply(this,arguments)}})}e.$inject=["c8yDeviceDatabase","gettextCatalog","$rootScope","c8yAlert","gettext"],angular.module("c8y.deviceProtocols").component("c8yDeviceProtocolImportButton",{bindings:{onImported:"&"},templateUrl:":::PLUGIN_PATH:::/device-protocol-import-button.html",controller:e,controllerAs:"vm"})})();