@roudanio/awesome-auth 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var AwesomeAuth=function(m){"use strict";function A(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k={exports:{}};(function(e){var r=Object.prototype.hasOwnProperty,t="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(t=!1));function d(c,i,s){this.fn=c,this.context=i,this.once=s||!1}function v(c,i,s,o,p){if(typeof s!="function")throw new TypeError("The listener must be a function");var u=new d(s,o||c,p),l=t?t+i:i;return c._events[l]?c._events[l].fn?c._events[l]=[c._events[l],u]:c._events[l].push(u):(c._events[l]=u,c._eventsCount++),c}function I(c,i){--c._eventsCount===0?c._events=new a:delete c._events[i]}function h(){this._events=new a,this._eventsCount=0}h.prototype.eventNames=function(){var i=[],s,o;if(this._eventsCount===0)return i;for(o in s=this._events)r.call(s,o)&&i.push(t?o.slice(1):o);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(s)):i},h.prototype.listeners=function(i){var s=t?t+i:i,o=this._events[s];if(!o)return[];if(o.fn)return[o.fn];for(var p=0,u=o.length,l=new Array(u);p<u;p++)l[p]=o[p].fn;return l},h.prototype.listenerCount=function(i){var s=t?t+i:i,o=this._events[s];return o?o.fn?1:o.length:0},h.prototype.emit=function(i,s,o,p,u,l){var g=t?t+i:i;if(!this._events[g])return!1;var n=this._events[g],y=arguments.length,b,f;if(n.fn){switch(n.once&&this.removeListener(i,n.fn,void 0,!0),y){case 1:return n.fn.call(n.context),!0;case 2:return n.fn.call(n.context,s),!0;case 3:return n.fn.call(n.context,s,o),!0;case 4:return n.fn.call(n.context,s,o,p),!0;case 5:return n.fn.call(n.context,s,o,p,u),!0;case 6:return n.fn.call(n.context,s,o,p,u,l),!0}for(f=1,b=new Array(y-1);f<y;f++)b[f-1]=arguments[f];n.fn.apply(n.context,b)}else{var re=n.length,T;for(f=0;f<re;f++)switch(n[f].once&&this.removeListener(i,n[f].fn,void 0,!0),y){case 1:n[f].fn.call(n[f].context);break;case 2:n[f].fn.call(n[f].context,s);break;case 3:n[f].fn.call(n[f].context,s,o);break;case 4:n[f].fn.call(n[f].context,s,o,p);break;default:if(!b)for(T=1,b=new Array(y-1);T<y;T++)b[T-1]=arguments[T];n[f].fn.apply(n[f].context,b)}}return!0},h.prototype.on=function(i,s,o){return v(this,i,s,o,!1)},h.prototype.once=function(i,s,o){return v(this,i,s,o,!0)},h.prototype.removeListener=function(i,s,o,p){var u=t?t+i:i;if(!this._events[u])return this;if(!s)return I(this,u),this;var l=this._events[u];if(l.fn)l.fn===s&&(!p||l.once)&&(!o||l.context===o)&&I(this,u);else{for(var g=0,n=[],y=l.length;g<y;g++)(l[g].fn!==s||p&&!l[g].once||o&&l[g].context!==o)&&n.push(l[g]);n.length?this._events[u]=n.length===1?n[0]:n:I(this,u)}return this},h.prototype.removeAllListeners=function(i){var s;return i?(s=t?t+i:i,this._events[s]&&I(this,s)):(this._events=new a,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=t,h.EventEmitter=h,e.exports=h})(k);var P=k.exports;const G=A(P);class w extends Error{}w.prototype.name="InvalidTokenError";function L(e){return decodeURIComponent(atob(e).replace(/(.)/g,(r,t)=>{let a=t.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}function N(e){let r=e.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return L(r)}catch{return atob(r)}}function D(e,r){if(typeof e!="string")throw new w("Invalid token specified: must be a string");r||(r={});const t=r.header===!0?0:1,a=e.split(".")[t];if(typeof a!="string")throw new w(`Invalid token specified: missing part #${t+1}`);let d;try{d=N(a)}catch(v){throw new w(`Invalid token specified: invalid base64 for part #${t+1} (${v.message})`)}try{return JSON.parse(d)}catch(v){throw new w(`Invalid token specified: invalid json for part #${t+1} (${v.message})`)}}var R=typeof global=="object"&&global&&global.Object===Object&&global,F=typeof self=="object"&&self&&self.Object===Object&&self,V=R||F||Function("return this")(),O=V.Symbol,C=Object.prototype,z=C.hasOwnProperty,J=C.toString,S=O?O.toStringTag:void 0;function U(e){var r=z.call(e,S),t=e[S];try{e[S]=void 0;var a=!0}catch{}var d=J.call(e);return a&&(r?e[S]=t:delete e[S]),d}var B=Object.prototype,K=B.toString;function M(e){return K.call(e)}var q="[object Null]",H="[object Undefined]",E=O?O.toStringTag:void 0;function Y(e){return e==null?e===void 0?H:q:E&&E in Object(e)?U(e):M(e)}var Q=Array.isArray;function W(e){return e!=null&&typeof e=="object"}var X="[object String]";function Z(e){return typeof e=="string"||!Q(e)&&W(e)&&Y(e)==X}var x=(e=>(e.INIT="init",e.VERIFYING="verifying",e.VERIFIED="verified",e.REFRESH="refresh",e.ERROR="error",e))(x||{});let _;class $ extends G{#e="";#t={};#s=0;#c;#o=!1;#n=!1;#i=!1;#a;#l;#r;constructor({googleId:r,prefix:t="aAuth",root:a="/api"}){if(super(),this.#c=r,this.#l=t,this.#r=a,this.#a=Date.now()/1e3>>0,this.setAccessToken(localStorage.getItem(this.localKey)||"",!1),this.#e){this.verifyToken().then(d=>{d||this.initGoogleIdentity()});return}this.initGoogleIdentity()}get accessToken(){return this.#e}get expiredIn(){return this.#s?0:this.#s-this.#a}get isVerifying(){return this.#n}get isVerified(){return this.#i}get localKey(){return`${this.#l}-token`}get root(){return this.#r}get user(){return this.#t}doSignIn(){this.initGoogleIdentity()}doSignOut(){this.#e="",google.accounts.id.revoke(this.#t.sub||""),this.#t={}}async store(r,t){t=Z(t)?t:JSON.stringify(t),await fetch(`${this.#r}/store`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`},body:JSON.stringify({key:r,value:t})})}async retrieve(r){const t=await fetch(`${this.#r}/retrieve`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`},body:JSON.stringify({key:r})}),{data:a}=await t.json();return a?.value}initGoogleIdentity(){if(!("google"in globalThis)){ee(),globalThis.onGoogleLibraryLoad=()=>this.initGoogleIdentity();return}this.#o||(this.emit("init",!0),this.#o=!0,google.accounts.id.initialize({client_id:this.#c,callback:r=>this.onGoogleIdentityCallback(r),auto_select:!0,ux_mode:"popup"}),google.accounts.id.prompt())}refreshCountDown(){this.#a=Date.now()/1e3>>0,this.expiredIn<=60&&(clearInterval(_),this.refreshToken())}async refreshToken(){this.emit("refresh",!0);const r=await fetch(`${this.#r}/refresh-token`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`}}),{data:t}=await r.json(),{token:a}=t;this.setAccessToken(a),this.emit("refresh",!1)}setAccessToken(r,t=!0){if(this.#e=r,t&&localStorage.setItem(this.localKey,r),!r){this.#t={},this.#s=0;return}try{this.#t=D(r)}catch{this.#t={}}this.#s=this.#t.exp||0,this.expiredIn>0&&(clearInterval(_),_=setInterval(()=>this.refreshCountDown(),1e3))}async verifyToken(){this.emit("verifying",!0),this.#n=!0;try{const r=await fetch(`${this.#r}/verify-auth`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`}}),{data:t}=await r.json();t&&(this.#t=t,this.#i=!0,this.emit("verified",!0))}catch(r){this.#i=!1,this.emit("error",r.message||String(r))}return this.emit("verifying",!1),this.#n=!1,this.#i}async onGoogleIdentityCallback(r){this.emit("init",!1),this.#o=!1,this.emit("verifying",!0),this.#n=!0;const t=await fetch(`${this.#r}/google-auth`,{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({credential:r.credential})}),{data:a}=await t.json();a||this.emit("error","Failed to validate user.");const{token:d}=a;this.setAccessToken(d),this.emit("verifying",!1),this.#n=!1,this.emit("verified",!0),this.#i=!0}}function ee(){const e="https://accounts.google.com/gsi/client";if(document.querySelector(`script[src="${e}"]`))return;const r=document.createElement("script");r.src=e,r.async=!0,document.head.appendChild(r)}let j;function te(e){return j=j||new $(e),j}return m.AwesomeAuth=$,m.AwesomeAuthEvent=x,m.getInstance=te,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}),m}({});
1
+ var AwesomeAuth=function(m){"use strict";function A(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k={exports:{}};(function(e){var n=Object.prototype.hasOwnProperty,t="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(t=!1));function d(c,i,s){this.fn=c,this.context=i,this.once=s||!1}function v(c,i,s,o,p){if(typeof s!="function")throw new TypeError("The listener must be a function");var u=new d(s,o||c,p),l=t?t+i:i;return c._events[l]?c._events[l].fn?c._events[l]=[c._events[l],u]:c._events[l].push(u):(c._events[l]=u,c._eventsCount++),c}function I(c,i){--c._eventsCount===0?c._events=new a:delete c._events[i]}function h(){this._events=new a,this._eventsCount=0}h.prototype.eventNames=function(){var i=[],s,o;if(this._eventsCount===0)return i;for(o in s=this._events)n.call(s,o)&&i.push(t?o.slice(1):o);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(s)):i},h.prototype.listeners=function(i){var s=t?t+i:i,o=this._events[s];if(!o)return[];if(o.fn)return[o.fn];for(var p=0,u=o.length,l=new Array(u);p<u;p++)l[p]=o[p].fn;return l},h.prototype.listenerCount=function(i){var s=t?t+i:i,o=this._events[s];return o?o.fn?1:o.length:0},h.prototype.emit=function(i,s,o,p,u,l){var g=t?t+i:i;if(!this._events[g])return!1;var r=this._events[g],y=arguments.length,b,f;if(r.fn){switch(r.once&&this.removeListener(i,r.fn,void 0,!0),y){case 1:return r.fn.call(r.context),!0;case 2:return r.fn.call(r.context,s),!0;case 3:return r.fn.call(r.context,s,o),!0;case 4:return r.fn.call(r.context,s,o,p),!0;case 5:return r.fn.call(r.context,s,o,p,u),!0;case 6:return r.fn.call(r.context,s,o,p,u,l),!0}for(f=1,b=new Array(y-1);f<y;f++)b[f-1]=arguments[f];r.fn.apply(r.context,b)}else{var ne=r.length,T;for(f=0;f<ne;f++)switch(r[f].once&&this.removeListener(i,r[f].fn,void 0,!0),y){case 1:r[f].fn.call(r[f].context);break;case 2:r[f].fn.call(r[f].context,s);break;case 3:r[f].fn.call(r[f].context,s,o);break;case 4:r[f].fn.call(r[f].context,s,o,p);break;default:if(!b)for(T=1,b=new Array(y-1);T<y;T++)b[T-1]=arguments[T];r[f].fn.apply(r[f].context,b)}}return!0},h.prototype.on=function(i,s,o){return v(this,i,s,o,!1)},h.prototype.once=function(i,s,o){return v(this,i,s,o,!0)},h.prototype.removeListener=function(i,s,o,p){var u=t?t+i:i;if(!this._events[u])return this;if(!s)return I(this,u),this;var l=this._events[u];if(l.fn)l.fn===s&&(!p||l.once)&&(!o||l.context===o)&&I(this,u);else{for(var g=0,r=[],y=l.length;g<y;g++)(l[g].fn!==s||p&&!l[g].once||o&&l[g].context!==o)&&r.push(l[g]);r.length?this._events[u]=r.length===1?r[0]:r:I(this,u)}return this},h.prototype.removeAllListeners=function(i){var s;return i?(s=t?t+i:i,this._events[s]&&I(this,s)):(this._events=new a,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=t,h.EventEmitter=h,e.exports=h})(k);var P=k.exports;const G=A(P);class w extends Error{}w.prototype.name="InvalidTokenError";function L(e){return decodeURIComponent(atob(e).replace(/(.)/g,(n,t)=>{let a=t.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}function N(e){let n=e.replace(/-/g,"+").replace(/_/g,"/");switch(n.length%4){case 0:break;case 2:n+="==";break;case 3:n+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return L(n)}catch{return atob(n)}}function D(e,n){if(typeof e!="string")throw new w("Invalid token specified: must be a string");n||(n={});const t=n.header===!0?0:1,a=e.split(".")[t];if(typeof a!="string")throw new w(`Invalid token specified: missing part #${t+1}`);let d;try{d=N(a)}catch(v){throw new w(`Invalid token specified: invalid base64 for part #${t+1} (${v.message})`)}try{return JSON.parse(d)}catch(v){throw new w(`Invalid token specified: invalid json for part #${t+1} (${v.message})`)}}var R=typeof global=="object"&&global&&global.Object===Object&&global,F=typeof self=="object"&&self&&self.Object===Object&&self,V=R||F||Function("return this")(),O=V.Symbol,C=Object.prototype,z=C.hasOwnProperty,J=C.toString,S=O?O.toStringTag:void 0;function U(e){var n=z.call(e,S),t=e[S];try{e[S]=void 0;var a=!0}catch{}var d=J.call(e);return a&&(n?e[S]=t:delete e[S]),d}var B=Object.prototype,K=B.toString;function M(e){return K.call(e)}var q="[object Null]",H="[object Undefined]",E=O?O.toStringTag:void 0;function Y(e){return e==null?e===void 0?H:q:E&&E in Object(e)?U(e):M(e)}var Q=Array.isArray;function W(e){return e!=null&&typeof e=="object"}var X="[object String]";function Z(e){return typeof e=="string"||!Q(e)&&W(e)&&Y(e)==X}var x=(e=>(e.INIT="init",e.VERIFYING="verifying",e.VERIFIED="verified",e.REFRESH="refresh",e.ERROR="error",e))(x||{});let _;class $ extends G{#e="";#t={};#s=0;#c;#o=!1;#r=!1;#i=!1;#a;#l;#n;constructor({googleId:n,prefix:t="aAuth",root:a="/api"}){if(super(),this.#c=n,this.#l=t,this.#n=a,this.#a=Date.now()/1e3>>0,this.setAccessToken(localStorage.getItem(this.localKey)||"",!1),this.#e){this.verifyToken().then(d=>{d||this.initGoogleIdentity()});return}this.initGoogleIdentity()}get accessToken(){return this.#e}get expiredIn(){return this.#s?0:this.#s-this.#a}get isVerifying(){return this.#r}get isVerified(){return this.#i}get localKey(){return`${this.#l}-token`}get root(){return this.#n}get user(){return this.#t}doSignIn(){this.initGoogleIdentity()}doSignOut(){this.#e="",google.accounts.id.revoke(this.#t.sub||""),this.#t={}}async store(n,t){t=Z(t)?t:JSON.stringify(t),await fetch(`${this.#n}/store`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`},body:JSON.stringify({key:n,value:t})})}async retrieve(n){const t=await fetch(`${this.#n}/retrieve`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`},body:JSON.stringify({key:n})}),{data:a}=await t.json();return a?.value}initGoogleIdentity(){if(!("google"in globalThis)||!("accounts"in globalThis.google)){ee(),globalThis.onGoogleLibraryLoad=()=>this.initGoogleIdentity();return}this.#o||(this.emit("init",!0),this.#o=!0,google.accounts.id.initialize({client_id:this.#c,callback:n=>this.onGoogleIdentityCallback(n),auto_select:!0,ux_mode:"popup"}),google.accounts.id.prompt())}refreshCountDown(){this.#a=Date.now()/1e3>>0,this.expiredIn<=60&&(clearInterval(_),this.refreshToken())}async refreshToken(){this.emit("refresh",!0);const n=await fetch(`${this.#n}/refresh-token`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`}}),{data:t}=await n.json(),{token:a}=t;this.setAccessToken(a),this.emit("refresh",!1)}setAccessToken(n,t=!0){if(this.#e=n,t&&localStorage.setItem(this.localKey,n),!n){this.#t={},this.#s=0;return}try{this.#t=D(n)}catch{this.#t={}}this.#s=this.#t.exp||0,this.expiredIn>0&&(clearInterval(_),_=setInterval(()=>this.refreshCountDown(),1e3))}async verifyToken(){this.emit("verifying",!0),this.#r=!0;try{const n=await fetch(`${this.#n}/verify-auth`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`}}),{data:t}=await n.json();t&&(this.#t=t,this.#i=!0,this.emit("verified",!0))}catch(n){this.#i=!1,this.emit("error",n.message||String(n))}return this.emit("verifying",!1),this.#r=!1,this.#i}async onGoogleIdentityCallback(n){this.emit("init",!1),this.#o=!1,this.emit("verifying",!0),this.#r=!0;const t=await fetch(`${this.#n}/google-auth`,{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({credential:n.credential})}),{data:a}=await t.json();a||this.emit("error","Failed to validate user.");const{token:d}=a;this.setAccessToken(d),this.emit("verifying",!1),this.#r=!1,this.emit("verified",!0),this.#i=!0}}function ee(){const e="https://accounts.google.com/gsi/client";if(document.querySelector(`script[src="${e}"]`))return;const n=document.createElement("script");n.src=e,n.async=!0,document.head.appendChild(n)}let j;function te(e){return j=j||new $(e),j}return m.AwesomeAuth=$,m.AwesomeAuthEvent=x,m.getInstance=te,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}),m}({});
@@ -13,10 +13,10 @@ var k = { exports: {} };
13
13
  function v(c, i, s, o, p) {
14
14
  if (typeof s != "function")
15
15
  throw new TypeError("The listener must be a function");
16
- var u = new d(s, o || c, p), f = t ? t + i : i;
17
- return c._events[f] ? c._events[f].fn ? c._events[f] = [c._events[f], u] : c._events[f].push(u) : (c._events[f] = u, c._eventsCount++), c;
16
+ var u = new d(s, o || c, p), l = t ? t + i : i;
17
+ return c._events[l] ? c._events[l].fn ? c._events[l] = [c._events[l], u] : c._events[l].push(u) : (c._events[l] = u, c._eventsCount++), c;
18
18
  }
19
- function T(c, i) {
19
+ function S(c, i) {
20
20
  --c._eventsCount === 0 ? c._events = new a() : delete c._events[i];
21
21
  }
22
22
  function h() {
@@ -32,16 +32,16 @@ var k = { exports: {} };
32
32
  var s = t ? t + i : i, o = this._events[s];
33
33
  if (!o) return [];
34
34
  if (o.fn) return [o.fn];
35
- for (var p = 0, u = o.length, f = new Array(u); p < u; p++)
36
- f[p] = o[p].fn;
37
- return f;
35
+ for (var p = 0, u = o.length, l = new Array(u); p < u; p++)
36
+ l[p] = o[p].fn;
37
+ return l;
38
38
  }, h.prototype.listenerCount = function(i) {
39
39
  var s = t ? t + i : i, o = this._events[s];
40
40
  return o ? o.fn ? 1 : o.length : 0;
41
- }, h.prototype.emit = function(i, s, o, p, u, f) {
41
+ }, h.prototype.emit = function(i, s, o, p, u, l) {
42
42
  var g = t ? t + i : i;
43
43
  if (!this._events[g]) return !1;
44
- var n = this._events[g], y = arguments.length, b, l;
44
+ var n = this._events[g], y = arguments.length, b, f;
45
45
  if (n.fn) {
46
46
  switch (n.once && this.removeListener(i, n.fn, void 0, !0), y) {
47
47
  case 1:
@@ -55,31 +55,31 @@ var k = { exports: {} };
55
55
  case 5:
56
56
  return n.fn.call(n.context, s, o, p, u), !0;
57
57
  case 6:
58
- return n.fn.call(n.context, s, o, p, u, f), !0;
58
+ return n.fn.call(n.context, s, o, p, u, l), !0;
59
59
  }
60
- for (l = 1, b = new Array(y - 1); l < y; l++)
61
- b[l - 1] = arguments[l];
60
+ for (f = 1, b = new Array(y - 1); f < y; f++)
61
+ b[f - 1] = arguments[f];
62
62
  n.fn.apply(n.context, b);
63
63
  } else {
64
64
  var C = n.length, m;
65
- for (l = 0; l < C; l++)
66
- switch (n[l].once && this.removeListener(i, n[l].fn, void 0, !0), y) {
65
+ for (f = 0; f < C; f++)
66
+ switch (n[f].once && this.removeListener(i, n[f].fn, void 0, !0), y) {
67
67
  case 1:
68
- n[l].fn.call(n[l].context);
68
+ n[f].fn.call(n[f].context);
69
69
  break;
70
70
  case 2:
71
- n[l].fn.call(n[l].context, s);
71
+ n[f].fn.call(n[f].context, s);
72
72
  break;
73
73
  case 3:
74
- n[l].fn.call(n[l].context, s, o);
74
+ n[f].fn.call(n[f].context, s, o);
75
75
  break;
76
76
  case 4:
77
- n[l].fn.call(n[l].context, s, o, p);
77
+ n[f].fn.call(n[f].context, s, o, p);
78
78
  break;
79
79
  default:
80
80
  if (!b) for (m = 1, b = new Array(y - 1); m < y; m++)
81
81
  b[m - 1] = arguments[m];
82
- n[l].fn.apply(n[l].context, b);
82
+ n[f].fn.apply(n[f].context, b);
83
83
  }
84
84
  }
85
85
  return !0;
@@ -91,26 +91,26 @@ var k = { exports: {} };
91
91
  var u = t ? t + i : i;
92
92
  if (!this._events[u]) return this;
93
93
  if (!s)
94
- return T(this, u), this;
95
- var f = this._events[u];
96
- if (f.fn)
97
- f.fn === s && (!p || f.once) && (!o || f.context === o) && T(this, u);
94
+ return S(this, u), this;
95
+ var l = this._events[u];
96
+ if (l.fn)
97
+ l.fn === s && (!p || l.once) && (!o || l.context === o) && S(this, u);
98
98
  else {
99
- for (var g = 0, n = [], y = f.length; g < y; g++)
100
- (f[g].fn !== s || p && !f[g].once || o && f[g].context !== o) && n.push(f[g]);
101
- n.length ? this._events[u] = n.length === 1 ? n[0] : n : T(this, u);
99
+ for (var g = 0, n = [], y = l.length; g < y; g++)
100
+ (l[g].fn !== s || p && !l[g].once || o && l[g].context !== o) && n.push(l[g]);
101
+ n.length ? this._events[u] = n.length === 1 ? n[0] : n : S(this, u);
102
102
  }
103
103
  return this;
104
104
  }, h.prototype.removeAllListeners = function(i) {
105
105
  var s;
106
- return i ? (s = t ? t + i : i, this._events[s] && T(this, s)) : (this._events = new a(), this._eventsCount = 0), this;
106
+ return i ? (s = t ? t + i : i, this._events[s] && S(this, s)) : (this._events = new a(), this._eventsCount = 0), this;
107
107
  }, h.prototype.off = h.prototype.removeListener, h.prototype.addListener = h.prototype.on, h.prefixed = t, h.EventEmitter = h, e.exports = h;
108
108
  })(k);
109
109
  var $ = k.exports;
110
110
  const P = /* @__PURE__ */ E($);
111
- class S extends Error {
111
+ class T extends Error {
112
112
  }
113
- S.prototype.name = "InvalidTokenError";
113
+ T.prototype.name = "InvalidTokenError";
114
114
  function A(e) {
115
115
  return decodeURIComponent(atob(e).replace(/(.)/g, (r, t) => {
116
116
  let a = t.charCodeAt(0).toString(16).toUpperCase();
@@ -139,21 +139,21 @@ function G(e) {
139
139
  }
140
140
  function L(e, r) {
141
141
  if (typeof e != "string")
142
- throw new S("Invalid token specified: must be a string");
142
+ throw new T("Invalid token specified: must be a string");
143
143
  r || (r = {});
144
144
  const t = r.header === !0 ? 0 : 1, a = e.split(".")[t];
145
145
  if (typeof a != "string")
146
- throw new S(`Invalid token specified: missing part #${t + 1}`);
146
+ throw new T(`Invalid token specified: missing part #${t + 1}`);
147
147
  let d;
148
148
  try {
149
149
  d = G(a);
150
150
  } catch (v) {
151
- throw new S(`Invalid token specified: invalid base64 for part #${t + 1} (${v.message})`);
151
+ throw new T(`Invalid token specified: invalid base64 for part #${t + 1} (${v.message})`);
152
152
  }
153
153
  try {
154
154
  return JSON.parse(d);
155
155
  } catch (v) {
156
- throw new S(`Invalid token specified: invalid json for part #${t + 1} (${v.message})`);
156
+ throw new T(`Invalid token specified: invalid json for part #${t + 1} (${v.message})`);
157
157
  }
158
158
  }
159
159
  var N = typeof global == "object" && global && global.Object === Object && global, D = typeof self == "object" && self && self.Object === Object && self, R = N || D || Function("return this")(), O = R.Symbol, x = Object.prototype, F = x.hasOwnProperty, V = x.toString, w = O ? O.toStringTag : void 0;
@@ -194,14 +194,14 @@ class Z extends P {
194
194
  #n = !1;
195
195
  #i = !1;
196
196
  #a;
197
- #f;
197
+ #l;
198
198
  #r;
199
199
  constructor({
200
200
  googleId: r,
201
201
  prefix: t = "aAuth",
202
202
  root: a = "/api"
203
203
  }) {
204
- if (super(), this.#c = r, this.#f = t, this.#r = a, this.#a = Date.now() / 1e3 >> 0, this.setAccessToken(localStorage.getItem(this.localKey) || "", !1), this.#e) {
204
+ if (super(), this.#c = r, this.#l = t, this.#r = a, this.#a = Date.now() / 1e3 >> 0, this.setAccessToken(localStorage.getItem(this.localKey) || "", !1), this.#e) {
205
205
  this.verifyToken().then((d) => {
206
206
  d || this.initGoogleIdentity();
207
207
  });
@@ -222,7 +222,7 @@ class Z extends P {
222
222
  return this.#i;
223
223
  }
224
224
  get localKey() {
225
- return `${this.#f}-token`;
225
+ return `${this.#l}-token`;
226
226
  }
227
227
  get root() {
228
228
  return this.#r;
@@ -263,7 +263,7 @@ class Z extends P {
263
263
  return a?.value;
264
264
  }
265
265
  initGoogleIdentity() {
266
- if (!("google" in globalThis)) {
266
+ if (!("google" in globalThis) || !("accounts" in globalThis.google)) {
267
267
  ee(), globalThis.onGoogleLibraryLoad = () => this.initGoogleIdentity();
268
268
  return;
269
269
  }
@@ -1 +1 @@
1
- (function(y,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(y=typeof globalThis<"u"?globalThis:y||self,w(y.AwesomeAuth={}))})(this,function(y){"use strict";function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var x={exports:{}};(function(e){var n=Object.prototype.hasOwnProperty,t="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(t=!1));function p(c,i,s){this.fn=c,this.context=i,this.once=s||!1}function b(c,i,s,o,d){if(typeof s!="function")throw new TypeError("The listener must be a function");var u=new p(s,o||c,d),f=t?t+i:i;return c._events[f]?c._events[f].fn?c._events[f]=[c._events[f],u]:c._events[f].push(u):(c._events[f]=u,c._eventsCount++),c}function I(c,i){--c._eventsCount===0?c._events=new a:delete c._events[i]}function h(){this._events=new a,this._eventsCount=0}h.prototype.eventNames=function(){var i=[],s,o;if(this._eventsCount===0)return i;for(o in s=this._events)n.call(s,o)&&i.push(t?o.slice(1):o);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(s)):i},h.prototype.listeners=function(i){var s=t?t+i:i,o=this._events[s];if(!o)return[];if(o.fn)return[o.fn];for(var d=0,u=o.length,f=new Array(u);d<u;d++)f[d]=o[d].fn;return f},h.prototype.listenerCount=function(i){var s=t?t+i:i,o=this._events[s];return o?o.fn?1:o.length:0},h.prototype.emit=function(i,s,o,d,u,f){var g=t?t+i:i;if(!this._events[g])return!1;var r=this._events[g],v=arguments.length,m,l;if(r.fn){switch(r.once&&this.removeListener(i,r.fn,void 0,!0),v){case 1:return r.fn.call(r.context),!0;case 2:return r.fn.call(r.context,s),!0;case 3:return r.fn.call(r.context,s,o),!0;case 4:return r.fn.call(r.context,s,o,d),!0;case 5:return r.fn.call(r.context,s,o,d,u),!0;case 6:return r.fn.call(r.context,s,o,d,u,f),!0}for(l=1,m=new Array(v-1);l<v;l++)m[l-1]=arguments[l];r.fn.apply(r.context,m)}else{var ne=r.length,O;for(l=0;l<ne;l++)switch(r[l].once&&this.removeListener(i,r[l].fn,void 0,!0),v){case 1:r[l].fn.call(r[l].context);break;case 2:r[l].fn.call(r[l].context,s);break;case 3:r[l].fn.call(r[l].context,s,o);break;case 4:r[l].fn.call(r[l].context,s,o,d);break;default:if(!m)for(O=1,m=new Array(v-1);O<v;O++)m[O-1]=arguments[O];r[l].fn.apply(r[l].context,m)}}return!0},h.prototype.on=function(i,s,o){return b(this,i,s,o,!1)},h.prototype.once=function(i,s,o){return b(this,i,s,o,!0)},h.prototype.removeListener=function(i,s,o,d){var u=t?t+i:i;if(!this._events[u])return this;if(!s)return I(this,u),this;var f=this._events[u];if(f.fn)f.fn===s&&(!d||f.once)&&(!o||f.context===o)&&I(this,u);else{for(var g=0,r=[],v=f.length;g<v;g++)(f[g].fn!==s||d&&!f[g].once||o&&f[g].context!==o)&&r.push(f[g]);r.length?this._events[u]=r.length===1?r[0]:r:I(this,u)}return this},h.prototype.removeAllListeners=function(i){var s;return i?(s=t?t+i:i,this._events[s]&&I(this,s)):(this._events=new a,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=t,h.EventEmitter=h,e.exports=h})(x);var P=x.exports;const G=w(P);class T extends Error{}T.prototype.name="InvalidTokenError";function L(e){return decodeURIComponent(atob(e).replace(/(.)/g,(n,t)=>{let a=t.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}function N(e){let n=e.replace(/-/g,"+").replace(/_/g,"/");switch(n.length%4){case 0:break;case 2:n+="==";break;case 3:n+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return L(n)}catch{return atob(n)}}function D(e,n){if(typeof e!="string")throw new T("Invalid token specified: must be a string");n||(n={});const t=n.header===!0?0:1,a=e.split(".")[t];if(typeof a!="string")throw new T(`Invalid token specified: missing part #${t+1}`);let p;try{p=N(a)}catch(b){throw new T(`Invalid token specified: invalid base64 for part #${t+1} (${b.message})`)}try{return JSON.parse(p)}catch(b){throw new T(`Invalid token specified: invalid json for part #${t+1} (${b.message})`)}}var R=typeof global=="object"&&global&&global.Object===Object&&global,F=typeof self=="object"&&self&&self.Object===Object&&self,V=R||F||Function("return this")(),j=V.Symbol,C=Object.prototype,z=C.hasOwnProperty,J=C.toString,S=j?j.toStringTag:void 0;function U(e){var n=z.call(e,S),t=e[S];try{e[S]=void 0;var a=!0}catch{}var p=J.call(e);return a&&(n?e[S]=t:delete e[S]),p}var B=Object.prototype,K=B.toString;function M(e){return K.call(e)}var q="[object Null]",H="[object Undefined]",E=j?j.toStringTag:void 0;function Y(e){return e==null?e===void 0?H:q:E&&E in Object(e)?U(e):M(e)}var Q=Array.isArray;function W(e){return e!=null&&typeof e=="object"}var X="[object String]";function Z(e){return typeof e=="string"||!Q(e)&&W(e)&&Y(e)==X}var $=(e=>(e.INIT="init",e.VERIFYING="verifying",e.VERIFIED="verified",e.REFRESH="refresh",e.ERROR="error",e))($||{});let _;class A extends G{#e="";#t={};#s=0;#c;#o=!1;#r=!1;#i=!1;#a;#f;#n;constructor({googleId:n,prefix:t="aAuth",root:a="/api"}){if(super(),this.#c=n,this.#f=t,this.#n=a,this.#a=Date.now()/1e3>>0,this.setAccessToken(localStorage.getItem(this.localKey)||"",!1),this.#e){this.verifyToken().then(p=>{p||this.initGoogleIdentity()});return}this.initGoogleIdentity()}get accessToken(){return this.#e}get expiredIn(){return this.#s?0:this.#s-this.#a}get isVerifying(){return this.#r}get isVerified(){return this.#i}get localKey(){return`${this.#f}-token`}get root(){return this.#n}get user(){return this.#t}doSignIn(){this.initGoogleIdentity()}doSignOut(){this.#e="",google.accounts.id.revoke(this.#t.sub||""),this.#t={}}async store(n,t){t=Z(t)?t:JSON.stringify(t),await fetch(`${this.#n}/store`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`},body:JSON.stringify({key:n,value:t})})}async retrieve(n){const t=await fetch(`${this.#n}/retrieve`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`},body:JSON.stringify({key:n})}),{data:a}=await t.json();return a?.value}initGoogleIdentity(){if(!("google"in globalThis)){ee(),globalThis.onGoogleLibraryLoad=()=>this.initGoogleIdentity();return}this.#o||(this.emit("init",!0),this.#o=!0,google.accounts.id.initialize({client_id:this.#c,callback:n=>this.onGoogleIdentityCallback(n),auto_select:!0,ux_mode:"popup"}),google.accounts.id.prompt())}refreshCountDown(){this.#a=Date.now()/1e3>>0,this.expiredIn<=60&&(clearInterval(_),this.refreshToken())}async refreshToken(){this.emit("refresh",!0);const n=await fetch(`${this.#n}/refresh-token`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`}}),{data:t}=await n.json(),{token:a}=t;this.setAccessToken(a),this.emit("refresh",!1)}setAccessToken(n,t=!0){if(this.#e=n,t&&localStorage.setItem(this.localKey,n),!n){this.#t={},this.#s=0;return}try{this.#t=D(n)}catch{this.#t={}}this.#s=this.#t.exp||0,this.expiredIn>0&&(clearInterval(_),_=setInterval(()=>this.refreshCountDown(),1e3))}async verifyToken(){this.emit("verifying",!0),this.#r=!0;try{const n=await fetch(`${this.#n}/verify-auth`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`}}),{data:t}=await n.json();t&&(this.#t=t,this.#i=!0,this.emit("verified",!0))}catch(n){this.#i=!1,this.emit("error",n.message||String(n))}return this.emit("verifying",!1),this.#r=!1,this.#i}async onGoogleIdentityCallback(n){this.emit("init",!1),this.#o=!1,this.emit("verifying",!0),this.#r=!0;const t=await fetch(`${this.#n}/google-auth`,{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({credential:n.credential})}),{data:a}=await t.json();a||this.emit("error","Failed to validate user.");const{token:p}=a;this.setAccessToken(p),this.emit("verifying",!1),this.#r=!1,this.emit("verified",!0),this.#i=!0}}function ee(){const e="https://accounts.google.com/gsi/client";if(document.querySelector(`script[src="${e}"]`))return;const n=document.createElement("script");n.src=e,n.async=!0,document.head.appendChild(n)}let k;function te(e){return k=k||new A(e),k}y.AwesomeAuth=A,y.AwesomeAuthEvent=$,y.getInstance=te,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
1
+ (function(y,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(y=typeof globalThis<"u"?globalThis:y||self,w(y.AwesomeAuth={}))})(this,function(y){"use strict";function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var x={exports:{}};(function(e){var n=Object.prototype.hasOwnProperty,t="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(t=!1));function p(c,i,s){this.fn=c,this.context=i,this.once=s||!1}function b(c,i,s,o,d){if(typeof s!="function")throw new TypeError("The listener must be a function");var u=new p(s,o||c,d),f=t?t+i:i;return c._events[f]?c._events[f].fn?c._events[f]=[c._events[f],u]:c._events[f].push(u):(c._events[f]=u,c._eventsCount++),c}function I(c,i){--c._eventsCount===0?c._events=new a:delete c._events[i]}function h(){this._events=new a,this._eventsCount=0}h.prototype.eventNames=function(){var i=[],s,o;if(this._eventsCount===0)return i;for(o in s=this._events)n.call(s,o)&&i.push(t?o.slice(1):o);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(s)):i},h.prototype.listeners=function(i){var s=t?t+i:i,o=this._events[s];if(!o)return[];if(o.fn)return[o.fn];for(var d=0,u=o.length,f=new Array(u);d<u;d++)f[d]=o[d].fn;return f},h.prototype.listenerCount=function(i){var s=t?t+i:i,o=this._events[s];return o?o.fn?1:o.length:0},h.prototype.emit=function(i,s,o,d,u,f){var g=t?t+i:i;if(!this._events[g])return!1;var r=this._events[g],v=arguments.length,m,l;if(r.fn){switch(r.once&&this.removeListener(i,r.fn,void 0,!0),v){case 1:return r.fn.call(r.context),!0;case 2:return r.fn.call(r.context,s),!0;case 3:return r.fn.call(r.context,s,o),!0;case 4:return r.fn.call(r.context,s,o,d),!0;case 5:return r.fn.call(r.context,s,o,d,u),!0;case 6:return r.fn.call(r.context,s,o,d,u,f),!0}for(l=1,m=new Array(v-1);l<v;l++)m[l-1]=arguments[l];r.fn.apply(r.context,m)}else{var ne=r.length,O;for(l=0;l<ne;l++)switch(r[l].once&&this.removeListener(i,r[l].fn,void 0,!0),v){case 1:r[l].fn.call(r[l].context);break;case 2:r[l].fn.call(r[l].context,s);break;case 3:r[l].fn.call(r[l].context,s,o);break;case 4:r[l].fn.call(r[l].context,s,o,d);break;default:if(!m)for(O=1,m=new Array(v-1);O<v;O++)m[O-1]=arguments[O];r[l].fn.apply(r[l].context,m)}}return!0},h.prototype.on=function(i,s,o){return b(this,i,s,o,!1)},h.prototype.once=function(i,s,o){return b(this,i,s,o,!0)},h.prototype.removeListener=function(i,s,o,d){var u=t?t+i:i;if(!this._events[u])return this;if(!s)return I(this,u),this;var f=this._events[u];if(f.fn)f.fn===s&&(!d||f.once)&&(!o||f.context===o)&&I(this,u);else{for(var g=0,r=[],v=f.length;g<v;g++)(f[g].fn!==s||d&&!f[g].once||o&&f[g].context!==o)&&r.push(f[g]);r.length?this._events[u]=r.length===1?r[0]:r:I(this,u)}return this},h.prototype.removeAllListeners=function(i){var s;return i?(s=t?t+i:i,this._events[s]&&I(this,s)):(this._events=new a,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=t,h.EventEmitter=h,e.exports=h})(x);var P=x.exports;const G=w(P);class T extends Error{}T.prototype.name="InvalidTokenError";function L(e){return decodeURIComponent(atob(e).replace(/(.)/g,(n,t)=>{let a=t.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}function N(e){let n=e.replace(/-/g,"+").replace(/_/g,"/");switch(n.length%4){case 0:break;case 2:n+="==";break;case 3:n+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return L(n)}catch{return atob(n)}}function D(e,n){if(typeof e!="string")throw new T("Invalid token specified: must be a string");n||(n={});const t=n.header===!0?0:1,a=e.split(".")[t];if(typeof a!="string")throw new T(`Invalid token specified: missing part #${t+1}`);let p;try{p=N(a)}catch(b){throw new T(`Invalid token specified: invalid base64 for part #${t+1} (${b.message})`)}try{return JSON.parse(p)}catch(b){throw new T(`Invalid token specified: invalid json for part #${t+1} (${b.message})`)}}var R=typeof global=="object"&&global&&global.Object===Object&&global,F=typeof self=="object"&&self&&self.Object===Object&&self,V=R||F||Function("return this")(),j=V.Symbol,C=Object.prototype,z=C.hasOwnProperty,J=C.toString,S=j?j.toStringTag:void 0;function U(e){var n=z.call(e,S),t=e[S];try{e[S]=void 0;var a=!0}catch{}var p=J.call(e);return a&&(n?e[S]=t:delete e[S]),p}var B=Object.prototype,K=B.toString;function M(e){return K.call(e)}var q="[object Null]",H="[object Undefined]",E=j?j.toStringTag:void 0;function Y(e){return e==null?e===void 0?H:q:E&&E in Object(e)?U(e):M(e)}var Q=Array.isArray;function W(e){return e!=null&&typeof e=="object"}var X="[object String]";function Z(e){return typeof e=="string"||!Q(e)&&W(e)&&Y(e)==X}var $=(e=>(e.INIT="init",e.VERIFYING="verifying",e.VERIFIED="verified",e.REFRESH="refresh",e.ERROR="error",e))($||{});let _;class A extends G{#e="";#t={};#s=0;#c;#o=!1;#r=!1;#i=!1;#a;#f;#n;constructor({googleId:n,prefix:t="aAuth",root:a="/api"}){if(super(),this.#c=n,this.#f=t,this.#n=a,this.#a=Date.now()/1e3>>0,this.setAccessToken(localStorage.getItem(this.localKey)||"",!1),this.#e){this.verifyToken().then(p=>{p||this.initGoogleIdentity()});return}this.initGoogleIdentity()}get accessToken(){return this.#e}get expiredIn(){return this.#s?0:this.#s-this.#a}get isVerifying(){return this.#r}get isVerified(){return this.#i}get localKey(){return`${this.#f}-token`}get root(){return this.#n}get user(){return this.#t}doSignIn(){this.initGoogleIdentity()}doSignOut(){this.#e="",google.accounts.id.revoke(this.#t.sub||""),this.#t={}}async store(n,t){t=Z(t)?t:JSON.stringify(t),await fetch(`${this.#n}/store`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`},body:JSON.stringify({key:n,value:t})})}async retrieve(n){const t=await fetch(`${this.#n}/retrieve`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`},body:JSON.stringify({key:n})}),{data:a}=await t.json();return a?.value}initGoogleIdentity(){if(!("google"in globalThis)||!("accounts"in globalThis.google)){ee(),globalThis.onGoogleLibraryLoad=()=>this.initGoogleIdentity();return}this.#o||(this.emit("init",!0),this.#o=!0,google.accounts.id.initialize({client_id:this.#c,callback:n=>this.onGoogleIdentityCallback(n),auto_select:!0,ux_mode:"popup"}),google.accounts.id.prompt())}refreshCountDown(){this.#a=Date.now()/1e3>>0,this.expiredIn<=60&&(clearInterval(_),this.refreshToken())}async refreshToken(){this.emit("refresh",!0);const n=await fetch(`${this.#n}/refresh-token`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`}}),{data:t}=await n.json(),{token:a}=t;this.setAccessToken(a),this.emit("refresh",!1)}setAccessToken(n,t=!0){if(this.#e=n,t&&localStorage.setItem(this.localKey,n),!n){this.#t={},this.#s=0;return}try{this.#t=D(n)}catch{this.#t={}}this.#s=this.#t.exp||0,this.expiredIn>0&&(clearInterval(_),_=setInterval(()=>this.refreshCountDown(),1e3))}async verifyToken(){this.emit("verifying",!0),this.#r=!0;try{const n=await fetch(`${this.#n}/verify-auth`,{method:"POST",headers:{"Content-type":"application/json",Authorization:`Bearer ${this.#e}`}}),{data:t}=await n.json();t&&(this.#t=t,this.#i=!0,this.emit("verified",!0))}catch(n){this.#i=!1,this.emit("error",n.message||String(n))}return this.emit("verifying",!1),this.#r=!1,this.#i}async onGoogleIdentityCallback(n){this.emit("init",!1),this.#o=!1,this.emit("verifying",!0),this.#r=!0;const t=await fetch(`${this.#n}/google-auth`,{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({credential:n.credential})}),{data:a}=await t.json();a||this.emit("error","Failed to validate user.");const{token:p}=a;this.setAccessToken(p),this.emit("verifying",!1),this.#r=!1,this.emit("verified",!0),this.#i=!0}}function ee(){const e="https://accounts.google.com/gsi/client";if(document.querySelector(`script[src="${e}"]`))return;const n=document.createElement("script");n.src=e,n.async=!0,document.head.appendChild(n)}let k;function te(e){return k=k||new A(e),k}y.AwesomeAuth=A,y.AwesomeAuthEvent=$,y.getInstance=te,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roudanio/awesome-auth",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "dist/awesome-auth.umd.js",
6
6
  "module": "dist/awesome-auth.js",
@@ -8,11 +8,11 @@
8
8
  "types": "dist/auth.d.ts",
9
9
  "dependencies": {
10
10
  "eventemitter3": "^5.0.1",
11
- "google-auth-library": "^9.14.1",
11
+ "google-auth-library": "^9.14.2",
12
12
  "jsonwebtoken": "^9.0.2",
13
13
  "jwt-decode": "^4.0.0",
14
14
  "lodash-es": "^4.17.21",
15
- "vue": "^3.5.10",
15
+ "vue": "^3.5.12",
16
16
  "@awesome-comment/core": "0.1.0"
17
17
  },
18
18
  "devDependencies": {
@@ -23,15 +23,14 @@
23
23
  "@vitejs/plugin-vue": "^5.1.4",
24
24
  "autoprefixer": "^10.4.20",
25
25
  "postcss": "^8.4.47",
26
- "tailwindcss": "^3.4.13",
27
- "typescript": "^5.5.3",
28
- "vite": "^5.4.8",
29
- "vite-plugin-dts": "^4.2.3",
30
- "vue-tsc": "^2.1.6"
26
+ "tailwindcss": "^3.4.14",
27
+ "typescript": "^5.6.3",
28
+ "vite": "^5.4.10",
29
+ "vite-plugin-dts": "^4.3.0",
30
+ "vue-tsc": "^2.1.10"
31
31
  },
32
32
  "scripts": {
33
33
  "dev": "vite",
34
- "build": "vue-tsc -b && vite build",
35
- "preview": "vite preview"
34
+ "build": "vue-tsc -b && vite build"
36
35
  }
37
36
  }
@@ -1 +1 @@
1
- {"root":["./src/auth.ts","./src/main.ts","./src/vite-env.d.ts","./src/app.vue"],"version":"5.6.2"}
1
+ {"root":["./src/auth.ts","./src/main.ts","./src/vite-env.d.ts","./src/app.vue"],"version":"5.6.3"}
@@ -1 +1 @@
1
- {"root":["./vite.config.ts"],"version":"5.6.2"}
1
+ {"root":["./vite.config.ts"],"version":"5.6.3"}