facebook-workplaceoutlookemailmicrosoft-teamsdiscordmessengercustom-servicesmacoslinuxwindowsinboxwhatsappicloudtweetdeckhipchattelegramhangoutsslackgmailskype
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
52 KiB
2 lines
52 KiB
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(){var a,b=-1,c=navigator.userAgent;return"Microsoft Internet Explorer"===navigator.appName?(a=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"),null!=a.exec(c)&&(b=parseFloat(RegExp.$1))):c.indexOf("Trident")>-1&&(a=new RegExp("rv:([0-9]{2,2}[.0-9]{0,})"),null!==a.exec(c)&&(b=parseFloat(RegExp.$1))),b}function e(a){var b="";for(var c in a)b+=c+"="+a[c]+",";return b.slice(0,-1)}function f(a,b){return!(!a||null==a[b])}function g(a,b){var c=a.status,e="string"==typeof a.responseText?a.responseText:a,f=10===d()||11===d(),g=!c||0===c,h=!!window.navigator.onLine;g&&!h?(c=0,e={code:"offline"}):g&&f?(c=401,e={code:"invalid_user_password"}):g&&(c=0,e={code:"connection_refused_timeout"});var i=new B(c,e);b(i)}function h(a,b,c){return a+"//"+b+c}function i(a){return this instanceof i?(p(a,"clientID"),p(a,"domain"),this._useJSONP=null!=a.forceJSONP?!!a.forceJSONP:C()&&!z("https:",a.domain),this._clientID=a.clientID,this._callbackURL=a.callbackURL||document.location.href,this._shouldRedirect=!!a.callbackURL,this._domain=a.domain,this._responseType=this._parseResponseType(a,!0)||"code",this._responseMode=this._parseResponseMode(a,!0),this._cordovaSocialPlugins={facebook:this._phonegapFacebookLogin},this._useCordovaSocialPlugins=a.useCordovaSocialPlugins,void(this._sendClientInfo=null!=a.sendSDKClientInfo?a.sendSDKClientInfo:!0)):new i(a)}function j(a){return a?"token":"code"}function k(a){if("string"!=typeof a)return!1;for(var b=["code","id_token","token"],c=a.split(" "),d=0;d<c.length;d++)if(-1===b.indexOf(c[d]))return!1;return c.length>=1}function l(a){return"form_post"===a}function m(a){console&&console.warn&&console.warn(a)}var n="undefined"!=typeof self?self:"undefined"!=typeof window?window:{},o=a("./lib/base64_url"),p=a("./lib/assert_required"),q=a("./lib/is-array"),r=a("./lib/index-of"),s=a("qs"),t=a("xtend"),u=a("trim"),v=a("reqwest"),w=a("winchan"),x=a("jsonp"),y={param:"cbx",timeout:8e3,prefix:"__auth0jp"},z=a("./lib/same-origin"),A=a("./lib/json-parse"),B=a("./lib/LoginError"),C=a("./lib/use_jsonp");i.version=a("./version").str,i.clientInfo={name:"auth0.js",version:i.version},i.prototype.openWindow=function(a,b,c){return window.open(a,b,e(c))},i.prototype._redirect=function(a){n.window.location=a},i.prototype._getResponseType=function(a){return this._parseResponseType(a)||this._responseType},i.prototype._getCallbackOnLocationHash=function(a){return"form_post"!==this._getResponseMode(a)&&"code"!==this._getResponseType(a)},i.prototype._getResponseMode=function(a){var b=this._parseResponseMode(a)||this._responseMode;return"form_post"===b?"form_post":null},i.prototype._getCallbackURL=function(a){return a&&"undefined"!=typeof a.callbackURL?a.callbackURL:this._callbackURL},i.prototype._getClientInfoString=function(){var a=JSON.stringify(i.clientInfo);return o.encode(a)},i.prototype._getClientInfoHeader=function(){return this._sendClientInfo?{"Auth0-Client":this._getClientInfoString()}:{}},i.prototype._renderAndSubmitWSFedForm=function(a,b){var c=document.createElement("div");c.innerHTML=b;var d=document.body.appendChild(c).children[0];a.popup&&!this._getCallbackOnLocationHash(a)&&(d.target="auth0_signup_popup"),d.submit()},i.prototype._getMode=function(a){var b={scope:"openid",response_type:this._getResponseType(a)},c=this._getResponseMode(a);return c&&(b.response_mode=c),b},i.prototype._configureOfflineMode=function(a){a.scope&&a.scope.indexOf("offline_access")>=0&&(a.device=a.device||"Browser")},i.prototype._getUserInfo=function(a,b,c){if(!a||a.user_id)return c(null,a);var d="https:",e=this._domain,f="/tokeninfo",g=h(d,e,f),i=function(a,b){var d=new Error(a+": "+(b||""));d.error=a,d.error_description=b,c(d)};return this._useJSONP?x(g+"?"+s.stringify({id_token:b}),y,function(a,b){return a?i(0,a.toString()):200===b.status?c(null,b.user):i(b.status,b.err||b.error)}):v({url:z(d,e)?f:g,method:"post",type:"json",crossOrigin:!z(d,e),data:{id_token:b}}).fail(function(a){i(a.status,a.responseText)}).then(function(a){c(null,a)})},i.prototype.getProfile=function(a,b){if("function"!=typeof b)throw new Error("A callback function is required");return a&&"string"==typeof a?void this._getUserInfo(this.decodeJwt(a),a,b):b(new Error("Invalid token"))},i.prototype.validateUser=function(a,b){var c="https:",d=this._domain,e="/public/api/users/validate_userpassword",f=h(c,d,e),g=t(a,{client_id:this._clientID,username:u(a.username||a.email||"")});return this._useJSONP?x(f+"?"+s.stringify(g),y,function(a,c){return a?b(a):"error"in c&&404!==c.status?b(new Error(c.error)):void b(null,200===c.status)}):void v({url:z(c,d)?e:f,method:"post",type:"text",data:g,crossOrigin:!z(c,d),error:function(a){return 404!==a.status?b(new Error(a.responseText)):void b(null,!1)},success:function(a){b(null,200===a.status)}})},i.prototype.decodeJwt=function(a){var b=a&&a.split(".")[1];return A(o.decode(b))},i.prototype.parseHash=function(a){a=a||window.location.hash,a=a.substr(1).replace(/^\//,"");var b=s.parse(a);if(b.hasOwnProperty("error")){var c={error:b.error,error_description:b.error_description};return b.state&&(c.state=b.state),c}if(!b.hasOwnProperty("access_token")&&!b.hasOwnProperty("id_token")&&!b.hasOwnProperty("refresh_token"))return null;var d;if(b.id_token){var e=function(a){var b={error:"invalid_token",error_description:a};return b};d=this.decodeJwt(b.id_token);var f=q(d.aud)?d.aud:[d.aud];if(-1===r(f,this._clientID))return e("The clientID configured ("+this._clientID+") does not match with the clientID set in the token ("+f.join(", ")+").");if(d.iss&&d.iss!=="https://"+this._domain+"/")return e("The domain configured (https://"+this._domain+"/) does not match with the domain set in the token ("+d.iss+").")}return{accessToken:b.access_token,idToken:b.id_token,idTokenPayload:d,refreshToken:b.refresh_token,state:b.state}},i.prototype.signup=function(a,b){function c(){return a.auto_login?e.login(a,b):"function"==typeof b?b():void 0}function d(a,c){var d=new B(a,c);if(j&&"function"==typeof j.kill&&j.kill(),"function"==typeof b)return b(d);throw d}var e=this,g={client_id:this._clientID,redirect_uri:this._getCallbackURL(a),email:u(a.email||a.username||""),tenant:this._domain.split(".")[0]};"string"==typeof a.username&&(g.username=u(a.username));var i=t(this._getMode(a),a,g);this._configureOfflineMode(i),f(a,"sso")||(a.sso=!0),f(a,"auto_login")||(a.auto_login=!0);var j,k=a.auto_login&&a.popup&&(!this._getCallbackOnLocationHash(a)||a.sso);k&&(j=this._buildPopupWindow(a));var l="https:",m=this._domain,n="/dbconnections/signup",o=h(l,m,n);return this._useJSONP?x(o+"?"+s.stringify(i),y,function(a,b){return a?d(0,a):200==b.status?c():d(b.status,b.err||b.error)}):void v({url:z(l,m)?n:o,method:"post",type:"html",data:i,success:c,crossOrigin:!z(l,m),error:function(a){d(a.status,a.responseText)}})},i.prototype.changePassword=function(a,b){function c(a,c){var d=new B(a,c);return b?b(d):void 0}var d={tenant:this._domain.split(".")[0],client_id:this._clientID,connection:a.connection,email:u(a.email||"")};"string"==typeof a.password&&(d.password=a.password);var e="https:",f=this._domain,g="/dbconnections/change_password",i=h(e,f,g);return this._useJSONP?x(i+"?"+s.stringify(d),y,function(a,d){return a?c(0,a):200==d.status?b(null,d.message):c(d.status,d.err||d.error)}):void v({url:z(e,f)?g:i,method:"post",type:"html",data:d,crossOrigin:!z(e,f),error:function(a){c(a.status,a.responseText)},success:function(a){b(null,a)}})},i.prototype._buildAuthorizeQueryString=function(a,b){var c=this._buildAuthorizationParameters(a,b);return s.stringify(c)},i.prototype._buildAuthorizationParameters=function(a,b){var c=t.apply(null,a);this._configureOfflineMode(c),this._sendClientInfo&&(c.auth0Client=this._getClientInfoString()),b=b||["popup","popupOptions"];var d,e;for(d=0;d<b.length;d++)e=b[d],delete c[e];return c.connection_scope&&q(c.connection_scope)&&(c.connection_scope=c.connection_scope.join(",")),c},i.prototype.login=i.prototype.signin=function(a,b){return f(a,"sso")||(a.sso=!0),"undefined"!=typeof a.passcode?this.loginWithPasscode(a,b):"undefined"!=typeof a.username||"undefined"!=typeof a.email?this.loginWithUsernamePassword(a,b):window.cordova||window.electron?this.loginPhonegap(a,b):a.popup&&this._getCallbackOnLocationHash(a)?this.loginWithPopup(a,b):void this._authorize(a)},i.prototype._authorize=function(a){var b=[this._getMode(a),a,{client_id:this._clientID,redirect_uri:this._getCallbackURL(a)}],c=this._buildAuthorizeQueryString(b),d=h("https:",this._domain,"/authorize?"+c);a.popup?this._buildPopupWindow(a,d):this._redirect(d)},i.prototype._computePopupPosition=function(a){a=a||{};var b=a.width||500,c=a.height||600,d="undefined"!=typeof window.screenX?window.screenX:window.screenLeft,e="undefined"!=typeof window.screenY?window.screenY:window.screenTop,f="undefined"!=typeof window.outerWidth?window.outerWidth:document.body.clientWidth,g="undefined"!=typeof window.outerHeight?window.outerHeight:document.body.clientHeight-22,h=d+(f-b)/2,i=e+(g-c)/2;return{width:b,height:c,left:h,top:i}},i.prototype.loginPhonegap=function(a,b){function c(a){n||(n=!0,m.close(),b(new Error(a.message),null))}function d(a){if(!(n||a.url&&0!==a.url.indexOf(f+"#")&&0!==a.url.indexOf(f+"?"))){var c=g.parseHash(a.url.slice(f.length));if(!c)return n=!0,m.close(),void b(new Error("Error parsing hash"),null);if(c.idToken)return n=!0,m.close(),void b(null,c);n=!0,m.close(),b(new Error(c.err||c.error||"Something went wrong"),null)}}function e(){n||(m.removeEventListener("loaderror",c),m.removeEventListener("loadstart",d),m.removeEventListener("exit",e),b(new Error("Browser window closed"),null))}if(this._shouldAuthenticateWithCordovaPlugin(a.connection))return void this._socialPhonegapLogin(a,b);var f=h("https:",this._domain,"/mobile"),g=this,i=[this._getMode(a),a,{client_id:this._clientID,redirect_uri:f}];this._sendClientInfo&&i.push({auth0Client:this._getClientInfoString()});var j=this._buildAuthorizeQueryString(i),k=h("https:",this._domain,"/authorize?"+j),l=t({location:"yes"},a.popupOptions);delete l.width,delete l.height;var m=this.openWindow(k,"_blank",l),n=!1;m.addEventListener("loaderror",c),m.addEventListener("loadstart",d),m.addEventListener("exit",e)},i.prototype.loginWithPopup=function(a,b){var c=this;if(!b)throw new Error("popup mode should receive a mandatory callback");var d=[this._getMode(a),a,{client_id:this._clientID,owp:!0}];this._sendClientInfo&&d.push({auth0Client:this._getClientInfoString()});var f=this._buildAuthorizeQueryString(d),g=h("https:",this._domain,"/authorize?"+f),i=this._computePopupPosition(a.popupOptions),j=t(i,a.popupOptions),k=w.open({url:g,relay_url:"https://"+this._domain+"/relay.html",window_features:e(j)},function(a,d){return c._current_popup=null,a?b(new B(a),null,null,null,null,null):d?d.id_token?b(null,c._prepareResult(d)):d.err?b(new B(d.err.status,d.err.details||d.err),null,null,null,null,null):d.error?b(new B(d.status,d.details||d),null,null,null,null,null):b(new B("Something went wrong"),null,null,null,null,null):b(new B("Something went wrong"),null,null,null,null,null)});k.focus()},i.prototype._shouldAuthenticateWithCordovaPlugin=function(a){var b=this._cordovaSocialPlugins[a];return this._useCordovaSocialPlugins&&!!b},i.prototype._socialPhonegapLogin=function(a,b){var c=this._cordovaSocialPlugins[a.connection],d=this;c(a.connection_scope,function(c,e,f){if(c)return void b(c,null,null,null,null);var g=t({access_token:e},a,f);d.loginWithSocialAccessToken(g,b)})},i.prototype._phonegapFacebookLogin=function(a,b){if(!window.facebookConnectPlugin||!window.facebookConnectPlugin.login)return void b(new Error("missing plugin phonegap-facebook-plugin"),null,null);var c;c=a&&q(a)?a:a?[a]:["public_profile"],window.facebookConnectPlugin.login(c,function(a){b(null,a.authResponse.accessToken,{})},function(a){b(new Error(a),null,null)})},i.prototype.loginWithUsernamePasswordAndSSO=function(a,b){var c=this,d=this._computePopupPosition(a.popupOptions),f=t(d,a.popupOptions),g=w.open({url:"https://"+this._domain+"/sso_dbconnection_popup/"+this._clientID,relay_url:"https://"+this._domain+"/relay.html",window_features:e(f),popup:this._current_popup,params:{domain:this._domain,clientID:this._clientID,options:{username:u(a.username||a.email||""),password:a.password,connection:a.connection,state:a.state,scope:a.scope}}},function(a,d){return c._current_popup=null,a?b(new B(a),null,null,null,null,null):d?d.id_token?b(null,c._prepareResult(d)):d.err?b(new B(d.err.status,d.err.details||d.err),null,null,null,null,null):d.error?b(new B(d.status,d.details||d),null,null,null,null,null):b(new B("Something went wrong"),null,null,null,null,null):b(new B("Something went wrong"),null,null,null,null,null)});g.focus()},i.prototype.loginWithResourceOwner=function(a,b){var c=this,d=t(this._getMode(a),a,{client_id:this._clientID,username:u(a.username||a.email||""),grant_type:"password"});this._configureOfflineMode(d);var e="https:",f=this._domain,i="/oauth/ro",j=h(e,f,i);return this._sendClientInfo&&this._useJSONP&&(d.auth0Client=this._getClientInfoString()),this._useJSONP?x(j+"?"+s.stringify(d),y,function(a,d){if(a)return b(a);if("error"in d){var e=new B(d.status,d.error);return b(e)}b(null,c._prepareResult(d))}):void v({url:z(e,f)?i:j,method:"post",type:"json",data:d,headers:this._getClientInfoHeader(),crossOrigin:!z(e,f),success:function(a){b(null,c._prepareResult(a))},error:function(a){g(a,b)}})},i.prototype.loginWithSocialAccessToken=function(a,b){var c=this,d=this._buildAuthorizationParameters([{scope:"openid"},a,{client_id:this._clientID}]),e="https:",f=this._domain,i="/oauth/access_token",j=h(e,f,i);return this._useJSONP?x(j+"?"+s.stringify(d),y,function(a,d){if(a)return b(a);if("error"in d){var e=new B(d.status,d.error);return b(e)}b(null,c._prepareResult(d))}):void v({url:z(e,f)?i:j,method:"post",type:"json",data:d,headers:this._getClientInfoHeader(),crossOrigin:!z(e,f),success:function(a){b(null,c._prepareResult(a))},error:function(a){g(a,b)}})},i.prototype._buildPopupWindow=function(a,b){if(this._current_popup&&!this._current_popup.closed)return this._current_popup;b=b||"about:blank";var c=this,d={width:500,height:600},f=t(d,a.popupOptions||{}),g=e(f);if(this._current_popup=window.open(b,"auth0_signup_popup",g),!this._current_popup)throw new Error("Popup window cannot not been created. Disable popup blocker or make sure to call Auth0 login or singup on an UI event.");return this._current_popup.kill=function(){this.close(),c._current_popup=null},this._current_popup},i.prototype.loginWithUsernamePassword=function(a,b){function c(a){if(b)return b(a);throw a}if(b&&b.length>1&&(!a.sso||window.cordova))return this.loginWithResourceOwner(a,b);var d,e=this;if(a.popup&&!this._getCallbackOnLocationHash(a)&&(d=this._buildPopupWindow(a)),b&&b.length>1&&a.sso)return this.loginWithUsernamePasswordAndSSO(a,b);var f=t(this._getMode(a),a,{client_id:this._clientID,redirect_uri:this._getCallbackURL(a),username:u(a.username||a.email||""),tenant:this._domain.split(".")[0]});this._configureOfflineMode(f);var i="https:",j=this._domain,k="/usernamepassword/login",l=h(i,j,k);return this._useJSONP?x(l+"?"+s.stringify(f),y,function(c,f){if(c)return d&&d.kill&&d.kill(),b(c);if("error"in f){d&&d.kill&&d.kill();var g=new B(f.status,f.error);return b(g)}e._renderAndSubmitWSFedForm(a,f.form)}):void v({url:z(i,j)?k:l,method:"post",type:"html",data:f,headers:this._getClientInfoHeader(),crossOrigin:!z(i,j),success:function(b){e._renderAndSubmitWSFedForm(a,b)},error:function(a){d&&d.kill&&d.kill(),g(a,c)}})},i.prototype.loginWithPasscode=function(a,b){if(null==a.email&&null==a.phoneNumber)throw new Error("email or phoneNumber is required for authentication");if(null==a.passcode)throw new Error("passcode is required for authentication");if(a.connection=null==a.email?"sms":"email",!this._shouldRedirect)return a=t(a,{username:null==a.email?a.phoneNumber:a.email,password:a.passcode,sso:!1}),delete a.email,delete a.phoneNumber,delete a.passcode,this.loginWithResourceOwner(a,b);var c={connection:a.connection};a.phoneNumber&&(a.phone_number=a.phoneNumber,delete a.phoneNumber,c.phone_number=a.phone_number),a.email&&(c.email=a.email),a.verification_code=a.passcode,delete a.passcode,c.verification_code=a.verification_code;var d=this;this._verify(c,function(c){return c?b(c):void d._verify_redirect(a)})},i.prototype._verify=function(a,b){var c="https:",d=this._domain,e="/passwordless/verify",f=h(c,d,e),g=a;return this._useJSONP?(this._sendClientInfo&&(g.auth0Client=this._getClientInfoString()),x(f+"?"+s.stringify(g),y,function(a,c){return a?b(new Error("0: "+a.toString())):200===c.status?b(null,!0):b({status:c.status})})):v({url:z(c,d)?e:f,method:"post",headers:this._getClientInfoHeader(),crossOrigin:!z(c,d),data:g}).fail(function(a){try{b(JSON.parse(a.responseText))}catch(c){var d=new Error(a.status+"("+a.statusText+"): "+a.responseText);d.statusCode=a.status,d.error=a.statusText,d.message=a.responseText,b(d)}}).then(function(a){b(null,a)})},i.prototype._verify_redirect=function(a){var b=[this._getMode(a),a,{client_id:this._clientID,redirect_uri:this._getCallbackURL(a)}],c=this._buildAuthorizeQueryString(b),d=h("https:",this._domain,"/passwordless/verify_redirect?"+c);this._redirect(d)},i.prototype.renewIdToken=function(a,b){this.getDelegationToken({id_token:a,scope:"passthrough",api:"auth0"},b)},i.prototype.refreshToken=function(a,b){this.getDelegationToken({refresh_token:a,scope:"passthrough",api:"auth0"},b)},i.prototype.getDelegationToken=function(a,b){if(a=a||{},!a.id_token&&!a.refresh_token)throw new Error("You must send either an id_token or a refresh_token to get a delegation token.");var c=t({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",client_id:this._clientID,target:a.targetClientId||this._clientID,api_type:a.api},a);delete c.hasOwnProperty,delete c.targetClientId,delete c.api;var e="https:",f=this._domain,g="/delegation",i=h(e,f,g);return this._useJSONP?x(i+"?"+s.stringify(c),y,function(a,c){if(a)return b(a);if("error"in c){var d=new B(c.status,c.error_description||c.error);return b(d)}b(null,c)}):void v({url:z(e,f)?g:i,method:"post",type:"json",data:c,crossOrigin:!z(e,f),success:function(a){b(null,a)},error:function(a){try{b(JSON.parse(a.responseText))}catch(c){var e=a,f=10===d()||11===d(),g=!e.status||0===e.status;g&&!window.navigator.onLine?(e={},e.status=0,e.responseText={code:"offline"}):g&&f?(e={},e.status=401,e.responseText={code:"invalid_operation"}):g?(e={},e.status=0,e.responseText={code:"connection_refused_timeout"}):e.responseText=a,b(new B(e.status,e.responseText))}}})},i.prototype.logout=function(a){var b=h("https:",this._domain,"/logout");a&&(b+="?"+s.stringify(a)),this._redirect(b)},i.prototype.getSSOData=function(a,b){"function"==typeof a&&(b=a,a=!1);var c={sso:!1};if(this._useJSONP){var d=new Error("The SSO data can't be obtained using JSONP");return void setTimeout(function(){b(d,c)},0)}var e="https:",f=this._domain,g="/user/ssodata",i=h(e,f,g),j=z(e,f),k={};return a&&(k={ldaps:1,client_id:this._clientID}),v({url:j?g:i,method:"get",type:"json",data:k,crossOrigin:!j,withCredentials:!j,timeout:3e3}).fail(function(a){var d=new Error("There was an error in the request that obtains the user's SSO data.");d.cause=a,b(d,c)}).then(function(a){b(null,a)})},i.prototype.getConnections=function(a){return x("https://"+this._domain+"/public/api/"+this._clientID+"/connections",y,a)},i.prototype.startPasswordless=function(a,b){if("object"!=typeof a)throw new Error("An options object is required");if("function"!=typeof b)throw new Error("A callback function is required");if(!a.email&&!a.phoneNumber)throw new Error("An `email` or a `phoneNumber` is required.");var c="https:",d=this._domain,e="/passwordless/start",f=h(c,d,e),g={client_id:this._clientID};return a.email?(g.email=a.email,g.connection="email",a.authParams&&(g.authParams=a.authParams),a.send&&"link"!==a.send||(g.authParams||(g.authParams={}),g.authParams.redirect_uri=this._callbackURL,g.authParams.response_type=this._shouldRedirect&&!this._callbackOnLocationHash?"code":"token"),a.send&&(g.send=a.send)):(g.phone_number=a.phoneNumber,g.connection="sms"),this._useJSONP?(this._sendClientInfo&&(g.auth0Client=this._getClientInfoString()),x(f+"?"+s.stringify(g),y,function(a,c){return a?b(new Error("0: "+a.toString())):200===c.status?b(null,!0):b(c.err||c.error)})):v({url:z(c,d)?e:f,method:"post",type:"json",headers:this._getClientInfoHeader(),crossOrigin:!z(c,d),data:g}).fail(function(a){try{b(JSON.parse(a.responseText))}catch(c){var d=new Error(a.status+"("+a.statusText+"): "+a.responseText);d.statusCode=a.status,d.error=a.statusText,d.message=a.responseText,b(d)}}).then(function(a){b(null,a)})},i.prototype.requestMagicLink=function(a,b){return this.startPasswordless(a,b)},i.prototype.requestEmailCode=function(a,b){return a.send="code",this.startPasswordless(a,b)},i.prototype.verifyEmailCode=function(a,b){return a.passcode=a.code,delete a.code,this.login(a,b)},i.prototype.requestSMSCode=function(a,b){return this.startPasswordless(a,b)},i.prototype.verifySMSCode=function(a,b){return a.passcode=a.code,delete a.code,this.login(a,b)},i.prototype.getUserCountry=function(a){var b="https:",c=this._domain,d="/user/geoloc/country",e=h(b,c,d);if(this._useJSONP){var f=new Error("The user's country can't be obtained using JSONP");return void setTimeout(function(){a(f)},0)}v({url:z(b,c)?d:e,method:"get",type:"json",headers:this._getClientInfoHeader(),crossOrigin:!z(b,c),success:function(b){a(null,b.country_code)},error:function(b){var c=new Error("There was an error in the request that obtains the user's country");c.cause=b,a(c)}})},i.prototype._prepareResult=function(a){if(a&&"object"==typeof a){var b=a.profile?a.profile:this.decodeJwt(a.id_token);return{accessToken:a.access_token,idToken:a.id_token,idTokenPayload:b,refreshToken:a.refresh_token,state:a.state}}},i.prototype._parseResponseType=function(a,b){a||(a={}),b&&!this._providedResponseOptions&&a.hasOwnProperty("callbackOnLocationHash")&&(this._providedCallbackOnLocationHash=!0),b&&!this._providedCallbackOnLocationHash&&a.hasOwnProperty("responseType")&&(this._providedResponseOptions=!0),!this._providedCallbackOnLocationHash&&!this._providedResponseOptions&&a.hasOwnProperty("callbackOnLocationHash")&&a.hasOwnProperty("responseType")&&m("The responseType option will be ignored. Both callbackOnLocationHash and responseType options were provided and they can't be used together."),this._providedCallbackOnLocationHash&&a.hasOwnProperty("responseType")&&m("The responseType option will be ignored. The callbackOnLocationHash option was provided to the constructor and they can't be mixed."),this._providedResponseOptions&&a.hasOwnProperty("callbackOnLocationHash")&&m("The callbackOnLocationHash option will be ignored. The responseType option was provided to the constructor and they can't be mixed."),this._providedCallbackOnLocationHash||a.hasOwnProperty("callbackOnLocationHash")||!a.responseType||k(a.responseType)||m('The responseType option will be ignored. Its valid values are "code", "id_token", "token" or any combination of them.');var c=void 0;return this._providedResponseOptions||null==a.callbackOnLocationHash||(c=j(a.callbackOnLocationHash)),!this._providedCallbackOnLocationHash&&!a.hasOwnProperty("callbackOnLocationHash")&&a.responseType&&k(a.responseType)&&(c=a.responseType),c},i.prototype._parseResponseMode=function(a,b){a||(a={}),b&&!this._providedCallbackOnLocationHash&&a.hasOwnProperty("responseMode")&&(this._providedResponseOptions=!0),this._providedCallbackOnLocationHash&&a.hasOwnProperty("responseMode")&&m("The responseMode option will be ignored. The callbackOnLocationHash option was provided to the constructor and they can't be mixed."),!this._providedCallbackOnLocationHash&&!this._providedResponseOptions&&a.hasOwnProperty("callbackOnLocationHash")&&a.hasOwnProperty("responseMode")&&m("The responseMode option will be ignored. Both callbackOnLocationHash and responseMode options were provided and they can't be used together.");var c=void 0;return this._providedCallbackOnLocationHash||!a.responseMode||l(a.responseMode)||m('The responseMode option will be ignored. Its only valid value is "form_post".'),!this._providedCallbackOnLocationHash&&l(a.responseMode)&&(c=a.responseMode),c},b.exports=i},{"./lib/LoginError":2,"./lib/assert_required":3,"./lib/base64_url":4,"./lib/index-of":5,"./lib/is-array":6,"./lib/json-parse":7,"./lib/same-origin":8,"./lib/use_jsonp":9,"./version":27,jsonp:12,qs:16,reqwest:17,trim:18,winchan:19,xtend:21}],2:[function(a,b,c){function d(a,b){var c;if("string"==typeof b)try{c=e(b)}catch(d){c={message:b}}else c=b||{description:"server error"};c.code||(c.code=c.error),"unauthorized"===c.code&&(a=401);var f=c.description||c.message||c.error;"PasswordStrengthError"===c.name&&(f="Password is not strong enough.");var g=Error.call(this,f);return g.status=a,g.name=c.code,g.code=c.code,g.details=c,0===a&&(g.code&&"offline"===g.code||(g.code="Unknown",g.message="Unknown error.")),g}var e=a("./json-parse");b.exports=d,Object&&Object.create&&(d.prototype=Object.create(Error.prototype,{constructor:{value:d}}))},{"./json-parse":7}],3:[function(a,b,c){function d(a,b){if(!a[b])throw new Error(b+" is required.")}b.exports=d},{}],4:[function(a,b,c){function d(a){return f.btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function e(a){return a+=Array(5-a.length%4).join("="),a=a.replace(/\-/g,"+").replace(/\_/g,"/"),f.atob(a)}var f=a("Base64");b.exports={encode:d,decode:e}},{Base64:10}],5:[function(a,b,c){function d(a,b,c){return a.indexOf(b,c)}function e(a,b,c){var d;if(null==a)throw new TypeError('"array" is null or not defined');var e=Object(a),f=e.length>>>0;if(0===f)return-1;var g=+c||0;if(Math.abs(g)===1/0&&(g=0),g>=f)return-1;for(d=Math.max(g>=0?g:f-Math.abs(g),0);f>d;){if(d in e&&e[d]===b)return d;d++}return-1}b.exports=Array.prototype.indexOf?d:e},{}],6:[function(a,b,c){function d(a){return"[object Array]"===e.call(a)}var e=Object.prototype.toString;b.exports=null!=Array.isArray?Array.isArray:d},{}],7:[function(a,b,c){b.exports="undefined"==typeof window.JSON?a("json-fallback").parse:window.JSON.parse},{"json-fallback":11}],8:[function(a,b,c){function d(a,b,c){return c=c||"",e===a&&f===b&&g===c}var e=window.location.protocol,f=window.location.hostname,g=window.location.port;b.exports=d},{}],9:[function(a,b,c){function d(){var a=window.XMLHttpRequest?new XMLHttpRequest:null;return a&&"withCredentials"in a?!1:!0}b.exports=d},{}],10:[function(a,b,c){!function(){var a="undefined"!=typeof c?c:this,b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=function(){try{document.createElement("$")}catch(a){return a}}();a.btoa||(a.btoa=function(a){for(var c,e,f=0,g=b,h="";a.charAt(0|f)||(g="=",f%1);h+=g.charAt(63&c>>8-f%1*8)){if(e=a.charCodeAt(f+=.75),e>255)throw d;c=c<<8|e}return h}),a.atob||(a.atob=function(a){if(a=a.replace(/=+$/,""),a.length%4==1)throw d;for(var c,e,f=0,g=0,h="";e=a.charAt(g++);~e&&(c=f%4?64*c+e:e,f++%4)?h+=String.fromCharCode(255&c>>(-2*f&6)):0)e=b.indexOf(e);return h})}()},{}],11:[function(require,module,exports){var JSON={};!function(){"use strict";function f(a){return 10>a?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g,h=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),"function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,g=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1)g[c]=str(c,i)||"null";return e=0===g.length?"[]":gap?"[\n"+gap+g.join(",\n"+gap)+"\n"+h+"]":"["+g.join(",")+"]",gap=h,e}if(rep&&"object"==typeof rep)for(f=rep.length,c=0;f>c;c+=1)"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));return e=0===g.length?"{}":gap?"{\n"+gap+g.join(",\n"+gap)+"\n"+h+"}":"{"+g.join(",")+"}",gap=h,e}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c)for(d=0;c>d;d+=1)indent+=" ";else"string"==typeof c&&(indent=c);if(rep=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return str("",{"":a})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),module.exports=JSON},{}],12:[function(a,b,c){function d(){}function e(a,b,c){function e(){h.parentNode.removeChild(h),window[o]=d}"function"==typeof b&&(c=b,b={}),b||(b={});var h,i,j=b.prefix||"__jp",k=b.param||"callback",l=null!=b.timeout?b.timeout:6e4,m=encodeURIComponent,n=document.getElementsByTagName("script")[0]||document.head,o=j+g++;l&&(i=setTimeout(function(){e(),c&&c(new Error("Timeout"))},l)),window[o]=function(a){f("jsonp got",a),i&&clearTimeout(i),e(),c&&c(null,a)},a+=(~a.indexOf("?")?"&":"?")+k+"="+m(o),a=a.replace("?&","?"),f('jsonp req "%s"',a),h=document.createElement("script"),h.src=a,n.parentNode.insertBefore(h,n)}var f=a("debug")("jsonp");b.exports=e;var g=0},{debug:13}],13:[function(a,b,c){function d(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function e(){var a=arguments,b=this.useColors;if(a[0]=(b?"%c":"")+this.namespace+(b?" %c":" ")+a[0]+(b?"%c ":" ")+"+"+c.humanize(this.diff),!b)return a;var d="color: "+this.color;a=[a[0],d,"color: inherit"].concat(Array.prototype.slice.call(a,1));var e=0,f=0;return a[0].replace(/%[a-z%]/g,function(a){"%%"!==a&&(e++,"%c"===a&&(f=e))}),a.splice(f,0,d),a}function f(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function g(a){try{null==a?c.storage.removeItem("debug"):c.storage.debug=a}catch(b){}}function h(){var a;try{a=c.storage.debug; |
|
}catch(b){}return a}function i(){try{return window.localStorage}catch(a){}}c=b.exports=a("./debug"),c.log=f,c.formatArgs=e,c.save=g,c.load=h,c.useColors=d,c.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:i(),c.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],c.formatters.j=function(a){return JSON.stringify(a)},c.enable(h())},{"./debug":14}],14:[function(a,b,c){function d(){return c.colors[k++%c.colors.length]}function e(a){function b(){}function e(){var a=e,b=+new Date,f=b-(j||b);a.diff=f,a.prev=j,a.curr=b,j=b,null==a.useColors&&(a.useColors=c.useColors()),null==a.color&&a.useColors&&(a.color=d());var g=Array.prototype.slice.call(arguments);g[0]=c.coerce(g[0]),"string"!=typeof g[0]&&(g=["%o"].concat(g));var h=0;g[0]=g[0].replace(/%([a-z%])/g,function(b,d){if("%%"===b)return b;h++;var e=c.formatters[d];if("function"==typeof e){var f=g[h];b=e.call(a,f),g.splice(h,1),h--}return b}),"function"==typeof c.formatArgs&&(g=c.formatArgs.apply(a,g));var i=e.log||c.log||console.log.bind(console);i.apply(a,g)}b.enabled=!1,e.enabled=!0;var f=c.enabled(a)?e:b;return f.namespace=a,f}function f(a){c.save(a);for(var b=(a||"").split(/[\s,]+/),d=b.length,e=0;d>e;e++)b[e]&&(a=b[e].replace(/\*/g,".*?"),"-"===a[0]?c.skips.push(new RegExp("^"+a.substr(1)+"$")):c.names.push(new RegExp("^"+a+"$")))}function g(){c.enable("")}function h(a){var b,d;for(b=0,d=c.skips.length;d>b;b++)if(c.skips[b].test(a))return!1;for(b=0,d=c.names.length;d>b;b++)if(c.names[b].test(a))return!0;return!1}function i(a){return a instanceof Error?a.stack||a.message:a}c=b.exports=e,c.coerce=i,c.disable=g,c.enable=f,c.enabled=h,c.humanize=a("ms"),c.names=[],c.skips=[],c.formatters={};var j,k=0},{ms:15}],15:[function(a,b,c){function d(a){if(a=""+a,!(a.length>1e4)){var b=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(a);if(b){var c=parseFloat(b[1]),d=(b[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*l;case"days":case"day":case"d":return c*k;case"hours":case"hour":case"hrs":case"hr":case"h":return c*j;case"minutes":case"minute":case"mins":case"min":case"m":return c*i;case"seconds":case"second":case"secs":case"sec":case"s":return c*h;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c}}}}function e(a){return a>=k?Math.round(a/k)+"d":a>=j?Math.round(a/j)+"h":a>=i?Math.round(a/i)+"m":a>=h?Math.round(a/h)+"s":a+"ms"}function f(a){return g(a,k,"day")||g(a,j,"hour")||g(a,i,"minute")||g(a,h,"second")||a+" ms"}function g(a,b,c){return b>a?void 0:1.5*b>a?Math.floor(a/b)+" "+c:Math.ceil(a/b)+" "+c+"s"}var h=1e3,i=60*h,j=60*i,k=24*j,l=365.25*k;b.exports=function(a,b){return b=b||{},"string"==typeof a?d(a):b["long"]?f(a):e(a)}},{}],16:[function(a,b,c){function d(a,b){if(0==a[b].length)return a[b]={};var c={};for(var d in a[b])q.call(a[b],d)&&(c[d]=a[b][d]);return a[b]=c,c}function e(a,b,c,f){var g=a.shift();if(!q.call(Object.prototype,c))if(g){var h=b[c]=b[c]||[];"]"==g?s(h)?""!=f&&h.push(f):"object"==typeof h?h[t(h).length]=f:h=b[c]=[b[c],f]:~r(g,"]")?(g=g.substr(0,g.length-1),!w.test(g)&&s(h)&&(h=d(b,c)),e(a,h,g,f)):(!w.test(g)&&s(h)&&(h=d(b,c)),e(a,h,g,f))}else s(b[c])?b[c].push(f):"object"==typeof b[c]?b[c]=f:"undefined"==typeof b[c]?b[c]=f:b[c]=[b[c],f]}function f(a,b,c){if(~r(b,"]")){var d=b.split("[");d.length;e(d,a,"base",c)}else{if(!w.test(b)&&s(a.base)){var f={};for(var g in a.base)f[g]=a.base[g];a.base=f}m(a.base,b,c)}return a}function g(a){if("object"!=typeof a)return a;if(s(a)){var b=[];for(var c in a)q.call(a,c)&&b.push(a[c]);return b}for(var d in a)a[d]=g(a[d]);return a}function h(a){var b={base:{}};return u(t(a),function(c){f(b,c,a[c])}),g(b.base)}function i(a,b){var c=v(String(a).split(b.separator),function(a,b){var c=r(b,"="),d=n(b),e=b.substr(0,d||c),g=b.substr(d||c,b.length),g=g.substr(r(g,"=")+1,g.length);return""==e&&(e=b,g=""),""==e?a:f(a,o(e),o(g))},{base:{}}).base;return g(c)}function j(a,b){if(!b)throw new TypeError("stringify expects an object");return b+"="+encodeURIComponent(a)}function k(a,b){var c=[];if(!b)throw new TypeError("stringify expects an object");for(var d=0;d<a.length;d++)c.push(x(a[d],b+"["+d+"]"));return c.join("&")}function l(a,b){for(var c,d=[],e=t(a),f=0,g=e.length;g>f;++f)c=e[f],""!=c&&(null==a[c]?d.push(encodeURIComponent(c)+"="):d.push(x(a[c],b?b+"["+encodeURIComponent(c)+"]":encodeURIComponent(c))));return d.join("&")}function m(a,b,c){var d=a[b];q.call(Object.prototype,b)||(void 0===d?a[b]=c:s(d)?d.push(c):a[b]=[d,c])}function n(a){for(var b,c,d=a.length,e=0;d>e;++e)if(c=a[e],"]"==c&&(b=!1),"["==c&&(b=!0),"="==c&&!b)return e}function o(a){try{return decodeURIComponent(a.replace(/\+/g," "))}catch(b){return a}}var p=Object.prototype.toString,q=Object.prototype.hasOwnProperty,r="function"==typeof Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){"string"==typeof a&&"undefined"==typeof"a"[0]&&(a=a.split(""));for(var c=0;c<a.length;c++)if(a[c]===b)return c;return-1},s=Array.isArray||function(a){return"[object Array]"==p.call(a)},t=Object.keys||function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},u="function"==typeof Array.prototype.forEach?function(a,b){return a.forEach(b)}:function(a,b){for(var c=0;c<a.length;c++)b(a[c])},v=function(a,b,c){if("function"==typeof a.reduce)return a.reduce(b,c);for(var d=c,e=0;e<a.length;e++)d=b(d,a[e]);return d},w=/^[0-9]+$/;c.parse=function(a,b){return null==a||""==a?{}:(b=b||{},b.separator=b.separator||"&","object"==typeof a?h(a):i(a,b))};var x=c.stringify=function(a,b){return s(a)?k(a,b):"[object Object]"==p.call(a)?l(a,b):"string"==typeof a?j(a,b):b+"="+encodeURIComponent(String(a))}},{}],17:[function(require,module,exports){!function(a,b,c){"undefined"!=typeof module&&module.exports?module.exports=c():"function"==typeof define&&define.amd?define(c):b[a]=c()}("reqwest",this,function(){function succeed(a){var b=protocolRe.exec(a.url);return b=b&&b[1]||window.location.protocol,httpsRe.test(b)?twoHundo.test(a.request.status):!!a.request.response}function handleReadyState(a,b,c){return function(){return a._aborted?c(a.request):a._timedOut?c(a.request,"Request is aborted: timeout"):void(a.request&&4==a.request[readyState]&&(a.request.onreadystatechange=noop,succeed(a)?b(a.request):c(a.request)))}}function setHeaders(a,b){var c,d=b.headers||{};d.Accept=d.Accept||defaultHeaders.accept[b.type]||defaultHeaders.accept["*"];var e="function"==typeof FormData&&b.data instanceof FormData;b.crossOrigin||d[requestedWith]||(d[requestedWith]=defaultHeaders.requestedWith),d[contentType]||e||(d[contentType]=b.contentType||defaultHeaders.contentType);for(c in d)d.hasOwnProperty(c)&&"setRequestHeader"in a&&a.setRequestHeader(c,d[c])}function setCredentials(a,b){"undefined"!=typeof b.withCredentials&&"undefined"!=typeof a.withCredentials&&(a.withCredentials=!!b.withCredentials)}function generalCallback(a){lastValue=a}function urlappend(a,b){return a+(/\?/.test(a)?"&":"?")+b}function handleJsonp(a,b,c,d){var e=uniqid++,f=a.jsonpCallback||"callback",g=a.jsonpCallbackName||reqwest.getcallbackPrefix(e),h=new RegExp("((^|\\?|&)"+f+")=([^&]+)"),i=d.match(h),j=doc.createElement("script"),k=0,l=-1!==navigator.userAgent.indexOf("MSIE 10.0");return i?"?"===i[3]?d=d.replace(h,"$1="+g):g=i[3]:d=urlappend(d,f+"="+g),win[g]=generalCallback,j.type="text/javascript",j.src=d,j.async=!0,"undefined"==typeof j.onreadystatechange||l||(j.htmlFor=j.id="_reqwest_"+e),j.onload=j.onreadystatechange=function(){return j[readyState]&&"complete"!==j[readyState]&&"loaded"!==j[readyState]||k?!1:(j.onload=j.onreadystatechange=null,j.onclick&&j.onclick(),b(lastValue),lastValue=void 0,head.removeChild(j),void(k=1))},head.appendChild(j),{abort:function(){j.onload=j.onreadystatechange=null,c({},"Request is aborted: timeout",{}),lastValue=void 0,head.removeChild(j),k=1}}}function getRequest(a,b){var c,d=this.o,e=(d.method||"GET").toUpperCase(),f="string"==typeof d?d:d.url,g=d.processData!==!1&&d.data&&"string"!=typeof d.data?reqwest.toQueryString(d.data):d.data||null,h=!1;return"jsonp"!=d.type&&"GET"!=e||!g||(f=urlappend(f,g),g=null),"jsonp"==d.type?handleJsonp(d,a,b,f):(c=d.xhr&&d.xhr(d)||xhr(d),c.open(e,f,d.async===!1?!1:!0),setHeaders(c,d),setCredentials(c,d),win[xDomainRequest]&&c instanceof win[xDomainRequest]?(c.onload=a,c.onerror=b,c.onprogress=function(){},h=!0):c.onreadystatechange=handleReadyState(this,a,b),d.before&&d.before(c),h?setTimeout(function(){c.send(g)},200):c.send(g),c)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return a.match("json")?"json":a.match("javascript")?"js":a.match("text")?"html":a.match("xml")?"xml":void 0}function init(o,fn){function complete(a){for(o.timeout&&clearTimeout(self.timeout),self.timeout=null;self._completeHandlers.length>0;)self._completeHandlers.shift()(a)}function success(resp){var type=o.type||resp&&setType(resp.getResponseHeader("Content-Type"));resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}for(self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp),self._successHandler(resp);self._fulfillmentHandlers.length>0;)resp=self._fulfillmentHandlers.shift()(resp);complete(resp)}function timedOut(){self._timedOut=!0,self.request.abort()}function error(a,b,c){for(a=self.request,self._responseArgs.resp=a,self._responseArgs.msg=b,self._responseArgs.t=c,self._erred=!0;self._errorHandlers.length>0;)self._errorHandlers.shift()(a,b,c);complete(a)}this.url="string"==typeof o?o:o.url,this.timeout=null,this._fulfilled=!1,this._successHandler=function(){},this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){timedOut()},o.timeout)),o.success&&(this._successHandler=function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest.call(this,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function normalize(a){return a?a.replace(/\r?\n/g,"\r\n"):""}function serial(a,b){var c,d,e,f,g=a.name,h=a.tagName.toLowerCase(),i=function(a){a&&!a.disabled&&b(g,normalize(a.attributes.value&&a.attributes.value.specified?a.value:a.text))};if(!a.disabled&&g)switch(h){case"input":/reset|button|image|file/i.test(a.type)||(c=/checkbox/i.test(a.type),d=/radio/i.test(a.type),e=a.value,(!(c||d)||a.checked)&&b(g,normalize(c&&""===e?"on":e)));break;case"textarea":b(g,normalize(a.value));break;case"select":if("select-one"===a.type.toLowerCase())i(a.selectedIndex>=0?a.options[a.selectedIndex]:null);else for(f=0;a.length&&f<a.length;f++)a.options[f].selected&&i(a.options[f])}}function eachFormElement(){var a,b,c=this,d=function(a,b){var d,e,f;for(d=0;d<b.length;d++)for(f=a[byTag](b[d]),e=0;e<f.length;e++)serial(f[e],c)};for(b=0;b<arguments.length;b++)a=arguments[b],/input|select|textarea/i.test(a.tagName)&&serial(a,c),d(a,["input","select","textarea"])}function serializeQueryString(){return reqwest.toQueryString(reqwest.serializeArray.apply(null,arguments))}function serializeHash(){var a={};return eachFormElement.apply(function(b,c){b in a?(a[b]&&!isArray(a[b])&&(a[b]=[a[b]]),a[b].push(c)):a[b]=c},arguments),a}function buildParams(a,b,c,d){var e,f,g,h=/\[\]$/;if(isArray(b))for(f=0;b&&f<b.length;f++)g=b[f],c||h.test(a)?d(a,g):buildParams(a+"["+("object"==typeof g?f:"")+"]",g,c,d);else if(b&&"[object Object]"===b.toString())for(e in b)buildParams(a+"["+e+"]",b[e],c,d);else d(a,b)}var win=window,doc=document,httpsRe=/^http/,protocolRe=/(^\w+):\/\//,twoHundo=/^(20\d|1223)$/,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,callbackPrefix="reqwest_"+ +new Date,lastValue,xmlHttpRequest="XMLHttpRequest",xDomainRequest="XDomainRequest",noop=function(){},isArray="function"==typeof Array.isArray?Array.isArray:function(a){return a instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=function(a){if(a.crossOrigin===!0){var b=win[xmlHttpRequest]?new XMLHttpRequest:null;if(b&&"withCredentials"in b)return b;if(win[xDomainRequest])return new XDomainRequest;throw new Error("Browser does not support cross-origin requests")}return win[xmlHttpRequest]?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")},globalSetupOptions={dataFilter:function(a){return a}};return Reqwest.prototype={abort:function(){this._aborted=!0,this.request.abort()},retry:function(){init.call(this,this.o,this.fn)},then:function(a,b){return a=a||function(){},b=b||function(){},this._fulfilled?this._responseArgs.resp=a(this._responseArgs.resp):this._erred?b(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):(this._fulfillmentHandlers.push(a),this._errorHandlers.push(b)),this},always:function(a){return this._fulfilled||this._erred?a(this._responseArgs.resp):this._completeHandlers.push(a),this},fail:function(a){return this._erred?a(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):this._errorHandlers.push(a),this},"catch":function(a){return this.fail(a)}},reqwest.serializeArray=function(){var a=[];return eachFormElement.apply(function(b,c){a.push({name:b,value:c})},arguments),a},reqwest.serialize=function(){if(0===arguments.length)return"";var a,b,c=Array.prototype.slice.call(arguments,0);return a=c.pop(),a&&a.nodeType&&c.push(a)&&(a=null),a&&(a=a.type),b="map"==a?serializeHash:"array"==a?reqwest.serializeArray:serializeQueryString,b.apply(null,c)},reqwest.toQueryString=function(a,b){var c,d,e=b||!1,f=[],g=encodeURIComponent,h=function(a,b){b="function"==typeof b?b():null==b?"":b,f[f.length]=g(a)+"="+g(b)};if(isArray(a))for(d=0;a&&d<a.length;d++)h(a[d].name,a[d].value);else for(c in a)a.hasOwnProperty(c)&&buildParams(c,a[c],e,h);return f.join("&").replace(/%20/g,"+")},reqwest.getcallbackPrefix=function(){return callbackPrefix},reqwest.compat=function(a,b){return a&&(a.type&&(a.method=a.type)&&delete a.type,a.dataType&&(a.type=a.dataType),a.jsonpCallback&&(a.jsonpCallbackName=a.jsonpCallback)&&delete a.jsonpCallback,a.jsonp&&(a.jsonpCallback=a.jsonp)),new Reqwest(a,b)},reqwest.ajaxSetup=function(a){a=a||{};for(var b in a)globalSetupOptions[b]=a[b]},reqwest})},{}],18:[function(a,b,c){function d(a){return a.replace(/^\s*|\s*$/g,"")}c=b.exports=d,c.left=function(a){return a.replace(/^\s*/,"")},c.right=function(a){return a.replace(/\s*$/,"")}},{}],19:[function(a,b,c){var d=function(){function a(a,b,c){a.attachEvent?a.attachEvent("on"+b,c):a.addEventListener&&a.addEventListener(b,c,!1)}function b(a,b,c){a.detachEvent?a.detachEvent("on"+b,c):a.removeEventListener&&a.removeEventListener(b,c,!1)}function c(){var a=-1,b=navigator.userAgent;if("Microsoft Internet Explorer"===navigator.appName){var c=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!=c.exec(b)&&(a=parseFloat(RegExp.$1))}else if(b.indexOf("Trident")>-1){var c=new RegExp("rv:([0-9]{2,2}[.0-9]{0,})");null!==c.exec(b)&&(a=parseFloat(RegExp.$1))}return a>=8}function d(){try{var a=navigator.userAgent;return-1!=a.indexOf("Fennec/")||-1!=a.indexOf("Firefox/")&&-1!=a.indexOf("Android")}catch(b){}return!1}function e(){return window.JSON&&window.JSON.stringify&&window.JSON.parse&&window.postMessage}function f(a){/^https?:\/\//.test(a)||(a=window.location.href);var b=/^(https?:\/\/[\-_a-zA-Z\.0-9:]+)/.exec(a);return b?b[1]:a}function g(){for(var a=(window.location,window.opener.frames),b=a.length-1;b>=0;b--)try{if(a[b].location.protocol===window.location.protocol&&a[b].location.host===window.location.host&&a[b].name===h)return a[b]}catch(c){}}var h="__winchan_relay_frame",i="die",j=c();return e()?{open:function(c,e){function g(){if(m&&document.body.removeChild(m),m=void 0,q&&(q=clearInterval(q)),b(window,"message",k),b(window,"unload",g),p)try{p.close()}catch(a){o.postMessage(i,n)}p=o=void 0}function k(a){if(a.origin===n)try{var b=JSON.parse(a.data);"ready"===b.a?o.postMessage(r,n):"error"===b.a?(g(),e&&(e(b.d),e=null)):"response"===b.a&&(g(),e&&(e(null,b.d),e=null))}catch(c){}}if(!e)throw"missing required callback argument";var l;c.url||(l="missing required 'url' parameter"),c.relay_url||(l="missing required 'relay_url' parameter"),l&&setTimeout(function(){e(l)},0),c.window_name||(c.window_name=null),(!c.window_features||d())&&(c.window_features=void 0);var m,n=f(c.url);if(n!==f(c.relay_url))return setTimeout(function(){e("invalid arguments: origin of url and relay_url must match")},0);var o;j&&(m=document.createElement("iframe"),m.setAttribute("src",c.relay_url),m.style.display="none",m.setAttribute("name",h),document.body.appendChild(m),o=m.contentWindow);var p=c.popup||window.open(c.url,c.window_name,c.window_features);c.popup&&(p.location.href=c.url),o||(o=p);var q=setInterval(function(){p&&p.closed&&(g(),e&&(e("User closed the popup window"),e=null))},500),r=JSON.stringify({a:"request",d:c.params});return a(window,"unload",g),a(window,"message",k),{close:g,focus:function(){if(p)try{p.focus()}catch(a){}}}},onOpen:function(c){function d(a){a=JSON.stringify(a),j?k.doPost(a,h):k.postMessage(a,h)}function e(a){var f;try{f=JSON.parse(a.data)}catch(g){}f&&"request"===f.a&&(b(window,"message",e),h=a.origin,c&&setTimeout(function(){c(h,f.d,function(a){c=void 0,d({a:"response",d:a})})},0))}function f(a){if(a.data===i)try{window.close()}catch(b){}}var h="*",k=j?g():window.opener;if(!k)throw"can't find relay frame";a(j?k:window,"message",e),a(j?k:window,"message",f);try{d({a:"ready"})}catch(l){a(k,"load",function(a){d({a:"ready"})})}var m=function(){try{b(j?k:window,"message",f)}catch(a){}c&&d({a:"error",d:"client closed window"}),c=void 0;try{window.close()}catch(e){}};return a(window,"unload",m),{detach:function(){b(window,"unload",m)}}}}:{open:function(a,b,c,d){setTimeout(function(){d("unsupported browser")},0)},onOpen:function(a){setTimeout(function(){a("unsupported browser")},0)}}}();"undefined"!=typeof b&&b.exports&&(b.exports=d)},{}],20:[function(a,b,c){function d(a){return null!==a&&("object"==typeof a||"function"==typeof a)}b.exports=d},{}],21:[function(a,b,c){function d(){for(var a={},b=0;b<arguments.length;b++){var c=arguments[b];if(f(c))for(var d=e(c),g=0;g<d.length;g++){var h=d[g];a[h]=c[h]}}return a}var e=a("object-keys"),f=a("./has-keys");b.exports=d},{"./has-keys":20,"object-keys":23}],22:[function(a,b,c){var d=Object.prototype.hasOwnProperty,e=Object.prototype.toString,f=function(a){var b="function"==typeof a&&!(a instanceof RegExp)||"[object Function]"===e.call(a);return b||"undefined"==typeof window||(b=a===window.setTimeout||a===window.alert||a===window.confirm||a===window.prompt),b};b.exports=function(a,b){if(!f(b))throw new TypeError("iterator must be a function");var c,e,g="string"==typeof a,h=a.length,i=arguments.length>2?arguments[2]:null;if(h===+h)for(c=0;h>c;c++)null===i?b(g?a.charAt(c):a[c],c,a):b.call(i,g?a.charAt(c):a[c],c,a);else for(e in a)d.call(a,e)&&(null===i?b(a[e],e,a):b.call(i,a[e],e,a))}},{}],23:[function(a,b,c){b.exports=Object.keys||a("./shim")},{"./shim":25}],24:[function(a,b,c){var d=Object.prototype.toString;b.exports=function e(a){var b=d.call(a),e="[object Arguments]"===b;return e||(e="[object Array]"!==b&&null!==a&&"object"==typeof a&&"number"==typeof a.length&&a.length>=0&&"[object Function]"===d.call(a.callee)),e}},{}],25:[function(a,b,c){!function(){"use strict";var c,d=Object.prototype.hasOwnProperty,e=Object.prototype.toString,f=a("./foreach"),g=a("./isArguments"),h=!{toString:null}.propertyIsEnumerable("toString"),i=function(){}.propertyIsEnumerable("prototype"),j=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];c=function(a){var b=null!==a&&"object"==typeof a,c="[object Function]"===e.call(a),k=g(a),l=[];if(!b&&!c&&!k)throw new TypeError("Object.keys called on a non-object");if(k)f(a,function(a){l.push(a)});else{var m,n=i&&c;for(m in a)n&&"prototype"===m||!d.call(a,m)||l.push(m)}if(h){var o=a.constructor,p=o&&o.prototype===a;f(j,function(b){p&&"constructor"===b||!d.call(a,b)||l.push(b)})}return l},b.exports=c}()},{"./foreach":22,"./isArguments":24}],26:[function(a,b,c){var d="undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e=a("./index");"function"==typeof d.window.define&&d.window.define.amd?d.window.define("auth0",function(){return e}):d.window&&(d.window.Auth0=e)},{"./index":1}],27:[function(a,b,c){b.exports={str:"7.1.0"}},{}]},{},[26]); |