UNPKG

53.8 kBJavaScriptView Raw
1!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("moauth",[],e):"object"==typeof exports?exports.moauth=e():t.moauth=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=33)}([function(t,e,r){var n=r(24)("wks"),o=r(23),i=r(1).Symbol,s="function"==typeof i;(t.exports=function(t){return n[t]||(n[t]=s&&i[t]||(s?i:o)("Symbol."+t))}).store=n},function(t,e){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,e,r){var n=r(4);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,e,r){var n=r(1),o=r(6),i=r(9),s=r(12),a=r(13),u=function(t,e,r){var c,l,f,h,p=t&u.F,d=t&u.G,y=t&u.S,v=t&u.P,m=t&u.B,g=d?n:y?n[e]||(n[e]={}):(n[e]||{}).prototype,b=d?o:o[e]||(o[e]={}),_=b.prototype||(b.prototype={});for(c in d&&(r=e),r)f=((l=!p&&g&&void 0!==g[c])?g:r)[c],h=m&&l?a(f,n):v&&"function"==typeof f?a(Function.call,f):f,g&&s(g,c,f,t&u.U),b[c]!=f&&i(b,c,h),v&&_[c]!=f&&(_[c]=f)};n.core=o,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,e){var r=t.exports={version:"2.6.9"};"number"==typeof __e&&(__e=r)},function(t,e,r){t.exports=!r(11)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,r){var n=r(10),o=r(37);t.exports=r(7)?function(t,e,r){return n.f(t,e,o(1,r))}:function(t,e,r){return t[e]=r,t}},function(t,e,r){var n=r(2),o=r(35),i=r(36),s=Object.defineProperty;e.f=r(7)?Object.defineProperty:function(t,e,r){if(n(t),e=i(e,!0),n(r),o)try{return s(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,r){var n=r(1),o=r(9),i=r(22),s=r(23)("src"),a=r(38),u=(""+a).split("toString");r(6).inspectSource=function(t){return a.call(t)},(t.exports=function(t,e,r,a){var c="function"==typeof r;c&&(i(r,"name")||o(r,"name",e)),t[e]!==r&&(c&&(i(r,s)||o(r,s,t[e]?""+t[e]:u.join(String(e)))),t===n?t[e]=r:a?t[e]?t[e]=r:o(t,e,r):(delete t[e],o(t,e,r)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[s]||a.call(this)}))},function(t,e,r){var n=r(14);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,r){var n=r(5),o=r(0)("toStringTag"),i="Arguments"==n(function(){return arguments}());t.exports=function(t){var e,r,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),o))?r:i?n(e):"Object"==(s=n(e))&&"function"==typeof e.callee?"Arguments":s}},function(t,e,r){var n=r(17),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},function(t,e){var r=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:r)(t)}},function(t,e,r){"use strict";var n=r(15),o=RegExp.prototype.exec;t.exports=function(t,e){var r=t.exec;if("function"==typeof r){var i=r.call(t,e);if("object"!=typeof i)throw new TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==n(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,e)}},function(t,e,r){"use strict";r(61);var n=r(12),o=r(9),i=r(11),s=r(8),a=r(0),u=r(20),c=a("species"),l=!i((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),f=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();t.exports=function(t,e,r){var h=a(t),p=!i((function(){var e={};return e[h]=function(){return 7},7!=""[t](e)})),d=p?!i((function(){var e=!1,r=/a/;return r.exec=function(){return e=!0,null},"split"===t&&(r.constructor={},r.constructor[c]=function(){return r}),r[h](""),!e})):void 0;if(!p||!d||"replace"===t&&!l||"split"===t&&!f){var y=/./[h],v=r(s,h,""[t],(function(t,e,r,n,o){return e.exec===u?p&&!o?{done:!0,value:y.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}})),m=v[0],g=v[1];n(String.prototype,t,m),o(RegExp.prototype,h,2==e?function(t,e){return g.call(t,this,e)}:function(t){return g.call(t,this)})}}},function(t,e,r){"use strict";var n,o,i=r(62),s=RegExp.prototype.exec,a=String.prototype.replace,u=s,c=(n=/a/,o=/b*/g,s.call(n,"a"),s.call(o,"a"),0!==n.lastIndex||0!==o.lastIndex),l=void 0!==/()??/.exec("")[1];(c||l)&&(u=function(t){var e,r,n,o,u=this;return l&&(r=new RegExp("^"+u.source+"$(?!\\s)",i.call(u))),c&&(e=u.lastIndex),n=s.call(u,t),c&&n&&(u.lastIndex=u.global?n.index+n[0].length:e),l&&n&&n.length>1&&a.call(n[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n}),t.exports=u},function(t,e,r){var n=r(4),o=r(1).document,i=n(o)&&n(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e){var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},function(t,e){var r=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+n).toString(36))}},function(t,e,r){var n=r(6),o=r(1),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:r(25)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports=!1},function(t,e){t.exports={}},function(t,e,r){var n=r(2),o=r(14),i=r(0)("species");t.exports=function(t,e){var r,s=n(t).constructor;return void 0===s||null==(r=n(s)[i])?e:o(r)}},function(t,e,r){var n,o,i,s=r(13),a=r(48),u=r(49),c=r(21),l=r(1),f=l.process,h=l.setImmediate,p=l.clearImmediate,d=l.MessageChannel,y=l.Dispatch,v=0,m={},g=function(){var t=+this;if(m.hasOwnProperty(t)){var e=m[t];delete m[t],e()}},b=function(t){g.call(t.data)};h&&p||(h=function(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return m[++v]=function(){a("function"==typeof t?t:Function(t),e)},n(v),v},p=function(t){delete m[t]},"process"==r(5)(f)?n=function(t){f.nextTick(s(g,t,1))}:y&&y.now?n=function(t){y.now(s(g,t,1))}:d?(i=(o=new d).port2,o.port1.onmessage=b,n=s(i.postMessage,i,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(n=function(t){l.postMessage(t+"","*")},l.addEventListener("message",b,!1)):n="onreadystatechange"in c("script")?function(t){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),g.call(t)}}:function(t){setTimeout(s(g,t,1),0)}),t.exports={set:h,clear:p}},function(t,e,r){"use strict";var n=r(14);function o(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=n(e),this.reject=n(r)}t.exports.f=function(t){return new o(t)}},function(t,e,r){var n=r(4),o=r(5),i=r(0)("match");t.exports=function(t){var e;return n(t)&&(void 0!==(e=t[i])?!!e:"RegExp"==o(t))}},function(t,e,r){"use strict";var n=r(64)(!0);t.exports=function(t,e,r){return e+(r?n(t,e).length:1)}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){return null!==t&&"object"===n(t)}},function(t,e,r){t.exports=r(83)},function(t,e,r){var n=r(3);n(n.S+n.F*!r(7),"Object",{defineProperty:r(10).f})},function(t,e,r){t.exports=!r(7)&&!r(11)((function(){return 7!=Object.defineProperty(r(21)("div"),"a",{get:function(){return 7}}).a}))},function(t,e,r){var n=r(4);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,r){t.exports=r(24)("native-function-to-string",Function.toString)},function(t,e,r){var n=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function u(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,i=Object.create(o.prototype),s=new j(n||[]);return i._invoke=function(t,e,r){var n=l;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=E(s,r);if(a){if(a===d)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=c(t,e,r);if("normal"===u.type){if(n=r.done?p:f,u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(t,r,s),i}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l="suspendedStart",f="suspendedYield",h="executing",p="completed",d={};function y(){}function v(){}function m(){}var g={};g[i]=function(){return this};var b=Object.getPrototypeOf,_=b&&b(b(S([])));_&&_!==r&&n.call(_,i)&&(g=_);var w=m.prototype=y.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function T(t){var e;this._invoke=function(r,o){function i(){return new Promise((function(e,i){!function e(r,o,i,s){var a=c(t[r],t,o);if("throw"!==a.type){var u=a.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then((function(t){e("next",t,i,s)}),(function(t){e("throw",t,i,s)})):Promise.resolve(l).then((function(t){u.value=t,i(u)}),(function(t){return e("throw",t,i,s)}))}s(a.arg)}(r,o,e,i)}))}return e=e?e.then(i,i):i()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return d;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=c(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,d;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,d):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return s.next=s}}return{next:P}}function P(){return{value:e,done:!0}}return v.prototype=w.constructor=m,m.constructor=v,m[a]=v.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},x(T.prototype),T.prototype[s]=function(){return this},t.AsyncIterator=T,t.async=function(e,r,n,o){var i=new T(u(e,r,n,o));return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},x(w),w[a]="Generator",w[i]=function(){return this},w.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return a.type="throw",a.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var u=n.call(s,"catchLoc"),c=n.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:S(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),d}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){var n=r(3);n(n.S,"Array",{isArray:r(41)})},function(t,e,r){var n=r(5);t.exports=Array.isArray||function(t){return"Array"==n(t)}},function(t,e,r){"use strict";var n,o,i,s,a=r(25),u=r(1),c=r(13),l=r(15),f=r(3),h=r(4),p=r(14),d=r(43),y=r(44),v=r(27),m=r(28).set,g=r(50)(),b=r(29),_=r(51),w=r(52),x=r(53),T=u.TypeError,E=u.process,k=E&&E.versions,O=k&&k.v8||"",j=u.Promise,S="process"==l(E),P=function(){},A=o=b.f,R=!!function(){try{var t=j.resolve(1),e=(t.constructor={})[r(0)("species")]=function(t){t(P,P)};return(S||"function"==typeof PromiseRejectionEvent)&&t.then(P)instanceof e&&0!==O.indexOf("6.6")&&-1===w.indexOf("Chrome/66")}catch(t){}}(),C=function(t){var e;return!(!h(t)||"function"!=typeof(e=t.then))&&e},U=function(t,e){if(!t._n){t._n=!0;var r=t._c;g((function(){for(var n=t._v,o=1==t._s,i=0,s=function(e){var r,i,s,a=o?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{a?(o||(2==t._h&&M(t),t._h=1),!0===a?r=n:(l&&l.enter(),r=a(n),l&&(l.exit(),s=!0)),r===e.promise?c(T("Promise-chain cycle")):(i=C(r))?i.call(r,u,c):u(r)):c(n)}catch(t){l&&!s&&l.exit(),c(t)}};r.length>i;)s(r[i++]);t._c=[],t._n=!1,e&&!t._h&&I(t)}))}},I=function(t){m.call(u,(function(){var e,r,n,o=t._v,i=L(t);if(i&&(e=_((function(){S?E.emit("unhandledRejection",o,t):(r=u.onunhandledrejection)?r({promise:t,reason:o}):(n=u.console)&&n.error&&n.error("Unhandled promise rejection",o)})),t._h=S||L(t)?2:1),t._a=void 0,i&&e.e)throw e.v}))},L=function(t){return 1!==t._h&&0===(t._a||t._c).length},M=function(t){m.call(u,(function(){var e;S?E.emit("rejectionHandled",t):(e=u.onrejectionhandled)&&e({promise:t,reason:t._v})}))},q=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),U(e,!0))},D=function(t){var e,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw T("Promise can't be resolved itself");(e=C(t))?g((function(){var n={_w:r,_d:!1};try{e.call(t,c(D,n,1),c(q,n,1))}catch(t){q.call(n,t)}})):(r._v=t,r._s=1,U(r,!1))}catch(t){q.call({_w:r,_d:!1},t)}}};R||(j=function(t){d(this,j,"Promise","_h"),p(t),n.call(this);try{t(c(D,this,1),c(q,this,1))}catch(t){q.call(this,t)}},(n=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(54)(j.prototype,{then:function(t,e){var r=A(v(this,j));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=S?E.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&U(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new n;this.promise=t,this.resolve=c(D,t,1),this.reject=c(q,t,1)},b.f=A=function(t){return t===j||t===s?new i(t):o(t)}),f(f.G+f.W+f.F*!R,{Promise:j}),r(55)(j,"Promise"),r(56)("Promise"),s=r(6).Promise,f(f.S+f.F*!R,"Promise",{reject:function(t){var e=A(this);return(0,e.reject)(t),e.promise}}),f(f.S+f.F*(a||!R),"Promise",{resolve:function(t){return x(a&&this===s?j:this,t)}}),f(f.S+f.F*!(R&&r(57)((function(t){j.all(t).catch(P)}))),"Promise",{all:function(t){var e=this,r=A(e),n=r.resolve,o=r.reject,i=_((function(){var r=[],i=0,s=1;y(t,!1,(function(t){var a=i++,u=!1;r.push(void 0),s++,e.resolve(t).then((function(t){u||(u=!0,r[a]=t,--s||n(r))}),o)})),--s||n(r)}));return i.e&&o(i.v),r.promise},race:function(t){var e=this,r=A(e),n=r.reject,o=_((function(){y(t,!1,(function(t){e.resolve(t).then(r.resolve,n)}))}));return o.e&&n(o.v),r.promise}})},function(t,e){t.exports=function(t,e,r,n){if(!(t instanceof e)||void 0!==n&&n in t)throw TypeError(r+": incorrect invocation!");return t}},function(t,e,r){var n=r(13),o=r(45),i=r(46),s=r(2),a=r(16),u=r(47),c={},l={};(e=t.exports=function(t,e,r,f,h){var p,d,y,v,m=h?function(){return t}:u(t),g=n(r,f,e?2:1),b=0;if("function"!=typeof m)throw TypeError(t+" is not iterable!");if(i(m)){for(p=a(t.length);p>b;b++)if((v=e?g(s(d=t[b])[0],d[1]):g(t[b]))===c||v===l)return v}else for(y=m.call(t);!(d=y.next()).done;)if((v=o(y,g,d.value,e))===c||v===l)return v}).BREAK=c,e.RETURN=l},function(t,e,r){var n=r(2);t.exports=function(t,e,r,o){try{return o?e(n(r)[0],r[1]):e(r)}catch(e){var i=t.return;throw void 0!==i&&n(i.call(t)),e}}},function(t,e,r){var n=r(26),o=r(0)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(n.Array===t||i[o]===t)}},function(t,e,r){var n=r(15),o=r(0)("iterator"),i=r(26);t.exports=r(6).getIteratorMethod=function(t){if(null!=t)return t[o]||t["@@iterator"]||i[n(t)]}},function(t,e){t.exports=function(t,e,r){var n=void 0===r;switch(e.length){case 0:return n?t():t.call(r);case 1:return n?t(e[0]):t.call(r,e[0]);case 2:return n?t(e[0],e[1]):t.call(r,e[0],e[1]);case 3:return n?t(e[0],e[1],e[2]):t.call(r,e[0],e[1],e[2]);case 4:return n?t(e[0],e[1],e[2],e[3]):t.call(r,e[0],e[1],e[2],e[3])}return t.apply(r,e)}},function(t,e,r){var n=r(1).document;t.exports=n&&n.documentElement},function(t,e,r){var n=r(1),o=r(28).set,i=n.MutationObserver||n.WebKitMutationObserver,s=n.process,a=n.Promise,u="process"==r(5)(s);t.exports=function(){var t,e,r,c=function(){var n,o;for(u&&(n=s.domain)&&n.exit();t;){o=t.fn,t=t.next;try{o()}catch(n){throw t?r():e=void 0,n}}e=void 0,n&&n.enter()};if(u)r=function(){s.nextTick(c)};else if(!i||n.navigator&&n.navigator.standalone)if(a&&a.resolve){var l=a.resolve(void 0);r=function(){l.then(c)}}else r=function(){o.call(n,c)};else{var f=!0,h=document.createTextNode("");new i(c).observe(h,{characterData:!0}),r=function(){h.data=f=!f}}return function(n){var o={fn:n,next:void 0};e&&(e.next=o),t||(t=o,r()),e=o}}},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,r){var n=r(1).navigator;t.exports=n&&n.userAgent||""},function(t,e,r){var n=r(2),o=r(4),i=r(29);t.exports=function(t,e){if(n(t),o(e)&&e.constructor===t)return e;var r=i.f(t);return(0,r.resolve)(e),r.promise}},function(t,e,r){var n=r(12);t.exports=function(t,e,r){for(var o in e)n(t,o,e[o],r);return t}},function(t,e,r){var n=r(10).f,o=r(22),i=r(0)("toStringTag");t.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,i)&&n(t,i,{configurable:!0,value:e})}},function(t,e,r){"use strict";var n=r(1),o=r(10),i=r(7),s=r(0)("species");t.exports=function(t){var e=n[t];i&&e&&!e[s]&&o.f(e,s,{configurable:!0,get:function(){return this}})}},function(t,e,r){var n=r(0)("iterator"),o=!1;try{var i=[7][n]();i.return=function(){o=!0},Array.from(i,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var r=!1;try{var i=[7],s=i[n]();s.next=function(){return{done:r=!0}},i[n]=function(){return s},t(i)}catch(t){}return r}},function(t,e,r){"use strict";var n=r(15),o={};o[r(0)("toStringTag")]="z",o+""!="[object z]"&&r(12)(Object.prototype,"toString",(function(){return"[object "+n(this)+"]"}),!0)},function(t,e,r){"use strict";var n=r(2),o=r(60),i=r(18);r(19)("search",1,(function(t,e,r,s){return[function(r){var n=t(this),o=null==r?void 0:r[e];return void 0!==o?o.call(r,n):new RegExp(r)[e](String(n))},function(t){var e=s(r,t,this);if(e.done)return e.value;var a=n(t),u=String(this),c=a.lastIndex;o(c,0)||(a.lastIndex=0);var l=i(a,u);return o(a.lastIndex,c)||(a.lastIndex=c),null===l?-1:l.index}]}))},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},function(t,e,r){"use strict";var n=r(20);r(3)({target:"RegExp",proto:!0,forced:n!==/./.exec},{exec:n})},function(t,e,r){"use strict";var n=r(2);t.exports=function(){var t=n(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,r){"use strict";var n=r(30),o=r(2),i=r(27),s=r(31),a=r(16),u=r(18),c=r(20),l=r(11),f=Math.min,h=[].push,p=!l((function(){RegExp(4294967295,"y")}));r(19)("split",2,(function(t,e,r,l){var d;return d="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,e){var o=String(this);if(void 0===t&&0===e)return[];if(!n(t))return r.call(o,t,e);for(var i,s,a,u=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),f=0,p=void 0===e?4294967295:e>>>0,d=new RegExp(t.source,l+"g");(i=c.call(d,o))&&!((s=d.lastIndex)>f&&(u.push(o.slice(f,i.index)),i.length>1&&i.index<o.length&&h.apply(u,i.slice(1)),a=i[0].length,f=s,u.length>=p));)d.lastIndex===i.index&&d.lastIndex++;return f===o.length?!a&&d.test("")||u.push(""):u.push(o.slice(f)),u.length>p?u.slice(0,p):u}:"0".split(void 0,0).length?function(t,e){return void 0===t&&0===e?[]:r.call(this,t,e)}:r,[function(r,n){var o=t(this),i=null==r?void 0:r[e];return void 0!==i?i.call(r,o,n):d.call(String(o),r,n)},function(t,e){var n=l(d,t,this,e,d!==r);if(n.done)return n.value;var c=o(t),h=String(this),y=i(c,RegExp),v=c.unicode,m=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(p?"y":"g"),g=new y(p?c:"^(?:"+c.source+")",m),b=void 0===e?4294967295:e>>>0;if(0===b)return[];if(0===h.length)return null===u(g,h)?[h]:[];for(var _=0,w=0,x=[];w<h.length;){g.lastIndex=p?w:0;var T,E=u(g,p?h:h.slice(w));if(null===E||(T=f(a(g.lastIndex+(p?0:w)),h.length))===_)w=s(h,w,v);else{if(x.push(h.slice(_,w)),x.length===b)return x;for(var k=1;k<=E.length-1;k++)if(x.push(E[k]),x.length===b)return x;w=_=T}}return x.push(h.slice(_)),x}]}))},function(t,e,r){var n=r(17),o=r(8);t.exports=function(t){return function(e,r){var i,s,a=String(o(e)),u=n(r),c=a.length;return u<0||u>=c?t?"":void 0:(i=a.charCodeAt(u))<55296||i>56319||u+1===c||(s=a.charCodeAt(u+1))<56320||s>57343?t?a.charAt(u):i:t?a.slice(u,u+2):s-56320+(i-55296<<10)+65536}}},function(t,e,r){"use strict";var n=r(2),o=r(66),i=r(16),s=r(17),a=r(31),u=r(18),c=Math.max,l=Math.min,f=Math.floor,h=/\$([$&`']|\d\d?|<[^>]*>)/g,p=/\$([$&`']|\d\d?)/g;r(19)("replace",2,(function(t,e,r,d){return[function(n,o){var i=t(this),s=null==n?void 0:n[e];return void 0!==s?s.call(n,i,o):r.call(String(i),n,o)},function(t,e){var o=d(r,t,this,e);if(o.done)return o.value;var f=n(t),h=String(this),p="function"==typeof e;p||(e=String(e));var v=f.global;if(v){var m=f.unicode;f.lastIndex=0}for(var g=[];;){var b=u(f,h);if(null===b)break;if(g.push(b),!v)break;""===String(b[0])&&(f.lastIndex=a(h,i(f.lastIndex),m))}for(var _,w="",x=0,T=0;T<g.length;T++){b=g[T];for(var E=String(b[0]),k=c(l(s(b.index),h.length),0),O=[],j=1;j<b.length;j++)O.push(void 0===(_=b[j])?_:String(_));var S=b.groups;if(p){var P=[E].concat(O,k,h);void 0!==S&&P.push(S);var A=String(e.apply(void 0,P))}else A=y(E,h,k,O,S,e);k>=x&&(w+=h.slice(x,k)+A,x=k+E.length)}return w+h.slice(x)}];function y(t,e,n,i,s,a){var u=n+t.length,c=i.length,l=p;return void 0!==s&&(s=o(s),l=h),r.call(a,l,(function(r,o){var a;switch(o.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,n);case"'":return e.slice(u);case"<":a=s[o.slice(1,-1)];break;default:var l=+o;if(0===l)return r;if(l>c){var h=f(l/10);return 0===h?r:h<=c?void 0===i[h-1]?o.charAt(1):i[h-1]+o.charAt(1):r}a=i[l-1]}return void 0===a?"":a}))}}))},function(t,e,r){var n=r(8);t.exports=function(t){return Object(n(t))}},function(t,e,r){"use strict";var n=r(3),o=r(68)(!0);n(n.P,"Array",{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(72)("includes")},function(t,e,r){var n=r(69),o=r(16),i=r(71);t.exports=function(t){return function(e,r,s){var a,u=n(e),c=o(u.length),l=i(s,c);if(t&&r!=r){for(;c>l;)if((a=u[l++])!=a)return!0}else for(;c>l;l++)if((t||l in u)&&u[l]===r)return t||l||0;return!t&&-1}}},function(t,e,r){var n=r(70),o=r(8);t.exports=function(t){return n(o(t))}},function(t,e,r){var n=r(5);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},function(t,e,r){var n=r(17),o=Math.max,i=Math.min;t.exports=function(t,e){return(t=n(t))<0?o(t+e,0):i(t,e)}},function(t,e,r){var n=r(0)("unscopables"),o=Array.prototype;null==o[n]&&r(9)(o,n,{}),t.exports=function(t){o[n][t]=!0}},function(t,e,r){"use strict";var n=r(3),o=r(74);n(n.P+n.F*r(75)("includes"),"String",{includes:function(t){return!!~o(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,r){var n=r(30),o=r(8);t.exports=function(t,e,r){if(n(e))throw TypeError("String#"+r+" doesn't accept regex!");return String(o(t))}},function(t,e,r){var n=r(0)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[n]=!1,!"/./"[t](e)}catch(t){}}return!0}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o;"undefined"!=typeof window?o=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),o=void 0):o=self;var i=r(77),s=r(78),a=r(79),u=r(32),c=r(80),l=r(82);function f(){}t.exports=function(t,r){return"function"==typeof r?new e.Request("GET",t).end(r):1===arguments.length?new e.Request("GET",t):new e.Request(t,r)};var h=e=t.exports;e.Request=b,h.getXHR=function(){if(o.XMLHttpRequest&&(!o.location||"file:"!==o.location.protocol||!o.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw new Error("Browser-only version of superagent could not find XHR")};var p="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};function d(t){if(!u(t))return t;var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&y(e,r,t[r]);return e.join("&")}function y(t,e,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))r.forEach((function(r){y(t,e,r)}));else if(u(r))for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&y(t,"".concat(e,"[").concat(n,"]"),r[n]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(r));else t.push(encodeURIComponent(e))}function v(t){for(var e,r,n={},o=t.split("&"),i=0,s=o.length;i<s;++i)-1===(r=(e=o[i]).indexOf("="))?n[decodeURIComponent(e)]="":n[decodeURIComponent(e.slice(0,r))]=decodeURIComponent(e.slice(r+1));return n}function m(t){return/[\/+]json($|[^-\w])/.test(t)}function g(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var e=this.xhr.status;1223===e&&(e=204),this._setStatusProperties(e),this.headers=function(t){for(var e,r,n,o,i=t.split(/\r?\n/),s={},a=0,u=i.length;a<u;++a)-1!==(e=(r=i[a]).indexOf(":"))&&(n=r.slice(0,e).toLowerCase(),o=p(r.slice(e+1)),s[n]=o);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function b(t,e){var r=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",(function(){var t,e=null,n=null;try{n=new g(r)}catch(t){return(e=new Error("Parser is unable to parse the response")).parse=!0,e.original=t,r.xhr?(e.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,e.status=r.xhr.status?r.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),r.callback(e)}r.emit("response",n);try{r._isResponseOK(n)||(t=new Error(n.statusText||"Unsuccessful HTTP response"))}catch(e){t=e}t?(t.original=e,t.response=n,t.status=n.status,r.callback(t,n)):r.callback(null,n)}))}function _(t,e,r){var n=h("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n}h.serializeObject=d,h.parseString=v,h.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"},h.serialize={"application/x-www-form-urlencoded":d,"application/json":s},h.parse={"application/x-www-form-urlencoded":v,"application/json":JSON.parse},c(g.prototype),g.prototype._parseBody=function(t){var e=h.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&m(this.type)&&(e=h.parse["application/json"]),e&&t&&(t.length>0||t instanceof Object)?e(t):null)},g.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,n="cannot ".concat(e," ").concat(r," (").concat(this.status,")"),o=new Error(n);return o.status=this.status,o.method=e,o.url=r,o},h.Response=g,i(b.prototype),a(b.prototype),b.prototype.type=function(t){return this.set("Content-Type",h.types[t]||t),this},b.prototype.accept=function(t){return this.set("Accept",h.types[t]||t),this},b.prototype.auth=function(t,e,r){1===arguments.length&&(e=""),"object"===n(e)&&null!==e&&(r=e,e=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var o=function(t){if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(t,e,r,o)},b.prototype.query=function(t){return"string"!=typeof t&&(t=d(t)),t&&this._query.push(t),this},b.prototype.attach=function(t,e,r){if(e){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,r||e.name)}return this},b.prototype._getFormData=function(){return this._formData||(this._formData=new o.FormData),this._formData},b.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();var r=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),r(t,e)},b.prototype.crossDomainError=function(){var t=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.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},b.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},b.prototype.buffer=b.prototype.ca,b.prototype.ca=b.prototype.agent,b.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},b.prototype.pipe=b.prototype.write,b.prototype._isHost=function(t){return t&&"object"===n(t)&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},b.prototype.end=function(t){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||f,this._finalizeQueryString(),this._end()},b.prototype._setUploadTimeout=function(){var t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},b.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var t=this;this.xhr=h.getXHR();var e=this.xhr,r=this._formData||this._data;this._setTimeouts(),e.onreadystatechange=function(){var r=e.readyState;if(r>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4===r){var n;try{n=e.status}catch(t){n=0}if(!n){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")}};var n=function(e,r){r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(t._uploadTimeoutTimer)),r.direction=e,t.emit("progress",r)};if(this.hasListeners("progress"))try{e.addEventListener("progress",n.bind(null,"download")),e.upload&&e.upload.addEventListener("progress",n.bind(null,"upload"))}catch(t){}e.upload&&this._setUploadTimeout();try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(t){return this.callback(t)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){var o=this._header["content-type"],i=this._serializer||h.serialize[o?o.split(";")[0]:""];!i&&m(o)&&(i=h.serialize["application/json"]),i&&(r=i(r))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&e.setRequestHeader(s,this.header[s]);this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send(void 0===r?null:r)},h.agent=function(){return new l},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(t){l.prototype[t.toLowerCase()]=function(e,r){var n=new h.Request(t,e);return this._setDefaults(n),r&&n.end(r),n}})),l.prototype.del=l.prototype.delete,h.get=function(t,e,r){var n=h("GET",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},h.head=function(t,e,r){var n=h("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},h.options=function(t,e,r){var n=h("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},h.del=_,h.delete=_,h.patch=function(t,e,r){var n=h("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},h.post=function(t,e,r){var n=h("POST",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},h.put=function(t,e,r){var n=h("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n}},function(t,e,r){function n(t){if(t)return function(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}(t)}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){t.exports=o,o.default=o,o.stable=s,o.stableStringify=s;var r=[],n=[];function o(t,e,o){var i;for(!function t(e,o,i,s){var a;if("object"==typeof e&&null!==e){for(a=0;a<i.length;a++)if(i[a]===e){var u=Object.getOwnPropertyDescriptor(s,o);return void(void 0!==u.get?u.configurable?(Object.defineProperty(s,o,{value:"[Circular]"}),r.push([s,o,e,u])):n.push([e,o]):(s[o]="[Circular]",r.push([s,o,e])))}if(i.push(e),Array.isArray(e))for(a=0;a<e.length;a++)t(e[a],a,i,e);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var l=c[a];t(e[l],l,i,e)}}i.pop()}}(t,"",[],void 0),i=0===n.length?JSON.stringify(t,e,o):JSON.stringify(t,a(e),o);0!==r.length;){var s=r.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}return i}function i(t,e){return t<e?-1:t>e?1:0}function s(t,e,o){var s,u=function t(e,o,s,a){var u;if("object"==typeof e&&null!==e){for(u=0;u<s.length;u++)if(s[u]===e){var c=Object.getOwnPropertyDescriptor(a,o);return void(void 0!==c.get?c.configurable?(Object.defineProperty(a,o,{value:"[Circular]"}),r.push([a,o,e,c])):n.push([e,o]):(a[o]="[Circular]",r.push([a,o,e])))}if("function"==typeof e.toJSON)return;if(s.push(e),Array.isArray(e))for(u=0;u<e.length;u++)t(e[u],u,s,e);else{var l={},f=Object.keys(e).sort(i);for(u=0;u<f.length;u++){var h=f[u];t(e[h],h,s,e),l[h]=e[h]}if(void 0===a)return l;r.push([a,o,e]),a[o]=l}s.pop()}}(t,"",[],void 0)||t;for(s=0===n.length?JSON.stringify(u,e,o):JSON.stringify(u,a(e),o);0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}return s}function a(t){return t=void 0!==t?t:function(t,e){return e},function(e,r){if(n.length>0)for(var o=0;o<n.length;o++){var i=n[o];if(i[1]===e&&i[0]===r){r="[Circular]",n.splice(o,1);break}}return t.call(this,e,r)}}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(32);function i(t){if(t)return function(t){for(var e in i.prototype)Object.prototype.hasOwnProperty.call(i.prototype,e)&&(t[e]=i.prototype[e]);return t}(t)}t.exports=i,i.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},i.prototype.parse=function(t){return this._parser=t,this},i.prototype.responseType=function(t){return this._responseType=t,this},i.prototype.serialize=function(t){return this._serializer=t,this},i.prototype.timeout=function(t){if(!t||"object"!==n(t))return this._timeout=t,this._responseTimeout=0,this._uploadTimeout=0,this;for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;case"upload":this._uploadTimeout=t.upload;break;default:console.warn("Unknown timeout option",e)}return this},i.prototype.retry=function(t,e){return 0!==arguments.length&&!0!==t||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this._retryCallback=e,this};var s=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];i.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(t,e);if(!0===r)return!0;if(!1===r)return!1}catch(t){console.error(t)}if(e&&e.status&&e.status>=500&&501!==e.status)return!0;if(t){if(t.code&&-1!==s.indexOf(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},i.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},i.prototype.then=function(t,e){var r=this;if(!this._fullfilledPromise){var n=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(t,e){n.on("abort",(function(){var t=new Error("Aborted");t.code="ABORTED",t.status=r.status,t.method=r.method,t.url=r.url,e(t)})),n.end((function(r,n){r?e(r):t(n)}))}))}return this._fullfilledPromise.then(t,e)},i.prototype.catch=function(t){return this.then(void 0,t)},i.prototype.use=function(t){return t(this),this},i.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},i.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(t,e){if(o(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.prototype.field=function(t,e){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(o(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.field(r,t[r]);return this}if(Array.isArray(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.field(t,e[n]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=String(e)),this._getFormData().append(t,e),this},i.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)},i.prototype._auth=function(t,e,r,n){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(n("".concat(t,":").concat(e))));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer ".concat(t))}return this},i.prototype.withCredentials=function(t){return void 0===t&&(t=!0),this._withCredentials=t,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(t){var e=o(t),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(e&&o(this._data))for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this._data[n]=t[n]);else"string"==typeof t?(r||this.type("form"),r=this._header["content-type"],this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(t):t:(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(r||this.type("json"),this)},i.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},i.prototype._finalizeQueryString=function(){var t=this._query.join("&");if(t&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+t),this._query.length=0,this._sort){var e=this.url.indexOf("?");if(e>=0){var r=this.url.substring(e+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.substring(0,e)+"?"+r.join("&")}}},i.prototype._appendQueryString=function(){console.warn("Unsupported")},i.prototype._timeoutError=function(t,e,r){if(!this._aborted){var n=new Error("".concat(t+e,"ms exceeded"));n.timeout=e,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.abort(),this.callback(n)}},i.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){t._timeoutError("Timeout of ",t._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},function(t,e,r){"use strict";var n=r(81);function o(t){if(t)return function(t){for(var e in o.prototype)Object.prototype.hasOwnProperty.call(o.prototype,e)&&(t[e]=o.prototype[e]);return t}(t)}t.exports=o,o.prototype.get=function(t){return this.header[t.toLowerCase()]},o.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=n.type(e);var r=n.params(e);for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(this[o]=r[o]);this.links={};try{t.link&&(this.links=n.parseLinks(t.link))}catch(t){}},o.prototype._setStatusProperties=function(t){var e=t/100|0;this.statusCode=t,this.status=this.statusCode,this.statusType=e,this.info=1===e,this.ok=2===e,this.redirect=3===e,this.clientError=4===e,this.serverError=5===e,this.error=(4===e||5===e)&&this.toError(),this.created=201===t,this.accepted=202===t,this.noContent=204===t,this.badRequest=400===t,this.unauthorized=401===t,this.notAcceptable=406===t,this.forbidden=403===t,this.notFound=404===t,this.unprocessableEntity=422===t}},function(t,e,r){"use strict";e.type=function(t){return t.split(/ *; */).shift()},e.params=function(t){return t.split(/ *; */).reduce((function(t,e){var r=e.split(/ *= */),n=r.shift(),o=r.shift();return n&&o&&(t[n]=o),t}),{})},e.parseLinks=function(t){return t.split(/ *, */).reduce((function(t,e){var r=e.split(/ *; */),n=r[0].slice(1,-1);return t[r[1].split(/ *= */)[1].slice(1,-1)]=n,t}),{})},e.cleanHeader=function(t,e){return delete t["content-type"],delete t["content-length"],delete t["transfer-encoding"],delete t.host,e&&(delete t.authorization,delete t.cookie),t}},function(t,e,r){"use strict";function n(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach((function(t){o.prototype[t]=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return this._defaults.push({fn:t,args:r}),this}})),o.prototype._setDefaults=function(t){this._defaults.forEach((function(e){t[e.fn].apply(t,n(e.args))}))},t.exports=o},function(t,e,r){"use strict";r.r(e);r(34),r(39),r(40),r(42),r(58),r(59),r(63),r(65),r(67),r(73);function n(t,e,r,n,o,i,s){try{var a=t[i](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var s=t.apply(e,r);function a(t){n(s,o,i,a,u,"next",t)}function u(t){n(s,o,i,a,u,"throw",t)}a(void 0)}))}}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s=r(76),a=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var r=e.authUrl,n=e.clientId,o=e.storage,i=e.loginUrl,s=e.logoutUrl,a=e.userFetchUrl,u=e.accessCheckUrl;this.authUrl=r||"https://moauth.fagbokforlaget.no",this.currentUser=void 0,this.token=void 0,this.clientId=n,this.storage=o||window.localStorage,this.loginUrl=i||this.authUrl+"/_auth/login",this.logoutUrl=s,this.userFetchUrl=a||this.authUrl+"/_auth/user?token=",this.accessCheckUrl=u||this.authUrl+"/_auth/access"}var e,r,n,a;return e=t,(r=[{key:"_loginUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.loginUrl.includes("?")||(this.loginUrl+="?"),this.loginUrl+"&client_id="+(this.clientId||"generic")+"&redirect_url="+encodeURIComponent(t)+"&scope="+(e||"dbok")}},{key:"_parseQueryString",value:function(t){var e=/\+/g,r=/([^&=]+)=?([^&]*)/g,n=function(t){return decodeURIComponent(t.replace(e," "))},o={},i=t.substring(1);for(/\?/.test(i)&&(i=i.split("?")[1]);;){var s=r.exec(i);if(!s)break;o[n(s[1])]=n(s[2])}return o}},{key:"authorize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.redirectUrl,r=t.scope;window.location=this._loginUrl(e||window.location,r)}},{key:"getUser",value:function(){var t=this.storage.getItem("user");return this.currentUser?this.currentUser:t?JSON.parse(t):void 0}},{key:"checkToken",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.search,r=this._parseQueryString(e),n=this;return n.token=r.token||r.access_token||this.storage.getItem("token")||void 0,new Promise((function(e,r){n.isAuthenticated()&&n.token&&void 0!==n.token&&e(n.getUser()),n.token&&void 0!==n.token?(window&&window.history.replaceState({},"",window.location.pathname+window.location.hash||""),n.storage.setItem("token",n.token),n.fetchUser(t.userFetchUrl+encodeURIComponent(n.token)).then((function(t){e(t)})).catch((function(t){r(t)}))):r(new Error("access token not found"))}))}},{key:"checkAccess",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.token||this.storage.getItem("token")||void 0,n=Array.isArray(e)?e:[e],i=this.getUser();return new Promise(function(){var e=o(regeneratorRuntime.mark((function e(o,s){var a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r||void 0===r){e.next=7;break}return e.next=3,t.fetchAccess(t.accessCheckUrl,{token:r,productIds:n});case 3:a=e.sent,o({success:!0,user:i,products:a}),e.next=8;break;case 7:throw new Error("access token not found");case 8:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}())}},{key:"fetchUser",value:function(t){var e=this;return new Promise((function(r,n){s.get(t).then((function(t){if(200===t.statusCode&&t.body){var o=t.body,i=o.user||o.objects[0];e.storage.setItem("user",JSON.stringify(i)),r(i)}else n(new Error("authentication failed: Invalid response"))})).catch((function(t){n(t)}))}))}},{key:"fetchAccess",value:function(t,e){return new Promise((function(r,n){s.post(t).send(e).set("Accept","application/json").then((function(t){200===t.statusCode&&t.body&&(t.body.success?r(t.body.products):n(new Error("This user does not have access to this product")))})).catch((function(t){n(t)}))}))}},{key:"logout",value:(a=o(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.storage.removeItem("user"),this.storage.removeItem("token"),(e=e||this.logoutUrl)&&(window.location=e);case 4:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"isAuthenticated",value:function(){return!!this.getUser()}}])&&i(e.prototype,r),n&&i(e,n),t}();e.default=a}])}));
2//# sourceMappingURL=moauth.bundle.js.map
\No newline at end of file