UNPKG

@lando/platformsh

Version:

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

2 lines 68.1 kB
/*! For license information please see index.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("platform-api",[],e):"object"==typeof exports?exports["platform-api"]=e():t["platform-api"]=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=15)}([,function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return a}));var n=function(){var t=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(t.replace(/(\/api\/?)$/,""),"/api"),api_url:e,authentication_url:t,scope:[],authorization:"".concat(t,"/oauth2/authorize"),logout_url:"".concat(t,"/user/logout"),prompt:"",redirect_uri:"",response_type:"code"}},o=n(),i=function(t){o=Object.assign(Object.assign({},n(t.base_url,t.api_url)),t)},a=function(){return o}},function(t,e,r){var n=r(35)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},,function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(24);function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}t.exports=function(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},,,,function(t,e,r){"use strict";r.d(e,"f",(function(){return d})),r.d(e,"d",(function(){return y})),r.d(e,"e",(function(){return m})),r.d(e,"a",(function(){return w})),r.d(e,"b",(function(){return _}));var n,o=r(19),i=r.n(o),a=r(20),s=r.n(a),u=(r(21),r(26)),c=r.n(u),f=r(14),h=r.n(f),l=r(1),p=r(15),d=function(t){n=t},y=function(){return n},v={};h.a&&(v["Content-Type"]="application/json");var g=function(t){return"undefined"!=typeof FormData&&t instanceof FormData},b=function(t){var e=(t.get("WWW-Authenticate")||"").replace("Bearer","").split(",").reduce((function(t,e){var r=e.replace(/"/g,"").trim().split("="),n=s()(r,2),o=n[0],i=n[1];return t[o]=i,t}),{});return["max_age","acr_values"].reduce((function(t,r){return e[r]&&(t[r]=e[r]),t}),{})},m=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=r instanceof Array?r&&i()(r):r&&Object.assign({},r),u=t;if("GET"===e){var f=c()(s||{},"",{arrayPrefix:a.queryStringArrayPrefix||""});u="".concat(t).concat(f.length?"?".concat(f):"")}var h=Object.assign(Object.assign({method:e},a),{headers:Object.assign(Object.assign({},v),n)});if("GET"!==e&&"HEAD"!==e&&s){var d=g(r)?r:JSON.stringify(s);h.body=d}return new Promise((function(i,s){fetch(u,h).then((function(u){if(401===u.status){var c=Object(l.a)(),f=b(u.headers);if(void 0===c.access_token&&o<2)return Object(p.default)(Object.assign(Object.assign({},c),{extra_params:f}),!0).then((function(s){i(w(t,e,r,n,o+1,a))}))}var h=u.headers.get("Content-Type"),d=!h||"application/json"===h||"application/hal+json; charset=utf-8"===h;return u.ok?h&&["image/gif","image/jpeg","image/png"].includes(h)||202===u.status?i(u):i(u.text().then((function(t){var e;try{e=JSON.parse(t)}catch(r){e=t}return e}))):d?u.json().then((function(t){return s(t)})).catch((function(t){console.log(t)})):u.text().then((function(t){return s(t)}))})).catch((function(t){s(t)}))}))},w=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",o=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};return n.then((function(n){if(!n)throw new Error("Token is mandatory");i.hasOwnProperty("Content-Type")||g(o)||(i["Content-Type"]="application/json");var u=Math.round((new Date).getTime()/1e3),c=n.expires;if(-1!==c&&u>=c){var f=Object(l.a)();return console.log("Token expiration detected"),Object(p.default)(f,!0).then((function(n){return t(e,r,o,i,a+1,s)}))}var h={Authorization:"Bearer ".concat(n.access_token)};return m(e,r,o,Object.assign(Object.assign({},i),h),a,s)}))},_=function(t){return n.then((function(e){return new window.EventSource("".concat(t,"?access_token=").concat(e.access_token))}))};e.c=w},function(t,e,r){"use strict";r.d(e,"a",(function(){return b})),r.d(e,"h",(function(){return m})),r.d(e,"j",(function(){return w})),r.d(e,"c",(function(){return x})),r.d(e,"n",(function(){return E})),r.d(e,"d",(function(){return A})),r.d(e,"g",(function(){return O})),r.d(e,"f",(function(){return S})),r.d(e,"e",(function(){return k})),r.d(e,"l",(function(){return P})),r.d(e,"k",(function(){return j})),r.d(e,"i",(function(){return R})),r.d(e,"m",(function(){return I})),r.d(e,"b",(function(){return B}));var n,o,i,a=r(19),s=r.n(a),u=r(2),c=r.n(u),f=r(4),h=r.n(f),l=r(5),p=r.n(l),d=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))},y={debug:!1},v={},g=function(t){y.debug&&console&&console.log&&console.log(t)},b=function(t,e){var r,n=t,o=0,i=-1===t.indexOf("?")?"?":"&";for(r in e)n+=(0==o++?i:"&")+encodeURIComponent(r)+"="+encodeURIComponent(e[r]);return n};o=function(t){window.location.href=t},i=new(function(){function t(){h()(this,t)}return p()(t,[{key:"saveState",value:function(t,e,r){localStorage.setItem("state-".concat(e,"-").concat(t),JSON.stringify(r))}},{key:"getState",value:function(t,e){var r=JSON.parse(localStorage.getItem("state-".concat(e,"-").concat(t)));return localStorage.removeItem("state-".concat(e,"-").concat(t)),r}},{key:"hasScope",value:function(t,e){var r;if(!t.scopes)return!1;for(r=0;r<t.scopes.length;r++)if(t.scopes[r]===e)return!0;return!1}},{key:"filterTokens",value:function(t,e){var r,n,o,i=[],a=Math.round((new Date).getTime()/1e3);for(e||(e=[]),r=0;r<t.length;r++){for(o=!0,t[r].expires&&t[r].expires<a+1&&(o=!1),n=0;n<e.length;n++)this.hasScope(t[r],e[n])||(o=!1);o&&i.push(t[r])}return i}},{key:"saveTokens",value:function(t,e){localStorage.setItem("tokens-".concat(t),JSON.stringify(e))}},{key:"getTokens",value:function(t){var e=JSON.parse(localStorage.getItem("tokens-".concat(t)));return e||(e=[]),e}},{key:"wipeTokens",value:function(t){localStorage.removeItem("tokens-".concat(t))}},{key:"saveToken",value:function(t,e){var r=this.getTokens(t);(r=this.filterTokens(r)).push(e),this.saveTokens(t,r)}},{key:"getToken",value:function(t,e){var r=this.getTokens(t);return(r=this.filterTokens(r,e)).length<1?null:r[0]}},{key:"saveCodeVerifier",value:function(t,e){localStorage.setItem("".concat(t,"-code-verifier"),e)}},{key:"getCodeVerifier",value:function(t){return localStorage.getItem("".concat(t,"-code-verifier"))}}]),t}());var m=function(t){return i.getCodeVerifier(t)},w=function(t,e){i.saveCodeVerifier(t,e)},_=function(t){var e=window.location.hash;if(t){if(-1===t.indexOf("#"))return;e=t.substring(t.indexOf("#"))}return function(t){var e,r=/\+/g,n=/([^&;=]+)=?([^&;]*)/g,o=function(t){return decodeURIComponent(t.replace(r," "))},i=t,a={};for(e=n.exec(i);e;)a[o(e[1])]=o(e[2]),e=n.exec(i);return a}(e.substring(1))},x=function(t){var e=function(t){var e=new URLSearchParams(t?"?".concat(t.split("?")[1]):window.location.search);if(e.has("code"))return{code:e.get("code"),state:e.get("state")}}(t);if(null==e?void 0:e.code)return e},E=function(t,e){var r=Math.round((new Date).getTime()/1e3);return t.expires_in&&(t.expires=r+parseInt(t.expires_in,10)),t},A=function(t,e,r,o){var a,s,u;if(g("jso_checkfortoken(".concat(t,")")),null==(a=_(r))?void 0:a.state){if(!(s=i.getState(a.state,e)))throw new Error("Could not retrieve state");if(!s.providerID)throw new Error("Could not get providerid from state");if(!n[s.providerID])throw new Error("Could not retrieve config for this provider.");u=n[s.providerID],!(null==a?void 0:a.state)&&u.scope&&(s.scopes=u.scope),(null==(a=E(a,u))?void 0:a.scope)?a.scopes=a.scope.split(" "):s.scopes&&(a.scopes=s.scopes),i.saveToken(s.providerID,a),o||(s.location?window.location.href=s.location:window.location.hash=""),a.state&&v[a.state]&&"function"==typeof v[a.state]&&(v[a.state](),delete v[a.state])}else{if(!t)throw new Error("Could not get [state] and no default providerid is provided.");s={providerID:t}}},O=function(t,e,r,o){var a,s,u;if(!n[t])throw new Error("Could not find configuration for provider ".concat(t));return u=n[t],a="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})),(s={response_type:"token"}).state=a,u.redirect_uri&&(s.redirect_uri=u.redirect_uri),u.client_id&&(s.client_id=u.client_id),e&&(s.scope=e.join(" ")),u.response_mode&&(s.response_mode=u.response_mode),u.response_type&&(s.response_type=u.response_type),u.prompt&&(s.prompt=u.prompt),void 0!==r&&(s.response_mode=r),void 0!==o&&(s.prompt=o),s.location=window.location.href,s.providerID=t,e&&(s.scopes=e),g("Saving state [".concat(a,"]")),g(JSON.parse(JSON.stringify(s))),i.saveState(a,t,s),s},T=function(t,e,r){var i;i=function(t,e,r){var o,i;if(!n[t])throw new Error("Could not find configuration for provider ".concat(t));return i=n[t],o=O(t,e,""),r&&(o.code_challenge=r,o.code_challenge_method="S256"),b(i.authorization,o)}(t,e,r),o(i)},S=function(t,e,r,n){var o,a,s;for(o in t)if(a=void 0,t[o]&&(a=t[o]),s=i.getToken(o,a),g("Ensure token for provider ["+o+"] "),g(s),null===s||e){var u=window.location,c="".concat(u.pathname).concat(u.search).concat(u.hash);if(r)r(c);else localStorage.getItem("auth-redirect-uri")||localStorage.setItem("auth-redirect-uri",c);T(o,a,n)}return!0},k=function(t,e,r){n=t,function(t){if(t)for(var e in t)t.hasOwnProperty(e)&&(y[e]=t[e])}(e);try{var o=Object.keys(t)[0];!r&&o&&"token"===t[o].response_type&&A(t[o].client_id,o)}catch(t){g("Error when retrieving token from hash: "+t),window.location.hash=""}},P=function(){for(var t in g("jso_wipe()"),n)g("Wipping tokens for "+t),i.wipeTokens(t)},j=function(t,e){i.saveToken(t,e)},R=function(t,e){var r=i.getToken(t,e);return r&&r.access_token?r:null},I=function(){for(var t in localStorage)t.startsWith("state-")&&localStorage.removeItem(t)},U=function(t){return btoa(String.fromCharCode.apply(null,s()(new Uint8Array(t)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},B=function(){return d(void 0,void 0,void 0,c.a.mark((function t(){var e,r,n,o,i;return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=new Uint32Array(80),window.crypto.getRandomValues(e),r=U(e),n=new TextEncoder,o=n.encode(r),t.t0=U,t.next=8,crypto.subtle.digest("SHA-256",o);case 8:return t.t1=t.sent,i=(0,t.t0)(t.t1),t.abrupt("return",{codeVerifier:r,codeChallenge:i});case 11:case"end":return t.stop()}}),t)})))}},,function(t,e,r){var n=r(24);t.exports=function(t,e,r){return(e=n(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(e){return t.exports=r="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.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=!1},function(t,e,r){"use strict";r.r(e),r.d(e,"authenticatedRequest",(function(){return s})),r.d(e,"wipeToken",(function(){return u}));var n=r(9),o=r(27),i=r(10),a=!1;e.default=function(t){var e,r=t.api_token,i=t.access_token,s=t.provider,u=void 0===s?"cg":s,c=t.popupMode,f=t.response_mode,h=t.prompt,l=t.extra_params,p=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return a?Object(n.d)():(a=!0,(e=i?Promise.resolve({access_token:i,expires:-1}):Object(o.a)(r,p,{provider:u,popupMode:c,response_mode:f,prompt:h,extra_params:l}))?(Object(n.f)(e),e.then((function(){a=!1})),e):Promise.reject())};var s=n.c,u=i.l},,,,function(t,e,r){var n=r(36),o=r(37),i=r(22),a=r(38);t.exports=function(t){return n(t)||o(t)||i(t)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(31),o=r(32),i=r(22),a=r(33);t.exports=function(t,e){return n(t)||o(t,e)||i(t,e)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=d(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=f(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),h(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),h(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(t,e){var r,n,o=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),b.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},g.call(m.prototype),g.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];_.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(n,i){var a=new m(t,r);if(a.signal&&a.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;n(new _(o,r))},s.onerror=function(){i(new TypeError("Network request failed"))},s.ontimeout=function(){i(new TypeError("Network request failed"))},s.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&o&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=l,t.Request=m,t.Response=_),e.Headers=l,e.Request=m,e.Response=_,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},function(t,e,r){var n=r(23);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(13).default,o=r(34);t.exports=function(t){var e=o(t,"string");return"symbol"===n(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";(function(t){var n=r(40),o=r(41),i=r(42);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=s(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|p(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):l(t,e);if("Buffer"===e.type&&i(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(f(e),t=s(t,e<0?0:0|p(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|p(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return N(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return O(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,o);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,o){var i,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var f=-1;for(i=r;i<s;i++)if(c(t,i)===c(e,-1===f?0:i-f)){if(-1===f&&(f=i),i-f+1===u)return f*a}else-1!==f&&(i-=i-f),f=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){for(var h=!0,l=0;l<u;l++)if(c(t,i+l)!==c(e,l)){h=!1;break}if(h)return i}return-1}function m(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function w(t,e,r,n){return z(N(e,t.length-r),t,r,n)}function _(t,e,r,n){return z(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function x(t,e,r,n){return _(t,e,r,n)}function E(t,e,r,n){return z(F(e),t,r,n)}function A(t,e,r,n){return z(function(t,e){for(var r,n,o,i=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function O(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,a,s,u,c=t[o],f=null,h=c>239?4:c>223?3:c>191?2:1;if(o+h<=r)switch(h){case 1:c<128&&(f=c);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&c)<<6|63&i)>127&&(f=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return c(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return f(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return h(null,t)},u.allocUnsafeSlow=function(t){return h(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var a=t[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,o),o+=a.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):y.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,o){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(i,a),c=this.slice(n,o),f=t.slice(e,r),h=0;h<s;++h)if(c[h]!==f[h]){i=c[h],a=f[h];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return g(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return g(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function k(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function P(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=Y(t[i]);return o}function j(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function U(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function L(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,i){return i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,i){return i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var o=e-t;r=new u(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);I(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i<r&&(a*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);I(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var a=u.isBuffer(t)?t:N(new u(t,n).toString()),s=a.length;for(i=0;i<r-e;++i)this[i+e]=a[i%s]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function N(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(39))},function(t,e,r){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return(r="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.r(e),t.d(e,{default:()=>s});var n=encodeURIComponent;function o(t,e,o,i,s){var u=i&&s.arrayPrefix||"";if("object"===r(e)){var c="".concat(t).concat(u).concat(o&&"]","[");return"".concat(a(e,"".concat(o).concat(c),s))}return o&&o.length?"".concat(o).concat(t,"]").concat(u,"=").concat(n(e)):"".concat(t).concat(u,"=").concat(n(e))}function i(t,e,r,n){return e.map((function(e){return o(t,e,r,!0,n)})).join("&")}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(Array.isArray(t)?t.map((function(t,n){return o("".concat(n),t,e,!0,r)})):Object.keys(t).filter((function(e){return void 0!==t[e]})).map((function(n){return t[n]&&Array.isArray(t[n])?i("".concat(n),t[n],e,r):o(n,t[n],e,!1,r)}))).join("&").replace(/%20/g,"+")}const s=a;return e})()},function(t,e,r){"use strict";(function(t){var n,o=r(12),i=r.n(o),a=r(2),s=r.n(a),u=r(14),c=r.n(u),f=r(28),h=(r(21),r(9)),l=r(10),p=r(1),d=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};function y(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.getElementById("logiframe-platformsh");return r||((r=document.createElement("iframe")).id="logiframe-platformsh",r.style.display="none",e.sandbox&&r.setAttribute("sandbox",e.sandbox),r.src=t,document.body.appendChild(r),r.contentWindow&&(r.contentWindow.onerror=function(t,e,r){if("[IFRAME ERROR MESSAGE]"===t)return!0}),r)}function v(){var t=document.getElementById("logiframe-platformsh");if(!t)return!1;document.body.removeChild(t)}function g(t){return new Promise((function(e,r){v(),y("".concat(t.authentication_url,"/request-storage-access.html")),window.addEventListener("message",(function n(o){return d(this,void 0,void 0,s.a.mark((function i(){var a;return s.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(o.origin===t.authentication_url){i.next=2;break}return i.abrupt("return",!1);case 2:a=o.data,window.removeEventListener("message",n,!1),v(),a.granted?e(a):r();case 6:case"end":return i.stop()}}),i)})))}),!1)}))}function b(t){var e={grant_type:"api_token",api_token:t},r={Authorization:"Basic ".concat(n)},o=Object(p.a)().authentication_url;return Object(h.e)("".concat(o,"/oauth2/token"),"POST",e,r)}n=c.a?t.from("platform-cli:","latin1").toString("base64"):btoa("platform-cli:");var m=function(t,e,r,n,o){return d(void 0,void 0,void 0,s.a.mark((function i(){var a,u,c;return s.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=btoa("".concat(e,":")),u={grant_type:"authorization_code",redirect_uri:r,code:o,code_verifier:n},i.next=4,fetch("".concat(t,"/oauth2/token"),{method:"POST",headers:{Authorization:"Basic ".concat(a),"Content-Type":"application/json"},body:JSON.stringify(u)});case 4:if(200===(c=i.sent).status){i.next=7;break}throw c;case 7:return i.next=9,c.json();case 9:return i.abrupt("return",i.sent);case 10:case"end":return i.stop()}}),i)})))};function w(t,e,r,n){return d(this,void 0,void 0,s.a.mark((function o(){var i;return s.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,m(t.authentication_url,t.client_id,t.redirect_uri,e,r);case 2:return i=o.sent,Object(l.n)(i,t),Object(l.k)(t.provider,i),localStorage.removeItem("state-".concat(t.provider,"-").concat(n)),localStorage.removeItem("".concat(t.provider,"-code-verifier")),o.abrupt("return",i);case 8:case"end":return o.stop()}}),o)})))}function _(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1?arguments[1]:void 0;return console.log("In redirect..."),new Promise((function(n,o){return d(t,void 0,void 0,s.a.mark((function t(){var a,u,c,f,h,g,b,m,_,x,E,A;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=Object(p.a)(),(u=Object.assign(Object.assign({},a),{response_mode:a.response_mode,prompt:a.prompt})).client_id||o("Client_id in AUTH_CONFIG is mandatory"),u.redirect_uri||(u.redirect_uri=window.location.origin),Object(l.e)(i()({},u.provider,u)),!(f=Object(l.i)(u.provider))||e){t.next=8;break}return t.abrupt("return",n(f));case 8:if(Object(l.l)(),h=Object(l.g)(u.provider,u.scope),u.response_mode="",u.prompt="","code"!==u.response_type){t.next=30;break}if(!(g=Object(l.c)())){t.next=22;break}if(!(b=Object(l.h)(a.provider))||!g.code){t.next=22;break}return t.t0=n,t.next=20,w(u,b,g.code,h.state);case 20:return t.t1=t.sent,t.abrupt("return",(0,t.t0)(t.t1));case 22:return t.next=24,Object(l.b)();case 24:c=t.sent,h.code_challenge=c.codeChallenge,h.code_challenge_method="S256",Object(l.j)(u.provider,c.codeVerifier),t.next=39;break;case 30:return t.prev=30,Object(l.d)(u.client_id,u.provider,void 0,!1),m=Object(l.i)(u.provider),localStorage.removeItem("state-".concat(h.providerID,"-").concat(h.state)),t.abrupt("return",n(m));case 37:t.prev=37,t.t2=t.catch(30);case 39:_=Object(l.a)(u.authorization,Object.assign(Object.assign({},h),r)),x=y(_,{sandbox:"allow-same-origin"}),E=0,A=setInterval((function(){var t;return d(this,void 0,void 0,s.a.mark((function e(){var r,o,a,f;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{"about:blank"===(r=null===(t=x.contentWindow)||void 0===t?void 0:t.location.href)&&(o=!0)}catch(t){o=!0}if(!o){e.next=9;break}if(!(E<1)){e.next=5;break}return E++,e.abrupt("return",!1);case 5:return clearInterval(A),v(),localStorage.removeItem("state-".concat(h.providerID,"-").concat(h.state)),e.abrupt("return",Object(l.f)(i()({},u.provider,u.scope),!0,u.onBeforeRedirect,"code"===u.response_type?c.codeChallenge:void 0));case 9:if(!r||-1===r.indexOf("access_token")&&-1===r.indexOf("code")){e.next=24;break}if(clearInterval(A),"code"!==u.response_type){e.next=19;break}if(!(null==(a=Object(l.c)(r))?void 0:a.code)){e.next=19;break}return e.t0=n,e.next=17,w(u,c.codeVerifier,null==a?void 0:a.code,h.state);case 17:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1));case 19:Object(l.d)(u.client_id,u.provider,r,!0),f=Object(l.i)(u.provider),localStorage.removeItem("state-".concat(h.providerID,"-").concat(h.state)),v(),n(f);case 24:case"end":return e.stop()}}),e)})))}),500);case 43:case"end":return t.stop()}}),t,null,[[30,37]])})))}))}var x=function(t){return d(void 0,void 0,void 0,s.a.mark((function e(){var r;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(p.a)(),e.abrupt("return",new Promise((function(e,n){return d(void 0,void 0,void 0,s.a.mark((function o(){var a,u,c,f,h,p,b;return s.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,a=function t(n){return d(this,void 0,void 0,s.a.mark((function o(){var i,a;return s.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(n.origin===r.authentication_url){o.next=2;break}return o.abrupt("return",!1);case 2:if(!(i=n.data).error&&i.payload&&i.state===h.state){o.next=7;break}if(!r.popupMode){o.next=6;break}return o.abrupt("return",E());case 6:return o.abrupt("return",_());case 7:return localStorage.removeItem("state-".concat(h.providerID,"-").concat(h.state)),window.removeEventListener("message",t,!1),clearTimeout(b),a=i.payload,o.t0=e,o.next=14,w(r,p.codeVerifier,a,h.state);case 14:return o.t1=o.sent,o.abrupt("return",(0,o.t0)(o.t1));case 16:case"end":return o.stop()}}),o)})))},r.client_id||n("