(window.webpackJsonp=window.webpackJsonp||[]).push([[23],{161:function(e,t,n){"use strict";n.r(t),n.d(t,"default",function(){return p});var r=n(22);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function a(e){i(u,r,o,a,c,"next",e)}function c(e){i(u,r,o,a,c,"throw",e)}a(void 0)})}}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}if(!window.externalApp&&!window.webkit)throw new Error("External auth requires either externalApp or webkit defined on Window object.");var p=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),c(this,s(t).call(this,{hassUrl:e,clientId:"",refresh_token:"",access_token:"",expires_in:0,expires:0}))}var n,o,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(t,r["a"]),n=t,(o=[{key:"refreshAccessToken",value:function(){var e=u(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Promise(function(e,t){window.externalAuthSetToken=function(n,r){return n?e(r):t(r)}}),e.next=3,0;case 3:return n={callback:"externalAuthSetToken"},window.externalApp?window.externalApp.getExternalAuth(JSON.stringify(n)):window.webkit.messageHandlers.getExternalAuth.postMessage(n),e.next=7,t;case 7:r=e.sent,this.data.access_token=r.access_token,this.data.expires=1e3*r.expires_in+Date.now();case 10:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"revoke",value:function(){var e=u(regeneratorRuntime.mark(function e(){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Promise(function(e,t){window.externalAuthRevokeToken=function(n,r){return n?e(r):t(r)}}),e.next=3,0;case 3:return n={callback:"externalAuthRevokeToken"},window.externalApp?window.externalApp.revokeExternalAuth(JSON.stringify(n)):window.webkit.messageHandlers.revokeExternalAuth.postMessage(n),e.next=7,t;case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}])&&a(n.prototype,o),i&&a(n,i),t}()}}]);