UNPKG

@lando/platformsh

Version:

A Lando plugin that provides a tight integration with Platform.sh.

2 lines 345 kB
/*! For license information please see index.js.LICENSE.txt */ !function(p,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var a=e();for(var d in a)("object"==typeof exports?exports:p)[d]=a[d]}}(global,(function(){return function(p){var e={};function a(d){if(e[d])return e[d].exports;var m=e[d]={i:d,l:!1,exports:{}};return p[d].call(m.exports,m,m.exports,a),m.l=!0,m.exports}return a.m=p,a.c=e,a.d=function(p,e,d){a.o(p,e)||Object.defineProperty(p,e,{enumerable:!0,get:d})},a.r=function(p){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},a.t=function(p,e){if(1&e&&(p=a(p)),8&e)return p;if(4&e&&"object"==typeof p&&p&&p.__esModule)return p;var d=Object.create(null);if(a.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:p}),2&e&&"string"!=typeof p)for(var m in p)a.d(d,m,function(e){return p[e]}.bind(null,m));return d},a.n=function(p){var e=p&&p.__esModule?function(){return p.default}:function(){return p};return a.d(e,"a",e),e},a.o=function(p,e){return Object.prototype.hasOwnProperty.call(p,e)},a.p="",a(a.s=18)}([,function(p,e,a){"use strict";a.d(e,"b",(function(){return i})),a.d(e,"a",(function(){return l}));var d=function(){var p=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://accounts.platform.sh",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https://api.platform.sh/api";return{provider:"cg",client_id:"platform@d4tobd5qpizwa.eu.platform.sh",account_url:"".concat(p.replace(/(\/api\/?)$/,""),"/api"),api_url:e,authentication_url:p,scope:[],authorization:"".concat(p,"/oauth2/authorize"),logout_url:"".concat(p,"/user/logout"),prompt:"",redirect_uri:"",response_type:"code"}},m=d(),i=function(p){m=Object.assign(Object.assign({},d(p.base_url,p.api_url)),p)},l=function(){return m}},function(p,e,a){var d=a(38)();p.exports=d;try{regeneratorRuntime=d}catch(p){"object"==typeof globalThis?globalThis.regeneratorRuntime=d:Function("r","regeneratorRuntime = r")(d)}},,function(p,e){p.exports=function(p,e){if(!(p instanceof e))throw new TypeError("Cannot call a class as a function")},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e,a){var d=a(29);function m(p,e){for(var a=0;a<e.length;a++){var m=e[a];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(p,d(m.key),m)}}p.exports=function(p,e,a){return e&&m(p.prototype,e),a&&m(p,a),Object.defineProperty(p,"prototype",{writable:!1}),p},p.exports.__esModule=!0,p.exports.default=p.exports},,,,function(p,e,a){"use strict";a.d(e,"f",(function(){return v})),a.d(e,"d",(function(){return c})),a.d(e,"e",(function(){return _})),a.d(e,"a",(function(){return g})),a.d(e,"b",(function(){return b}));var d,m=a(22),i=a.n(m),l=a(23),t=a.n(l),o=(a(26),a(32)),r=a.n(o),s=a(16),n=a(1),u=a(18),v=function(p){d=p},c=function(){return d},h={};s.a&&(h["Content-Type"]="application/json");var f=function(p){return"undefined"!=typeof FormData&&p instanceof FormData},w=function(p){var e=(p.get("WWW-Authenticate")||"").replace("Bearer","").split(",").reduce((function(p,e){var a=e.replace(/"/g,"").trim().split("="),d=t()(a,2),m=d[0],i=d[1];return p[m]=i,p}),{});return["max_age","acr_values"].reduce((function(p,a){return e[a]&&(p[a]=e[a]),p}),{})},_=function(p,e,a){var d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},m=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},t=a instanceof Array?a&&i()(a):a&&Object.assign({},a),o=p;if("GET"===e){var s=r()(t||{},"",{arrayPrefix:l.queryStringArrayPrefix||""});o="".concat(p).concat(s.length?"?".concat(s):"")}var v=Object.assign(Object.assign({method:e},l),{headers:Object.assign(Object.assign({},h),d)});if("GET"!==e&&"HEAD"!==e&&t){var c=f(a)?a:JSON.stringify(t);v.body=c}return new Promise((function(i,t){fetch(o,v).then((function(o){if(401===o.status){var r=Object(n.a)(),s=w(o.headers);if(void 0===r.access_token&&m<2)return Object(u.default)(Object.assign(Object.assign({},r),{extra_params:s}),!0).then((function(t){i(g(p,e,a,d,m+1,l))}))}var v=o.headers.get("Content-Type"),c=!v||"application/json"===v||"application/hal+json; charset=utf-8"===v;return o.ok?v&&["image/gif","image/jpeg","image/png"].includes(v)||202===o.status?i(o):i(o.text().then((function(p){var e;try{e=JSON.parse(p)}catch(a){e=p}return e}))):c?o.json().then((function(p){return t(p)})).catch((function(p){console.log(p)})):o.text().then((function(p){return t(p)}))})).catch((function(p){t(p)}))}))},g=function p(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",m=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,t=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};return d.then((function(d){if(!d)throw new Error("Token is mandatory");i.hasOwnProperty("Content-Type")||f(m)||(i["Content-Type"]="application/json");var o=Math.round((new Date).getTime()/1e3),r=d.expires;if(-1!==r&&o>=r){var s=Object(n.a)();return console.log("Token expiration detected"),Object(u.default)(s,!0).then((function(d){return p(e,a,m,i,l+1,t)}))}var v={Authorization:"Bearer ".concat(d.access_token)};return _(e,a,m,Object.assign(Object.assign({},i),v),l,t)}))},b=function(p){return d.then((function(e){return new window.EventSource("".concat(p,"?access_token=").concat(e.access_token))}))};e.c=g},,function(p,e){p.exports=require("stream")},function(p,e,a){"use strict";const d=a(30),m=a(48),i={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},l=Symbol("failure");function t(p){return d.ucs2.decode(p).length}function o(p,e){const a=p[e];return isNaN(a)?void 0:String.fromCodePoint(a)}function r(p){return p>=48&&p<=57}function s(p){return p>=65&&p<=90||p>=97&&p<=122}function n(p){return r(p)||p>=65&&p<=70||p>=97&&p<=102}function u(p){return"."===p||"%2e"===p.toLowerCase()}function v(p){return 2===p.length&&s(p.codePointAt(0))&&(":"===p[1]||"|"===p[1])}function c(p){return void 0!==i[p]}function h(p){return c(p.scheme)}function f(p){let e=p.toString(16).toUpperCase();return 1===e.length&&(e="0"+e),"%"+e}function w(p){return p<=31||p>126}const _=new Set([32,34,35,60,62,63,96,123,125]);function g(p){return w(p)||_.has(p)}const b=new Set([47,58,59,61,64,91,92,93,94,124]);function y(p){return g(p)||b.has(p)}function N(p,e){const a=String.fromCodePoint(p);return e(p)?function(p){const e=new Buffer(p);let a="";for(let p=0;p<e.length;++p)a+=f(e[p]);return a}(a):a}function V(p){let e=10;if(p.length>=2&&"0"===p.charAt(0)&&"x"===p.charAt(1).toLowerCase()?(p=p.substring(2),e=16):p.length>=2&&"0"===p.charAt(0)&&(p=p.substring(1),e=8),""===p)return 0;return(10===e?/[^0-9]/:16===e?/[^0-9A-Fa-f]/:/[^0-7]/).test(p)?l:parseInt(p,e)}function S(p,e){if("["===p[0])return"]"!==p[p.length-1]?l:function(p){const e=[0,0,0,0,0,0,0,0];let a=0,m=null,i=0;if(58===(p=d.ucs2.decode(p))[i]){if(58!==p[i+1])return l;i+=2,++a,m=a}for(;i<p.length;){if(8===a)return l;if(58===p[i]){if(null!==m)return l;++i,++a,m=a;continue}let d=0,t=0;for(;t<4&&n(p[i]);)d=16*d+parseInt(o(p,i),16),++i,++t;if(46===p[i]){if(0===t)return l;if(i-=t,a>6)return l;let d=0;for(;void 0!==p[i];){let m=null;if(d>0){if(!(46===p[i]&&d<4))return l;++i}if(!r(p[i]))return l;for(;r(p[i]);){const e=parseInt(o(p,i));if(null===m)m=e;else{if(0===m)return l;m=10*m+e}if(m>255)return l;++i}e[a]=256*e[a]+m,++d,2!==d&&4!==d||++a}if(4!==d)return l;break}if(58===p[i]){if(++i,void 0===p[i])return l}else if(void 0!==p[i])return l;e[a]=d,++a}if(null!==m){let p=a-m;for(a=7;0!==a&&p>0;){const d=e[m+p-1];e[m+p-1]=e[a],e[a]=d,--a,--p}}else if(null===m&&8!==a)return l;return e}(p.substring(1,p.length-1));if(!e)return function(p){if(e=p,-1!==e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/))return l;var e;let a="";const m=d.ucs2.decode(p);for(let p=0;p<m.length;++p)a+=N(m[p],w);return a}(p);const a=function(p){const e=new Buffer(p),a=[];for(let p=0;p<e.length;++p)37!==e[p]?a.push(e[p]):37===e[p]&&n(e[p+1])&&n(e[p+2])?(a.push(parseInt(e.slice(p+1,p+3).toString(),16)),p+=2):a.push(e[p]);return new Buffer(a).toString()}(p),i=m.toASCII(a,!1,m.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(null===i)return l;if(-1!==i.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/))return l;const t=function(p){const e=p.split(".");if(""===e[e.length-1]&&e.length>1&&e.pop(),e.length>4)return p;const a=[];for(const d of e){if(""===d)return p;const e=V(d);if(e===l)return p;a.push(e)}for(let p=0;p<a.length-1;++p)if(a[p]>255)return l;if(a[a.length-1]>=Math.pow(256,5-a.length))return l;let d=a.pop(),m=0;for(const p of a)d+=p*Math.pow(256,3-m),++m;return d}(i);return"number"==typeof t||t===l?t:i}function D(p){return"number"==typeof p?function(p){let e="",a=p;for(let p=1;p<=4;++p)e=String(a%256)+e,4!==p&&(e="."+e),a=Math.floor(a/256);return e}(p):p instanceof Array?"["+function(p){let e="";const a=function(p){let e=null,a=1,d=null,m=0;for(let i=0;i<p.length;++i)0!==p[i]?(m>a&&(e=d,a=m),d=null,m=0):(null===d&&(d=i),++m);m>a&&(e=d,a=m);return{idx:e,len:a}}(p).idx;let d=!1;for(let m=0;m<=7;++m)if(!d||0!==p[m])if(d&&(d=!1),a!==m)e+=p[m].toString(16),7!==m&&(e+=":");else{e+=0===m?"::":":",d=!0}return e}(p)+"]":p}function T(p){const e=p.path;var a;0!==e.length&&("file"===p.scheme&&1===e.length&&(a=e[0],/^[A-Za-z]:$/.test(a))||e.pop())}function x(p){return""!==p.username||""!==p.password}function E(p,e,a,m,i){if(this.pointer=0,this.input=p,this.base=e||null,this.encodingOverride=a||"utf-8",this.stateOverride=i,this.url=m,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};const p=function(p){return p.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}(this.input);p!==this.input&&(this.parseError=!0),this.input=p}const t=function(p){return p.replace(/\u0009|\u000A|\u000D/g,"")}(this.input);for(t!==this.input&&(this.parseError=!0),this.input=t,this.state=i||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=d.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){const p=this.input[this.pointer],e=isNaN(p)?void 0:String.fromCodePoint(p),a=this["parse "+this.state](p,e);if(!a)break;if(a===l){this.failure=!0;break}}}E.prototype["parse scheme start"]=function(p,e){if(s(p))this.buffer+=e.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,l;this.state="no scheme",--this.pointer}return!0},E.prototype["parse scheme"]=function(p,e){if(function(p){return s(p)||r(p)}(p)||43===p||45===p||46===p)this.buffer+=e.toLowerCase();else if(58===p){if(this.stateOverride){if(h(this.url)&&!c(this.buffer))return!1;if(!h(this.url)&&c(this.buffer))return!1;if((x(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&(""===this.url.host||null===this.url.host))return!1}if(this.url.scheme=this.buffer,this.buffer="",this.stateOverride)return!1;"file"===this.url.scheme?(47===this.input[this.pointer+1]&&47===this.input[this.pointer+2]||(this.parseError=!0),this.state="file"):h(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":h(this.url)?this.state="special authority slashes":47===this.input[this.pointer+1]?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else{if(this.stateOverride)return this.parseError=!0,l;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},E.prototype["parse no scheme"]=function(p){return null===this.base||this.base.cannotBeABaseURL&&35!==p?l:(this.base.cannotBeABaseURL&&35===p?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},E.prototype["parse special relative or authority"]=function(p){return 47===p&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},E.prototype["parse path or authority"]=function(p){return 47===p?this.state="authority":(this.state="path",--this.pointer),!0},E.prototype["parse relative"]=function(p){return this.url.scheme=this.base.scheme,isNaN(p)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):47===p?this.state="relative slash":63===p?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===p?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):h(this.url)&&92===p?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0},E.prototype["parse relative slash"]=function(p){return!h(this.url)||47!==p&&92!==p?47===p?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(92===p&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},E.prototype["parse special authority slashes"]=function(p){return 47===p&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},E.prototype["parse special authority ignore slashes"]=function(p){return 47!==p&&92!==p?(this.state="authority",--this.pointer):this.parseError=!0,!0},E.prototype["parse authority"]=function(p,e){if(64===p){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;const p=t(this.buffer);for(let e=0;e<p;++e){const p=this.buffer.codePointAt(e);if(58===p&&!this.passwordTokenSeenFlag){this.passwordTokenSeenFlag=!0;continue}const a=N(p,y);this.passwordTokenSeenFlag?this.url.password+=a:this.url.username+=a}this.buffer=""}else if(isNaN(p)||47===p||63===p||35===p||h(this.url)&&92===p){if(this.atFlag&&""===this.buffer)return this.parseError=!0,l;this.pointer-=t(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=e;return!0},E.prototype["parse hostname"]=E.prototype["parse host"]=function(p,e){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(58!==p||this.arrFlag)if(isNaN(p)||47===p||63===p||35===p||h(this.url)&&92===p){if(--this.pointer,h(this.url)&&""===this.buffer)return this.parseError=!0,l;if(this.stateOverride&&""===this.buffer&&(x(this.url)||null!==this.url.port))return this.parseError=!0,!1;const p=S(this.buffer,h(this.url));if(p===l)return l;if(this.url.host=p,this.buffer="",this.state="path start",this.stateOverride)return!1}else 91===p?this.arrFlag=!0:93===p&&(this.arrFlag=!1),this.buffer+=e;else{if(""===this.buffer)return this.parseError=!0,l;const p=S(this.buffer,h(this.url));if(p===l)return l;if(this.url.host=p,this.buffer="",this.state="port","hostname"===this.stateOverride)return!1}return!0},E.prototype["parse port"]=function(p,e){if(r(p))this.buffer+=e;else{if(!(isNaN(p)||47===p||63===p||35===p||h(this.url)&&92===p||this.stateOverride))return this.parseError=!0,l;if(""!==this.buffer){const p=parseInt(this.buffer);if(p>Math.pow(2,16)-1)return this.parseError=!0,l;this.url.port=p===(a=this.url.scheme,i[a])?null:p,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}var a;return!0};const A=new Set([47,92,63,35]);E.prototype["parse file"]=function(p){var e,a;return this.url.scheme="file",47===p||92===p?(92===p&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?isNaN(p)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):63===p?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===p?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1==0||(e=p,a=this.input[this.pointer+1],!s(e)||58!==a&&124!==a)||this.input.length-this.pointer-1>=2&&!A.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),T(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0},E.prototype["parse file slash"]=function(p){var e;return 47===p||92===p?(92===p&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(2===(e=this.base.path[0]).length&&s(e.codePointAt(0))&&":"===e[1]?this.url.path.push(this.base.path[0]):this.url.host=this.base.host),this.state="path",--this.pointer),!0},E.prototype["parse file host"]=function(p,e){if(isNaN(p)||47===p||92===p||63===p||35===p)if(--this.pointer,!this.stateOverride&&v(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let p=S(this.buffer,h(this.url));if(p===l)return l;if("localhost"===p&&(p=""),this.url.host=p,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=e;return!0},E.prototype["parse path start"]=function(p){return h(this.url)?(92===p&&(this.parseError=!0),this.state="path",47!==p&&92!==p&&--this.pointer):this.stateOverride||63!==p?this.stateOverride||35!==p?void 0!==p&&(this.state="path",47!==p&&--this.pointer):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},E.prototype["parse path"]=function(p){if(isNaN(p)||47===p||h(this.url)&&92===p||!this.stateOverride&&(63===p||35===p)){if(h(this.url)&&92===p&&(this.parseError=!0),".."===(e=(e=this.buffer).toLowerCase())||"%2e."===e||".%2e"===e||"%2e%2e"===e?(T(this.url),47===p||h(this.url)&&92===p||this.url.path.push("")):!u(this.buffer)||47===p||h(this.url)&&92===p?u(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&v(this.buffer)&&(""!==this.url.host&&null!==this.url.host&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)):this.url.path.push(""),this.buffer="","file"===this.url.scheme&&(void 0===p||63===p||35===p))for(;this.url.path.length>1&&""===this.url.path[0];)this.parseError=!0,this.url.path.shift();63===p&&(this.url.query="",this.state="query"),35===p&&(this.url.fragment="",this.state="fragment")}else 37!==p||n(this.input[this.pointer+1])&&n(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=N(p,g);var e;return!0},E.prototype["parse cannot-be-a-base-URL path"]=function(p){return 63===p?(this.url.query="",this.state="query"):35===p?(this.url.fragment="",this.state="fragment"):(isNaN(p)||37===p||(this.parseError=!0),37!==p||n(this.input[this.pointer+1])&&n(this.input[this.pointer+2])||(this.parseError=!0),isNaN(p)||(this.url.path[0]=this.url.path[0]+N(p,w))),!0},E.prototype["parse query"]=function(p,e){if(isNaN(p)||!this.stateOverride&&35===p){h(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8");const e=new Buffer(this.buffer);for(let p=0;p<e.length;++p)e[p]<33||e[p]>126||34===e[p]||35===e[p]||60===e[p]||62===e[p]?this.url.query+=f(e[p]):this.url.query+=String.fromCodePoint(e[p]);this.buffer="",35===p&&(this.url.fragment="",this.state="fragment")}else 37!==p||n(this.input[this.pointer+1])&&n(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=e;return!0},E.prototype["parse fragment"]=function(p){return isNaN(p)||(0===p?this.parseError=!0:(37!==p||n(this.input[this.pointer+1])&&n(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=N(p,w))),!0},p.exports.serializeURL=function(p,e){let a=p.scheme+":";if(null!==p.host?(a+="//",""===p.username&&""===p.password||(a+=p.username,""!==p.password&&(a+=":"+p.password),a+="@"),a+=D(p.host),null!==p.port&&(a+=":"+p.port)):null===p.host&&"file"===p.scheme&&(a+="//"),p.cannotBeABaseURL)a+=p.path[0];else for(const e of p.path)a+="/"+e;return null!==p.query&&(a+="?"+p.query),e||null===p.fragment||(a+="#"+p.fragment),a},p.exports.serializeURLOrigin=function(e){switch(e.scheme){case"blob":try{return p.exports.serializeURLOrigin(p.exports.parseURL(e.path[0]))}catch(p){return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return function(p){let e=p.scheme+"://";return e+=D(p.host),null!==p.port&&(e+=":"+p.port),e}({scheme:e.scheme,host:e.host,port:e.port});case"file":return"file://";default:return"null"}},p.exports.basicURLParse=function(p,e){void 0===e&&(e={});const a=new E(p,e.baseURL,e.encodingOverride,e.url,e.stateOverride);return a.failure?"failure":a.url},p.exports.setTheUsername=function(p,e){p.username="";const a=d.ucs2.decode(e);for(let e=0;e<a.length;++e)p.username+=N(a[e],y)},p.exports.setThePassword=function(p,e){p.password="";const a=d.ucs2.decode(e);for(let e=0;e<a.length;++e)p.password+=N(a[e],y)},p.exports.serializeHost=D,p.exports.cannotHaveAUsernamePasswordPort=function(p){return null===p.host||""===p.host||p.cannotBeABaseURL||"file"===p.scheme},p.exports.serializeInteger=function(p){return String(p)},p.exports.parseURL=function(e,a){return void 0===a&&(a={}),p.exports.basicURLParse(e,{baseURL:a.baseURL,encodingOverride:a.encodingOverride})}},function(p,e){p.exports=require("zlib")},function(p,e,a){var d=a(29);p.exports=function(p,e,a){return(e=d(e))in p?Object.defineProperty(p,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):p[e]=a,p},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e){function a(e){return p.exports=a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(p){return typeof p}:function(p){return p&&"function"==typeof Symbol&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},p.exports.__esModule=!0,p.exports.default=p.exports,a(e)}p.exports=a,p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e,a){"use strict";e.a="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)},,function(p,e,a){"use strict";a.r(e),a.d(e,"authenticatedRequest",(function(){return ep})),a.d(e,"wipeToken",(function(){return ap}));var d=a(9),m=a(14),i=a.n(m),l=a(2),t=a.n(l),o=a(16);function r(p,e,a,d){return new(a||(a=Promise))((function(m,i){function l(p){try{o(d.next(p))}catch(p){i(p)}}function t(p){try{o(d.throw(p))}catch(p){i(p)}}function o(p){var e;p.done?m(p.value):(e=p.value,e instanceof a?e:new a((function(p){p(e)}))).then(l,t)}o((d=d.apply(p,e||[])).next())}))}class s{constructor(p){this.authorizationUri=p.authorizationUri,this.clientId=p.clientId,this.redirectUri=p.redirectUri,this.scope=p.scope,this.responseType=p.responseType||"token",this.accessTokenStorageKey=p.accessTokenStorageKey||"token",this.accessTokenResponseKey=p.accessTokenResponseKey||"access_token",this.storage=p.storage||window.localStorage,this.pollingTime=p.pollingTime||200,this.additionalAuthorizationParameters=p.additionalAuthorizationParameters,this.tokenValidator=p.tokenValidator,this.beforePopup=p.beforePopup,this.afterResponse=p.afterResponse,this._eventListeners={}}get _rawToken(){return this.storage.getItem(this.accessTokenStorageKey)||void 0}set _rawToken(p){null!=p&&this.storage.setItem(this.accessTokenStorageKey,p)}get _rawTokenPayload(){const p=this._rawToken;if(!p)return;const e=p.split(".")[1];if(!e)return;const a=window.atob(e.replace("-","+").replace("_","/"));return s.jsonParseOrUndefined(a)}loggedIn(){const p=this._rawTokenPayload;if(!p)return!1;if(this.tokenValidator){const e=this._rawToken;if(!this.tokenValidator({payload:p,token:e}))return!1}const e=p.exp;return!!e&&!((new Date).getTime()>1e3*e)}tokenExpired(){const p=this._rawTokenPayload;if(!p)return!1;const e=p.exp;return!!e&&!((new Date).getTime()<=1e3*e)}logout(){this.storage.removeItem(this.accessTokenStorageKey),this.dispatchEvent(new Event("logout"))}handleRedirect(){if(!window.location.href.startsWith(this.redirectUri))return"REDIRECT_URI_MISMATCH";const p=window.location.hash;if(!p)return"FALSY_HASH";const e=/#(.*)/.exec(p);if(!e)return"NO_HASH_MATCH";const a=e[1],d=s.decodeUriToObject(a);this.afterResponse&&this.afterResponse(d);const m=d[this.accessTokenResponseKey];return m?(this._rawToken=m,window.location.hash="","SUCCESS"):"FALSY_TOKEN"}addEventListener(p,e){const a=this._eventListeners[p]||[];a.push(e),this._eventListeners[p]=a}dispatchEvent(p){const e=this._eventListeners[p.type]||[];for(const a of e){("function"==typeof a?a:"object"==typeof a&&"function"==typeof a.handleEvent?a.handleEvent.bind(a):()=>{})(p)}return!0}removeEventListener(p,e){const a=this._eventListeners[p]||[];this._eventListeners[p]=a.filter(p=>p!==e)}tryLoginPopup(){return r(this,void 0,void 0,(function*(){if(this.loggedIn())return"ALREADY_LOGGED_IN";this.beforePopup&&(yield Promise.resolve(this.beforePopup()));const p="function"==typeof this.additionalAuthorizationParameters?this.additionalAuthorizationParameters():"object"==typeof this.additionalAuthorizationParameters?this.additionalAuthorizationParameters:{},e=window.open(`${this.authorizationUri}?${s.encodeObjectToUri(Object.assign({client_id:this.clientId,response_type:this.responseType,redirect_uri:this.redirectUri,scope:this.scope},p))}`);return e?(yield this.authenticated(),e.close(),this.dispatchEvent(new Event("login")),"SUCCESS"):"POPUP_FAILED"}))}authenticated(){return r(this,void 0,void 0,(function*(){for(;!this.loggedIn();)yield s.time(this.pollingTime)}))}token(){return r(this,void 0,void 0,(function*(){yield this.authenticated();const p=this._rawToken;if(!p)throw new Error("Token was falsy after being authenticated.");return p}))}tokenPayload(){return r(this,void 0,void 0,(function*(){yield this.authenticated();const p=this._rawTokenPayload;if(!p)throw new Error("Token payload was falsy after being authenticated.");return p}))}static jsonParseOrUndefined(p){try{return JSON.parse(p)}catch(p){return}}static time(p){return new Promise(e=>window.setTimeout(()=>e("TIMER"),p))}static decodeUri(p){try{return decodeURIComponent(p)}catch(e){return p}}static encodeObjectToUri(p){return Object.keys(p).map(e=>({key:e,value:p[e]})).map(({key:p,value:e})=>`${encodeURIComponent(p)}=${encodeURIComponent(e)}`).join("&")}static decodeUriToObject(p){return p.split("&").reduce((p,e)=>{const[a,d]=e.split("="),m=this.decodeUri(a),i=this.decodeUri(d);return p[m]=i,p},{})}}a(26);var n,u,v,c=a(22),h=a.n(c),f=a(4),w=a.n(f),_=a(5),g=a.n(_),b=function(p,e,a,d){return new(a||(a=Promise))((function(m,i){function l(p){try{o(d.next(p))}catch(p){i(p)}}function t(p){try{o(d.throw(p))}catch(p){i(p)}}function o(p){var e;p.done?m(p.value):(e=p.value,e instanceof a?e:new a((function(p){p(e)}))).then(l,t)}o((d=d.apply(p,e||[])).next())}))},y={debug:!1},N={},V=function(p){y.debug&&console&&console.log&&console.log(p)},S=function(p,e){var a,d=p,m=0,i=-1===p.indexOf("?")?"?":"&";for(a in e)d+=(0==m++?i:"&")+encodeURIComponent(a)+"="+encodeURIComponent(e[a]);return d};u=function(p){window.location.href=p},v=new(function(){function p(){w()(this,p)}return g()(p,[{key:"saveState",value:function(p,e,a){localStorage.setItem("state-".concat(e,"-").concat(p),JSON.stringify(a))}},{key:"getState",value:function(p,e){var a=JSON.parse(localStorage.getItem("state-".concat(e,"-").concat(p)));return localStorage.removeItem("state-".concat(e,"-").concat(p)),a}},{key:"hasScope",value:function(p,e){var a;if(!p.scopes)return!1;for(a=0;a<p.scopes.length;a++)if(p.scopes[a]===e)return!0;return!1}},{key:"filterTokens",value:function(p,e){var a,d,m,i=[],l=Math.round((new Date).getTime()/1e3);for(e||(e=[]),a=0;a<p.length;a++){for(m=!0,p[a].expires&&p[a].expires<l+1&&(m=!1),d=0;d<e.length;d++)this.hasScope(p[a],e[d])||(m=!1);m&&i.push(p[a])}return i}},{key:"saveTokens",value:function(p,e){localStorage.setItem("tokens-".concat(p),JSON.stringify(e))}},{key:"getTokens",value:function(p){var e=JSON.parse(localStorage.getItem("tokens-".concat(p)));return e||(e=[]),e}},{key:"wipeTokens",value:function(p){localStorage.removeItem("tokens-".concat(p))}},{key:"saveToken",value:function(p,e){var a=this.getTokens(p);(a=this.filterTokens(a)).push(e),this.saveTokens(p,a)}},{key:"getToken",value:function(p,e){var a=this.getTokens(p);return(a=this.filterTokens(a,e)).length<1?null:a[0]}},{key:"saveCodeVerifier",value:function(p,e){localStorage.setItem("".concat(p,"-code-verifier"),e)}},{key:"getCodeVerifier",value:function(p){return localStorage.getItem("".concat(p,"-code-verifier"))}}]),p}());var D,T=function(p){return v.getCodeVerifier(p)},x=function(p,e){v.saveCodeVerifier(p,e)},E=function(p){var e=window.location.hash;if(p){if(-1===p.indexOf("#"))return;e=p.substring(p.indexOf("#"))}return function(p){var e,a=/\+/g,d=/([^&;=]+)=?([^&;]*)/g,m=function(p){return decodeURIComponent(p.replace(a," "))},i=p,l={};for(e=d.exec(i);e;)l[m(e[1])]=m(e[2]),e=d.exec(i);return l}(e.substring(1))},A=function(p){var e=function(p){var e=new URLSearchParams(p?"?".concat(p.split("?")[1]):window.location.search);if(e.has("code"))return{code:e.get("code"),state:e.get("state")}}(p);if(null==e?void 0:e.code)return e},O=function(p,e){var a=Math.round((new Date).getTime()/1e3);return p.expires_in&&(p.expires=a+parseInt(p.expires_in,10)),p},C=function(p,e,a,d){var m,i,l;if(V("jso_checkfortoken(".concat(p,")")),null==(m=E(a))?void 0:m.state){if(!(i=v.getState(m.state,e)))throw new Error("Could not retrieve state");if(!i.providerID)throw new Error("Could not get providerid from state");if(!n[i.providerID])throw new Error("Could not retrieve config for this provider.");l=n[i.providerID],!(null==m?void 0:m.state)&&l.scope&&(i.scopes=l.scope),(null==(m=O(m))?void 0:m.scope)?m.scopes=m.scope.split(" "):i.scopes&&(m.scopes=i.scopes),v.saveToken(i.providerID,m),d||(i.location?window.location.href=i.location:window.location.hash=""),m.state&&N[m.state]&&"function"==typeof N[m.state]&&(N[m.state](),delete N[m.state])}else{if(!p)throw new Error("Could not get [state] and no default providerid is provided.");i={providerID:p}}},B=function(p,e,a,d){var m,i,l;if(!n[p])throw new Error("Could not find configuration for provider ".concat(p));return l=n[p],m="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(p){var e=16*Math.random()|0;return("x"===p?e:3&e|8).toString(16)})),(i={response_type:"token"}).state=m,l.redirect_uri&&(i.redirect_uri=l.redirect_uri),l.client_id&&(i.client_id=l.client_id),e&&(i.scope=e.join(" ")),l.response_mode&&(i.response_mode=l.response_mode),l.response_type&&(i.response_type=l.response_type),l.prompt&&(i.prompt=l.prompt),void 0!==a&&(i.response_mode=a),void 0!==d&&(i.prompt=d),i.location=window.location.href,i.providerID=p,e&&(i.scopes=e),V("Saving state [".concat(m,"]")),V(JSON.parse(JSON.stringify(i))),v.saveState(m,p,i),i},k=function(p,e,a){var d;d=function(p,e,a){var d,m;if(!n[p])throw new Error("Could not find configuration for provider ".concat(p));return m=n[p],d=B(p,e,""),a&&(d.code_challenge=a,d.code_challenge_method="S256"),S(m.authorization,d)}(p,e,a),u(d)},P=function(p,e,a,d){var m,i,l;for(m in p)if(i=void 0,p[m]&&(i=p[m]),l=v.getToken(m,i),V("Ensure token for provider ["+m+"] "),V(l),null===l||e){var t=window.location,o="".concat(t.pathname).concat(t.search).concat(t.hash);if(a)a(o);else localStorage.getItem("auth-redirect-uri")||localStorage.setItem("auth-redirect-uri",o);k(m,i,d)}return!0},j=function(p,e,a){n=p,function(p){if(p)for(var e in p)p.hasOwnProperty(e)&&(y[e]=p[e])}(e);try{var d=Object.keys(p)[0];!a&&d&&"token"===p[d].response_type&&C(p[d].client_id,d)}catch(p){V("Error when retrieving token from hash: "+p),window.location.hash=""}},F=function(){for(var p in V("jso_wipe()"),n)V("Wipping tokens for "+p),v.wipeTokens(p)},L=function(p,e){v.saveToken(p,e)},U=function(p,e){var a=v.getToken(p,e);return a&&a.access_token?a:null},R=function(){for(var p in localStorage)p.startsWith("state-")&&localStorage.removeItem(p)},I=function(p){return btoa(String.fromCharCode.apply(null,h()(new Uint8Array(p)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},z=function(){return b(void 0,void 0,void 0,t.a.mark((function p(){var e,a,d,m,i;return t.a.wrap((function(p){for(;;)switch(p.prev=p.next){case 0:return e=new Uint32Array(80),window.crypto.getRandomValues(e),a=I(e),d=new TextEncoder,m=d.encode(a),p.t0=I,p.next=8,crypto.subtle.digest("SHA-256",m);case 8:return p.t1=p.sent,i=(0,p.t0)(p.t1),p.abrupt("return",{codeVerifier:a,codeChallenge:i});case 11:case"end":return p.stop()}}),p)})))},M=a(1),q=function(p,e,a,d){return new(a||(a=Promise))((function(m,i){function l(p){try{o(d.next(p))}catch(p){i(p)}}function t(p){try{o(d.throw(p))}catch(p){i(p)}}function o(p){var e;p.done?m(p.value):(e=p.value,e instanceof a?e:new a((function(p){p(e)}))).then(l,t)}o((d=d.apply(p,e||[])).next())}))};function H(p){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=document.getElementById("logiframe-platformsh");return a||((a=document.createElement("iframe")).id="logiframe-platformsh",a.style.display="none",e.sandbox&&a.setAttribute("sandbox",e.sandbox),a.src=p,document.body.appendChild(a),a.contentWindow&&(a.contentWindow.onerror=function(p,e,a){if("[IFRAME ERROR MESSAGE]"===p)return!0}),a)}function $(){var p=document.getElementById("logiframe-platformsh");if(!p)return!1;document.body.removeChild(p)}function G(p){return new Promise((function(e,a){$(),H("".concat(p.authentication_url,"/request-storage-access.html")),window.addEventListener("message",(function d(m){return q(this,void 0,void 0,t.a.mark((function i(){var l;return t.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(m.origin===p.authentication_url){i.next=2;break}return i.abrupt("return",!1);case 2:l=m.data,window.removeEventListener("message",d,!1),$(),l.granted?e(l):a();case 6:case"end":return i.stop()}}),i)})))}),!1)}))}function J(p){var e={grant_type:"api_token",api_token:p},a={Authorization:"Basic ".concat(D)},m=Object(M.a)().authentication_url;return Object(d.e)("".concat(m,"/oauth2/token"),"POST",e,a)}D=o.a?Buffer.from("platform-cli:","latin1").toString("base64"):btoa("platform-cli:");var W=function(p,e,a,d,m){return q(void 0,void 0,void 0,t.a.mark((function i(){var l,o,r;return t.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return l=btoa("".concat(e,":")),o={grant_type:"authorization_code",redirect_uri:a,code:m,code_verifier:d},i.next=4,fetch("".concat(p,"/oauth2/token"),{method:"POST",headers:{Authorization:"Basic ".concat(l),"Content-Type":"application/json"},body:JSON.stringify(o)});case 4:if(200===(r=i.sent).status){i.next=7;break}throw r;case 7:return i.next=9,r.json();case 9:return i.abrupt("return",i.sent);case 10:case"end":return i.stop()}}),i)})))};function K(p,e,a,d){return q(this,void 0,void 0,t.a.mark((function m(){var i;return t.a.wrap((function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,W(p.authentication_url,p.client_id,p.redirect_uri,e,a);case 2:return i=m.sent,O(i),L(p.provider,i),localStorage.removeItem("state-".concat(p.provider,"-").concat(d)),localStorage.removeItem("".concat(p.provider,"-code-verifier")),m.abrupt("return",i);case 8:case"end":return m.stop()}}),m)})))}function Y(){var p=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1?arguments[1]:void 0;return console.log("In redirect..."),new Promise((function(d,m){return q(p,void 0,void 0,t.a.mark((function p(){var l,o,r,s,n,u,v,c,h,f,w,_;return t.a.wrap((function(p){for(;;)switch(p.prev=p.next){case 0:if(l=Object(M.a)(),(o=Object.assign(Object.assign({},l),{response_mode:l.response_mode,prompt:l.prompt})).client_id||m("Client_id in AUTH_CONFIG is mandatory"),o.redirect_uri||(o.redirect_uri=window.location.origin),j(i()({},o.provider,o)),!(s=U(o.provider))||e){p.next=8;break}return p.abrupt("return",d(s));case 8:if(F(),n=B(o.provider,o.scope),o.response_mode="",o.prompt="","code"!==o.response_type){p.next=30;break}if(!(u=A())){p.next=22;break}if(!(v=T(l.provider))||!u.code){p.next=22;break}return p.t0=d,p.next=20,K(o,v,u.code,n.state);case 20:return p.t1=p.sent,p.abrupt("return",(0,p.t0)(p.t1));case 22:return p.next=24,z();case 24:r=p.sent,n.code_challenge=r.codeChallenge,n.code_challenge_method="S256",x(o.provider,r.codeVerifier),p.next=39;break;case 30:return p.prev=30,C(o.client_id,o.provider,void 0,!1),c=U(o.provider),localStorage.removeItem("state-".concat(n.providerID,"-").concat(n.state)),p.abrupt("return",d(c));case 37:p.prev=37,p.t2=p.catch(30);case 39:h=S(o.authorization,Object.assign(Object.assign({},n),a)),f=H(h,{sandbox:"allow-same-origin"}),w=0,_=setInterval((function(){var p;return q(this,void 0,void 0,t.a.mark((function e(){var a,m,l,s;return t.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{"about:blank"===(a=null===(p=f.contentWindow)||void 0===p?void 0:p.location.href)&&(m=!0)}catch(p){m=!0}if(!m){e.next=9;break}if(!(w<1)){e.next=5;break}return w++,e.abrupt("return",!1);case 5:return clearInterval(_),$(),localStorage.removeItem("state-".concat(n.providerID,"-").concat(n.state)),e.abrupt("return",P(i()({},o.provider,o.scope),!0,o.onBeforeRedirect,"code"===o.response_type?r.codeChallenge:void 0));case 9:if(!a||-1===a.indexOf("access_token")&&-1===a.indexOf("code")){e.next=24;break}if(clearInterval(_),"code"!==o.response_type){e.next=19;break}if(!(null==(l=A(a))?void 0:l.code)){e.next=19;break}return e.t0=d,e.next=17,K(o,r.codeVerifier,null==l?void 0:l.code,n.state);case 17:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1));case 19:C(o.client_id,o.provider,a,!0),s=U(o.provider),localStorage.removeItem("state-".concat(n.providerID,"-").concat(n.state)),$(),d(s);case 24:case"end":return e.stop()}}),e)})))}),500);case 43:case"end":return p.stop()}}),p,null,[[30,37]])})))}))}var Z=function(p){return q(void 0,void 0,void 0,t.a.mark((function e(){var a;return t.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=Object(M.a)(),e.abrupt("return",new Promise((function(e,d){return q(void 0,void 0,void 0,t.a.mark((function m(){var l,o,r,s,n,u,v;return t.a.wrap((function(m){for(;;)switch(m.prev=m.next){case 0:if(m.prev=0,l=function p(d){return q(this,void 0,void 0,t.a.mark((function m(){var i,l;return t.a.wrap((function(m){for(;;)switch(m.prev=m.next){case 0:if(d.origin===a.authentication_url){m.next=2;break}return m.abrupt("return",!1);case 2:if(!(i=d.data).error&&i.payload&&i.state===n.state){m.next=7;break}if(!a.popupMode){m.next=6;break}return m.abrupt("return",X());case 6:return m.abrupt("return",Y());case 7:return localStorage.removeItem("state-".concat(n.providerID,"-").concat(n.state)),window.removeEventListener("message",p,!1),clearTimeout(v),l=i.payload,m.t0=e,m.next=14,K(a,u.codeVerifier,l,n.state);case 14:return m.t1=m.sent,m.abrupt("return",(0,m.t0)(m.t1));case 16:case"end":return m.stop()}}),m)})))},a.client_id||d("Client_id in AUTH_CONFIG is mandatory"),a.redirect_uri||(a.redirect_uri=window.location.origin),j(i()({},a.provider,a)),!(o=U(a.provider))||p){m.next=8;break}return m.abrupt("return",e(o));case 8:if(F(),$(),!(r=A())){m.next=19;break}if(!((s=T(a.provider))&&r.code&&r.state)){m.next=19;break}return m.t0=e,m.next=17,K(a,s,r.code,r.state);case 17:return m.t1=m.sent,m.abrupt("return",(0,m.t0)(m.t1));case 19:if(!document.hasStorageAccess){m.next=22;break}return m.next=22,G(a);case 22:return n=B(a.provider,a.scope),m.next=25,z();case 25:u=m.sent,n.code_challenge=u.codeChallenge,n.code_challenge_method="S256",v=setTimeout((function(){if(a.popupMode)return e(X());e(Y())}),5e3),window.addEventListener("message",l,!1),H(S(a.authorization,n)),m.next=42;break;case 34:if(m.prev=34,m.t2=m.catch(0),console.log("Error Silent refresh"),console.log(m.t2),!a.popupMode){m.next=40;break}return m.abrupt("return",X());case 40:return console.log("Error In web message mode, trying redirect..."),m.abrupt("return",Y());case 42:case"end":return m.stop()}}),m,null,[[0,34]])})))})));case 2:case"end":return e.stop()}}),e)})))},X=function(){var p=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return q(void 0,void 0,void 0,t.a.mark((function e(){var a,d,m,l,o;return t.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("true"!==localStorage.getItem("redirectFallBack")){e.next=5;break}return localStorage.removeItem("redirectFallBack"),e.next=4,Y();case 4:return e.abrupt("return",e.sent);case 5:if(d=Object(M.a)(),j(i()({},d.provider,d),{},!0),!(m=U(d.provider))||p){e.next=10;break}return e.abrupt("return",m);case 10:return l=B(d.provider,d.scope,void 0,""),o=new s({authorizationUri:d.authorization,clientId:d.client_id,redirectUri:d.redirect_uri,scope:null===(a=d.scope)||void 0===a?void 0:a.join(","),accessTokenStorageKey:"raw-token-".concat(l.providerID),additionalAuthorizationParameters:{state:l.state||""},afterResponse:function(p){C(d.client_id,d.provider,void 0,!0)}}),e.next=14,o.tryLoginPopup();case 14:if("POPUP_FAILED"!==e.sent){e.next=20;break}return localStorage.setItem("redirectFallBack","true"),e.next=19,Y();case 19:return e.abrupt("return",e.sent);case 20:return R(),e.abrupt("return",U(d.provider));case 22:case"end":return e.stop()}}),e)})))},Q=function(p){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2?arguments[2]:void 0;return o.a&&p?J(p).catch((function(p){return new Error(p)})):(null==a?void 0:a.extra_params)&&Object.entries(a.extra_params).length?Y(e,a.extra_params):"web_message"===(null==a?void 0:a.response_mode)&&"none"===a.prompt?Z(e):(null==a?void 0:a.popupMode)?X(e):Y(e,null==a?void 0:a.extra_params)},pp=!1,ep=(e.default=function(p){var e,a=p.api_token,m=p.access_token,i=p.provider,l=void 0===i?"cg":i,t=p.popupMode,o=p.response_mode,r=p.prompt,s=p.extra_params,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return pp?Object(d.d)():(pp=!0,(e=m?Promise.resolve({access_token:m,expires:-1}):Q(a,n,{provider:l,popupMode:t,response_mode:o,prompt:r,extra_params:s}))?(Object(d.f)(e),e.then((function(){pp=!1})),e):Promise.reject())},d.c),ap=F},,function(p,e){p.exports=require("url")},,function(p,e,a){var d=a(39),m=a(40),i=a(27),l=a(41);p.exports=function(p){return d(p)||m(p)||i(p)||l()},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e,a){var d=a(34),m=a(35),i=a(27),l=a(36);p.exports=function(p,e){return d(p)||m(p,e)||i(p,e)||l()},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e){p.exports=require("http")},function(p,e,a){"use strict";e.URL=a(44).interface,e.serializeURL=a(12).serializeURL,e.serializeURLOrigin=a(12).serializeURLOrigin,e.basicURLParse=a(12).basicURLParse,e.setTheUsername=a(12).setTheUsername,e.setThePassword=a(12).setThePassword,e.serializeHost=a(12).serializeHost,e.serializeInteger=a(12).serializeInteger,e.parseURL=a(12).parseURL},function(p,e,a){const d=a(42),m=d.fetch.bind({});m.polyfill=!0,global.fetch||(global.fetch=m,global.Response=d.Response,global.Headers=d.Headers,global.Request=d.Request)},function(p,e,a){var d=a(28);p.exports=function(p,e){if(p){if("string"==typeof p)return d(p,e);var a=Object.prototype.toString.call(p).slice(8,-1);return"Object"===a&&p.constructor&&(a=p.constructor.name),"Map"===a||"Set"===a?Array.from(p):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?d(p,e):void 0}},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e){p.exports=function(p,e){(null==e||e>p.length)&&(e=p.length);for(var a=0,d=new Array(e);a<e;a++)d[a]=p[a];return d},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e,a){var d=a(15).default,m=a(37);p.exports=function(p){var e=m(p,"string");return"symbol"===d(e)?e:String(e)},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e){p.exports=require("punycode")},function(p,e){p.exports=require("https")},function(p,e,a){p.exports=(()=>{"use strict";var p={d:(e,a)=>{for(var d in a)p.o(a,d)&&!p.o(e,d)&&Object.defineProperty(e,d,{enumerable:!0,get:a[d]})},o:(p,e)=>Object.prototype.hasOwnProperty.call(p,e),r:p=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})}},e={};function a(p){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(p){return typeof p}:function(p){return p&&"function"==typeof Symbol&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p})(p)}p.r(e),p.d(e,{default:()=>t});var d=encodeURIComponent;function m(p,e,m,i,t){var o=i&&t.arrayPrefix||"";if("object"===a(e)){var r="".concat(p).concat(o).concat(m&&"]","[");return"".concat(l(e,"".concat(m).concat(r),t))}return m&&m.length?"".concat(m).concat(p,"]").concat(o,"=").concat(d(e)):"".concat(p).concat(o,"=").concat(d(e))}function i(p,e,a,d){return e.map((function(e){return m(p,e,a,!0,d)})).join("&")}function l(p){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(Array.isArray(p)?p.map((function(p,d){return m("".concat(d),p,e,!0,a)})):Object.keys(p).filter((function(e){return void 0!==p[e]})).map((function(d){return p[d]&&Array.isArray(p[d])?i("".concat(d),p[d],e,a):m(d,p[d],e,!1,a)}))).join("&").replace(/%20/g,"+")}const t=l;return e})()},,function(p,e){p.exports=function(p){if(Array.isArray(p))return p},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e){p.exports=function(p,e){var a=null==p?null:"undefined"!=typeof Symbol&&p[Symbol.iterator]||p["@@iterator"];if(null!=a){var d,m,i,l,t=[],o=!0,r=!1;try{if(i=(a=a.call(p)).next,0===e){if(Object(a)!==a)return;o=!1}else for(;!(o=(d=i.call(a)).done)&&(t.push(d.value),t.length!==e);o=!0);}catch(p){r=!0,m=p}finally{try{if(!o&&null!=a.return&&(l=a.return(),Object(l)!==l))return}finally{if(r)throw m}}return t}},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e){p.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e,a){var d=a(15).default;p.exports=function(p,e){if("object"!==d(p)||null===p)return p;var a=p[Symbol.toPrimitive];if(void 0!==a){var m=a.call(p,e||"default");if("object"!==d(m))return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(p)},p.exports.__esModule=!0,p.exports.default=p.exports},function(p,e,a){var d=a(15).default;function m(){"use strict";p.exports=m=function(){return e},p.exports.__esModule=!0,p.exports.default=p.exports;var e={},a=Object.prototype,i=a.hasOwnProperty,l=Object.defineProperty||function(p,e,a){p[e]=a.value},t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",s=t.toStringTag||"@@toStringTag";function n(p,e,a){return Object.defineProperty(p,e,{value:a,enumerable:!0,configurable:!0,writable:!0}),p[e]}try{n({},"")}catch(p){n=function(p,e,a){return p[e]=a}}function u(p,e,a,d){var m=e&&e.prototype instanceof h?e:h,i=Object.create(m.prototype),t=new E(d||[]);return l(i,"_invoke",{value:S(p,a,t)}),i}function v(p,e,a){try{return{type:"normal",arg:p.call(e,a)}}catch(p){return{type:"throw",arg:p}}}e.wrap=u;var c={};function h(){}function f(){}function w(){}var _={};n(_,o,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(A([])));b&&b!==a&&i.call(b,o)&&(_=b);var y=w.prototype=h.prototype=Object.create(_);function N(p){["next","throw","return"].forEach((function(e){n(p,e,(function(p){return this._invoke(e,p)}))}))}function V(p,e){var a;l(this,"_invoke",{value:function(m,l){function t(){return new e((function(a,t){!function a(m,l,t,o){var r=v(p[m],p,l);if("throw"!==r.type){var s=r.arg,n=s.value;return n&&"object"==d(n)&&i.call(n,"__await")?e.resolve(n.__await).then((function(p){a("next",p,t,o)}),(function(p){a("throw",p,t,o)})):e.resolve(n).then((function(p){s.value=p,t(s)}),(function(p){return a("throw",p,t,o)}))}o(r.arg)}(m,l,a,t)}))}return a=a?a.then(t,t):t()}})}function S(p,e,a){var d="suspendedStart";return function(m,i){if("executing"===d)throw new Error("Generator is already running");if("completed"===d){if("throw"===m)throw i;return O()}for(a.method=m,a.arg=i;;){var l=a.delegate;if(l){var t=D(l,a);if(t){if(t===c)continue;return t}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===d)throw d="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);d="executing";var o=v(p,e,a);if("normal"===o.type){if(d=a.done?"completed":"suspendedYield",o.arg===c)continue;return{value:o.arg,done:a.done}}"throw"===o.type&&(d="completed",a.method="throw",a.arg=o.arg)}}}function D(p,e){var a=e.method,d=p.iterator[a];if(void 0===d)return e.delegate=null,"throw"===a&&p.iterator.return&&(e.method="return",e.arg=void 0,D(p,e),"throw"===e.method)||"return"!==a&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+a+"' method")),c;var m=v(d,p.iterator,e.arg);if("throw"===m.type)return e.method="throw",e.arg=m.arg,e.delegate=null,c;var i=m.arg;return i?i.done?(e[p.resultName]=i.value,e.next=p.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function T(p){var e={tryLoc:p[0]};1 in p&&