function _regenerator(){var p,e="function"==typeof Symbol?Symbol:{},t=e.iterator||"@@iterator",n=e.toStringTag||"@@toStringTag";function r(e,t,n,r){var o,i,c,a,u,f,s,l,d,t=t&&t.prototype instanceof g?t:g,t=Object.create(t.prototype);return _regeneratorDefine2(t,"_invoke",(o=e,i=n,s=r||[],l=!1,d={p:f=0,n:0,v:p,a:v,f:v.bind(p,4),d:function(e,t){return c=e,a=0,u=p,d.n=t,y}},function(e,t,n){if(1<f)throw TypeError("Generator is already running");for(l&&1===t&&v(t,n),a=t,u=n;(_=a<2?p:u)||!l;){c||(a?a<3?(1<a&&(d.n=-1),v(a,u)):d.n=u:d.v=u);try{if(f=2,c){if(_=c[e=a?e:"next"]){if(!(_=_.call(c,u)))throw TypeError("iterator result is not an object");if(!_.done)return _;u=_.value,a<2&&(a=0)}else 1===a&&(_=c.return)&&_.call(c),a<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),a=1);c=p}else if((_=(l=d.n<0)?u:o.call(i,d))!==y)break}catch(e){c=p,a=1,u=e}finally{f=1}}return{value:_,done:l}}),!0),t;function v(e,t){for(a=e,u=t,_=0;!l&&f&&!n&&_<s.length;_++){var n,r=s[_],o=d.p,i=r[2];3<e?(n=i===t)&&(u=r[(a=r[4])?5:a=3],r[4]=r[5]=p):r[0]<=o&&((n=e<2&&o<r[1])?(a=0,d.v=t,d.n=r[1]):o<i&&(n=e<3||r[0]>t||i<t)&&(r[4]=e,r[5]=t,d.n=i,a=0))}if(n||1<e)return y;throw l=!0,t}}var y={};function g(){}function o(){}function i(){}var _=Object.getPrototypeOf,e=[][t]?_(_([][t]())):(_regeneratorDefine2(_={},t,function(){return this}),_),c=i.prototype=g.prototype=Object.create(e);function a(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_regeneratorDefine2(e,n,"GeneratorFunction")),e.prototype=Object.create(c),e}return _regeneratorDefine2(c,"constructor",o.prototype=i),_regeneratorDefine2(i,"constructor",o),_regeneratorDefine2(i,n,o.displayName="GeneratorFunction"),_regeneratorDefine2(c),_regeneratorDefine2(c,n,"Generator"),_regeneratorDefine2(c,t,function(){return this}),_regeneratorDefine2(c,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:r,m:a}})()}function _regeneratorDefine2(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(_regeneratorDefine2=function(e,t,n,r){function o(t,n){_regeneratorDefine2(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))})(e,t,n,r)}function asyncGeneratorStep(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(a){return function(){var e=this,c=arguments;return new Promise(function(t,n){var r=a.apply(e,c);function o(e){asyncGeneratorStep(r,t,n,o,i,"next",e)}function i(e){asyncGeneratorStep(r,t,n,o,i,"throw",e)}o(void 0)})}}(()=>{function e(e,t,n,r,o,i,c,a,u){var f=n("Restart device"),s=this,l=a.get("additionalDeviceStatusButtons");function d(e){s.status=i.status(e)}function v(){return(v=_asyncToGenerator(_regenerator().m(function e(){return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,u.delete(s.device);case 1:r.success(n("Device deleted.")),t.path("/device");case 2:return e.a(2)}},e)}))).apply(this,arguments)}s.additionalButtonsHaveDelete=!1,_.assign(s,{$onInit:function(){o.detailRealtime(s.config.device.id,e,d).then(function(t){s.device=t,s.displayRestartBtn=o.supportsOperation(t,"c8y_Restart"),s.additionalButtonsInfo=l.filter(function(e){return e.canShowButton(t)}).map(function(e){return e.getButtonInfo()}),s.additionalButtonsHaveDelete=!!s.additionalButtonsInfo.filter(function(e){return"delete"===e.icon}).length})},restart:function(){c.create({deviceId:s.device.id,description:f,c8y_Restart:{}}).then(function(){r.success(n("Device will be restarted."))})},deleteDevice:function(){return v.apply(this,arguments)}})}e.$inject=["$scope","$location","gettext","c8yAlert","c8yDevices","c8yDeviceStatus","c8yDeviceControl","c8yServiceRegistry","c8yDeviceGridService"],angular.module("c8y.deviceStatus").component("c8yDeviceStatus",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/deviceStatus.html",bindings:{config:"<"}})})();