(window.webpackJsonp=window.webpackJsonp||[]).push([[23],{161:function(e,n,t){"use strict";t.r(n),t.d(n,"default",function(){return o});var s=t(22);const a="externalAuthSetToken",r="externalAuthRevokeToken";if(!window.externalApp&&!window.webkit)throw new Error("External auth requires either externalApp or webkit defined on Window object.");class o extends s.a{constructor(e){super({hassUrl:e,clientId:"",refresh_token:"",access_token:"",expires_in:0,expires:0})}async refreshAccessToken(){const e=new Promise((e,n)=>{window[a]=((t,s)=>t?e(s):n(s))});await 0;const n={callback:a};window.externalApp?window.externalApp.getExternalAuth(JSON.stringify(n)):window.webkit.messageHandlers.getExternalAuth.postMessage(n);const t=await e;this.data.access_token=t.access_token,this.data.expires=1e3*t.expires_in+Date.now()}async revoke(){const e=new Promise((e,n)=>{window[r]=((t,s)=>t?e(s):n(s))});await 0;const n={callback:r};window.externalApp?window.externalApp.revokeExternalAuth(JSON.stringify(n)):window.webkit.messageHandlers.revokeExternalAuth.postMessage(n),await e}}}}]);