"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/helpers/createClass"),t=require("@babel/runtime/helpers/classCallCheck"),n=require("@babel/runtime/helpers/defineProperty"),u=require("@babel/runtime/regenerator"),a=require("auth0-js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=i(e),o=i(r),s=i(t),f=i(n),l=i(u),p=i(a);function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?b(Object(t),!0).forEach((function(r){f.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var h=new(o.default((function e(){var r,t=this;s.default(this,e),f.default(this,"configure",(function(e){var r=process.env.REACT_APP_AUTH0_REDIRECT_URI||e.redirectUri||"";t.handler=new p.default.WebAuth(d(d({},e),{},{redirectUri:r}))})),f.default(this,"authorize",(r=c.default(l.default.mark((function e(r){return l.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.handler.authorize({connection:r});case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})),f.default(this,"authenticate",c.default(l.default.mark((function e(){return l.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.handler.parseHash((function(t,n){t?r(new Error(t)):e(n.accessToken)}))})));case 1:case"end":return e.stop()}}),e)}))))})));exports.provider=h;
