UNPKG

hurbis-ui-seguranca-v1

Version:

Biblioteca de segurança para autenticação e autorização utilizando Auth0.

2 lines 115 kB
(function(){angular.module("angular-jwt",["angular-jwt.options","angular-jwt.interceptor","angular-jwt.jwt","angular-jwt.authManager"]);angular.module("angular-jwt.authManager",[]).provider("authManager",function(){this.$get=["$rootScope","$injector","$location","jwtHelper","jwtInterceptor","jwtOptions",function(n,t,i,r,u,f){function o(n){return Array.isArray(n)?t.invoke(n,this,{options:null}):n()}function s(n){if(Array.isArray(n)||angular.isFunction(n))return t.invoke(n,e,{});throw new Error("unauthenticatedRedirector must be a function");}function h(){var n=o(e.tokenGetter);if(n)return!r.isTokenExpired(n)}function c(){n.isAuthenticated=!0}function l(){n.isAuthenticated=!1}function a(){var t=o(e.tokenGetter);t&&(r.isTokenExpired(t)?n.$broadcast("tokenHasExpired",t):c())}function p(){if(t.has("$transitions")){var i=t.get("$transitions");i.onStart({},a)}else n.$on("$locationChangeStart",a)}function w(){n.$on("unauthenticated",function(){s(e.unauthenticatedRedirector);l()})}function b(n,t){if(!t)return!1;var i=t.$$route?t.$$route:t.data;i&&i.requiresLogin===!0&&!h()&&(n.preventDefault(),s(e.unauthenticatedRedirector))}function k(n){var t=n.to(),i=n.router.stateService;if(t&&t.data&&t.data.requiresLogin===!0&&!h())return i.target(e.loginPath)}var e=f.getConfig(),v,y;if(n.isAuthenticated=!1,t.has("$transitions")){v=t.get("$transitions");v.onStart({},k)}else y=t.has("$state")?"$stateChangeStart":"$routeChangeStart",n.$on(y,b);return{authenticate:c,unauthenticate:l,getToken:function(){return o(e.tokenGetter)},redirect:function(){return s(e.unauthenticatedRedirector)},checkAuthOnRefresh:p,redirectWhenUnauthenticated:w,isAuthenticated:h}}]});angular.module("angular-jwt.interceptor",[]).provider("jwtInterceptor",function(){this.urlParam;this.authHeader;this.authPrefix;this.whiteListedDomains;this.tokenGetter;var n=this;this.$get=["$q","$injector","$rootScope","urlUtils","jwtOptions",function(t,i,r,u,f){function o(n){var r,t,i;if(!u.isSameOrigin(n)&&!e.whiteListedDomains.length)throw new Error("As of v0.1.0, requests to domains other than the application's origin must be white listed. Use jwtOptionsProvider.config({ whiteListedDomains: [<domain>] }); to whitelist.");for(r=u.urlResolve(n).hostname.toLowerCase(),t=0;t<e.whiteListedDomains.length;t++)if(i=e.whiteListedDomains[t],i instanceof RegExp){if(r.match(i))return!0}else if(r===i.toLowerCase())return!0;return u.isSameOrigin(n)?!0:!1}var e=angular.extend({},f.getConfig(),n);return{request:function(n){if(n.skipAuthorization||!o(n.url))return n;if(e.urlParam){if(n.params=n.params||{},n.params[e.urlParam])return n}else if(n.headers=n.headers||{},n.headers[e.authHeader])return n;var r=t.when(i.invoke(e.tokenGetter,this,{options:n}));return r.then(function(t){return t&&(e.urlParam?n.params[e.urlParam]=t:n.headers[e.authHeader]=e.authPrefix+t),n})},responseError:function(n){return n.status===401&&r.$broadcast("unauthenticated",n),t.reject(n)}}}]});angular.module("angular-jwt.jwt",[]).service("jwtHelper",["$window",function(n){this.urlBase64Decode=function(t){var i=t.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw"Illegal base64url string!";}return n.decodeURIComponent(escape(n.atob(i)))};this.decodeToken=function(n){var i=n.split("."),t;if(i.length!==3)throw new Error("JWT must have 3 parts");if(t=this.urlBase64Decode(i[1]),!t)throw new Error("Cannot decode the token");return angular.fromJson(t)};this.getTokenExpirationDate=function(n){var i=this.decodeToken(n),t;return typeof i.exp=="undefined"?null:(t=new Date(0),t.setUTCSeconds(i.exp),t)};this.isTokenExpired=function(n,t){var i=this.getTokenExpirationDate(n);return(t=t||0,i===null)?!1:!(i.valueOf()>(new Date).valueOf()+t*1e3)}}]);angular.module("angular-jwt.options",[]).provider("jwtOptions",function(){var n={};this.config=function(t){n=t};this.$get=function(){function t(){var t=this.config=angular.extend({},i,n)}var i={urlParam:null,authHeader:"Authorization",authPrefix:"Bearer ",whiteListedDomains:[],tokenGetter:function(){return null},loginPath:"/",unauthenticatedRedirectPath:"/",unauthenticatedRedirector:["$location",function(n){n.path(this.unauthenticatedRedirectPath)}]};return t.prototype.getConfig=function(){return this.config},new t}});angular.module("angular-jwt.interceptor").service("urlUtils",function(){function t(t){var i=t;return n.setAttribute("href",i),i=n.href,n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}function r(n){var r=angular.isString(n)?t(n):n;return r.protocol===i.protocol&&r.host===i.host}var n=document.createElement("a"),i=t(window.location.href);return{urlResolve:t,isSameOrigin:r}})})(),function(n,t){typeof exports=="object"&&typeof module!="undefined"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):t(n.auth0={})}(this,function(n){"use strict";function a(n,t){return t={exports:{}},n(t,t.exports),t.exports}function lf(n){return null!==n&&"object"==typeof n}function r(n){if(n)return vf(n)}function vf(n){for(var t in r.prototype)n[t]=r.prototype[t];return n}function st(n){if(n)return df(n)}function df(n){for(var t in st.prototype)n[t]=st.prototype[t];return n}function vi(){this._defaults=[]}function sr(n){var t=n.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return n[t-2]==="="?2:n[t-1]==="="?1:0}function re(n){return n.length*3/4-sr(n)}function ue(n){var t,o,s,i,f,r,e=n.length,u;for(f=sr(n),r=new ie(e*3/4-f),s=f>0?e-4:e,u=0,t=0,o=0;t<s;t+=4,o+=3)i=l[n.charCodeAt(t)]<<18|l[n.charCodeAt(t+1)]<<12|l[n.charCodeAt(t+2)]<<6|l[n.charCodeAt(t+3)],r[u++]=i>>16&255,r[u++]=i>>8&255,r[u++]=i&255;return f===2?(i=l[n.charCodeAt(t)]<<2|l[n.charCodeAt(t+1)]>>4,r[u++]=i&255):f===1&&(i=l[n.charCodeAt(t)]<<10|l[n.charCodeAt(t+1)]<<4|l[n.charCodeAt(t+2)]>>2,r[u++]=i>>8&255,r[u++]=i&255),r}function fe(n){return v[n>>18&63]+v[n>>12&63]+v[n>>6&63]+v[n&63]}function ee(n,t,i){for(var u,f=[],r=t;r<i;r+=3)u=(n[r]<<16)+(n[r+1]<<8)+n[r+2],f.push(fe(u));return f.join("")}function oe(n){for(var i,r=n.length,f=r%3,t="",e=[],o=16383,u=0,s=r-f;u<s;u+=o)e.push(ee(n,u,u+o>s?s:u+o));return f===1?(i=n[r-1],t+=v[i>>2],t+=v[i<<4&63],t+="=="):f===2&&(i=(n[r-2]<<8)+n[r-1],t+=v[i>>10],t+=v[i>>4&63],t+=v[i<<2&63],t+="="),e.push(t),e.join("")}function se(n){var t=n.length%4,i=4-t;return t===0?n:n+new Array(1+i).join("=")}function he(n){for(var i=new Array(n.length),t=0;t<n.length;t++)i[t]=n.charCodeAt(t);return i}function ce(n){for(var i="",t=0;t<n.length;t++)i+=String.fromCharCode(n[t]);return i}function le(n){return ht.fromByteArray(he(n)).replace(/\+/g,"-").replace(/\//g,"_")}function ae(n){return n=se(n).replace(/-/g,"+").replace(/_/g,"/"),ce(ht.toByteArray(n))}function lt(n){this.request=n;this.method=n.method;this.url=n.url;this.body=n._data;this.headers=n._header}function tt(n){this.request=n}function y(n){this._sendTelemetry=n._sendTelemetry===!1?n._sendTelemetry:!0;this._telemetryInfo=n._telemetryInfo||null;this._timesToRetryFailedRequests=n._timesToRetryFailedRequests;this.headers=n.headers||{}}function lr(n,t,i,r){if(i=i==="array"?"object":i,n&&typeof n[t]!==i)throw new Error(r);}function ar(n,t,i){if(typeof n!==t)throw new Error(i);}function vr(n,t,i){if(t.indexOf(n)===-1)throw new Error(i);}function ve(n,t,i){var f,u,r;if((!t.optional||n)&&ar(n,t.type,t.message),t.type==="object"&&i)for(f=Object.keys(i),u=0;u<f.length;u++)r=f[u],(!i[r].optional||n[r])&&(!i[r].condition||i[r].condition(n))&&(lr(n,r,i[r].type,i[r].message),i[r].values&&vr(n[r],i[r].values,i[r].value_message))}function ye(n){return this.supportsIsArray()?Array.isArray(n):cr.call(n)==="[object Array]"}function pe(){return Array.isArray!=null}function we(){return Object.assign?Object.assign:yr}function yr(n){var f,i,t,e,r,s,u,o;if(n===undefined||n===null)throw new TypeError("Cannot convert first argument to object");for(f=Object(n),i=1;i<arguments.length;i++)if(t=arguments[i],t!==undefined&&t!==null)for(e=Object.keys(Object(t)),r=0,s=e.length;r<s;r++)u=e[r],o=Object.getOwnPropertyDescriptor(t,u),o!==undefined&&o.enumerable&&(f[u]=t[u]);return f}function pi(n,t){return t.reduce(function(t,i){return n[i]&&(t[i]=n[i]),t},{})}function be(n,t){var i=[];for(var r in n)t.indexOf(r)===-1&&i.push(r);return i}function ke(n){var t=[];for(var i in n)t.push(n[i]);return t}function wr(){var n=ke(arguments);return n.unshift({}),pr.get().apply(undefined,n)}function de(n,t){return{base:t?pi(n,t):n,"with":function(n,t){return n=t?pi(n,t):n,wr(this.base,n)}}}function ge(n,t){return Object.keys(n).reduce(function(i,r){return t.indexOf(r)===-1&&(i[r]=n[r]),i},{})}function no(n){for(var r="",i=0,t,u=!0,f=!0;i<n.length;)t=n.charCodeAt(i),!f&&t>=65&&t<=90||!u&&t>=48&&t<=57?(r+="_",r+=n[i].toLowerCase()):r+=n[i].toLowerCase(),u=t>=48&&t<=57,f=t>=65&&t<=90,i++;return r}function to(n){var t=n.split("_");return t.reduce(function(n,t){return n+t.charAt(0).toUpperCase()+t.slice(1)},t.shift())}function br(n,t){return typeof n!="object"||i.isArray(n)||n===null?n:(t=t||[],Object.keys(n).reduce(function(i,r){var u=t.indexOf(r)===-1?no(r):r;return i[u]=br(n[r]),i},{}))}function kr(n,t){return typeof n!="object"||i.isArray(n)||n===null?n:(t=t||[],Object.keys(n).reduce(function(i,r){var u=t.indexOf(r)===-1?to(r):r;return i[u]=kr(n[r]),i},{}))}function dr(n){var t=n.match(/^(https?:)\/\/(([^:/?#]*)(?::([0-9]+))?)([/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);return t&&{href:n,protocol:t[1],host:t[2],hostname:t[3],port:t[4],pathname:t[5],search:t[6],hash:t[7]}}function io(n){if(!n)return undefined;var t=dr(n),i=t.protocol+"//"+t.hostname;return t.port&&(i+=":"+t.port),i}function ro(n){ii().location=n}function uo(){return ii().document}function ii(){return window}function fo(){var i=ii().location,n=i.origin;return n||(n=t.getOriginFromUrl(i.href)),n}function wt(){}function at(){}function it(n){this.disableWarnings=n.disableWarnings}function bt(){this.warn=new it({});this.storage=new at;try{var n=u.getWindow().localStorage;n&&(this.storage=n)}catch(t){this.warn.warning(t);this.warn.warning("Can't use localStorage. Using CookieStorage instead.")}}function nu(n,t){return{error:n,errorDescription:t}}function eo(n){return nu("invalid_token",n)}function o(n,i){return i=i||{},i.ignoreCasing=i.ignoreCasing?i.ignoreCasing:!1,function(r,u){var f;return!r&&!u?n(rt.buildResponse("generic_error","Something went wrong")):(!r&&u.err&&(r=u.err,u=null),!r&&u.error&&(r=u,u=null),r)?(f={original:r},r.response&&r.response.statusCode&&(f.statusCode=r.response.statusCode),r.response&&r.response.statusText&&(f.statusText=r.response.statusText),r.response&&r.response.body&&(r=r.response.body),r.err&&(r=r.err),f.code=r.error||r.code||r.error_code||r.status||null,f.description=r.errorDescription||r.error_description||r.description||r.error||r.details||r.err||null,i.forceLegacyError&&(f.error=f.code,f.error_description=f.description),r.name&&(f.name=r.name),r.policy&&(f.policy=r.policy),n(f)):u.type&&(u.type==="text/html"||u.type==="text/plain")?n(null,u.text):i.ignoreCasing?n(null,u.body||u):n(null,t.toCamelCase(u.body||u))}}function oo(n,i){var r=t.getKeysNotIn(i,iu);return r.length>0&&n.warning("Following parameters are not allowed on the `/authorize` endpoint: ["+r.join(",")+"]"),i}function so(n,i){return t.pick(i,tu)}function hu(n,t){if(this.n=null,this.e=0,n!=null&&t!=null&&n.length>0&&t.length>0)this.n=new eu(n,16),this.e=parseInt(t,16);else throw new Error("Invalid key data");}function lo(n){var t,i,r;for(t in ou)if(i=ou[t],r=i.length,n.substring(0,r)===i)return{alg:t,hash:n.substring(r)};return[]}function gi(n){var t=n.length%4,i=4-t;return t===0?n:n+new Array(1+i).join("=")}function cu(n){for(var i="",t=0;t<n.length;t++)i+=String.fromCharCode(n[t]);return i}function lu(n){for(var i=new Array(n.length),t=0;t<n.length;t++)i[t]=n.charCodeAt(t);return i}function au(n){for(var t,r="",i=0;i<n.length;i++)t=n[i].toString(16),r+=t.length===2?t:"0"+t;return r}function ao(n){return ht.fromByteArray(lu(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,function(n,t){return String.fromCharCode("0x"+t)}))).replace(/\+/g,"-").replace(/\//g,"_")}function vo(n){return n=gi(n).replace(/\-/g,"+").replace(/_/g,"/"),decodeURIComponent(cu(ht.toByteArray(n)).split("").map(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)}).join(""))}function yo(n){return au(ht.toByteArray(gi(n)))}function po(n){var t={"+":"-","/":"_","=":""};return n.replace(/[+/=]/g,function(n){return t[n]})}function vu(n){var t=ut.decodeToHEX(n.n),i=ut.decodeToHEX(n.e);return{modulus:t,exp:i}}function wo(n,t){var i=n.jwksURI||f(n.iss,".well-known","jwks.json");return pt.get(i).end(function(i,r){var f=null,u,e;if(i)return t(i);for(u=0;u<r.body.keys.length&&f===null;u++)e=r.body.keys[u],e.kid===n.kid&&(f=e);return t(null,vu(f))})}function pu(n){this.name="ConfigurationError";this.message=n||""}function wu(n){this.name="TokenValidationError";this.message=n||""}function ui(){}function ft(n){var t=n||{};if(this.jwksCache=t.jwksCache||new bu,this.expectedAlg=t.expectedAlg||"RS256",this.issuer=t.issuer,this.audience=t.audience,this.leeway=t.leeway||0,this.__disableExpirationCheck=t.__disableExpirationCheck||!1,this.jwksURI=t.jwksURI,this.leeway<0||this.leeway>60)throw new s.ConfigurationError("The leeway should be positive and lower than a minute.");if(fi.indexOf(this.expectedAlg)===-1)throw new s.ConfigurationError("Algorithm "+this.expectedAlg+" is not supported. (Expected algs: ["+fi.join(",")+"])");}function ku(n,t){var i,r;for(this.plugins=t,i=0;i<this.plugins.length;i++){if(this.plugins[i].version!==ct.raw){r="";this.plugins[i].constructor&&this.plugins[i].constructor.name&&(r=this.plugins[i].constructor.name);throw new Error("Plugin "+r+" version ("+this.plugins[i].version+") is not compatible with the SDK version ("+ct.raw+")");}this.plugins[i].setWebAuth(n)}}function bo(n){var o=new Uint8Array(n),r=[],f="0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~",e=u.getWindow().crypto||u.getWindow().msCrypto,i,t;if(!e)return null;for(i=e.getRandomValues(o),t=0;t<i.length;t++)r.push(f[i[t]%f.length]);return r.join("")}function et(n){n=n||{};this.namespace=n.namespace||ns;this.keyLength=n.keyLength||32}function vt(n){if(this.url=n.url,this.callback=n.callback,this.timeout=n.timeout||6e4,this.timeoutCallback=n.timeoutCallback||null,this.eventListenerType=n.eventListenerType||"message",this.iframe=null,this.timeoutHandle=null,this._destroyTimeout=null,this.transientMessageEventListener=null,this.proxyEventListener=null,this.eventValidator=n.eventValidator||{isValid:function(){return!0}},typeof this.callback!="function")throw new Error("options.callback must be a function");}function ts(n,t,i){var r=new vt({url:n,eventListenerType:"message",callback:function(n){i(null,n)},timeout:t.timeout,eventValidator:{isValid:function(n){return n.event.data.type==="authorization_response"&&t.state===n.event.data.response.state}},timeoutCallback:function(){i({error:"timeout",error_description:"Timeout during executing web_message communication",state:t.state})}});r.init()}function nr(n){this.webAuth=n;this.warn=new it(n.baseOptions)}function kt(n,t){this.webAuth=n;this.baseOptions=t;this.request=new y(t);this.webMessageHandler=new nr(n)}function is(n){var i=u.getWindow(),r="&"+i.location.hash.substring(1),t=r.split("&"+n+"=");if(t.length===2)return t.pop().split("&").shift()}function gu(n,t){return["co/verifier",encodeURIComponent(n),encodeURIComponent(t)].join("/")}function rs(n,t){try{var i=b.getItem(t);return b.removeItem(t),i||""}catch(r){return""}}function tr(n,t){this.webAuth=n;this.baseOptions=t;this.crossOriginAuthentication=new kt(n,this.baseOptions);this.warn=new it({disableWarnings:!!t._disableDeprecationWarnings})}function us(n){/^https?:\/\//.test(n)||(n=window.location.href);var t=/^(https?:\/\/[-_a-zA-Z.0-9:]+)/.exec(n);return t?t[1]:n}function oi(){this._current_popup=null}function w(n,t){this.baseOptions=t;this.baseOptions.popupOrigin=t.popupOrigin;this.client=n.client;this.webAuth=n;this.transactionManager=new et(this.baseOptions.transaction);this.crossOriginAuthentication=new kt(n,this.baseOptions);this.warn=new it({disableWarnings:!!t._disableDeprecationWarnings})}function yt(n){this.authenticationUrl=n.authenticationUrl;this.timeout=n.timeout||6e4;this.handler=null;this.postMessageDataType=n.postMessageDataType||!1;this.postMessageOrigin=n.postMessageOrigin||u.getWindow().location.origin||u.getWindow().location.protocol+"//"+u.getWindow().location.hostname+(u.getWindow().location.port?":"+u.getWindow().location.port:"")}function rr(n){this.baseOptions=n;this.request=new y(n);this.transactionManager=new et(this.baseOptions.transaction)}function si(n,t){this.baseOptions=t;this.client=n;this.request=new y(this.baseOptions);this.warn=new it({disableWarnings:!!t._disableDeprecationWarnings})}function e(n){i.check(n,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},clientID:{type:"string",message:"clientID option is required"},responseType:{optional:!0,type:"string",message:"responseType is not valid"},responseMode:{optional:!0,type:"string",message:"responseMode is not valid"},redirectUri:{optional:!0,type:"string",message:"redirectUri is not valid"},scope:{optional:!0,type:"string",message:"scope is not valid"},audience:{optional:!0,type:"string",message:"audience is not valid"},popupOrigin:{optional:!0,type:"string",message:"popupOrigin is not valid"},leeway:{optional:!0,type:"number",message:"leeway is not valid"},plugins:{optional:!0,type:"array",message:"plugins is not valid"},_disableDeprecationWarnings:{optional:!0,type:"boolean",message:"_disableDeprecationWarnings option is not valid"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"},_timesToRetryFailedRequests:{optional:!0,type:"number",message:"_timesToRetryFailedRequests option is not valid"}});n.overrides&&i.check(n.overrides,{type:"object",message:"overrides option is not valid"},{__tenant:{optional:!0,type:"string",message:"__tenant option is required"},__token_issuer:{optional:!0,type:"string",message:"__token_issuer option is required"},__jwks_uri:{optional:!0,type:"string",message:"__jwks_uri is required"}});this.baseOptions=n;this.baseOptions.plugins=new ku(this,this.baseOptions.plugins||[]);this.baseOptions._sendTelemetry=this.baseOptions._sendTelemetry===!1?this.baseOptions._sendTelemetry:!0;this.baseOptions._timesToRetryFailedRequests=n._timesToRetryFailedRequests?parseInt(n._timesToRetryFailedRequests,0):0;this.baseOptions.tenant=this.baseOptions.overrides&&this.baseOptions.overrides.__tenant||this.baseOptions.domain.split(".")[0];this.baseOptions.token_issuer=this.baseOptions.overrides&&this.baseOptions.overrides.__token_issuer||"https://"+this.baseOptions.domain+"/";this.baseOptions.jwksURI=this.baseOptions.overrides&&this.baseOptions.overrides.__jwks_uri;this.transactionManager=new et(this.baseOptions.transaction);this.client=new c(this.baseOptions);this.redirect=new tr(this,this.baseOptions);this.popup=new w(this,this.baseOptions);this.crossOriginAuthentication=new kt(this,this.baseOptions);this.webMessageHandler=new nr(this);this._universalLogin=new si(this,this.baseOptions)}function fs(n,t,i){return{accessToken:n.access_token||null,idToken:n.id_token||null,idTokenPayload:i||null,appState:t||null,refreshToken:n.refresh_token||null,state:n.state||null,expiresIn:n.expires_in?parseInt(n.expires_in,10):null,tokenType:n.token_type||null,scope:n.scope||null}}function hi(n,t){this.baseOptions=t;this.request=n}function ur(n,t){this.baseOptions=t;this.request=n}function c(n,t){arguments.length===2?this.auth0=n:t=n;i.check(t,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},clientID:{type:"string",message:"clientID option is required"},responseType:{optional:!0,type:"string",message:"responseType is not valid"},responseMode:{optional:!0,type:"string",message:"responseMode is not valid"},redirectUri:{optional:!0,type:"string",message:"redirectUri is not valid"},scope:{optional:!0,type:"string",message:"scope is not valid"},audience:{optional:!0,type:"string",message:"audience is not valid"},_disableDeprecationWarnings:{optional:!0,type:"boolean",message:"_disableDeprecationWarnings option is not valid"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"}});this.baseOptions=t;this.baseOptions._sendTelemetry=this.baseOptions._sendTelemetry===!1?this.baseOptions._sendTelemetry:!0;this.baseOptions.rootUrl="https://"+this.baseOptions.domain;this.request=new y(this.baseOptions);this.passwordless=new hi(this.request,this.baseOptions);this.dbConnection=new ur(this.request,this.baseOptions);this.warn=new it({disableWarnings:!!t._disableDeprecationWarnings})}function dt(n){i.check(n,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},token:{type:"string",message:"token option is required"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"}});this.baseOptions=n;this.baseOptions.headers={Authorization:"Bearer "+this.baseOptions.token};this.request=new y(this.baseOptions);this.baseOptions.rootUrl=f("https://"+this.baseOptions.domain,"api","v2")}var k=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},f=a(function(n){(function(t,i,r){n.exports?n.exports=r():typeof undefined=="function"&&undefined.amd?undefined(r):i[t]=r()})("urljoin",k,function(){function n(n){return n=n.replace(/:\//g,"://"),n=n.replace(/([^:\s])\/+/g,"$1/"),n=n.replace(/\/(\?|&|#[^!])/g,"$1"),n.replace(/(\?.+)\?/g,"$1&")}return function(){var t=arguments,i={},r;return typeof arguments[0]=="object"&&(t=arguments[0],i=arguments[1]||{}),r=[].slice.call(t,0).join("/"),n(r,i)}})}),h=a(function(n,t){var r=Object.prototype.hasOwnProperty,i=function(){for(var t=[],n=0;n<256;++n)t.push("%"+((n<16?"0":"")+n.toString(16)).toUpperCase());return t}();t.arrayToObject=function(n,t){for(var r=t&&t.plainObjects?Object.create(null):{},i=0;i<n.length;++i)typeof n[i]!="undefined"&&(r[i]=n[i]);return r};t.merge=function(n,i,u){if(!i)return n;if(typeof i!="object"){if(Array.isArray(n))n.push(i);else if(typeof n=="object")(u.plainObjects||u.allowPrototypes||!r.call(Object.prototype,i))&&(n[i]=!0);else return[n,i];return n}if(typeof n!="object")return[n].concat(i);var f=n;return(Array.isArray(n)&&!Array.isArray(i)&&(f=t.arrayToObject(n,u)),Array.isArray(n)&&Array.isArray(i))?(i.forEach(function(i,f){r.call(n,f)?n[f]&&typeof n[f]=="object"?n[f]=t.merge(n[f],i,u):n.push(i):n[f]=i}),n):Object.keys(i).reduce(function(n,r){var f=i[r];return n[r]=Object.prototype.hasOwnProperty.call(n,r)?t.merge(n[r],f,u):f,n},f)};t.decode=function(n){try{return decodeURIComponent(n.replace(/\+/g," "))}catch(t){return n}};t.encode=function(n){var f,r,u,t;if(n.length===0)return n;for(f=typeof n=="string"?n:String(n),r="",u=0;u<f.length;++u){if(t=f.charCodeAt(u),t===45||t===46||t===95||t===126||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122){r+=f.charAt(u);continue}if(t<128){r=r+i[t];continue}if(t<2048){r=r+(i[192|t>>6]+i[128|t&63]);continue}if(t<55296||t>=57344){r=r+(i[224|t>>12]+i[128|t>>6&63]+i[128|t&63]);continue}u+=1;t=65536+((t&1023)<<10|f.charCodeAt(u)&1023);r+=i[240|t>>18]+i[128|t>>12&63]+i[128|t>>6&63]+i[128|t&63]}return r};t.compact=function(n,i){var u,e,f,r,o;if(typeof n!="object"||n===null)return n;if(u=i||[],e=u.indexOf(n),e!==-1)return u[e];if(u.push(n),Array.isArray(n)){for(f=[],r=0;r<n.length;++r)n[r]&&typeof n[r]=="object"?f.push(t.compact(n[r],u)):typeof n[r]!="undefined"&&f.push(n[r]);return f}return o=Object.keys(n),o.forEach(function(i){n[i]=t.compact(n[i],u)}),n};t.isRegExp=function(n){return Object.prototype.toString.call(n)==="[object RegExp]"};t.isBuffer=function(n){return n===null||typeof n=="undefined"?!1:!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}}),es=h.arrayToObject,os=h.merge,ss=h.decode,hs=h.encode,cs=h.compact,ls=h.isRegExp,as=h.isBuffer,rf=String.prototype.replace,uf=/%20/g,gt={"default":"RFC3986",formatters:{RFC1738:function(n){return rf.call(n,uf,"+")},RFC3986:function(n){return n}},RFC1738:"RFC1738",RFC3986:"RFC3986"},fr={brackets:function(n){return n+"[]"},indices:function(n,t){return n+"["+t+"]"},repeat:function(n){return n}},ff=Date.prototype.toISOString,d={delimiter:"&",encode:!0,encoder:h.encode,encodeValuesOnly:!1,serializeDate:function(n){return ff.call(n)},skipNulls:!1,strictNullHandling:!1},ci=function ci(n,t,i,r,u,f,e,o,s,c,l,a){var v=n,d,p,w,k,b,y;if(typeof e=="function")v=e(t,v);else if(v instanceof Date)v=c(v);else if(v===null){if(r)return f&&!a?f(t):t;v=""}if(typeof v=="string"||typeof v=="number"||typeof v=="boolean"||h.isBuffer(v))return f?(d=a?t:f(t),[l(d)+"="+l(f(v))]):[l(t)+"="+l(String(v))];if(p=[],typeof v=="undefined")return p;for(Array.isArray(e)?w=e:(k=Object.keys(v),w=o?k.sort(o):k),b=0;b<w.length;++b)(y=w[b],u&&v[y]===null)||(p=Array.isArray(v)?p.concat(ci(v[y],i(t,y),i,r,u,f,e,o,s,c,l,a)):p.concat(ci(v[y],t+(s?"."+y:"["+y+"]"),i,r,u,f,e,o,s,c,l,a)));return p},ef=function(n,t){var r=n,i=t||{},l,u,f,e,a,v,o,s;if(i.encoder!==null&&i.encoder!==undefined&&typeof i.encoder!="function")throw new TypeError("Encoder has to be a function.");var y=typeof i.delimiter=="undefined"?d.delimiter:i.delimiter,p=typeof i.strictNullHandling=="boolean"?i.strictNullHandling:d.strictNullHandling,c=typeof i.skipNulls=="boolean"?i.skipNulls:d.skipNulls,w=typeof i.encode=="boolean"?i.encode:d.encode,b=typeof i.encoder=="function"?i.encoder:d.encoder,h=typeof i.sort=="function"?i.sort:null,k=typeof i.allowDots=="undefined"?!1:i.allowDots,g=typeof i.serializeDate=="function"?i.serializeDate:d.serializeDate,nt=typeof i.encodeValuesOnly=="boolean"?i.encodeValuesOnly:d.encodeValuesOnly;if(typeof i.format=="undefined")i.format=gt.default;else if(!Object.prototype.hasOwnProperty.call(gt.formatters,i.format))throw new TypeError("Unknown format option provided.");if(l=gt.formatters[i.format],typeof i.filter=="function"?(f=i.filter,r=f("",r)):Array.isArray(i.filter)&&(f=i.filter,u=f),e=[],typeof r!="object"||r===null)return"";for(a=(i.arrayFormat in fr)?i.arrayFormat:("indices"in i)?i.indices?"indices":"repeat":"indices",v=fr[a],u||(u=Object.keys(r)),h&&u.sort(h),o=0;o<u.length;++o)(s=u[o],c&&r[s]===null)||(e=e.concat(ci(r[s],s,v,p,c,w?b:null,f,h,k,g,l,nt)));return e.join(y)},li=Object.prototype.hasOwnProperty,p={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:h.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},of=function(n,t){for(var i,f,r,e,u={},s=n.split(t.delimiter,t.parameterLimit===Infinity?undefined:t.parameterLimit),o=0;o<s.length;++o)i=s[o],f=i.indexOf("]=")===-1?i.indexOf("="):i.indexOf("]=")+1,f===-1?(r=t.decoder(i),e=t.strictNullHandling?null:""):(r=t.decoder(i.slice(0,f)),e=t.decoder(i.slice(f+1))),u[r]=li.call(u,r)?[].concat(u[r]).concat(e):e;return u},ni=function(n,t,i){var r,u,e,f;return n.length?(r=n.shift(),r==="[]"?(u=[],u=u.concat(ni(n,t,i))):(u=i.plainObjects?Object.create(null):{},e=r.charAt(0)==="["&&r.charAt(r.length-1)==="]"?r.slice(1,-1):r,f=parseInt(e,10),!isNaN(f)&&r!==e&&String(f)===e&&f>=0&&i.parseArrays&&f<=i.arrayLimit?(u=[],u[f]=ni(n,t,i)):u[e]=ni(n,t,i)),u):t},sf=function(n,t,i){var o;if(n){var u=i.allowDots?n.replace(/\.([^.[]+)/g,"[$1]"):n,s=/(\[[^[\]]*])/g,r=/(\[[^[\]]*])/.exec(u),e=r?u.slice(0,r.index):u,f=[];if(e){if(!i.plainObjects&&li.call(Object.prototype,e)&&!i.allowPrototypes)return;f.push(e)}for(o=0;(r=s.exec(u))!==null&&o<i.depth;){if(o+=1,!i.plainObjects&&li.call(Object.prototype,r[1].slice(1,-1))&&!i.allowPrototypes)return;f.push(r[1])}return r&&f.push("["+u.slice(r.index)+"]"),ni(f,t,i)}},hf=function(n,t){var i=t||{},r,f,s;if(i.decoder!==null&&i.decoder!==undefined&&typeof i.decoder!="function")throw new TypeError("Decoder has to be a function.");if(i.delimiter=typeof i.delimiter=="string"||h.isRegExp(i.delimiter)?i.delimiter:p.delimiter,i.depth=typeof i.depth=="number"?i.depth:p.depth,i.arrayLimit=typeof i.arrayLimit=="number"?i.arrayLimit:p.arrayLimit,i.parseArrays=i.parseArrays!==!1,i.decoder=typeof i.decoder=="function"?i.decoder:p.decoder,i.allowDots=typeof i.allowDots=="boolean"?i.allowDots:p.allowDots,i.plainObjects=typeof i.plainObjects=="boolean"?i.plainObjects:p.plainObjects,i.allowPrototypes=typeof i.allowPrototypes=="boolean"?i.allowPrototypes:p.allowPrototypes,i.parameterLimit=typeof i.parameterLimit=="number"?i.parameterLimit:p.parameterLimit,i.strictNullHandling=typeof i.strictNullHandling=="boolean"?i.strictNullHandling:p.strictNullHandling,n===""||n===null||typeof n=="undefined")return i.plainObjects?Object.create(null):{};var e=typeof n=="string"?of(n,i):n,u=i.plainObjects?Object.create(null):{},o=Object.keys(e);for(r=0;r<o.length;++r)f=o[r],s=sf(f,e[f],i),u=h.merge(u,s,i);return h.compact(u)},g={formats:gt,parse:hf,stringify:ef},cf=a(function(n){function t(n){if(n)return i(n)}function i(n){for(var i in t.prototype)n[i]=t.prototype[i];return n}n.exports=t;t.prototype.on=t.prototype.addEventListener=function(n,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(t),this};t.prototype.once=function(n,t){function i(){this.off(n,i);t.apply(this,arguments)}i.fn=t;this.on(n,i);return this};t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(n,t){var i,u,r;if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;if(i=this._callbacks["$"+n],!i)return this;if(1==arguments.length)return delete this._callbacks["$"+n],this;for(r=0;r<i.length;r++)if(u=i[r],u===t||u.fn===t){i.splice(r,1);break}return this};t.prototype.emit=function(n){var r,t,i,u;if(this._callbacks=this._callbacks||{},r=[].slice.call(arguments,1),t=this._callbacks["$"+n],t)for(t=t.slice(0),i=0,u=t.length;i<u;++i)t[i].apply(this,r);return this};t.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};t.prototype.hasListeners=function(n){return!!this.listeners(n).length}}),ot=lf,af=r,er,nt,or,ht,hr,ct,cr,i,pr,t,u,ri,rt,tu,iu,di,ut,yu,s,bu,fi,ei,ir,nf,tf;r.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this};r.prototype.parse=function(n){return this._parser=n,this};r.prototype.responseType=function(n){return this._responseType=n,this};r.prototype.serialize=function(n){return this._serializer=n,this};r.prototype.timeout=function(n){if(!n||"object"!=typeof n)return this._timeout=n,this._responseTimeout=0,this;for(var t in n)switch(t){case"deadline":this._timeout=n.deadline;break;case"response":this._responseTimeout=n.response;break;default:console.warn("Unknown timeout option",t)}return this};r.prototype.retry=function(n,t){return(arguments.length===0||n===!0)&&(n=1),n<=0&&(n=0),this._maxRetries=n,this._retries=0,this._retryCallback=t,this};er=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];r.prototype._shouldRetry=function(n,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var i=this._retryCallback(n,t);if(i===!0)return!0;if(i===!1)return!1}catch(r){console.error(r)}return t&&t.status&&t.status>=500&&t.status!=501?!0:n&&(n.code&&~er.indexOf(n.code)||n.timeout&&n.code=="ECONNABORTED"||n.crossDomain)?!0:!1};r.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()};r.prototype.then=function(n,t){if(!this._fullfilledPromise){var i=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises");this._fullfilledPromise=new Promise(function(n,t){i.end(function(i,r){i?t(i):n(r)})})}return this._fullfilledPromise.then(n,t)};r.prototype.catch=function(n){return this.then(undefined,n)};r.prototype.use=function(n){return n(this),this};r.prototype.ok=function(n){if("function"!=typeof n)throw Error("Callback required");return this._okCallback=n,this};r.prototype._isResponseOK=function(n){return n?this._okCallback?this._okCallback(n):n.status>=200&&n.status<300:!1};r.prototype.get=function(n){return this._header[n.toLowerCase()]};r.prototype.getHeader=r.prototype.get;r.prototype.set=function(n,t){if(ot(n)){for(var i in n)this.set(i,n[i]);return this}return this._header[n.toLowerCase()]=t,this.header[n]=t,this};r.prototype.unset=function(n){return delete this._header[n.toLowerCase()],delete this.header[n],this};r.prototype.field=function(n,t){var i,r;if(null===n||undefined===n)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),ot(n)){for(i in n)this.field(i,n[i]);return this}if(Array.isArray(t)){for(r in t)this.field(n,t[r]);return this}if(null===t||undefined===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(n,t),this};r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)};r.prototype._auth=function(n,t,i,r){switch(i.type){case"basic":this.set("Authorization","Basic "+r(n+":"+t));break;case"auto":this.username=n;this.password=t;break;case"bearer":this.set("Authorization","Bearer "+n)}return this};r.prototype.withCredentials=function(n){return n==undefined&&(n=!0),this._withCredentials=n,this};r.prototype.redirects=function(n){return this._maxRedirects=n,this};r.prototype.maxResponseSize=function(n){if("number"!=typeof n)throw TypeError("Invalid argument");return this._maxResponseSize=n,this};r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}};r.prototype.send=function(n){var i=ot(n),t=this._header["content-type"],r;if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),i&&!this._data)Array.isArray(n)?this._data=[]:this._isHost(n)||(this._data={});else if(n&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(i&&ot(this._data))for(r in n)this._data[r]=n[r];else"string"==typeof n?(t||this.type("form"),t=this._header["content-type"],this._data="application/x-www-form-urlencoded"==t?this._data?this._data+"&"+n:n:(this._data||"")+n):this._data=n;return!i||this._isHost(n)?this:(t||this.type("json"),this)};r.prototype.sortQuery=function(n){return this._sort=typeof n=="undefined"?!0:n,this};r.prototype._finalizeQueryString=function(){var i=this._query.join("&"),n,t;i&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+i);this._query.length=0;this._sort&&(n=this.url.indexOf("?"),n>=0&&(t=this.url.substring(n+1).split("&"),"function"==typeof this._sort?t.sort(this._sort):t.sort(),this.url=this.url.substring(0,n)+"?"+t.join("&")))};r.prototype._appendQueryString=function(){console.trace("Unsupported")};r.prototype._timeoutError=function(n,t,i){if(!this._aborted){var r=new Error(n+t+"ms exceeded");r.timeout=t;r.code="ECONNABORTED";r.errno=i;this.timedout=!0;this.abort();this.callback(r)}};r.prototype._setTimeouts=function(){var n=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){n._timeoutError("Timeout of ",n._timeout,"ETIME")},this._timeout));this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){n._timeoutError("Response timeout of ",n._responseTimeout,"ETIMEDOUT")},this._responseTimeout))};var yf=function(n){return n.split(/ *; */).shift()},pf=function(n){return n.split(/ *; */).reduce(function(n,t){var i=t.split(/ *= */),r=i.shift(),u=i.shift();return r&&u&&(n[r]=u),n},{})},wf=function(n){return n.split(/ *, */).reduce(function(n,t){var i=t.split(/ *; */),r=i[0].slice(1,-1),u=i[1].split(/ *= */)[1].slice(1,-1);return n[u]=r,n},{})},bf=function(n,t){return delete n["content-type"],delete n["content-length"],delete n["transfer-encoding"],delete n.host,t&&(delete n.authorization,delete n.cookie),n},ai={type:yf,params:pf,parseLinks:wf,cleanHeader:bf},kf=st;st.prototype.get=function(n){return this.header[n.toLowerCase()]};st.prototype._setHeaderProperties=function(n){var r=n["content-type"]||"",t,i;this.type=ai.type(r);t=ai.params(r);for(i in t)this[i]=t[i];this.links={};try{n.link&&(this.links=ai.parseLinks(n.link))}catch(u){}};st.prototype._setStatusProperties=function(n){var t=n/100|0;this.status=this.statusCode=n;this.statusType=t;this.info=1==t;this.ok=2==t;this.redirect=3==t;this.clientError=4==t;this.serverError=5==t;this.error=4==t||5==t?this.toError():!1;this.accepted=202==n;this.noContent=204==n;this.badRequest=400==n;this.unauthorized=401==n;this.notAcceptable=406==n;this.forbidden=403==n;this.notFound=404==n};["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach(function(n){vi.prototype[n]=function(){return this._defaults.push({fn:n,arguments:arguments}),this}});vi.prototype._setDefaults=function(n){this._defaults.forEach(function(t){n[t.fn].apply(n,t.arguments)})};var ti=vi,pt=a(function(n,t){function a(){}function e(n){var t,i;if(!ot(n))return n;t=[];for(i in n)o(t,i,n[i]);return t.join("&")}function o(n,t,i){if(i!=null)if(Array.isArray(i))i.forEach(function(i){o(n,t,i)});else if(ot(i))for(var r in i)o(n,t+"["+r+"]",i[r]);else n.push(encodeURIComponent(t)+"="+encodeURIComponent(i));else i===null&&n.push(encodeURIComponent(t))}function h(n){for(var r={},f=n.split("&"),t,i,u=0,e=f.length;u<e;++u)t=f[u],i=t.indexOf("="),i==-1?r[decodeURIComponent(t)]="":r[decodeURIComponent(t.slice(0,i))]=decodeURIComponent(t.slice(i+1));return r}function v(n){for(var u=n.split(/\r?\n/),f={},t,i,e,o,r=0,h=u.length;r<h;++r)(i=u[r],t=i.indexOf(":"),t!==-1)&&(e=i.slice(0,t).toLowerCase(),o=s(i.slice(t+1)),f[e]=o);return f}function c(n){return/[\/+]json($|[^-\w])/.test(n)}function f(n){this.req=n;this.xhr=this.req.xhr;this.text=this.req.method!="HEAD"&&(this.xhr.responseType===""||this.xhr.responseType==="text")||typeof this.xhr.responseType=="undefined"?this.xhr.responseText:null;this.statusText=this.req.xhr.statusText;var t=this.xhr.status;t===1223&&(t=204);this._setStatusProperties(t);this.header=this.headers=v(this.xhr.getAllResponseHeaders());this.header["content-type"]=this.xhr.getResponseHeader("content-type");this._setHeaderProperties(this.header);this.body=null===this.text&&n._responseType?this.xhr.response:this.req.method!="HEAD"?this._parseBody(this.text?this.text:this.xhr.response):null}function r(n,t){var i=this;this._query=this._query||[];this.method=n;this.url=t;this.header={};this._header={};this.on("end",function(){var n=null,t=null,r;try{t=new f(i)}catch(u){return n=new Error("Parser is unable to parse the response"),n.parse=!0,n.original=u,i.xhr?(n.rawResponse=typeof i.xhr.responseType=="undefined"?i.xhr.responseText:i.xhr.response,n.status=i.xhr.status?i.xhr.status:null,n.statusCode=n.status):(n.rawResponse=null,n.status=null),i.callback(n)}i.emit("response",t);try{i._isResponseOK(t)||(r=new Error(t.statusText||"Unsuccessful HTTP response"))}catch(e){r=e}r?(r.original=n,r.response=t,r.status=t.status,i.callback(r,t)):i.callback(null,t)})}function l(n,t,r){var u=i("DELETE",n);return"function"==typeof t&&(r=t,t=null),t&&u.send(t),r&&u.end(r),u}var u,i,s;typeof window!="undefined"?u=window:typeof self!="undefined"?u=self:(console.warn("Using browser-only version of superagent in non-browser environment"),u=k);i=t=n.exports=function(n,i){return"function"==typeof i?new t.Request("GET",n).end(i):1==arguments.length?new t.Request("GET",n):new t.Request(n,i)};t.Request=r;i.getXHR=function(){if(!u.XMLHttpRequest||u.location&&"file:"==u.location.protocol&&u.ActiveXObject){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(n){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(n){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(n){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(n){}}else return new XMLHttpRequest;throw Error("Browser-only version of superagent could not find XHR");};s="".trim?function(n){return n.trim()}:function(n){return n.replace(/(^\s*|\s*$)/g,"")};i.serializeObject=e;i.parseString=h;i.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"};i.serialize={"application/x-www-form-urlencoded":e,"application/json":JSON.stringify};i.parse={"application/x-www-form-urlencoded":h,"application/json":JSON.parse};kf(f.prototype);f.prototype._parseBody=function(n){var t=i.parse[this.type];return this.req._parser?this.req._parser(this,n):(!t&&c(this.type)&&(t=i.parse["application/json"]),t&&n&&(n.length||n instanceof Object)?t(n):null)};f.prototype.toError=function(){var t=this.req,i=t.method,r=t.url,u="cannot "+i+" "+r+" ("+this.status+")",n=new Error(u);return n.status=this.status,n.method=i,n.url=r,n};i.Response=f;cf(r.prototype);af(r.prototype);r.prototype.type=function(n){return this.set("Content-Type",i.types[n]||n),this};r.prototype.accept=function(n){return this.set("Accept",i.types[n]||n),this};r.prototype.auth=function(n,t,i){1===arguments.length&&(t="");typeof t=="object"&&t!==null&&(i=t,t="");i||(i={type:"function"==typeof btoa?"basic":"auto"});var r=function(n){if("function"==typeof btoa)return btoa(n);throw new Error("Cannot use basic auth, btoa is not a function");};return this._auth(n,t,i,r)};r.prototype.query=function(n){return"string"!=typeof n&&(n=e(n)),n&&this._query.push(n),this};r.prototype.attach=function(n,t,i){if(t){if(this._data)throw Error("superagent can't mix .send() and .attach()");this._getFormData().append(n,t,i||t.name)}return this};r.prototype._getFormData=function(){return this._formData||(this._formData=new u.FormData),this._formData};r.prototype.callback=function(n,t){if(this._shouldRetry(n,t))return this._retry();var i=this._callback;this.clearTimeout();n&&(this._maxRetries&&(n.retries=this._retries-1),this.emit("error",n));i(n,t)};r.prototype.crossDomainError=function(){var n=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");n.crossDomain=!0;n.status=this.status;n.method=this.method;n.url=this.url;this.callback(n)};r.prototype.buffer=r.prototype.ca=r.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this};r.prototype.pipe=r.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent");};r.prototype._isHost=function(n){return n&&"object"==typeof n&&!Array.isArray(n)&&Object.prototype.toString.call(n)!=="[object Object]"};r.prototype.end=function(n){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=n||a,this._finalizeQueryString(),this._end()};r.prototype._end=function(){var t=this,n=this.xhr=i.getXHR(),r=this._formData||this._data,o,e,u,f;if(this._setTimeouts(),n.onreadystatechange=function(){var r=n.readyState,i;if(r>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4==r){try{i=n.status}catch(u){i=0}if(!i)return t.timedout||t._aborted?void 0:t.crossDomainError();t.emit("end")}},o=function(n,i){i.total>0&&(i.percent=i.loaded/i.total*100);i.direction=n;t.emit("progress",i)},this.hasListeners("progress"))try{n.onprogress=o.bind(null,"download");n.upload&&(n.upload.onprogress=o.bind(null,"upload"))}catch(h){}try{this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0)}catch(s){return this.callback(s)}this._withCredentials&&(n.withCredentials=!0);this._formData||"GET"==this.method||"HEAD"==this.method||"string"==typeof r||this._isHost(r)||(e=this._header["content-type"],u=this._serializer||i.serialize[e?e.split(";")[0]:""],!u&&c(e)&&(u=i.serialize["application/json"]),u&&(r=u(r)));for(f in this.header)null!=this.header[f]&&this.header.hasOwnProperty(f)&&n.setRequestHeader(f,this.header[f]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send(typeof r!="undefined"?r:null),this};i.agent=function(){return new ti};["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(n){ti.prototype[n.toLowerCase()]=function(t,r){var u=new i.Request(n,t);return this._setDefaults(u),r&&u.end(r),u}});ti.prototype.del=ti.prototype["delete"];i.get=function(n,t,r){var u=i("GET",n);return"function"==typeof t&&(r=t,t=null),t&&u.query(t),r&&u.end(r),u};i.head=function(n,t,r){var u=i("HEAD",n);return"function"==typeof t&&(r=t,t=null),t&&u.query(t),r&&u.end(r),u};i.options=function(n,t,r){var u=i("OPTIONS",n);return"function"==typeof t&&(r=t,t=null),t&&u.send(t),r&&u.end(r),u};i.del=l;i["delete"]=l;i.patch=function(n,t,r){var u=i("PATCH",n);return"function"==typeof t&&(r=t,t=null),t&&u.send(t),r&&u.end(r),u};i.post=function(n,t,r){var u=i("POST",n);return"function"==typeof t&&(r=t,t=null),t&&u.send(t),r&&u.end(r),u};i.put=function(n,t,r){var u=i("PUT",n);return"function"==typeof t&&(r=t,t=null),t&&u.send(t),r&&u.end(r),u}}),fh=pt.Request,gf=re,ne=ue,te=oe,v=[],l=[],ie=typeof Uint8Array!="undefined"?Uint8Array:Array,yi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(nt=0,or=yi.length;nt<or;++nt)v[nt]=yi[nt],l[yi.charCodeAt(nt)]=nt;l["-".charCodeAt(0)]=62;l["_".charCodeAt(0)]=63;ht={byteLength:gf,toByteArray:ne,fromByteArray:te};hr={encode:le,decode:ae};ct={raw:"9.7.3"};lt.prototype.abort=function(){this.request.abort()};lt.prototype.getMethod=function(){return this.method};lt.prototype.getBody=function(){return this.body};lt.prototype.getUrl=function(){return this.url};lt.prototype.getHeaders=function(){return this.headers};tt.prototype.set=function(n,t){return this.request=this.request.set(n,t),this};tt.prototype.send=function(n){return this.request=this.request.send(n),this};tt.prototype.withCredentials=function(){return this.request=this.request.withCredentials(),this};tt.prototype.end=function(n){return this.request=this.request.end(n),new lt(this.request)};y.prototype.setCommonConfiguration=function(n,t){var u,r,i;if(t=t||{},this._timesToRetryFailedRequests>0&&(n=n.retry(this._timesToRetryFailedRequests)),t.noHeaders)return n;for(u=this.headers,n=n.set("Content-Type","application/json"),r=Object.keys(this.headers),i=0;i<r.length;i++)n=n.set(r[i],u[r[i]]);return this._sendTelemetry&&(n=n.set("Auth0-Client",this.getTelemetryData())),n};y.prototype.getTelemetryData=function(){var n=this._telemetryInfo||{name:"auth0.js",version:ct.raw},t=JSON.stringify(n);return hr.encode(t)};y.prototype.get=function(n,t){return new tt(this.setCommonConfiguration(pt.get(n),t))};y.prototype.post=function(n,t){return new tt(this.setCommonConfiguration(pt.post(n),t))};y.prototype.patch=function(n,t){return new tt(this.setCommonConfiguration(pt.patch(n),t))};cr=Object.prototype.toString;i={check:ve,attribute:lr,variable:ar,value:vr,isArray:ye,supportsIsArray:pe};pr={get:we,objectAssignPolyfill:yr};t={toSnakeCase:br,toCamelCase:kr,blacklist:ge,merge:de,pick:pi,getKeysNotIn:be,extend:wr,getOriginFromUrl:io,getLocationFromUrl:dr};u={redirect:ro,getDocument:uo,getWindow:ii,getOrigin:fo};wt.prototype.getItem=function(){return null};wt.prototype.removeItem=function(){};wt.prototype.setItem=function(){};ri=a(function(n){(function(t){var i=!1,u,r;typeof undefined=="function"&&undefined.amd&&(undefined(t),i=!0);n.exports=t();i=!0;i||(u=window.Cookies,r=window.Cookies=t(),r.noConflict=function(){return window.Cookies=u,r})})(function(){function n(){for(var n=0,r={},t,i;n<arguments.length;n++){t=arguments[n];for(i in t)r[i]=t[i]}return r}function t(i){function r(t,u,f){var o,c,l,s,v,e,h;if(typeof document!="undefined"){if(arguments.length>1){f=n({path:"/"},r.defaults,f);typeof f.expires=="number"&&(c=new Date,c.setMilliseconds(c.getMilliseconds()+f.expires*864e5),f.expires=c);f.expires=f.expires?f.expires.toUTCString():"";try{o=JSON.stringify(u);/^[\{\[]/.test(o)&&(u=o)}catch(w){}u=i.write?i.write(u,t):encodeURIComponent(String(u)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);t=encodeURIComponent(String(t));t=t.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent);t=t.replace(/[\(\)]/g,escape);l="";for(s in f)f[s]&&(l+="; "+s,f[s]!==!0)&&(l+="="+f[s]);return document.cookie=t+"="+u+l}t||(o={});for(var y=document.cookie?document.cookie.split("; "):[],p=/(%[0-9A-Z]{2})+/g,a=0;a<y.length;a++){v=y[a].split("=");e=v.slice(1).join("=");this.json||e.charAt(0)!=='"'||(e=e.slice(1,-1));try{if(h=v[0].replace(p,decodeURIComponent),e=i.read?i.read(e,h):i(e,h)||e.replace(p,decodeURIComponent),this.json)try{e=JSON.parse(e)}catch(w){}if(t===h){o=e;break}t||(o[h]=e)}catch(w){}}return o}}return r.set=r,r.get=function(n){return r.call(r,n)},r.getJSON=function(){return r.apply({json:!0},[].slice.call(arguments))},r.defaults={},r.remove=function(t,i){r(t,"",n(i,{expires:-1}))},r.withConverter=t,r}return t(function(){})})});at.prototype.getItem=function(n){return ri.get(n)};at.prototype.removeItem=function(n){ri.remove(n)};at.prototype.setItem=function(n,i,r){var u=t.extend({expires:1},r);ri.set(n,i,u)};it.prototype.warning=function(n){this.disableWarnings||console.warn(n)};bt.prototype.failover=function(){if(this.storage instanceof wt){this.warn.warning("DummyStorage: ignore failover");return}this.storage instanceof at?(this.warn.warning("CookieStorage: failing over DummyStorage"),this.storage=new wt):(this.warn.warning("LocalStorage: failing over CookieStorage"),this.storage=new at)};bt.prototype.getItem=function(n){try{return this.storage.getItem(n)}catch(t){return this.warn.warning(t),this.failover(),this.getItem(n)}};bt.prototype.removeItem=function(n){try{return this.storage.removeItem(n)}catch(t){return this.warn.warning(t),this.failover(),this.removeItem(n)}};bt.prototype.setItem=function(n,t,i){try{return this.storage.setItem(n,t,i)}catch(r){return this.warn.warning(r),this.failover(),this.setItem(n,t,i)}};var wi,bi=function(){return wi||(wi=new bt),wi},b={getItem:function(n){var t=bi().getItem(n);try{return JSON.parse(t)}catch(i){return t}},removeItem:function(n){return bi().removeItem(n)},setItem:function(n,t,i){var r=JSON.stringify(t);return bi().setItem(n,r,i)}},gr={set:function(n,t){var i={lastUsedConnection:n,lastUsedSub:t};b.setItem("auth0.ssodata",JSON.stringify(i))},get:function(){var n=b.getItem("auth0.ssodata");if(n)return JSON.parse(n)}};rt={buildResponse:nu,invalidToken:eo};tu=["realm","audience","client_id","client_secret","redirect_uri","scope","code","grant_type","username","password","refresh_token","assertion","client_assertion","client_assertion_type","code_verifier"];iu=["connection","connection_scope","auth0Client","owp","device","realm","protocol","_csrf","_intstate","login_ticket","client_id","response_type","response_mode","redirect_uri","audience","scope","state","nonce","display","prompt","max_age","ui_locales","claims_locales","id_token_hint","login_hint","acr_values","claims","registration","request","request_uri","code_challenge","code_challenge_method","access_type","display"];var ru={oauthTokenParams:so,oauthAuthorizeParams:oo},ki=a(function(n,t){(function(i,r){n.exports=t=r()})(k,function(){var n=n||function(n,t){var h=Object.create||function(){function n(){}return function(t){var i;return n.prototype=t,i=new n,n.prototype=null,i}}(),u={},f=u.lib={},i=f.Base=function(){return{extend:function(n){var t=h(this);return n&&t.mixIn(n),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var t in n)n.hasOwnProperty(t)&&(this[t]=n[t]);n.hasOwnProperty("toString")&&(this.toString=n.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),r=f.WordArray=i.extend({init:function(n,i){n=this.words=n||[];this.sigBytes=i!=t?i:n.length*4},toString:function(n){return(n||c).stringify(this)},concat:function(n){var u=this.words,f=n.words,i=this.sigBytes,r=n.sigBytes,e,t;if(this.clamp(),i%4)for(t=0;t<r;t++)e=f[t>>>2]>>>24-t%4*8&255,u[i+t>>>2]|=e<<24-(i+t)%4*8;else for(t=0;t<r;t+=4)u[i+t>>>2]=f[t>>>2];return this.sigBytes+=r,this},clamp:function(){var i=this.words,t=this.sigBytes;i[t>>>2]&=4294967295<<32-t%4*8;i.length=n.ceil(t/4)},clone:function(){var n=i.clone.call(this);return n.words=this.words.slice(0),n},random:function(t){for(var i,u=[],o=function(t){var t=t,i=987654321,r=4294967295;return function(){i=36969*(i&65535)+(i>>16)&r;t=18e3*(t&65535)+(t>>16)&r;var u=(i<<16)+t&r;return u/=4294967296,u+=.5,u*(n.random()>.5?1:-1)}},f=0,e;f<t;f+=4)i=o((e||n.random())*4294967296),e=i()*987654071,u.push(i()*4294967296|0);return new r.init(u,t)}}),e=u.enc={},c=e.Hex={stringify:function(n){for(var r,u=n.words,f=n.sigBytes,i=[],t=0;t<f;t++)r=u[t>>>2]>>>24-t%4*8&255,i.push((r>>>4).toString(16)),i.push((r&15).toString(16));return i.join("")},parse:function(n){for(var i=n.length,u=[],t=0;t<i;t+=2)u[t>>>3]|=parseInt(n.substr(t,2),16)<<24-t%8*4;return new r.init(u,i/2)}},o=e.Latin1={stringify:function(n){for(var r,u=n.words,f=n.sigBytes,i=[],t=0;t<f;t++)r=u[t>>>2]>>>24-t%4*8&255,i.push(String.fromCharCode(r));return i.join("")},parse:function(n){for(var i=n.length,u=[],t=0;t<i;t++)u[t>>>2]|=(n.charCodeAt(t)&255)<<24-t%4*8;return new r.init(u,i)}},l=e.Utf8={stringify:function(n){try{return decodeURIComponent(escape(o.stringify(n)))}catch(t){throw new Error("Malformed UTF-8 data");}},parse:function(n){return o.parse(unescape(encodeURIComponent(n)))}},s=f.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(n){typeof n=="string"&&(n=l.parse(n));this._data.concat(n);this._nDataBytes+=n.sigBytes},_process:function(t){var e=this._data,h=e.words,c=e.sigBytes,o=this.blockSize,a=o*4,u=c/a,i,s,f,l;if(u=t?n.ceil(u):n.max((u|0)-this._minBufferSize,0),i=u*o,s=n.min(i*4,c),i){for(f=0;f<i;f+=o)this._doProcessBlock(h,f);l=h.splice(0,i);e.sigBytes-=s}return new r.init(l,s)},clone:function(){var n=i.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0}),v=f.Hasher=s.extend({cfg:i.extend(),init:function(n){this.cfg=this.cfg.extend(n);this.reset()},reset:function(){s.reset.call(this);this._doReset()},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);return this._doFinalize()},blockSize:16,_createHelper:function(n){return function(t,i){return new n.init(i).finalize(t)}},_createHmacHelper:function(n){return function(t,i){return new a.HMAC.init(n,i).finalize(t)}}}),a=u.algo={};return u}(Math);return n})}),uu=a(function(n,t){(function(i,r){n.exports=t=r(ki)})(k,function(n){return function(t){var r=n,e=r.lib,h=e.WordArray,u=e.Hasher,c=r.algo,o=[],s=[],i,f;(function(){function u(n){for(var r=t.sqrt(n),i=2;i<=r;i++)if(!(n%i))return!1;return!0}function r(n){return(n-(n|0))*4294967296|0}for(var i=2,n=0;n<64;)u(i)&&(n<8&&(o[n]=r(t.pow(i,1/2))),s[n]=r(t.pow(i,1/3)),n++),i++})();i=[];f=c.SHA256=u.extend({_doReset:function(){this._hash=new h.init(o.slice(0))},_doProcessBlock:function(n,t){for(var r=this._hash.words,f=r[0],o=r[1],h=r[2],y=r[3],e=r[4],a=r[5],v=r[6],p=r[7],u=0;u<64;u++){if(u<16)i[u]=n[t+u]|0;else{var c=i[u-15],b=(c<<25|c>>>7)^(c<<14|c>>>18)^c>>>3,l=i[u-2],k=(l<<15|l>>>17)^(l<<13|l>>>19)^l>>>10;i[u]=b+i[u-7]+k+i[u-16]}var d=e&a^~e&v,g=f&o^f&h^o&h,nt=(f<<30|f>>>2)^(f<<19|f>>>13)^(f<<10|f>>>22),tt=(e<<26|e>>>6)^(e<<21|e>>>11)^(e<<7|e>>>25),w=p+tt+d+s[u]+i[u],it=nt+g;p=v;v=a;a=e;e=y+w|0;y=h;h=o;o=f;f=w+it|0}r[0]=r[0]+f|0;r[1]=r[1]+o|0;r[2]=r[2]+h|0;r[3]=r[3]+y|0;r[4]=r[4]+e|0;r[5]=r[5]+a|0;r[6]=r[6]+v|0;r[7]=r[7]+p|0},_doFinalize:function(){var r=this._data,n=r.words,u=this._nDataBytes*8,i=r.sigBytes*8;return n[i>>>5]|=128<<24-i%32,n[(i+64>>>9<<4)+14]=t.floor(u/4294967296),n[(i+64>>>9<<4)+15]=u,r.sigBytes=n.length*4,this._process(),this._hash},clone:function(){var n=u.clone.call(this);return n._hash=this._hash.clone(),n}});r.SHA256=u._createHelper(f);r.HmacSHA256=u._createHmacHelper(f)}(Math),n.SHA256})}),ho=a(function(n,t){(function(i,r){n.exports=t=r(ki)})(k,function(n){return function(){function f(n,t,i){for(var o,s,e=[],f=0,u=0;u<t;u++)u%4&&(o=i[n.charCodeAt(u-1)]<<u%4*2,s=i[n.charCodeAt(u)]>>>6-u%4*2,e[f>>>2]|=(o|s)<<24-f%4*8,f++);return r.create(e,f)}var t=n,i=t.lib,r=i.WordArray,u=t.enc,e=u.Base64={stringify:function(n){var u=n.words,e=n.sigBytes,o=this._map,i,t,r,f;for(n.clamp(),i=[],t=0;t<e;t+=3){var s=u[t>>>2]>>>24-t%4*8&255,h=u[t+1>>>2]>>>24-(t+1)%4*8&255,c=u[t+2>>>2]>>>24-(t+2)%4*8&255,l=s<<16|h<<8|c;for(r=0;r<4&&t+r*.75<e;r++)i.push(o.charAt(l>>>6*(3-r)&63))}if(f=o.charAt(64),f)while(i.length%4)i.push(f);return i.join("")},parse:function(n){var o=n.length,r=this._map,i=this._reverseMap,t,u,e;if(!i)for(i=this._reverseMap=[],t=0;t<r.length;t++)i[r.charCodeAt(t)]=t;return u=r.charAt(64),u&&(e=n.indexOf(u),e!==-1&&(o=e)),f(n,o,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),n.enc.Base64})}),fu=a(function(n,t){(function(i,r){n.exports=t=r(ki)})(k,function(n){return n.enc.Hex})}),co=a(function(n,t){(function(){function i(n,t,i){n!=null&&("number"==typeof n?this.fromNumber(n,t,i):t==null&&"string"!=typeof n?this.fromString(n,256):this.fromString(n,t))}function r(){return new i(null)}function pt(n,t,i,r,u,f){while(--f>=0){var e=t*this[n++]+i[r]+u;u=Math.floor(e/67108864);i[r++]=e&67108863}return u}function wt(n,t,i,r,u,f){for(var o=t&32767,s=t>>15;--f>=0;){var e=this[n]&32767,h=this[n++]>>15,c=s*e+h*o;e=o*e+((c&32767)<<15)+i[r]+(u&1073741823);u=(e>>>30)+(c>>>15)+s*h+(u>>>30);i[r++]=e&1073741823}return u}function bt(n,t,i,r,u,f){for(var o=t&16383,s=t>>14;--f>=0;){var e=this[n]&16383,h=this[n++]>>14,c=s*e+h*o;e=o*e+((c&16383)<<14)+i[r]+u;u=(e>>28)+(c>>14)+s*h;i[r++]=e&268435455}return u}function ot(n){return et.charAt(n)}function st(n,t){var i=p[n.charCodeAt(t)];return i==null?-1:i}function kt(n){for(var t=this.t-1;t>=0;--t)n[t]=this[t];n.t=this.t;n.s=this.s}function dt(n){this.t=1;this.s=n<0?-1:0;n>0?this[0]=n:n<-1?this[0]=n+this.DV:this.t=0}function c(n){var t=r();return t.fromInt(n),t}function gt(n,t){var u,f;if(t==16)u=4;else if(t==8)u=3;else if(t==256)u=8;else if(t==2)u=1;else if(t==32)u=5;else if(t==4)u=2;else{this.fromRadix(n,t);return}this.t=0;this.s=0;for(var e=n.length,o=!1,r=0;--e>=0;){if(f=u==8?n[e]&255:st(n,e),f<0){n.charAt(e)=="-"&&(o=!0);continue}o=!1;r==0?this[this.t++]=f:r+u>this.DB?(this[this.t-1]|=(f&(1<<this.DB-r)-1)<<r,this[this.t++]=f>>this.DB-r):this[this.t-1]|=f<<r;r+=u;r>=this.DB&&(r-=this.DB)}u==8&&(n[0]&128)!=0&&(this.s=-1,r>0&&(this[this.t-1]|=(1<<this.DB-r)-1<<r));this.clamp();o&&i.ZERO.subTo(this,this)}function ni(){for(var n=this.s&this.DM;this.t>0&&this[this.t-1]==n;)--this.t}function ti(n){var t;if(this.s<0)return"-"+this.negate().toString(n);if(n==16)t=4;else if(n==8)t=3;else if(n==2)t=1;else if(n==32)t=5;else if(n==4)t=2;else return this.toRadix(n);var o=(1<<t)-1,u,f=!1,e="",r=this.t,i=this.DB-r*this.DB%t;if(r-->0)for(i<this.DB&&(u=this[r]>>i)>0&&(f=!0,e=ot(u));r>=0;)i<t?u=(this[r]&(1<<i)-1)<<t-i|this[--r]>>(i+=this.DB-t):(u=this[r]>>(i-=t)&o,i<=0&&(i+=this.DB,--r)),u>0&&(f=!0),f&&(e+=ot(u));return f?e:"0"}function ii(){var n=r();return i.ZERO.subTo(this,n),n}function ri(){return this.s<0?this.negate():this}function ui(n){var t=this.s-n.s,i;if(t!=0)return t;if(i=this.t,t=i-n.t,t!=0)return this.s<0?-t:t;while(--i>=0)if((t=this[i]-n[i])!=0)return t;return 0}function k(n){var i=1,t;return(t=n>>>16)!=0&&(n=t,i+=16),(t=n>>8)!=0&&(n=t,i+=8),(t=n>>4)!=0&&(n=t,i+=4),(t=n>>2)!=0&&(n=t,i+=2),(t=n>>1)!=0&&(n=t,i+=1),i}function fi(){return this.t<=0?0:this.DB*(this.t-1)+k(this[this.t-1]^this.s&this.DM)}function ei(n,t){for(var i=this.t-1;i>=0;--i)t[i+n]=this[i];for(i=n-1;i>=0;--i)t[i]=0;t.t=this.t+n;t.s=this.s}function oi(n,t){for(var i=n;i<this.t;++i)t[i-n]=this[i];t.t=Math.max(this.t-n,0);t.s=this.s}function si(n,t){for(var u=n%this.DB,e=this.DB-u,o=(1<<e)-1,r=Math.floor(n/this.DB),f=this.s<<u&this.DM,i=this.t-1;i>=0;--i)t[i+r+1]=this[i]>>e|f,f=(this[i]&o)<<u;for(i=r-1;i>=0;--i)t[i]=0;t[r]=f;t.t=this.t+r+1;t.s=this.s;t.clamp()}function hi(n,t){var i,r;if(t.s=this.s,i=Math.floor(n/this.DB),i>=this.t){t.t=0;return}var u=n%this.DB,f=this.DB-u,e=(1<<u)-1;for(t[0]=this[i]>>u,r=i+1;r<this.t;++r)t[r-i-1]|=(this[r]&e)<<f,t[r-i]=this[r]>>u;u>0&&(t[this.t-i-1]|=(this.s&e)<<f);t.t=this.t-i;t.clamp()}function ci(n,t){for(var r=0,i=0,u=Math.min(n.t,this.t);r<u;)i+=this[r]-n[r],t[r++]=i&this.DM,i>>=this.DB;if(n.t<this.t){for(i-=n.s;r<this.t;)i+=this[r],t[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<n.t;)i-=n[r],t[r++]=i&this.DM,i>>=this.DB;i-=n.s}t.s=i<0?-1:0;i<-1?t[r++]=this.DV+i:i>0&&(t[r++]=i);t.t=r;t.clamp()}function li(n,t){var u=this.abs(),f=n.abs(),r=u.t;for(t.t=r+f.t;--r>=0;)t[r]=0;for(r=0;r<f.t;++r)t[r+u.t]=u.am(0,f[r],t,r,0,u.t);t.s=0;t.clamp();this.s!=n.s&&i.ZERO.subTo(t,t)}function ai(n){for(var i=this.abs(),t=n.t=2*i.t,r;--t>=0;)n[t]=0;for(t=0;t<i.t-1;++t)r=i.am(t,i[t],n,2*t,0,1),(n[t+i.t]+=i.am(t+1,2*i[t],n,2*t+1,r,i.t-t-1))>=i.DV&&(n[t+i.t]-=i.DV,n[t+i.t+1]=1);n.t>0&&(n[n.t-1]+=i.am(t,i[t],n,2*t,0,1));n.s=0;n.clamp()}function vi(n,t,u){var s=n.abs(),l,e,a,y;if(!(s.t<=0)){if(l=this.abs(),l.t<s.t){t!=null&&t.fromInt(0);u!=null&&this.copyTo(u);return}u==null&&(u=r());var f=r(),p=this.s,b=n.s,c=this.DB-k(s[s.t-1]);if(c>0?(s.lShiftTo(c,f),l.lShiftTo(c,u)):(s.copyTo(f),l.copyTo(u)),e=f.t,a=f[e-1],a!=0){var w=a*(1<<this.F1)+(e>1?f[e-2]>>this.F2:0),d=this.FV/w,g=(1<<this.F1)/w,nt=1<<this.F2,h=u.t,v=h-e,o=t==null?r():t;for(f.dlShiftTo(v,o),u.compareTo(o)>=0&&(u[u.t++]=1,u.subTo(o,u)),i.ONE.dlShiftTo(e,o),o.subTo(f,f);f.t<e;)f[f.t++]=0;while(--v>=0)if(y=u[--h]==a?this.DM:Math.floor(u[h]*d+(u[h-1]+nt)*g),(u[h]+=f.am(0,y,u,v,0,e))<y)for(f.dlShiftTo(v,o),u.subTo(o,u);u[h]<--y;)u.subTo(o,u);t!=null&&(u.drShiftTo(e,t),p!=b&&i.ZERO.subTo(t,t));u.t=e;u.clamp();c>0&&u.rShiftTo(c,u);p<0&&i.ZERO.subTo(u,u)}}}function yi(n){var t=r();return this.abs().divRemTo(n,null,t),this.s<0&&t.compareTo(i.ZERO)>0&&n.subTo(t,t),t}function l(n){this.m=n}function pi(n){return n.s<0||n.compareTo(this.m)>=0?n.mod(this.m):n}function wi(n){return n}function bi(n){n.divRemTo(this.m,null,n)}function ki(n,t,i){n.multiplyTo(t,i);this.reduce(i)}function di(n,t){n.squareTo(t);this.reduce(t)}function gi(){var t,n;return this.t<1?0:(t=this[0],(t&1)==0)?0:(n=t&3,n=n*(2-(t&15)*n)&15,n=n*(2-(t&255)*n)&255,n=n*(2-((t&65535)*n&65535))&65535,n=n*(2-t*n%this.DV)%this.DV,n>0?this.DV-n:-n)}function a(n){this.m=n;this.mp=n.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<n.DB-15)-1;this.mt2=2*n.t}function nr(n){var t=r();return n.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),n.s<0&&t.compareTo(i.ZERO)>0&&this.m.subTo(t,t),t}function tr(n){var t=r();return n.copyTo(t),this.reduce(t),t}function ir(n){for(var i,t,r;n.t<=this.mt2;)n[n.t++]=0;for(i=0;i<this.m.t;++i)for(t=n[i]&32767,r=t*this.mpl+((t*this.mph+(n[i]>>15)*this.mpl&this.um)<<15)&n.DM,t=i+this.m.t,n[t]+=this.m.am(0,r,n,i,0,this.m.t);n[t]>=n.DV;)n[t]-=n.DV,n[++t]++;n.clamp();n.drShiftTo(this.m.t,n);n.compareTo(this.m)>=0&&n.subTo(this.m,n)}function rr(n,t){n.squareTo(t);this.reduce(t)}function ur(n,t,i){n.multiplyTo(t,i);this.reduce(i)}function fr(){return(this.t>0?this[0]&1:this.s)==0}function er(n,t){var s;if(n>4294967295||n<1)return i.ONE;var u=r(),f=r(),e=t.convert(this),o=k(n)-1;for(e.copyTo(u);--o>=0;)t.sqrTo(u,f),(n&1<<o)>0?t.mulTo(f,e,u):(s=u,u=f,f=s);return t.revert(u)}function or(n,t){var i;return i=n<256||t.isEven()?new l(t):new a(t),this.exp(n,i)}function sr(){var n=r();return this.copyTo(n),n}function hr(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function cr(){return this.t==0?this.s:this[0]<<24>>24}function lr(){return this.t==0?this.s:this[0]<<16>>16}function ar(n){return Math.floor(Math.LN2*this.DB/Math.log(n))}function vr(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function yr(n){if(n==null&&(n=10),this.signum()==0||n<2||n>36)return"0";var o=this.chunkSize(n),f=Math.pow(n,o),e=c(f),t=r(),i=r(),u="";for(this.divRemTo(e,t,i);t.signum()>0;)u=(f+i.intValue()).toString(n).substr(1)+u,t.divRemTo(e,t,i);return i.intValue().toString(n)+u}function pr(n,t){var u,e;this.fromInt(0);t==null&&(t=10);var o=this.chunkSize(t),h=Math.pow(t,o),s=!1,f=0,r=0;for(u=0;u<n.length;++u){if(e=st(n,u),e<0){n.charAt(u)=="-"&&this.signum()==0&&(s=!0);continue}r=t*r+e;++f>=o&&(this.dMultiply(h),this.dAddOffset(r,0),f=0,r=0)}f>0&&(this.dMultiply(Math.pow(t,f)),this.dAddOffset(r,0));s&&i.ZERO.subTo(this,this)}function wr(n,t,r){if("number"==typeof t)if(n<2)this.fromInt(1);else for(this.fromNumber(n,r),this.testBit(n-1)||this.bitwiseTo(i.ONE.shiftLeft(n-1),nt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>n&&this.subTo(i.ONE.shiftLeft(n-1),this);else{var u=[],f=n&7;u.length=(n>>3)+1;t.nextBytes(u);f>0?u[0]&=(1<<f)-1:u[0]=0;this.fromString(u,256)}}function br(){var i=this.t,u=[],n,t,r;if(u[0]=this.s,n=this.DB-i*this.DB%8,r=0,i-->0)for(n<this.DB&&(t=this[i]>>n)!=(this.s&this.DM)>>n&&(u[r++]=t|this.s<<this.DB-n);i>=0;)n<8?t=(this[i]&(1<<n)-1)<<8-n|this[--i]>>(n+=this.DB-8):(t=this[i]>>(n-=8)&255,n<=0&&(n+=this.DB,--i)),(t&128)!=0&&(t|=-256),r==0&&(this.s&128)!=(t&128)&&++r,(r>0||t!=this.s)&&(u[r++]=t);return u}function kr(n){return this.compareTo(n)==0}function dr(n){return this.compareTo(n)<0?this:n}function gr(n){return this.compareTo(n)>0?this:n}function nu(n,t,i){for(var u,f=Math.min(n.t,this.t),r=0;r<f;++r)i[r]=t(this[r],n[r]);if(n.t<this.t){for(u=n.s&this.DM,r=f;r<this.t;++r)i[r]=t(this[r],u);i.t=this.t}else{for(u=this.s&this.DM,r=f;r<n.t;++r)i[r]=t(u,n[r]);i.t=n.t}i.s=t(this.s,n.s);i.clamp()}function tu(n,t){return n&t}function iu(n){var t=r();return this.bitwiseTo(n,tu,t),t}function nt(n,t){return n|t}function ru(n){var t=r();return this.bitwiseTo(n,nt,t),t}function ht(n,t){return n^t}function uu(n){var t=r();return this.bitwiseTo(n,ht,t),t}function ct(n,t){return n&~t}function fu(n){var t=r();return this.bitwiseTo(n,ct,t),t}function eu(){for(var n=r(),t=0;t<this.t;++t)n[t]=this.DM&~this[t];return n.t=this.t,n.s=~this.s,n}function ou(n){var t=r();return n<0?this.rShiftTo(-n,t):this.lShiftTo(n,t),t}function su(n){var t=r();return n<0?this.lShiftTo(-n,t):this.rShiftTo(n,t),t}function hu(n){if(n==0)return-1;var t=0;return(n&65535)==0&&(n>>=16,t+=16),(n&255)==0&&(n>>=8,t+=8),(n&15)==0&&(n>>=4,t+=4),(n&3)==0&&(n>>=2,t+=2),(n&1)==0&&++t,t}function cu(){for(var n=0;n<this.t;++n)if(this[n]!=0)return n*this.DB+hu(this[n]);return this.s<0?this.t*this.DB:-1}function lu(n){for(var t=0;n!=0;)n&=n-1,++t;return t}function au(){for(var t=0,i=this.s&this.DM,n=0;n<this.t;++n)t+=lu(this[n]^i);return t}function vu(n){var t=Math.floor(n/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<n%this.DB)!=0}function yu(n,t){var r=i.ONE.shiftLeft(n);return this.bitwiseTo(r,t,r),r}function pu(n){return this.changeBit(n,nt)}function wu(n){return this.changeBit(n,ct)}function bu(n){return this.changeBit(n,ht)}function ku(n,t){for(var r=0,i=0,u=Math.min(n.t,this.t);r<u;)i+=this[r]+n[r],t[r++]=i&this.DM,i>>=this.DB;if(n.t<this.t){for(i+=n.s;r<this.t;)i+=this[r],t[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<n.t;)i+=n[r],t[r++]=i&this.DM,i>>=this.DB;i+=n.s}t.s=i<0?-1:0;i>0?t[r++]=i:i<-1&&(t[r++]=this.DV+i);t.t=r;t.clamp()}function du(n){var t=r();return this.addTo(n,t),t}function gu(n){var t=r();return this.subTo(n,t),t}function nf(n){var t=r();return this.multiplyTo(n,t),t}function tf(){var n=r();return this.squareTo(n),n}function rf(n){var t=r();return this.divRemTo(n,t,null),t}function uf(n){var t=r();return this.divRemTo(n,null,t),t}function ff(n){var t=r(),i=r();return this.divRemTo(n,t,i),[t,i]}function ef(n){this[this.t]=this.am(0,n-1,this,0,0,this.t);++this.t;this.clamp()}function of(n,t){if(n!=0){while(this.t<=t)this[this.t++]=0;for(this[t]+=n;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function w(){}function lt(n){return n}function sf(n,t,i){n.multiplyTo(t,i)}function hf(n,t){n.squareTo(t)}function cf(n){return this.exp(n,new w)}function lf(n,t,i){var r=Math.min(this.t+n.t,t),u;for(i.s=0,i.t=r;r>0;)i[--r]=0;for(u=i.t-this.t;r<u;++r)i[r+this.t]=this.am(0,n[r],i,r,0,this.t);for(u=Math.min(n.t,t);r<u;++r)this.am(0,n[r],i,r,0,t-r);i.clamp()}function af(n,t,i){--t;var r=i.t=this.t+n.t-t;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(t-this.t,0);r<n.t;++r)i[this.t+r-t]=this.am(t-r,n[r],i,0,0,this.t+r-t);i.clamp();i.drShiftTo(1,i)}function v(n){this.r2=r();this.q3=r();i.ONE.dlShiftTo(2*n.t,this.r2);this.mu=this.r2.divide(n);this.m=n}function vf(n){if(n.s<0||n.t>2*this.m.t)return n.mod(this.m);if(n.compareTo(this.m)<0)return n;var t=r();return n.copyTo(t),this.reduce(t),t}function yf(n){return n}function pf(n){for(n.drShiftTo(this.m.t-1,this.r2),n.t>this.m.t+1&&(n.t=this.m.t+1,n.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);n.compareTo(this.r2)<0;)n.dAddOffset(1,this.m.t+1);for(n.subTo(this.r2,n);n.compareTo(this.m)>=0;)n.subTo(this.m,n)}function wf(n,t){n.squareTo(t);this.reduce(t)}function bf(n,t,i){n.multiplyTo(t,i);this.reduce(i)}function kf(n,t){var i=n.bitLength(),p,u=c(1),e,d;if(i<=0)return u;p=i<18?1:i<48?3:i<144?4:i<768?5:6;e=i<8?new l(t):t.isEven()?new v(t):new a(t);var h=[],f=3,w=p-1,g=(1<<p)-1;if(h[1]=e.convert(this),p>1)for(d=r(),e.sqrTo(h[1],d);f<=g;)h[f]=r(),e.mulTo(d,h[f-2],h[f]),f+=2;var o=n.t-1,y,nt=!0,s=r(),b;for(i=k(n[o])-1;o>=0;){for(i>=w?y=n[o]>>i-w&g:(y=(n[o]&(1<<i+1)-1)<<w-i,o>0&&(y|=n[o-1]>>this.DB+i-w)),f=p;(y&1)==0;)y>>=1,--f;if((i-=f)<0&&(i+=this.DB,--o),nt)h[y].copyTo(u),nt=!1;else{while(f>1)e.sqrTo(u,s),e.sqrTo(s,u),f-=2;f>0?e.sqrTo(u,s):(b=u,u=s,s=b);e.mulTo(s,h[y],u)}while(o>=0&&(n[o]&1<<i)==0)e.sqrTo(u,s),b=u,u=s,s=b,--i<0&&(i=this.DB-1,--o)}return e.revert(u)}function df(n){var i=this.s<0?this.negate():this.clone(),t=n.s<0?n.negate():n.clone(),f,u,r;if(i.compareTo(t)<0&&(f=i,i=t,t=f),u=i.getLowestSetBit(),r=t.getLowestSetBit(),r<0)return i;for(u<r&&(r=u),r>0&&(i.rShiftTo(r,i),t.rShiftTo(r,t));i.signum()>0;)(u=i.getLowestSetBit())>0&&i.rShiftTo(u,i),(u=t.getLowestSetBit())>0&&t.rShiftTo(u,t),i.compareTo(t)>=0?(i.subTo(t,i),i.rShiftTo(1,i)):(t.subTo(i,t),t.rShiftTo(1,t));return r>0&&t.lShiftTo(r,t),t}function gf(n){var r,t,i;if(n<=0)return 0;if(r=this.DV%n,t=this.s<0?n-1:0,this.t>0)if(r==0)t=this[0]%n;else for(i=this.t-1;i>=0;--i)t=(r*t+this[i])%n;return t}function ne(n){var s=n.isEven();if(this.isEven()&&s||n.signum()==0)return i.ZERO;for(var u=n.clone(),f=this.clone(),e=c(1),r=c(0),o=c(0),t=c(1);u.signum()!=0;){while(u.isEven())u.rShiftTo(1,u),s?(e.isEven()&&r.isEven()||(e.addTo(this,e),r.subTo(n,r)),e.rShiftTo(1,e)):r.isEven()||r.subTo(n,r),r.rShiftTo(1,r);while(f.isEven())f.rShiftTo(1,f),s?(o.isEven()&&t.isEven()||(o.addTo(this,o),t.subTo(n,t)),o.rShiftTo(1,o)):t.isEven()||t.subTo(n,t),t.rShiftTo(1,t);u.compareTo(f)>=0?(u.subTo(f,u),s&&e.subTo(o,e),r.subTo(t,r)):(f.subTo(u,f),s&&o.subTo(e,o),t.subTo(r,t))}if(f.compareTo(i.ONE)!=0)return i.ZERO;if(t.compareTo(n)>=0)return t.subtract(n);if(t.signum()<0)t.addTo(n,t);else return t;return t.signum()<0?t.add(n):t}function te(n){var t,i=this.abs(),r,u;if(i.t==1&&i[0]<=f[f.length-1]){for(t=0;t<f.length;++t)if(i[0]==f[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<f.length;){for(r=f[t],u=t+1;u<f.length&&r<at;)r*=f[u++];for(r=i.modInt(r);t<u;)if(r%f[t++]==0)return!1}return i.millerRabin(n)}function ie(n){var u=this.subtract(i.ONE),e=u.getLowestSetBit(),h,o,s,t,c;if(e<=0)return!1;for(h=u.shiftRight(e),n=n+1>>1,n>f.length&&(n=f.length),o=r(),s=0;s<n;++s)if(o.fromInt(f[Math.floor(Math.random()*f.length)]),t=o.modPow(h,this),t.compareTo(i.ONE)!=0&&t.compareTo(u)!=0){for(c=1;c++<e&&t.compareTo(u)!=0;)if(t=t.modPowInt(2,this),t.compareTo(i.ONE)==0)return!1;if(t.compareTo(u)!=0)return!1}return!0}function re(n){e[u++]^=n&255;e[u++]^=n>>8&255;e[u++]^=n>>16&255;e[u++]^=n>>24&255;u>=g&&(u-=g)}function vt(){re((new Date).getTime())}function ue(){if(d==null){for(vt(),d=se(),d.init(e),u=0;u<e.length;++u)e[u]=0;u=0}return d.next()}function fe(n){for(var t=0;t<n.length;++t)n[t]=ue()}function yt(){}function rt(){this.i=0;this.j=0;this.S=[]}function ee(n){for(var i,r,t=0;t<256;++t)this.S[t]=t;for(i=0,t=0;t<256;++t)i=i+this.S[t]+n[t%n.length]&255,r=this.S[t],this.S[t]=this.S[i],this.S[i]=r;this.i=0;this.j=0}function oe(){var n;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,n=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=n,this.S[n+this.S[this.i]&255]}function se(){return new rt}var h,ut=(0xdeadbeefcafe&16777215)==15715070,ft=typeof navigator!="undefined",b,et,p,y,o,f,at,d,e,u,s,tt,it,g;for(ft&&ut&&navigator.appName=="Microsoft Internet Explorer"?(i.prototype.am=wt,h=30):ft&&ut&&navigator.appName!="Netscape"?(i.prototype.am=pt,h=26):(i.prototype.am=bt,h=28),i.prototype.DB=h,i.prototype.DM=(1<<h)-1,i.prototype.DV=1<<h,b=52,i.prototype.FV=Math.pow(2,b),i.prototype.F1=b-h,i.prototype.F2=2*h-b,et="0123456789abcdefghijklmnopqrstuvwxyz",p=[],y="0".charCodeAt(0),o=0;o<=9;++o)p[y++]=o;for(y="a".charCodeAt(0),o=10;o<36;++o)p[y++]=o;for(y="A".charCodeAt(0),o=10;o<36;++o)p[y++]=o;if(l.prototype.convert=pi,l.prototype.revert=wi,l.prototype.reduce=bi,l.prototype.mulTo=ki,l.prototype.sqrTo=di,a.prototype.convert=nr,a.prototype.revert=tr,a.prototype.reduce=ir,a.prototype.mulTo=ur,a.prototype.sqrTo=rr,i.prototype.copyTo=kt,i.prototype.fromInt=dt,i.prototype.fromString=gt,i.prototype.clamp=ni,i.prototype.dlShiftTo=ei,i.prototype.drShiftTo=oi,i.prototype.lShiftTo=si,i.prototype.rShiftTo=hi,i.prototype.subTo=ci,i.prototype.multiplyTo=li,i.prototype.squareTo=ai,i.prototype.divRemTo=vi,i.prototype.invDigit=gi,i.prototype.isEven=fr,i.prototype.exp=er,i.prototype.toString=ti,i.prototype.negate=ii,i.prototype.abs=ri,i.prototype.compareTo=ui,i.prototype.bitLength=fi,i.prototype.mod=yi,i.prototype.modPowInt=or,i.ZERO=c(0),i.ONE=c(1),w.prototype.convert=lt,w.prototype.revert=lt,w.prototype.mulTo=sf,w.prototype.sqrTo=hf,v.prototype.convert=vf,v.prototype.revert=yf,v.prototype.reduce=pf,v.prototype.mulTo=bf,v.prototype.sqrTo=wf,f=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],at=67108864/f[f.length-1],i.prototype.chunkSize=ar,i.prototype.toRadix=yr,i.prototype.fromRadix=pr,i.prototype.fromNumber=wr,i.prototype.bitwiseTo=nu,i.prototype.changeBit=yu,i.prototype.addTo=ku,i.prototype.dMultiply=ef,i.prototype.dAddOffset=of,i.prototype.multiplyLowerTo=lf,i.prototype.multiplyUpperTo=af,i.prototype.modInt=gf,i.prototype.millerRabin=ie,i.prototype.clone=sr,i.prototype.intValue=hr,i.prototype.byteValue=cr,i.prototype.shortValue=lr,i.prototype.signum=vr,i.prototype.toByteArray=br,i.prototype.equals=kr,i.prototype.min=dr,i.prototype.max=gr,i.prototype.and=iu,i.prototype.or=ru,i.prototype.xor=uu,i.prototype.andNot=fu,i.prototype.not=eu,i.prototype.shiftLeft=ou,i.prototype.shiftRight=su,i.prototype.getLowestSetBit=cu,i.prototype.bitCount=au,i.prototype.testBit=vu,i.prototype.setBit=pu,i.prototype.clearBit=wu,i.prototype.flipBit=bu,i.prototype.add=du,i.prototype.subtract=gu,i.prototype.multiply=nf,i.prototype.divide=rf,i.prototype.remainder=uf,i.prototype.divideAndRemainder=ff,i.prototype.modPow=kf,i.prototype.modInverse=ne,i.prototype.pow=cf,i.prototype.gcd=df,i.prototype.isProbablePrime=te,i.prototype.square=tf,i.prototype.Barrett=v,e==null){if(e=[],u=0,typeof window!="undefined"&&window.crypto)if(window.crypto.getRandomValues)for(tt=new Uint8Array(32),window.crypto.getRandomValues(tt),s=0;s<32;++s)e[u++]=tt[s];else if(navigator.appName=="Netscape"&&navigator.appVersion<"5")for(it=window.crypto.random(32),s=0;s<it.length;++s)e[u++]=it.charCodeAt(s)&255;while(u<g)s=Math.floor(65536*Math.random()),e[u++]=s>>>8,e[u++]=s&255;u=0;vt()}yt.prototype.nextBytes=fe;rt.prototype.init=ee;rt.prototype.next=oe;g=256;i.SecureRandom=yt;i.BigInteger=i;t=n.exports=i}).call(k)}),eu=co.BigInteger,ou={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},su={sha256:uu};hu.prototype.verify=function(n,t){var r,u;if(t=t.replace(/[^0-9a-f]|[\s\n]]/ig,""),r=new eu(t,16),r.bitLength()>this.n.bitLength())throw new Error("Signature does not match with the key modulus.");var f=r.modPowInt(this.e,this.n),e=f.toString(16).replace(/^1f+00/,""),i=lo(e);if(i.length===0)return!1;if(!su.hasOwnProperty(i.alg))throw new Error("Hashing algorithm is not supported.");return u=su[i.alg](n).toString(),i.hash===u};di=hu;ut={encodeString:ao,decodeToString:vo,byteArrayToString:cu,stringToByteArray:lu,padding:gi,byteArrayToHex:au,decodeToHEX:yo,base64ToBase64Url:po};yu={process:vu,getJWKS:wo};pu.prototype=Error.prototype;wu.prototype=Error.prototype;s={ConfigurationError:pu,TokenValidationError:wu};ui.prototype.get=function(){return null};ui.prototype.has=function(){return!1};ui.prototype.set=function(){};bu=ui;fi=["RS256"];ft.prototype.verify=function(n,t,i){var r=this.decode(n),f;if(r instanceof Error)return i(r,!1);var h=r.encoded.header+"."+r.encoded.payload,c=ut.decodeToHEX(r.encoded.signature),e=r.header.alg,l=r.header.kid,o=r.payload.aud,u=r.payload.iss,a=r.payload.exp,v=r.payload.nbf,y=r.payload.nonce||null;return this.issuer!==u?i(new s.TokenValidationError("Issuer "+u+" is not valid."),!1):this.audience!==o?i(new s.TokenValidationError("Audience "+o+" is not valid."),!1):this.expectedAlg!==e?i(new s.TokenValidationError("Algorithm "+e+" is not supported. (Expected algs: ["+fi.join(",")+"])"),!1):y!==t?i(new s.TokenValidationError("Nonce does not match."),!1):(f=this.verifyExpAndNbf(a,v),f)?i(f,!1):this.getRsaVerifier(u,l,function(n,t){return n?i(n):t.verify(h,c)?i(null,r.payload):i(new s.TokenValidationError("Invalid signature."))})};ft.prototype.verifyExpAndNbf=function(n,t){var i=new Date,r=new Date(0),u=new Date(0);return this.__disableExpirationCheck?null:(r.setUTCSeconds(n+this.leeway),i>r)?new s.TokenValidationError("Expired token."):typeof t=="undefined"?null:(u.setUTCSeconds(t-this.leeway),i<u)?new s.TokenValidationError("The token is not valid until later in the future. Please check your computed clock."):null};ft.prototype.verifyExpAndIat=function(n,t){var i=new Date,r=new Date(0),u=new Date(0);return this.__disableExpirationCheck?null:(r.setUTCSeconds(n+this.leeway),i>r)?new s.TokenValidationError("Expired token."):(u.setUTCSeconds(t-this.leeway),i<u)?new s.TokenValidationError("The token was issued in the future. Please check your computed clock."):null};ft.prototype.getRsaVerifier=function(n,t,i){var f=this,r=n+t,u;this.jwksCache.has(r)?(u=this.jwksCache.get(r),i(null,new di(u.modulus,u.exp))):yu.getJWKS({jwksURI:this.jwksURI,iss:n,kid:t},function(n,t){return n?i(n):(f.jwksCache.set(r,t),i(null,new di(t.modulus,t.exp)))})};ft.prototype.decode=function(n){var t=n.split("."),i,r;if(t.length!==3)return new s.TokenValidationError("Cannot decode a malformed JWT");try{i=JSON.parse(ut.decodeToString(t[0]));r=JSON.parse(ut.decodeToString(t[1]))}catch(u){return new s.TokenValidationError("Token header or payload is not valid JSON")}return{header:i,payload:r,encoded:{header:t[0],payload:t[1],signature:t[2]}}};ft.prototype.validateAccessToken=function(n,t,i,r){if(this.expectedAlg!==t)return r(new s.TokenValidationError("Algorithm "+t+" is not supported. (Expected alg: "+this.expectedAlg+")"));var f=uu(n),u=fu.stringify(f),e=u.substring(0,u.length/2),o=fu.parse(e),h=ho.stringify(o),c=ut.base64ToBase64Url(h);return c!==i?r(new s.TokenValidationError("Invalid access_token")):r(null)};ei=ft;ku.prototype.get=function(n){for(var t=0;t<this.plugins.length;t++)if(this.plugins[t].supports(n))return this.plugins[t].init();return null};var du={randomString:bo},ko=1/96,go=1/48,ns="com.auth0.auth.";et.prototype.process=function(n){if(!n.responseType)throw new Error("responseType is required");var r=n.realm||n.connection,t=n.responseType.indexOf("id_token")!==-1,i=this.generateTransaction(n.appState,n.state,n.nonce,r,t);return n.state||(n.state=i.state),t&&!n.nonce&&(n.nonce=i.nonce),n};et.prototype.generateTransaction=function(n,t,i,r,u){return t=t||du.randomString(this.keyLength),i=i||(u?du.randomString(this.keyLength):null),b.setItem(this.namespace+t,{nonce:i,appState:n,state:t,lastUsedConnection:r},go),{state:t,nonce:i}};et.prototype.getStoredTransaction=function(n){var t;return t=b.getItem(this.namespace+n),this.clearTransaction(n),t};et.prototype.clearTransaction=function(n){b.removeItem(this.namespace+n)};vt.prototype.init=function(){var t=this,n=u.getWindow();this.iframe=n.document.createElement("iframe");this.iframe.style.display="none";this.proxyEventListener=function(n){t.eventListener(n)};switch(this.eventListenerType){case"message":this.eventSourceObject=n;break;case"load":this.eventSourceObject=this.iframe;break;default:throw new Error("Unsupported event listener type: "+this.eventListenerType);}this.eventSourceObject.addEventListener(this.eventListenerType,this.proxyEventListener,!1);n.document.body.appendChild(this.iframe);this.iframe.src=this.url;this.timeoutHandle=setTimeout(function(){t.timeoutHandler()},this.timeout)};vt.prototype.eventListener=function(n){var t={event:n,sourceObject:this.eventSourceObject};this.eventValidator.isValid(t)&&(this.destroy(),this.callback(t))};vt.prototype.timeoutHandler=function(){this.destroy();this.timeoutCallback&&this.timeoutCallback()};vt.prototype.destroy=function(){var n=this;clearTimeout(this.timeoutHandle);this._destroyTimeout=setTimeout(function(){n.eventSourceObject.removeEventListener(n.eventListenerType,n.proxyEventListener,!1);n.iframe.parentNode&&n.iframe.parentNode.removeChild(n.iframe)},0)};nr.prototype.run=function(n,i){var f=this,e,r;if(n.responseMode="web_message",n.prompt="none",e=u.getOrigin(),r=t.getOriginFromUrl(n.redirectUri),r&&e!==r)return i({error:"origin_mismatch",error_description:"The redirectUri's origin ("+r+") should match the window's origin ("+e+")."});ts(this.webAuth.client.buildAuthorizeUrl(n),n,function(r,e){var o=r,s;return(!r&&e.event.data.response.error&&(o=e.event.data.response),!o)?(s=e.event.data.response,f.webAuth.validateAuthenticationResponse(n,s,i)):(o.error==="consent_required"&&u.getWindow().location.hostname==="localhost"&&f.warn.warning("Consent Required. Consent can't be skipped on localhost. Read more here: https://auth0.com/docs/api-auth/user-consent#skipping-consent-for-first-party-clients"),f.webAuth.transactionManager.clearTransaction(o.state),i(t.pick(o,["error","error_description"])))})};kt.prototype.login=function(n,i){var u=this,h=f(this.baseOptions.rootUrl,"/co/authenticate"),r,e,s;n.username=n.username||n.email;delete n.email;r={client_id:n.clientID||this.baseOptions.clientID,username:n.username};n.password&&(r.password=n.password);n.otp&&(r.otp=n.otp);e=n.realm||this.baseOptions.realm;e?(s=n.credentialType||this.baseOptions.credentialType||"http://auth0.com/oauth/grant-type/password-realm",r.realm=e,r.credential_type=s):r.credential_type="password";this.request.post(h).withCredentials().send(r).end(function(r,f){var s,h,e,c;if(r)return s=r.response&&r.response.body||{error:"request_error",error_description:JSON.stringify(r)},o(i,{forceLegacyError:!0})(s);h=n.popup===!0;n=t.blacklist(n,["password","credentialType","otp","popup"]);e=t.merge(n).with({loginTicket:f.body.login_ticket});c=gu(u.baseOptions.rootUrl,f.body.co_id);b.setItem(c,f.body.co_verifier,{expires:ko});h?u.webMessageHandler.run(e,o(i,{forceLegacyError:!0})):u.webAuth.authorize(e)})};kt.prototype.callback=function(){var t=decodeURIComponent(is("origin")),n=u.getWindow();n.addEventListener("message",function(t){if(t.data.type==="co_verifier_request"){var i=gu(t.origin,t.data.request.id),r=rs(n,i);t.source.postMessage({type:"co_verifier_response",response:{verifier:r}},t.origin)}});n.parent.postMessage({type:"ready"},t)};tr.prototype.loginWithCredentials=function(n,t){n.realm=n.realm||n.connection;delete n.connection;this.crossOriginAuthentication.login(n,t)};tr.prototype.signupAndLogin=function(n,t){var i=this;return this.webAuth.client.dbConnection.signup(n,function(r){return r?t(r):(n.realm=n.realm||n.connection,delete n.connection,i.webAuth.login(n,t))})};ir=a(function(n){var t=function(){function n(n,t,i){n.attachEvent?n.attachEvent("on"+t,i):n.addEventListener&&n.addEventListener(t,i,!1)}function i(n,t,i){n.detachEvent?n.detachEvent("on"+t,i):n.removeEventListener&&n.removeEventListener(t,i,!1)}function e(){var n,t,i;return typeof navigator=="undefined"?!1:(n=-1,t=navigator.userAgent,navigator.appName==="Microsoft Internet Explorer"?(i=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"),i.exec(t)!=null&&(n=parseFloat(RegExp.$1))):t.indexOf("Trident")>-1&&(i=new RegExp("rv:([0-9]{2,2}[.0-9]{0,})"),i.exec(t)!==null&&(n=parseFloat(RegExp.$1))),n>=8)}function o(){try{var n=navigator.userAgent;return n.indexOf("Fennec/")!=-1||n.indexOf("Firefox/")!=-1&&n.indexOf("Android")!=-1}catch(t){}return!1}function s(){return typeof window!="undefined"&&window.JSON&&window.JSON.stringify&&window.JSON.parse&&window.postMessage}function f(n){/^https?:\/\//.test(n)||(n=window.location.href);var t=/^(https?:\/\/[\-_a-zA-Z\.0-9:]+)/.exec(n);return t?t[1]:n}function h(){for(var i=window.location,t=window.opener.frames,n=t.length-1;n>=0;n--)try{if(t[n].location.protocol===window.location.protocol&&t[n].location.host===window.location.host&&t[n].name===r)return t[n]}catch(u){}return}var r="__winchan_relay_frame",u="die",t=e();return s()?{open:function(e,s){function a(){if(c&&document.body.removeChild(c),c=undefined,p&&(p=clearInterval(p)),i(window,"message",b),i(window,"unload",a),h)try{h.close()}catch(n){l.postMessage(u,v)}h=l=undefined}function b(n){if(n.origin===v){try{var t=JSON.parse(n.data)}catch(i){if(s)s(i);else throw i;}t.a==="ready"?l.postMessage(w,v):t.a==="error"?(a(),s&&(s(t.d),s=null)):t.a==="response"&&(a(),s&&(s(null,t.d),s=null))}}var y,c,v,l,h,p,w;if(!s)throw"missing required callback argument";return(e.url||(y="missing required 'url' parameter"),e.relay_url||(y="missing required 'relay_url' parameter"),y&&setTimeout(function(){s(y)},0),e.window_name||(e.window_name=null),(!e.window_features||o())&&(e.window_features=undefined),v=e.origin||f(e.url),v!==f(e.relay_url))?setTimeout(function(){s("invalid arguments: origin of url and relay_url must match")},0):(t&&(c=document.createElement("iframe"),c.setAttribute("src",e.relay_url),c.style.display="none",c.setAttribute("name",r),document.body.appendChild(c),l=c.contentWindow),h=e.popup||window.open(e.url,e.window_name,e.window_features),e.popup&&(h.location.href=e.url),l||(l=h),p=setInterval(function(){h&&h.closed&&(a(),s&&(s("User closed the popup window"),s=null))},500),w=JSON.stringify({a:"request",d:e.params}),n(window,"unload",a),n(window,"message",b),{close:a,focus:function(){if(h)try{h.focus()}catch(n){}}})},onOpen:function(r){function o(n){n=JSON.stringify(n);t?f.doPost(n,e):f.postMessage(n,e)}function c(n){var t;try{t=JSON.parse(n.data)}catch(u){}t&&t.a==="request"&&(i(window,"message",c),e=n.origin,r&&setTimeout(function(){r(e,t.d,function(n){r=undefined;o({a:"response",d:n})})},0))}function l(n){if(n.data===u)try{window.close()}catch(t){}}var e="*",f=t?h():window.opener,s;if(!f)throw"can't find relay frame";n(t?f:window,"message",c);n(t?f:window,"message",l);try{o({a:"ready"})}catch(a){n(f,"load",function(){o({a:"ready"})})}return s=function(){try{i(t?f:window,"message",l)}catch(n){}r&&o({a:"error",d:"client closed window"});r=undefined;try{window.close()}catch(u){}},n(window,"unload",s),{detach:function(){i(window,"unload",s)}}}}:{open:function(n,t,i,r){setTimeout(function(){r("unsupported browser")},0)},onOpen:function(n){setTimeout(function(){n("unsupported browser")},0)}}}();n.exports&&(n.exports=t)});nf={extractOrigin:us};oi.prototype.calculatePosition=function(n){var i=n.width||500,r=n.height||600,t=u.getWindow(),f=typeof t.screenX!="undefined"?t.screenX:t.screenLeft,e=typeof t.screenY!="undefined"?t.screenY:t.screenTop,o=typeof t.outerWidth!="undefined"?t.outerWidth:t.document.body.clientWidth,s=typeof t.outerHeight!="undefined"?t.outerHeight:t.document.body.clientHeight,h=(o-i)/2,c=(s-r)/2;return{width:i,height:r,left:f+h,top:e+c}};oi.prototype.preload=function(n){var i=this,r=u.getWindow(),f=this.calculatePosition(n.popupOptions||{}),e=t.merge(f).with(n.popupOptions),o=n.url||"about:blank",s=g.stringify(e,{encode:!1,delimiter:","});return this._current_popup&&!this._current_popup.closed?this._current_popup:(this._current_popup=r.open(o,"auth0_signup_popup",s),this._current_popup.kill=function(){this.close();i._current_popup=null},this._current_popup)};oi.prototype.load=function(n,i,r,u){var e=this,o=this.calculatePosition(r.popupOptions||{}),s=t.merge(o).with(r.popupOptions),h=t.merge({url:n,relay_url:i,window_features:g.stringify(s,{delimiter:",",encode:!1}),popup:this._current_popup}).with(r),f=ir.open(h,function(n,t){return e._current_popup=null,u(n,t)});return f.focus(),f};w.prototype.buildPopupHandler=function(){var n=this.baseOptions.plugins.get("popup.getPopupHandler");return n?n.getPopupHandler():new oi};w.prototype.preload=function(n){n=n||{};var t=this.buildPopupHandler();return t.preload(n),t};w.prototype.getPopupHandler=function(n,t){return n.popupHandler?n.popupHandler:t?this.preload(n):this.buildPopupHandler()};w.prototype.callback=function(n){var r=this,t=u.getWindow(),i;if(n=n||{},i=n.popupOrigin||this.baseOptions.popupOrigin||u.getOrigin(),!t.opener){t.doPost=function(n){t.parent&&t.parent.postMessage(n,i)};return}ir.onOpen(function(t,u,f){if(t!==i)return f({error:"origin_mismatch",error_description:"The popup's origin ("+t+") should match the `popupOrigin` parameter ("+i+")."});r.webAuth.parseHash(n||{},function(n,t){return f(n||t)})})};w.prototype.authorize=function(n,r){var h,c,e,s={},l=this.baseOptions.plugins.get("popup.authorize"),u=t.merge(this.baseOptions,["clientID","scope","domain","audience","tenant","responseType","redirectUri","_csrf","state","_intstate","nonce"]).with(t.blacklist(n,["popupHandler"]));return i.check(u,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),e=f(this.baseOptions.rootUrl,"relay.html"),n.owp?u.owp=!0:(s.origin=nf.extractOrigin(u.redirectUri),e=u.redirectUri),n.popupOptions&&(s.popupOptions=t.pick(n.popupOptions,["width","height"])),l&&(u=l.processParams(u)),u=this.transactionManager.process(u),u.scope=u.scope||"openid profile email",delete u.domain,c=this.client.buildAuthorizeUrl(u),h=this.getPopupHandler(n),h.load(c,e,s,o(r))};w.prototype.loginWithCredentials=function(n,i){n.realm=n.realm||n.connection;n.popup=!0;n=t.merge(this.baseOptions,["redirectUri","responseType","state","nonce"]).with(t.blacklist(n,["popupHandler","connection"]));n=this.transactionManager.process(n);this.crossOriginAuthentication.login(n,i)};w.prototype.passwordlessVerify=function(n,i){var r=this;return this.client.passwordless.verify(t.blacklist(n,["popupHandler"]),function(t){if(t)return i(t);n.username=n.phoneNumber||n.email;n.password=n.verificationCode;delete n.email;delete n.phoneNumber;delete n.verificationCode;delete n.type;r.client.loginWithResourceOwner(n,i)})};w.prototype.signupAndLogin=function(n,i){var u=this,r=this.getPopupHandler(n,!0);return n.popupHandler=r,this.client.dbConnection.signup(t.blacklist(n,["popupHandler"]),function(t){if(t)return r._current_popup&&r._current_popup.kill(),i(t);u.loginWithCredentials(n,i)})};yt.create=function(n){return new yt(n)};yt.prototype.login=function(n,t){this.handler=new vt({auth0:this.auth0,url:this.authenticationUrl,eventListenerType:n?"message":"load",callback:this.getCallbackHandler(t,n),timeout:this.timeout,eventValidator:this.getEventValidator(),timeoutCallback:function(){t(null,"#error=timeout&error_description=Timeout+during+authentication+renew.")},usePostMessage:n||!1});this.handler.init()};yt.prototype.getEventValidator=function(){var n=this;return{isValid:function(t){switch(t.event.type){case"message":return t.event.origin!==n.postMessageOrigin||t.event.source!==n.handler.iframe.contentWindow?!1:n.postMessageDataType===!1?!0:t.event.data.type&&t.event.data.type===n.postMessageDataType;case"load":if(t.sourceObject.contentWindow.location.protocol==="about:")return!1;default:return!0}}}};yt.prototype.getCallbackHandler=function(n,t){return function(i){var r;r=t?typeof i.event.data=="object"&&i.event.data.hash?i.event.data.hash:i.event.data:i.sourceObject.contentWindow.location.hash;n(null,r)}};rr.prototype.login=function(n,i){var u,r;return u=f(this.baseOptions.rootUrl,"usernamepassword","login"),n.username=n.username||n.email,n=t.blacklist(n,["email"]),r=t.merge(this.baseOptions,["clientID","redirectUri","tenant","responseType","responseMode","scope","audience"]).with(n),r=this.transactionManager.process(r),r=t.toSnakeCase(r,["auth0Client"]),this.request.post(u).send(r).end(o(i))};rr.prototype.callback=function(n){var t,i,r=u.getDocument();t=r.createElement("div");t.innerHTML=n;i=r.body.appendChild(t).children[0];i.submit()};si.prototype.login=function(n,r){if(u.getWindow().location.host!==this.baseOptions.domain)throw new Error("This method is meant to be used only inside the Universal Login Page.");var f,e=t.merge(this.baseOptions,["clientID","redirectUri","tenant","responseType","responseMode","scope","audience","_csrf","state","_intstate","nonce"]).with(n);return i.check(e,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),f=new rr(this.baseOptions),f.login(e,function(n,t){return n?r(n):f.callback(t)})};si.prototype.signupAndLogin=function(n,t){var i=this;return i.client.client.dbConnection.signup(n,function(r){return r?t(r):i.login(n,t)})};si.prototype.getSSOData=function(n,t){var r,u="";return typeof n=="function"&&(t=n,n=!1),i.check(n,{type:"boolean",message:"withActiveDirectories parameter is not valid"}),i.check(t,{type:"function",message:"cb parameter is not valid"}),n&&(u="?"+g.stringify({ldaps:1,client_id:this.baseOptions.clientID})),r=f(this.baseOptions.rootUrl,"user","ssodata",u),this.request.get(r,{noHeaders:!0}).withCredentials().end(o(t))};e.prototype.parseHash=function(n,t){var i,e,o,f,r;return(t||typeof n!="function"?n=n||{}:(t=n,n={}),o=u.getWindow(),f=n.hash===undefined?o.location.hash:n.hash,f=f.replace(/^#?\/?/,""),i=g.parse(f),i.hasOwnProperty("error"))?(e=rt.buildResponse(i.error,i.error_description),i.state&&(e.state=i.state),t(e)):!i.hasOwnProperty("access_token")&&!i.hasOwnProperty("id_token")&&!i.hasOwnProperty("refresh_token")?t(null,null):(r=(this.baseOptions.responseType||n.responseType||"").split(" "),r.length>0&&r.indexOf("token")!==-1&&!i.hasOwnProperty("access_token"))?t(rt.buildResponse("invalid_hash","response_type contains `token`, but the parsed hash does not contain an `access_token` property")):r.length>0&&r.indexOf("id_token")!==-1&&!i.hasOwnProperty("id_token")?t(rt.buildResponse("invalid_hash","response_type contains `id_token`, but the parsed hash does not contain an `id_token` property")):this.validateAuthenticationResponse(n,i,t)};e.prototype.validateAuthenticationResponse=function(n,t,i){var o=this;n.__enableIdPInitiatedLogin=n.__enableIdPInitiatedLogin||n.__enableImpersonation;var f=t.state,u=this.transactionManager.getStoredTransaction(f),e=n.state||u&&u.state||null,s=e===f,h=!f&&!e&&n.__enableIdPInitiatedLogin;if(!h&&!s)return i({error:"invalid_token",errorDescription:"`state` does not match."});var c=n.nonce||u&&u.nonce||null,l=n.state||u&&u.appState||null,r=function(n,r){if(n)return i(n);if(u&&u.lastUsedConnection){var f;r&&(f=r.sub);gr.set(u.lastUsedConnection,f)}return i(null,fs(t,l,r))};return t.id_token?this.validateToken(t.id_token,c,function(n,i){var u,f;return n?n.error!=="invalid_token"?r(n):(u=(new ei).decode(t.id_token),u.header.alg!=="HS256")?r(n):t.access_token?o.client.userInfo(t.access_token,function(n,t){return n?r(n):r(null,t)}):(f={error:"invalid_token",description:"The id_token cannot be validated because it was signed with the HS256 algorithm and public clients (like a browser) can’t store secrets. Please read the associated doc for possible ways to fix this. Read more: https://auth0.com/docs/errors/libraries/auth0-js/invalid-token#parsing-an-hs256-signed-id-token-without-an-access-token"},r(f)):t.access_token?i.at_hash?(new ei).validateAccessToken(t.access_token,"RS256",i.at_hash,function(n){return n?r(rt.invalidToken(n.message)):r(null,i)}):r(null,i):r(null,i)}):r(null,null)};e.prototype.validateToken=function(n,t,i){var r=new ei({issuer:this.baseOptions.token_issuer,jwksURI:this.baseOptions.jwksURI,audience:this.baseOptions.clientID,leeway:this.baseOptions.leeway||0,__disableExpirationCheck:this.baseOptions.__disableExpirationCheck});r.verify(n,t,function(n,t){if(n)return i(rt.invalidToken(n.message));i(null,t)})};e.prototype.renewAuth=function(n,r){var e,o=!!n.usePostMessage,s=n.postMessageDataType||!1,h=n.postMessageOrigin||u.getWindow().origin,c=n.timeout,l=this,f=t.merge(this.baseOptions,["clientID","redirectUri","responseType","scope","audience","_csrf","state","_intstate","nonce"]).with(n);f.responseType=f.responseType||"token";f.responseMode=f.responseMode||"fragment";f=this.transactionManager.process(f);i.check(f,{type:"object",message:"options parameter is not valid"});i.check(r,{type:"function",message:"cb parameter is not valid"});f.prompt="none";f=t.blacklist(f,["usePostMessage","tenant","postMessageDataType","postMessageOrigin"]);e=yt.create({authenticationUrl:this.client.buildAuthorizeUrl(f),postMessageDataType:s,postMessageOrigin:h,timeout:c});e.login(o,function(n,t){if(typeof t=="object")return r(n,t);l.parseHash({hash:t},r)})};e.prototype.checkSession=function(n,r){var u=t.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(n);if(u.responseType==="code")return r({error:"error",error_description:"responseType can't be `code`"});n.nonce||(u=this.transactionManager.process(u));i.check(u,{type:"object",message:"options parameter is not valid"});i.check(r,{type:"function",message:"cb parameter is not valid"});u=t.blacklist(u,["usePostMessage","tenant","postMessageDataType"]);this.webMessageHandler.run(u,r)};e.prototype.changePassword=function(n,t){return this.client.dbConnection.changePassword(n,t)};e.prototype.passwordlessStart=function(n,i){var r=t.merge(this.baseOptions,["responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(n.authParams);return n.authParams=this.transactionManager.process(r),this.client.passwordless.start(n,i)};e.prototype.signup=function(n,t){return this.client.dbConnection.signup(n,t)};e.prototype.authorize=function(n){var r=t.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(n);i.check(r,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}});r=this.transactionManager.process(r);r.scope=r.scope||"openid profile email";u.redirect(this.client.buildAuthorizeUrl(r))};e.prototype.signupAndAuthorize=function(n,i){var r=this;return this.client.dbConnection.signup(t.blacklist(n,["popupHandler"]),function(t){if(t)return i(t);n.realm=n.connection;n.username||(n.username=n.email);r.client.login(n,i)})};e.prototype.login=function(n,i){var r=t.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(n),f;r=this.transactionManager.process(r);f=u.getWindow().location.host===this.baseOptions.domain;f?(r.connection=r.realm,delete r.realm,this._universalLogin.login(r,i)):this.crossOriginAuthentication.login(r,i)};e.prototype.passwordlessLogin=function(n,i){var r=t.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(n),f,e;r=this.transactionManager.process(r);f=u.getWindow().location.host===this.baseOptions.domain;f?this.passwordlessVerify(r,i):(e=t.extend({credentialType:"http://auth0.com/oauth/grant-type/passwordless/otp",realm:r.connection,username:r.email||r.phoneNumber,otp:r.verificationCode},t.blacklist(r,["connection","email","phoneNumber","verificationCode"])),this.crossOriginAuthentication.login(e,i))};e.prototype.crossOriginAuthenticationCallback=function(){this.crossOriginVerification()};e.prototype.crossOriginVerification=function(){this.crossOriginAuthentication.callback()};e.prototype.logout=function(n){u.redirect(this.client.buildLogoutUrl(n))};e.prototype.passwordlessVerify=function(n,r){var e=this,f=t.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(n);return i.check(f,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),f=this.transactionManager.process(f),this.client.passwordless.verify(f,function(n){return n?r(n):u.redirect(e.client.passwordless.buildVerifyUrl(f))})};hi.prototype.buildVerifyUrl=function(n){var r,u;return i.check(n,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(n){return!n.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(n){return!n.phoneNumber}}}),r=t.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","protocol","nonce"]).with(n),this.baseOptions._sendTelemetry&&(r.auth0Client=this.request.getTelemetryData()),r=t.toSnakeCase(r,["auth0Client"]),u=g.stringify(r),f(this.baseOptions.rootUrl,"passwordless","verify_redirect","?"+u)};hi.prototype.start=function(n,r){var e,u;return i.check(n,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},send:{type:"string",message:"send option is required",values:["link","code"],value_message:"send is not valid ([link, code])"},phoneNumber:{optional:!0,type:"string",message:"phoneNumber option is required",condition:function(n){return n.send==="code"||!n.email}},email:{optional:!0,type:"string",message:"email option is required",condition:function(n){return n.send==="link"||!n.phoneNumber}},authParams:{optional:!0,type:"object",message:"authParams option is required"}}),i.check(r,{type:"function",message:"cb parameter is not valid"}),e=f(this.baseOptions.rootUrl,"passwordless","start"),u=t.merge(this.baseOptions,["clientID","responseType","redirectUri","scope"]).with(n),u.scope&&(u.authParams=u.authParams||{},u.authParams.scope=u.scope),u.redirectUri&&(u.authParams=u.authParams||{},u.authParams.redirect_uri=u.redirectUri),u.responseType&&(u.authParams=u.authParams||{},u.authParams.response_type=u.responseType),delete u.redirectUri,delete u.responseType,delete u.scope,u=t.toSnakeCase(u,["auth0Client","authParams"]),this.request.post(e).send(u).end(o(r))};hi.prototype.verify=function(n,r){var e,u;return i.check(n,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(n){return!n.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(n){return!n.phoneNumber}}}),i.check(r,{type:"function",message:"cb parameter is not valid"}),u=t.pick(n,["connection","verificationCode","phoneNumber","email","auth0Client"]),u=t.toSnakeCase(u,["auth0Client"]),e=f(this.baseOptions.rootUrl,"passwordless","verify"),this.request.post(e).send(u).end(o(r))};ur.prototype.signup=function(n,r){var s,u,e;return i.check(n,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"},password:{type:"string",message:"password option is required"}}),i.check(r,{type:"function",message:"cb parameter is not valid"}),s=f(this.baseOptions.rootUrl,"dbconnections","signup"),u=t.merge(this.baseOptions,["clientID"]).with(n),e=u.user_metadata||u.userMetadata,u=t.blacklist(u,["scope","userMetadata","user_metadata"]),u=t.toSnakeCase(u,["auth0Client"]),e&&(u.user_metadata=e),this.request.post(s).send(u).end(o(r))};ur.prototype.changePassword=function(n,r){var e,u;return i.check(n,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"}}),i.check(r,{type:"function",message:"cb parameter is not valid"}),e=f(this.baseOptions.rootUrl,"dbconnections","change_password"),u=t.merge(this.baseOptions,["clientID"]).with(n,["email","connection"]),u=t.toSnakeCase(u,["auth0Client"]),this.request.post(e).send(u).end(o(r))};c.prototype.buildAuthorizeUrl=function(n){var r,u;return i.check(n,{type:"object",message:"options parameter is not valid"}),r=t.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience"]).with(n),i.check(r,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},redirectUri:{optional:!0,type:"string",message:"redirectUri option is required"},responseType:{type:"string",message:"responseType option is required"},nonce:{type:"string",message:"nonce option is required",condition:function(n){return n.responseType.indexOf("code")===-1&&n.responseType.indexOf("id_token")!==-1}},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),this.baseOptions._sendTelemetry&&(r.auth0Client=this.request.getTelemetryData()),r.connection_scope&&i.isArray(r.connection_scope)&&(r.connection_scope=r.connection_scope.join(",")),r=t.blacklist(r,["username","popupOptions","domain","tenant","timeout"]),r=t.toSnakeCase(r,["auth0Client"]),r=ru.oauthAuthorizeParams(this.warn,r),u=g.stringify(r),f(this.baseOptions.rootUrl,"authorize","?"+u)};c.prototype.buildLogoutUrl=function(n){var r,u;return i.check(n,{optional:!0,type:"object",message:"options parameter is not valid"}),r=t.merge(this.baseOptions,["clientID"]).with(n||{}),this.baseOptions._sendTelemetry&&(r.auth0Client=this.request.getTelemetryData()),r=t.toSnakeCase(r,["auth0Client","returnTo"]),u=g.stringify(t.blacklist(r,["federated"])),n&&n.federated!==undefined&&n.federated!==!1&&n.federated!=="false"&&(u+="&federated"),f(this.baseOptions.rootUrl,"v2","logout","?"+u)};c.prototype.loginWithDefaultDirectory=function(n,t){return i.check(n,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),n.grantType="password",this.oauthToken(n,t)};c.prototype.login=function(n,t){return i.check(n,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},realm:{type:"string",message:"realm option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),n.grantType="http://auth0.com/oauth/grant-type/password-realm",this.oauthToken(n,t)};c.prototype.oauthToken=function(n,r){var e,u;return i.check(n,{type:"object",message:"options parameter is not valid"}),i.check(r,{type:"function",message:"cb parameter is not valid"}),e=f(this.baseOptions.rootUrl,"oauth","token"),u=t.merge(this.baseOptions,["clientID","scope","audience"]).with(n),i.check(u,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},grantType:{type:"string",message:"grantType option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),u=t.toSnakeCase(u,["auth0Client"]),u=ru.oauthTokenParams(this.warn,u),this.request.post(e).send(u).end(o(r))};c.prototype.loginWithResourceOwner=function(n,r){var e,u;return i.check(n,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},connection:{type:"string",message:"connection option is required"},scope:{optional:!0,type:"string",message:"scope option is required"}}),i.check(r,{type:"function",message:"cb parameter is not valid"}),e=f(this.baseOptions.rootUrl,"oauth","ro"),u=t.merge(this.baseOptions,["clientID","scope"]).with(n,["username","password","scope","connection","device"]),u=t.toSnakeCase(u,["auth0Client"]),u.grant_type=u.grant_type||"password",this.request.post(e).send(u).end(o(r))};c.prototype.getSSOData=function(n,t){var o,f,r;if(this.auth0||(this.auth0=new e(this.baseOptions)),o=u.getWindow().location.host===this.baseOptions.domain,o)return this.auth0._universalLogin.getSSOData(n,t);typeof n=="function"&&(t=n);i.check(t,{type:"function",message:"cb parameter is not valid"});f=this.baseOptions.clientID;r=gr.get()||{};this.auth0.checkSession({responseType:"token id_token",scope:"openid profile email",connection:r.lastUsedConnection,timeout:5e3},function(n,i){return n?n.error==="login_required"?t(null,{sso:!1}):(n.error==="consent_required"&&(n.error_description="Consent required. When using `getSSOData`, the user has to be authenticated with the following scope: `openid profile email`."),t(n,{sso:!1})):r.lastUsedSub&&r.lastUsedSub!==i.idTokenPayload.sub?t(n,{sso:!1}):t(null,{lastUsedConnection:{name:r.lastUsedConnection},lastUsedUserID:i.idTokenPayload.sub,lastUsedUsername:i.idTokenPayload.email||i.idTokenPayload.name,lastUsedClientID:f,sessionClients:[f],sso:!0})})};c.prototype.userInfo=function(n,t){var r;return i.check(n,{type:"string",message:"accessToken parameter is not valid"}),i.check(t,{type:"function",message:"cb parameter is not valid"}),r=f(this.baseOptions.rootUrl,"userinfo"),this.request.get(r).set("Authorization","Bearer "+n).end(o(t,{ignoreCasing:!0}))};c.prototype.delegation=function(n,r){var e,u;return i.check(n,{type:"object",message:"options parameter is not valid"},{grant_type:{type:"string",message:"grant_type option is required"}}),i.check(r,{type:"function",message:"cb parameter is not valid"}),e=f(this.baseOptions.rootUrl,"delegation"),u=t.merge(this.baseOptions,["clientID"]).with(n),u=t.toSnakeCase(u,["auth0Client"]),this.request.post(e).send(u).end(o(r))};c.prototype.getUserCountry=function(n){var t;return i.check(n,{type:"function",message:"cb parameter is not valid"}),t=f(this.baseOptions.rootUrl,"user","geoloc","country"),this.request.get(t).end(o(n))};dt.prototype.getUser=function(n,t){var r;return i.check(n,{type:"string",message:"userId parameter is not valid"}),i.check(t,{type:"function",message:"cb parameter is not valid"}),r=f(this.baseOptions.rootUrl,"users",n),this.request.get(r).end(o(t,{ignoreCasing:!0}))};dt.prototype.patchUserMetadata=function(n,t,r){var u;return i.check(n,{type:"string",message:"userId parameter is not valid"}),i.check(t,{type:"object",message:"userMetadata parameter is not valid"}),i.check(r,{type:"function",message:"cb parameter is not valid"}),u=f(this.baseOptions.rootUrl,"users",n),this.request.patch(u).send({user_metadata:t}).end(o(r,{ignoreCasing:!0}))};dt.prototype.linkUser=function(n,t,r){var u;return i.check(n,{type:"string",message:"userId parameter is not valid"}),i.check(t,{type:"string",message:"secondaryUserToken parameter is not valid"}),i.check(r,{type:"function",message:"cb parameter is not valid"}),u=f(this.baseOptions.rootUrl,"users",n,"identities"),this.request.post(u).send({link_with:t}).end(o(r,{ignoreCasing:!0}))};tf={Authentication:c,Management:dt,WebAuth:e,version:ct};n.Authentication=c;n.Management=dt;n.WebAuth=e;n.version=ct;n.default=tf;Object.defineProperty(n,"__esModule",{value:!0})});
//# sourceMappingURL=hurbis-ui-seguranca-v1.dependencia.min.js.map