text: /*!
   * @websanova/vue-auth v4.1.10
   * https://websanova.com/docs/vue-auth
   * Released under the MIT License.
   */
  
  !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueAuth=e()}(this,function(){"use strict";function s(t){return null!==t&&"object"==typeof t&&t.constructor!==Array}function c(t){return"string"==typeof t||"number"==typeof t?[t]:t}function u(t,e){var n,r,o,i={};for(o in e=e||{},t)s(t[o])&&"FormData"!==t[o].constructor.name?i[o]=u(t[o],{}):i[o]=t[o];for(n=0,r=(e=e.constructor!==Array?[e]:e).length;n<r;n++)for(o in e[n])s(e[n][o])&&"FormData"!==e[n][o].constructor.name?i[o]=u(t[o]||{},[e[n][o]]):i[o]=e[n][o];return i}function l(t,e){var n,r,o;if("[object Object]"===Object.prototype.toString.call(t)&&"[object Object]"===Object.prototype.toString.call(e)){for(o in t)if(l(t[o],e[o]))return!0;return!1}if(t=c(t),e=c(e),!t||!e||t.constructor!==Array||e.constructor!==Array)return!1;for(n=0,r=t.length;n<r;n++)if(0<=e.indexOf(t[n]))return!0;return!1}function p(t,e){for(var n=e.split(".");n.length;)t=t[n.shift()];return t}function o(t,e,n){var r,o=t+"="+e+";";for(r in n)!1!==n[r]&&void 0!==n[r]&&(null===n[r]?this.options["getCookie"+r]&&(o+=" "+r+"="+this.options["getCookie"+r]()+";"):!0===n[r]?o+=" "+r+";":o+=" "+r+"="+n[r]+";");document.cookie=o}function i(t){return"string"!=typeof t&&null!=t?new Date((new Date).getTime()+t).toUTCString():t}function e(t){var e=Object.assign({},this.options.cookie);e.Expires=i(-12096e5),o.call(this,t,"",e)}var d=Object.freeze({get:function(t){for(var e=document.cookie,n=0,r=(e=e.replace(/;\s+/g,";").split(";").map(function(t){return t.replace(/\s+=\s+/g,"=").split("=")})).length;n<r;n++)if(e[n][0]&&e[n][0]===t)return e[n][1];return null},set:function(t,e,n){var r=this.options.cookie;r.Expires=!0===n?"":i(r.Expires),o.call(this,t,e,r)},remove:e});var f=Object.freeze({get:function(t){return sessionStorage.getItem(t)||localStorage.getItem(t)},set:function(t,e,n){(n?sessionStorage:localStorage).setItem(t,e)},remove:function(t){localStorage.removeItem(t),sessionStorage.removeItem(t)}});function r(t,e,n,r){var o=0,i=this.options.stores,a=i.length,s=[function(t){return(t=t||this.currentToken)?t:this.impersonating()?this.options.tokenImpersonateKey:this.options.tokenDefaultKey}.call(this,e)];for("set"===t&&(s.push(n),s.push(!0===r));o<a;o++){if("function"==typeof i[o][t])return i[o][t].apply(this,s);if("storage"===i[o]&&function(){try{if(!window.localStorage)throw"exception";return localStorage.setItem("storage_test",1),localStorage.removeItem("storage_test"),1}catch(t){return}}()&&function(){try{if(!window.sessionStorage)throw"exception";return sessionStorage.setItem("storage_test",1),sessionStorage.removeItem("storage_test"),1}catch(t){return}}())return f[t].apply(this,s);if("cookie"===i[o])return d[t].apply(this,s)}}function h(t){return r.call(this,"get",t)}function m(t,e,n){return r.call(this,"set",t,e,n)}function a(t){return r.call(this,"remove",t)}var v=null,n={rolesKey:"roles",rememberKey:"auth_remember",staySignedInKey:"auth_stay_signed_in",tokenDefaultKey:"auth_token_default",tokenImpersonateKey:"auth_token_impersonate",stores:["storage","cookie"],cookie:{Path:"/",Domain:null,Secure:!0,Expires:12096e5,SameSite:"None"},authRedirect:{path:"/login"},forbiddenRedirect:{path:"/403"},notFoundRedirect:{path:"/404"},registerData:{url:"auth/register",method:"POST",redirect:"/login",autoLogin:!1},loginData:{url:"auth/login",method:"POST",redirect:"/",fetchUser:!0,staySignedIn:!0},logoutData:{url:"auth/logout",method:"POST",redirect:"/",makeRequest:!1},fetchData:{url:"auth/user",method:"GET",enabled:!0},refreshData:{url:"auth/refresh",method:"GET",enabled:!0,interval:30},impersonateData:{url:"auth/impersonate",method:"POST",redirect:"/",fetchUser:!0},unimpersonateData:{url:"auth/unimpersonate",method:"POST",redirect:"/admin",fetchUser:!0,makeRequest:!1},oauth2Data:{url:"auth/social",method:"POST",redirect:"/",fetchUser:!0},getUrl:b,getCookieDomain:function(){return window.location.hostname},parseUserData:function(t){return t.data||{}}};function y(){return!h.call(v)}function g(t){var e;return t.to?e=t.to.auth:(t=t.matched.filter(function(t){return Object.prototype.hasOwnProperty.call(t.meta,"auth")})).length&&(e=t[t.length-1].meta.auth),e}function b(){var t=window.location.port;return window.location.protocol+"//"+window.location.hostname+(t?":"+t:"")}function w(t){v.$vm.state.loaded=!0,v.$vm.state.authenticated=t}function t(t){!0===t?m.call(v,v.options.staySignedInKey,"true",!1):a.call(v,v.options.staySignedInKey)}function k(t){t?(m.call(v,v.options.rememberKey,t,!1),v.$vm.state.remember=t):(a.call(v,v.options.rememberKey),v.$vm.state.remember=null)}function D(t){v.transitionPrev=v.transitionThis,v.transitionThis=t}function S(t){return v.options.parseUserData(v.drivers.http.httpData(t))}function I(t){var e;return t&&t.ignoreVueAuth||(!1===t.impersonating&&v.impersonating()&&(e=v.options.tokenDefaultKey),(e=h.call(v,e))&&v.drivers.auth.request.call(v,t,e)),t}function T(t,e){var n,r,o;e&&e.ignoreVueAuth||(n=t,e=v.transitionThis,v.drivers.http.invalidToken&&v.drivers.http.invalidToken.call(v,n)&&(e&&(r=g(e)),O(o=r?r.redirect||v.options.authRedirect:o)),(t=v.drivers.auth.response.call(v,t))&&m.call(v,null,t,!h.call(v,v.options.staySignedInKey)))}function $(t){var e=y();e&&v.$vm.state.authenticated&&O(),e||v.$vm.state.loaded||!v.options.refreshData.enabled?K(t):v.refresh().then(function(){K(t)})}function K(t){return null===v.$vm.state.authenticated&&h.call(v)?v.options.fetchData.enabled?void v.fetch().then(t,t):(P({}),t.call(v)):(v.$vm.state.loaded=!0,t.call(v))}function R(t,e,n){var r=(e||"").redirect||v.options.authRedirect,o=(e||"").forbiddenRedirect||(e||"").redirect||v.options.forbiddenRedirect,i=(e||"").notFoundRedirect||(e||"").redirect||v.options.notFoundRedirect,a=(e||"").rolesKey||v.options.rolesKey;if((e=c(void 0!==(e||"").roles?e.roles:e))&&(!0===e||e.constructor===Array||s(e)))if(v.check()){if(e.constructor!==Array&&!s(e)||l(e,p(v.$vm.state.data||{},a)))return v.$vm.state.redirect=v.transitionRedirectType?{type:v.transitionRedirectType,from:v.transitionPrev,to:v.transitionThis}:null,v.transitionRedirectType=null,n();v.transitionRedirectType=403,"function"==typeof o&&(o=o(t)),n.call(v,o)}else v.transitionRedirectType=401,"function"==typeof r&&(r=r(t)),n.call(v,r);else{if(!1!==e||!v.check())return v.$vm.state.redirect=v.transitionRedirectType?{type:v.transitionRedirectType,from:v.transitionPrev,to:v.transitionThis}:null,v.transitionRedirectType=null,n();v.transitionRedirectType=404,"function"==typeof i&&(i=i(t)),n.call(v,i)}}function P(t,e){v.$vm.state.data=t,w(!0),U(e)}function O(t){e.call(v,v.options.tokenImpersonateKey),e.call(v,v.options.tokenDefaultKey),a.call(v,v.options.tokenImpersonateKey),a.call(v,v.options.tokenDefaultKey),a.call(v,v.options.staySignedInKey),v.$vm.state.loaded=!0,v.$vm.state.authenticated=!1,v.$vm.state.data=null,U(t)}function U(t){t&&v.drivers.router.routerGo.call(v,t)}function j(t,e){(v=this).plugins=(e=e||{}).plugins,this.drivers=e.drivers,this.options=u(n,e.options),delete e.plugins,delete e.drivers,delete e.options,this.currentToken=null,this.transitionPrev=null,this.transitionThis=null,this.transitionRedirectType=null,function(){for(var t,e=["auth","http","router"],n=0,r=e.length;n<r;n++){if(!v.drivers[e[n]])return console.error('Error (@websanova/vue-auth): "'+e[n]+'" driver must be set.');if(v.drivers[e[n]].init&&(t=v.drivers[e[n]].init.call(v)))return console.error("Error (@websanova/vue-auth): "+t)}}(),v.$vm=new t({data:function(){return{state:{data:null,loaded:!1,redirect:null,authenticated:null,impersonating:void 0,remember:void 0}}}}),v.options.refreshData.enabled&&0<v.options.refreshData.interval&&setInterval(function(){v.options.refreshData.enabled&&!y()&&v.refresh()},1e3*v.options.refreshData.interval*60),v.drivers.http.interceptor.call(v,I,T),v.drivers.router.beforeEach.call(v,$,R,D,g)}function _(t,e){t.auth=new j(t,e),Object.defineProperties(t.prototype,{$auth:{get:function(){return t.auth}}})}return j.prototype.ready=function(){return v.$vm.state.loaded},j.prototype.load=function(){return new Promise(function(t){var e=null,e=setInterval(function(){v.$vm.state.loaded&&(clearInterval(e),t())},50)})},j.prototype.redirect=function(){return v.$vm.state.redirect},j.prototype.user=function(t){return void 0!==t&&P(t),v.$vm.state.data},j.prototype.check=function(t,e){return t=t,e=e,!0===v.$vm.state.authenticated&&(!t||l(t,p(v.$vm.state.data||{},e||v.options.rolesKey)))},j.prototype.impersonating=function(){var t=!!h.call(v,v.options.tokenImpersonateKey);return void 0===v.$vm.state.impersonating&&(v.$vm.state.impersonating=t),v.$vm.state.impersonating},j.prototype.token=function(t,e,n){return void 0!==e&&(null===e?a.call(v,t):(n=!0===n||!1===n?n:!h.call(v,v.options.staySignedInKey),m.call(v,t,e,n))),h.call(v,t)},j.prototype.fetch=function(n){return n=u(v.options.fetchData,n),new Promise(function(e,t){v.drivers.http.http.call(v,n).then(function(t){P(S(t),n.redirect),e(t)},t)})},j.prototype.refresh=function(t){return t=u(v.options.refreshData,t),v.drivers.http.http.call(v,t)},j.prototype.register=function(o){var i=u(v.options.registerData,o);return!0!==i.autoLogin&&(k(i.remember),t(i.staySignedIn)),new Promise(function(n,r){v.drivers.http.http.call(v,i).then(function(t){var e;i.autoLogin?(e=u(v.options.loginData,o),v.login(e).then(n,r)):(n(t),U(i.redirect))},r)})},j.prototype.login=function(r){return k((r=u(v.options.loginData,r)).remember),t(r.staySignedIn),new Promise(function(e,n){v.drivers.http.http.call(v,r).then(function(t){r.fetchUser||void 0===r.fetchUser&&v.options.fetchData.enabled?v.fetch({redirect:r.redirect}).then(e,n):(P(S(t),r.redirect),e(t))},function(t){w(!1),n(t)})})},j.prototype.remember=function(t){t&&k(t);t=h.call(v,v.options.rememberKey);return void 0===v.$vm.state.remember&&(v.$vm.state.remember=t),v.$vm.state.remember},j.prototype.unremember=function(){k(null)},j.prototype.logout=function(n){return n=u(v.options.logoutData,n),new Promise(function(e,t){n.makeRequest?v.drivers.http.http.call(v,n).then(function(t){O(n.redirect),e(t)},t):(O(n.redirect),e())})},j.prototype.impersonate=function(a){return a=u(v.options.impersonateData,a),new Promise(function(r,o){var i=v.token();v.drivers.http.http.call(v,a).then(function(t){var e,n;e=i,m.call(v,v.options.tokenImpersonateKey,v.token(),!h.call(v,v.options.staySignedInKey)),m.call(v,v.options.tokenDefaultKey,e,!h.call(v,v.options.staySignedInKey)),v.$vm.state.impersonating=!0,U(n),a.fetchUser||void 0===a.fetchUser&&v.options.fetchData.enabled?v.fetch({redirect:a.redirect}).then(r,o):(U(a.redirect),r(t))},o)})},j.prototype.unimpersonate=function(n){return n=u(v.options.unimpersonateData,n),new Promise(function(t,e){n.makeRequest?v.drivers.http.http.call(v,n).then(t,e):t()}).then(function(){return new Promise(function(t,e){a.call(v,v.options.tokenImpersonateKey),v.$vm.state.impersonating=!1,U(void 0),n.fetchUser||void 0===n.fetchUser&&v.options.fetchData.enabled?v.fetch({redirect:n.redirect}).then(t,e):(U(n.redirect),t())})})},j.prototype.oauth2=function(t,e){var n=[];if(e.code){try{e.state&&(e.state=JSON.parse(decodeURIComponent(e.state)))}catch(t){console.error("vue-auth:error There was an issue retrieving the state data."),e.state=e.state||{}}return delete(e=u(v.options.oauth2Data,[e.state,e])).code,delete e.state,delete e.params,v.login(e)}(e=u(v.drivers.oauth2[t],e)).params.state=JSON.stringify(e.params.state||{}),e.params.redirect_uri=(t=e.params.redirect_uri,/^https?:\/\//.test(t=t||"")?t:b()+"/"+t.replace(/^\/|\/$/g,"")),Object.keys(e.params).forEach(t=>{n.push(t+"="+encodeURIComponent(e.params[t]))}),window.open(e.url+"?"+n.join("&"),(e.window||{}).name||"_self",(e.window||{}).specs||{},!1!==(e.window||{}).replace)},j.prototype.enableImpersonate=function(){v.impersonating()&&(v.currentToken=null)},j.prototype.disableImpersonate=function(){v.impersonating()&&(v.currentToken=v.options.tokenDefaultKey)},"undefined"!=typeof window&&window.Vue&&window.Vue.use(_),_});