/*! For license information please see main.d336a3f3.js.LICENSE.txt */ (()=>{var e={5044:(e,t,n)=>{"use strict";n.d(t,{k:()=>de,c:()=>pe});var r=n(392);const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function o(e,t,n,r){if(["32f","64"].indexOf(t)>-1&&["32f","64"].indexOf(r)>-1)return void n.set(e);l(t),l(r);let i=function(e,t){let n=function(e){return e};e!=t&&(n=["32f","64"].includes(e)?s:["32f","64"].includes(t)?u:a);return n}(t,r),o={oldMin:Math.pow(2,parseInt(t,10))/2,newMin:Math.pow(2,parseInt(r,10))/2,oldMax:Math.pow(2,parseInt(t,10))/2-1,newMax:Math.pow(2,parseInt(r,10))/2-1};c(t,e,!0);for(let a=0,s=e.length;a0?parseInt(e/t.oldMax*t.newMax,10):parseInt(e/t.oldMin*t.newMin,10)}function s(e,t){return parseInt(e>0?e*t.newMax:e*t.newMin,10)}function u(e,t){return e>0?e/t.oldMax:e/t.oldMin}function l(e){if("32f"!=e&&"64"!=e&&(parseInt(e,10)<"8"||parseInt(e,10)>"53"))throw new Error("Invalid bit depth.")}function c(e,t,n){if("8"==e){let e=n?-128:128;for(let n=0,r=t.length;n>8&255),n.push(t.index),n.push(0),n}(e[0],t);for(let r=3,i=e.length;r32768?n-65536:n,t.index=e[2],t.step=h[t.index];let r=[t.predicted,t.predicted];for(let i=4,o=e.length;i>4,a=o<<4^n;r.push(m(a,t)),r.push(m(o,t))}return r}function g(e,t){let n=e-t.predicted,r=0;n>=0?r=0:(r=8,n=-n);let i=h[t.index],o=i>>3;return n>i&&(r|=4,n-=i,o+=i),i>>=1,n>i&&(r|=2,n-=i,o+=i),i>>=1,n>i&&(r|=1,o+=i),function(e,t,n){8&e?n.predicted-=t:n.predicted+=t;n.predicted<-32768?n.predicted=-32768:n.predicted>32767&&(n.predicted=32767);n.index+=f[7&e],n.index<0?n.index=0:n.index>88&&(n.index=88)}(r,o,t),r}function m(e,t){let n=0;return 4&e&&(n+=t.step),2&e&&(n+=t.step>>1),1&e&&(n+=t.step>>2),n+=t.step>>3,8&e&&(n=-n),t.predicted+=n,t.predicted>32767?t.predicted=32767:t.predicted<-32767&&(t.predicted=-32767),function(e,t){t.index+=f[e],t.index<0?t.index=0:t.index>88&&(t.index=88);t.step=h[t.index]}(e,t),t.predicted}const y=[1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];function v(e){let t,n=~(e=-32768==e?-32767:e)>>8&128;if(n||(e*=-1),e>32635&&(e=32635),e>=256){let n=y[e>>8&127];t=n<<4|e>>n+3&15}else t=e>>4;return 85^t^n}function b(e){let t=0;0!==(128&(e^=85))&&(e&=-129,t=-1);let n=4+((240&e)>>4),r=0;return r=4!=n?1<>8&128,0!=t&&(e=-e),(e+=w)>S&&(e=S),n=_[e>>7&255],r=e>>n+3&15,i=~(t|n<<4|r),i}function I(e){let t,n,r,i;return t=128&(e=~e),n=e>>4&7,r=15&e,i=k[n]+(r<2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length;for(let i=n;i2&&void 0!==arguments[2]?arguments[2]:0,r=0,i=e.length;for(;r>6*e)+o,n++;e>0;)t[n]=128|i>>6*(e-1)&63,n++,e--}r++}return n}class A{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.bits=e,this.offset=Math.ceil(e/8),this.max=Math.pow(2,e)-1,this.min=0,this.unpack=this.unpack_,t&&(this.max=Math.pow(2,e)/2-1,this.min=-this.max-1,this.unpack=this.unpackSigned_)}pack(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=this.clamp_(Math.round(t));for(let r=0,i=this.offset;r1&&void 0!==arguments[1]?arguments[1]:0,n=0;for(let r=0;r1&&void 0!==arguments[1]?arguments[1]:0;return this.sign_(this.unpack_(e,t))}clamp_(e){return e>this.max?this.max:ethis.max&&(e-=2*this.max+2),e}}class U{constructor(e,t){this.offset=Math.ceil((e+t)/8),this.ebits=e,this.fbits=t,this.bias=(1<this.biasP2-2*this.ebitsFbits&&(t=t<0?-1/0:1/0);let r=((t=+t)||1/t)<0||t<0?1:0;t=Math.abs(t);let i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023),o=x(t/Math.pow(2,i)*Math.pow(2,this.fbits));return t!==t?(o=Math.pow(2,this.fbits-1),i=(1<=Math.pow(2,1-this.bias)?(o/Math.pow(2,this.fbits)>=2&&(i+=1,o=1),i>this.bias?(i=(1<=0;s--){let n=e[s+t].toString(2);i+="00000000".substring(n.length)+n}let o="1"==i.charAt(0)?-1:1;i=i.substring(1);let a=parseInt(i.substring(0,this.ebits),2);return i=i.substring(this.ebits),a==r?0!==parseInt(i,2)?NaN:o*(1/0):(0===a?(a+=1,n=parseInt(i,2)):n=parseInt("1"+i,2),o*n*this.fbias*Math.pow(2,a-this.bias))}packFloatBits_(e,t,n,r,i){let o=[];o.push(n);for(let c=this.ebits;c>0;c-=1)o[c]=r%2?1:0,r=Math.floor(r/2);let a=o.length;for(let c=this.fbits;c>0;c-=1)o[a+c]=i%2?1:0,i=Math.floor(i/2);let s=o.join(""),u=this.offset+t-1,l=t;for(;u>=t;)e[u]=parseInt(s.substring(0,8),2),s=s.substring(8),u--,l++;return l}}function x(e){let t=Math.floor(e),n=e-t;return n<.5?t:n>.5||t%2?t+1:t}function R(e){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r="";for(let i=t;i=0&&a<=127)r+=String.fromCharCode(a);else{let s=0;a>=194&&a<=223?s=1:a>=224&&a<=239?(s=2,224===e[i]&&(t=160),237===e[i]&&(n=159)):a>=240&&a<=244?(s=3,240===e[i]&&(t=144),244===e[i]&&(n=143)):o=!0,a&=(1<<8-s-1)-1;for(let r=0;rn)&&(o=!0),a=a<<6|63&e[i],i++;o?r+=String.fromCharCode(65533):a<=65535?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296+(a>>10&1023),56320+(1023&a)))}}return r}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length)}function O(e){let t=[];return P(e,t),t}function D(e,t){return P(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)}function L(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=z((t=t||{}).bits,t.fp,t.signed),o=Math.ceil(t.bits/8),a=0,s=r;for(let u=e.length;a3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.length,o=z((t=t||{}).bits,t.fp,t.signed);if(i=function(e,t,n,r){let i=(n-t)%r;return n-i}(0,r,i,o.offset),t.be){let a=function(e){return new Uint8Array(e)}(e);t.be&&C(a,o.offset,r,i),j(a,n,r,i,o)}else j(e,n,r,i,o)}function F(e,t,n){return L([e],t,n,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}function N(e,t){let n=[];return F(e,t,n,0),n}function B(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[];return M(e,t,r,n,n+Math.ceil(t.bits/8)),r[0]}function j(e,t,n,r,i){let o=i.offset;for(let a=0,s=n;s1&&void 0!==arguments[1]&&arguments[1],n=this.signature.subChunks,r=[];for(let i=0;i1&&void 0!==arguments[1])||arguments[1];if(this.clearHeaders(),this.setSignature(e),this.uInt16.be=this.uInt32.be,"WAVE"!=this.format)throw Error('Could not find the "WAVE" format identifier');this.readDs64Chunk_(e),this.readFmtChunk_(e),this.readFactChunk_(e),this.readBextChunk_(e),this.readiXMLChunk_(e),this.readCueChunk_(e),this.readSmplChunk_(e),this.readDataChunk_(e,t),this.readJunkChunk_(e),this.readLISTChunk_(e),this.read_PMXChunk_(e)}clearHeaders(){let e=new H;Object.assign(this.fmt,e.fmt),Object.assign(this.fact,e.fact),Object.assign(this.cue,e.cue),Object.assign(this.smpl,e.smpl),Object.assign(this.bext,e.bext),Object.assign(this.iXML,e.iXML),Object.assign(this.ds64,e.ds64),Object.assign(this.data,e.data),this.LIST=[],Object.assign(this.junk,e.junk),Object.assign(this._PMX,e._PMX)}readFmtChunk_(e){let t=this.findChunk("fmt ");if(!t)throw Error('Could not find the "fmt " chunk');this.head=t.chunkData.start,this.fmt.chunkId=t.chunkId,this.fmt.chunkSize=t.chunkSize,this.fmt.audioFormat=this.readUInt16_(e),this.fmt.numChannels=this.readUInt16_(e),this.fmt.sampleRate=this.readUInt32(e),this.fmt.byteRate=this.readUInt32(e),this.fmt.blockAlign=this.readUInt16_(e),this.fmt.bitsPerSample=this.readUInt16_(e),this.readFmtExtension_(e)}readFmtExtension_(e){this.fmt.chunkSize>16&&(this.fmt.cbSize=this.readUInt16_(e),this.fmt.chunkSize>18&&(this.fmt.validBitsPerSample=this.readUInt16_(e),this.fmt.chunkSize>20&&(this.fmt.dwChannelMask=this.readUInt32(e),this.fmt.subformat=[this.readUInt32(e),this.readUInt32(e),this.readUInt32(e),this.readUInt32(e)])))}readFactChunk_(e){let t=this.findChunk("fact");t&&(this.head=t.chunkData.start,this.fact.chunkId=t.chunkId,this.fact.chunkSize=t.chunkSize,this.fact.dwSampleLength=this.readUInt32(e))}readCueChunk_(e){let t=this.findChunk("cue ");if(t){this.head=t.chunkData.start,this.cue.chunkId=t.chunkId,this.cue.chunkSize=t.chunkSize,this.cue.dwCuePoints=this.readUInt32(e);for(let t=0;t-1&&this.readLISTadtlSubChunks_(n,e):"INFO"==t&&this.readLISTINFOSubChunks_(n,e)}readLISTadtlSubChunks_(e,t){this.head=t.chunkData.start;let n={chunkId:t.chunkId,chunkSize:t.chunkSize,dwName:this.readUInt32(e)};"ltxt"==t.chunkId?(n.dwSampleLength=this.readUInt32(e),n.dwPurposeID=this.readUInt32(e),n.dwCountry=this.readUInt16_(e),n.dwLanguage=this.readUInt16_(e),n.dwDialect=this.readUInt16_(e),n.dwCodePage=this.readUInt16_(e),n.value=""):n.value=this.readZSTR_(e,this.head),this.LIST[this.LIST.length-1].subChunks.push(n)}readLISTINFOSubChunks_(e,t){this.head=t.chunkData.start,this.LIST[this.LIST.length-1].subChunks.push({chunkId:t.chunkId,chunkSize:t.chunkSize,value:this.readZSTR_(e,this.head)})}readJunkChunk_(e){let t=this.findChunk("junk");t&&(this.junk={chunkId:t.chunkId,chunkSize:t.chunkSize,chunkData:[].slice.call(e.slice(t.chunkData.start,t.chunkData.end))})}read_PMXChunk_(e){let t=this.findChunk("_PMX");t&&(this.head=t.chunkData.start,this._PMX.chunkId=t.chunkId,this._PMX.chunkSize=t.chunkSize,this._PMX.value=R(e,this.head,this.head+this._PMX.chunkSize))}readZSTR_(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=t;n16&&(e=e.concat(N(this.fmt.cbSize,this.uInt16))),this.fmt.chunkSize>18&&(e=e.concat(N(this.fmt.validBitsPerSample,this.uInt16))),this.fmt.chunkSize>20&&(e=e.concat(N(this.fmt.dwChannelMask,this.uInt32))),this.fmt.chunkSize>24&&(e=e.concat(N(this.fmt.subformat[0],this.uInt32),N(this.fmt.subformat[1],this.uInt32),N(this.fmt.subformat[2],this.uInt32),N(this.fmt.subformat[3],this.uInt32))),e}getLISTBytes_(){let e=[];for(let t=0;t-1){let n=K(e.value,e.value.length);t=t.concat(O(e.chunkId),N(n.length+4+1,this.uInt32),N(e.dwName,this.uInt32),n),t.push(0)}else"ltxt"==e.chunkId&&(t=t.concat(this.getLtxtChunkBytes_(e)));return t}getLtxtChunkBytes_(e){return[].concat(O(e.chunkId),N(e.value.length+20,this.uInt32),N(e.dwName,this.uInt32),N(e.dwSampleLength,this.uInt32),N(e.dwPurposeID,this.uInt32),N(e.dwCountry,this.uInt16),N(e.dwLanguage,this.uInt16),N(e.dwDialect,this.uInt16),N(e.dwCodePage,this.uInt16),K(e.value,e.value.length))}get_PMXBytes_(){let e=[];if(this._PMX.chunkId){let t=O(this._PMX.value);this._PMX.chunkSize=t.length,e=e.concat(O(this._PMX.chunkId),N(this._PMX.chunkSize,this.uInt32),t)}return this.enforceByteLen_(e),e}getJunkBytes_(){let e=[];return this.junk.chunkId?e.concat(O(this.junk.chunkId),N(this.junk.chunkData.length,this.uInt32),this.junk.chunkData):(this.enforceByteLen_(e),e)}enforceByteLen_(e){e.length%2&&e.push(0)}}function q(e,t,n){return!(n<1||e*(t/8)*n>4294967295)}class G extends W{constructor(){super(),this.bitDepth="0",this.dataType={bits:0,be:!1},this.WAV_AUDIO_FORMATS={4:17,8:1,"8a":6,"8m":7,16:1,24:1,32:1,"32f":3,64:3}}fromScratch(e,t,n,r,i){i=i||{},this.clearHeaders(),this.newWavFile_(e,t,n,r,i)}fromBuffer(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];super.fromBuffer(e,t),this.bitDepthFromFmt_(),this.updateDataType_()}toBuffer(){return this.validateWavHeader_(),super.toBuffer()}getSamples(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Float64Array,n=new t(this.data.samples.length/(this.dataType.bits/8));return M(this.data.samples,this.dataType,n,0,this.data.samples.length),!e&&this.fmt.numChannels>1?function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float64Array,r=[];for(let i=0;ithis.data.samples.length)throw new Error("Range error");return B(this.data.samples.slice(e,e+this.dataType.bits/8),this.dataType)}setSample(e,t){if((e*=this.dataType.bits/8)+this.dataType.bits/8>this.data.samples.length)throw new Error("Range error");F(t,this.dataType,this.data.samples,e,!0)}getiXML(){return this.iXML.value}setiXML(e){if("string"!==typeof e)throw new TypeError("iXML value must be a string.");this.iXML.value=e,this.iXML.chunkId="iXML"}get_PMX(){return this._PMX.value}set_PMX(e){if("string"!==typeof e)throw new TypeError("_PMX value must be a string.");this._PMX.value=e,this._PMX.chunkId="_PMX"}newWavFile_(e,t,n,r,i){i.container||(i.container="RIFF"),this.container=i.container,this.bitDepth=n,r=function(e){let t=[];if(e.length>0)if(e[0].constructor!==Number){t=new Float64Array(e[0].length*e.length);for(let n=0,r=e[0].length,i=0;n2?this.createExtensibleHeader_(e,t,n,r,i,o):this.createPCMHeader_(e,t,n,r,i,o)}createPCMHeader_(e,t,n,r,i,o){this.container=o.container,this.chunkSize=36+i,this.format="WAVE",this.bitDepth=e,this.fmt={chunkId:"fmt ",chunkSize:16,audioFormat:this.WAV_AUDIO_FORMATS[e]||65534,numChannels:t,sampleRate:n,byteRate:t*r*n,blockAlign:t*r,bitsPerSample:parseInt(e,10),cbSize:0,validBitsPerSample:0,dwChannelMask:0,subformat:[]}}createADPCMHeader_(e,t,n,r,i,o){this.createPCMHeader_(e,t,n,r,i,o),this.chunkSize=40+i,this.fmt.chunkSize=20,this.fmt.byteRate=4055,this.fmt.blockAlign=256,this.fmt.bitsPerSample=4,this.fmt.cbSize=2,this.fmt.validBitsPerSample=505,this.fact={chunkId:"fact",chunkSize:4,dwSampleLength:2*i}}createExtensibleHeader_(e,t,n,r,i,o){this.createPCMHeader_(e,t,n,r,i,o),this.chunkSize=60+i,this.fmt.chunkSize=40,this.fmt.bitsPerSample=1+(parseInt(e,10)-1|7),this.fmt.cbSize=22,this.fmt.validBitsPerSample=parseInt(e,10),this.fmt.dwChannelMask=function(e){let t=0;1===e?t=4:2===e?t=3:4===e?t=51:6===e?t=63:8===e&&(t=1599);return t}(t),this.fmt.subformat=[1,1048576,2852126848,1905997824]}createALawMulawHeader_(e,t,n,r,i,o){this.createPCMHeader_(e,t,n,r,i,o),this.chunkSize=40+i,this.fmt.chunkSize=20,this.fmt.cbSize=2,this.fmt.validBitsPerSample=8,this.fact={chunkId:"fact",chunkSize:4,dwSampleLength:i}}bitDepthFromFmt_(){3===this.fmt.audioFormat&&32===this.fmt.bitsPerSample?this.bitDepth="32f":6===this.fmt.audioFormat?this.bitDepth="8a":7===this.fmt.audioFormat?this.bitDepth="8m":this.bitDepth=this.fmt.bitsPerSample.toString()}validateBitDepth_(){if(!this.WAV_AUDIO_FORMATS[this.bitDepth]){if(parseInt(this.bitDepth,10)>8&&parseInt(this.bitDepth,10)<54)return!0;throw new Error("Invalid bit depth.")}return!0}updateDataType_(){this.dataType={bits:1+(parseInt(this.bitDepth,10)-1|7),fp:"32f"==this.bitDepth||"64"==this.bitDepth,signed:"8"!=this.bitDepth,be:"RIFX"==this.container},["4","8a","8m"].indexOf(this.bitDepth)>-1&&(this.dataType.bits=8,this.dataType.signed=!1)}validateWavHeader_(){if(this.validateBitDepth_(),e=this.fmt.numChannels,t=this.fmt.bitsPerSample,e<1||e*t/8>65535)throw new Error("Invalid number of channels.");var e,t;if(!q(this.fmt.numChannels,this.fmt.bitsPerSample,this.fmt.sampleRate))throw new Error("Invalid sample rate.")}}class Y extends G{getTag(e){let t=this.getTagIndex_(e);return null!==t.TAG?this.LIST[t.LIST].subChunks[t.TAG].value:null}setTag(e,t){e=function(e){if(e.constructor!==String)throw new Error("Invalid tag name.");if(e.length<4)for(let t=0,n=4-e.length;tt.dwSampleOffset&&!n?(this.setCuePoint_(t,r+1),this.setCuePoint_(e[r],r+2),n=!0):this.setCuePoint_(e[r],n?r+2:r+1);n||this.setCuePoint_(t,this.cue.points.length+1)}clearLISTadtl_(){for(let e=0,t=this.LIST.length;e3&&void 0!==arguments[3]?arguments[3]:null;r=r||{};let i=(n-t)/t+1,o=new Float64Array(e.length*i);r.method=r.method||"cubic";let a=new X(e.length,o.length,{method:r.method,tension:r.tension||0,sincFilterSize:r.sincFilterSize||6,sincWindow:r.sincWindow||void 0,clip:r.clip||"mirror"});if(void 0===r.LPF&&(r.LPF=Q[r.method]),r.LPF){r.LPFType=r.LPFType||"IIR";const i=ee[r.LPFType];if(n>t){!function(e,t,n,r){for(let i=0,o=t.length;i=0;i--)t[i]=r.filter(t[i])}(e,o,a,new i(r.LPForder||Z[r.LPFType],n,t/2))}else{!function(e,t,n,r){for(let i=0,o=e.length;i=0;i--)e[i]=r.filter(e[i]);ne(e,t,n)}(e,o,a,new i(r.LPForder||Z[r.LPFType],t,n/2))}}else ne(e,o,a);return o}function ne(e,t,n){for(let r=0,i=t.length;r0&&void 0!==arguments[0]?arguments[0]:"16";this.fromExisting_(this.fmt.numChannels,this.fmt.sampleRate,"16",function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:256,n={index:0,predicted:0,step:7},r=new Int16Array(2*e.length),i=[],o=0;for(let a=0,s=e.length;a0&&void 0!==arguments[0]?arguments[0]:"16";this.fromExisting_(this.fmt.numChannels,this.fmt.sampleRate,"16",function(e){let t=new Int16Array(e.length);for(let n=0,r=e.length;n0&&void 0!==arguments[0]?arguments[0]:"16";this.fromExisting_(this.fmt.numChannels,this.fmt.sampleRate,"16",function(e){let t=new Int16Array(e.length);for(let n=0,r=e.length;n1&&void 0!==arguments[1])||arguments[1],n=e,r=this.bitDepth;t||("32f"!=e&&(n=this.dataType.bits.toString()),r=""+this.dataType.bits),this.assureUncompressed_();let i=this.getSamples(!0),a=new Float64Array(i.length);o(i,r,a,n),this.fromExisting_(this.fmt.numChannels,this.fmt.sampleRate,e,a,{container:this.correctContainer_()})}toSampleRate(e,t){this.validateResample_(e);let n=this.getSamples(),r=[];if(n.constructor===Float64Array)r=te(n,this.fmt.sampleRate,e,t);else for(let i=0;i-1)throw new Error("wavefile can't change the sample rate of compressed files.")}assure16Bit_(){this.assureUncompressed_(),"16"!=this.bitDepth&&this.toBitDepth("16")}assureUncompressed_(){"8a"==this.bitDepth?this.fromALaw():"8m"==this.bitDepth?this.fromMuLaw():"4"==this.bitDepth&&this.fromIMAADPCM()}correctContainer_(){return"RF64"==this.container?"RIFF":this.container}fromExisting_(e,t,n,r,i){let o=new $;Object.assign(this.fmt,o.fmt),Object.assign(this.fact,o.fact),Object.assign(this.ds64,o.ds64),Object.assign(this.data,o.data),this.newWavFile_(e,t,n,r,i)}}function ie(e,t){let n=e/t;return n%2&&n++,n}class oe extends re{constructor(e){super(),e&&this.fromBuffer(e)}fromBase64(e){this.fromBuffer(function(e){let t=new Uint8Array(256);for(let o=0;o<64;o++)t[i.charCodeAt(o)]=o;let n=.75*e.length;"="===e[e.length-1]&&(n--,"="===e[e.length-2]&&n--);let r=new Uint8Array(n);for(let i=0,o=0;i>4,r[o++]=(15&a)<<4|s>>2,r[o++]=(3&s)<<6|63&u}return r}(e))}toBase64(){return function(e){let t="";for(let n=0;n>2],t+=i[(3&e[n])<<4|e[n+1]>>4],t+=i[(15&e[n+1])<<2|e[n+2]>>6],t+=i[63&e[n+2]];return e.length%3===2?t=t.substring(0,t.length-1)+"=":e.length%3===1&&(t=t.substring(0,t.length-2)+"=="),t}(this.toBuffer())}toDataURI(){return"data:audio/wav;base64,"+this.toBase64()}fromDataURI(e){this.fromBase64(e.replace("data:audio/wav;base64,",""))}}class ae{constructor(e,t){this._headers=void 0,this._baseUrl=void 0,this._apiEndpoint=void 0,this._kmsKeyId=void 0,this._baseUrl="https://".concat(e.url),this._headers={Authorization:t,"Content-Type":"application/json;charset=utf-8","x-amz-server-side-encryption":"aws:kms","x-amz-server-side-encryption-aws-kms-key-id":e.kmsKeyId},this._apiEndpoint=e.apiEndpoint,this._kmsKeyId=e.kmsKeyId}_url(e){return"".concat(this._baseUrl,"/").concat(this._apiEndpoint,"/").concat(e)}async get(e,t){const n=t?{...this._headers,...t}:this._headers;return await this._fetch(this._url(e),"GET",n)}async post(e,t,n){const r=n?{...this._headers,...n}:this._headers;return await this._fetch(this._url(e),"POST",r,!1,t)}async put(e,t,n){const r=n?{...this._headers,...n}:this._headers;return await this._fetch(this._url(e),"PUT",r,!1,t)}async patch(e,t,n){const r=n?{...this._headers,...n}:this._headers;return await this._fetch(this._url(e),"PATCH",r,!1,t)}async delete(e,t){const n=t?{...this._headers,...t}:this._headers;return await this._fetch(this._url(e),"DELETE",n)}async getPresignedUrl(e){return await this._fetch(e,"GET",{},!0)}async putPresignedUrl(e,t){const n=new oe;n.fromDataURI(t),n.toSampleRate(8e3),n.toMuLaw();const r=n.toBuffer(),i=await fetch(e,{method:"PUT",headers:{"Content-Type":"audio/wav"},body:r});return i.ok?this._successResponse(i.ok):(console.error(i.body),this._errorResponse(i.ok))}_successResponse(e){return{status:"success",response:e}}_errorResponse(e){return{status:"error",response:e}}async _fetch(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;const a=await fetch(e,{method:t,headers:n,body:o});if(a.ok){if(i){const e=new oe(r.Sn.from(await a.arrayBuffer()));e.fromMuLaw();const t=e.toBase64();return this._successResponse(t)}return this._successResponse(await a.json())}return this._errorResponse(await a.json())}}let se=function(e){return e.recordings="recordings",e.recording="recording",e}({});var ue=n(112),le=n(5852),ce=n(6252),fe=n(3768);const he=(0,ue.createContext)(null);function de(e){const t=(0,le.Y)(),n=(0,ce.k)(),{user:r}=t,i=(0,ue.useMemo)((()=>{if(r)return new ae(n.config,t.user.signInUserSession.idToken.jwtToken)}),[r]),o={getRecordings:async()=>i?await i.get(se.recordings):void 0,getRecording:async e=>{if(i){return await i.get("".concat(se.recording,"/").concat(e),{"Content-Type":"application/json"})}},getRecordingFromPresignedUrl:async e=>{if(i){const t=await i.getPresignedUrl(e);if("success"===t.status)return t.response}console.error("could not get audio from presigned url")},saveRecording:async(e,t)=>{if(!i)return{status:"error",response:"the api service does not exist"};{const n=await i.post("".concat(se.recording,"/").concat(e.recordingId),void 0,{"Content-Type":"audio/wav;base64"});if(n.status&&"success"===n.status&&n.response){const e=n.response.preSignedUrl;return await i.putPresignedUrl(e,t)}}},updateRecording:async e=>{if(i){return await i.put("".concat(se.recording,"/").concat(e.recordingId),JSON.stringify(e),{"Content-Type":"application/json"})}return{status:"error",response:"the api service does not exist"}},updateLabel:async(e,t)=>{if(i){e.label=t;return await i.put("".concat(se.recording,"/").concat(e.recordingId),JSON.stringify(e),{"Content-Type":"application/json"})}return{status:"error",response:"the api service does not exist"}},deleteRecording:async e=>{if(i){return await i.delete("".concat(se.recording,"/").concat(e.recordingId),{"Content-Type":"application/json"})}}};return(0,fe.jsx)(he.Provider,{value:o,children:e.children})}function pe(){return(0,ue.useContext)(he)}},5852:(e,t,n)=>{"use strict";n.d(t,{_:()=>pr,Y:()=>gr});var r=n(112),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},i(e,t)};function o(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a,s,u,l=function(){return l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function d(e){return e&&!!["provider"].find((function(t){return e.hasOwnProperty(t)}))}function p(e){return void 0!==e.redirectSignIn}!function(e){e.Cognito="COGNITO",e.Google="Google",e.Facebook="Facebook",e.Amazon="LoginWithAmazon",e.Apple="SignInWithApple"}(a||(a={})),function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default",e.DeviceConfig="deviceConfig",e.NetworkError="networkError",e.AutoSignInError="autoSignInError"}(s||(s={})),function(e){e.API_KEY="API_KEY",e.AWS_IAM="AWS_IAM",e.OPENID_CONNECT="OPENID_CONNECT",e.AMAZON_COGNITO_USER_POOLS="AMAZON_COGNITO_USER_POOLS",e.AWS_LAMBDA="AWS_LAMBDA"}(u||(u={}));var g=n(7980),m=function(){return m=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},v=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i-1)&&(r===w||b.warn("WARNING: ".concat(e," is protected and dispatching on it can have unintended consequences")));var i={channel:e,payload:m({},t),source:n,patternInfo:[]};try{this._toListeners(i)}catch(o){b.error(o)}},e.prototype.listen=function(e,t,n){var r,i=this;if(void 0===n&&(n="noname"),function(e){return void 0!==e.onHubCapsule}(t))b.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."),r=t.onHubCapsule.bind(t);else{if("function"!==typeof t)throw new Error("No callback supplied to Hub");r=t}if(e instanceof RegExp)this.patterns.push({pattern:e,callback:r});else{var o=this.listeners[e];o||(o=[],this.listeners[e]=o),o.push({name:n,callback:r})}return function(){i._remove(e,r)}},e.prototype._toListeners=function(e){var t=e.channel,n=e.payload,r=this.listeners[t];if(r&&r.forEach((function(r){b.debug("Dispatching to ".concat(t," with "),n);try{r.callback(e)}catch(i){b.error(i)}})),this.patterns.length>0){if(!n.message)return void b.warn("Cannot perform pattern matching without a message key");var i=n.message;this.patterns.forEach((function(t){var n=i.match(t.pattern);if(n){var r=y(n).slice(1),o=m(m({},e),{patternInfo:r});try{t.callback(o)}catch(a){b.error(a)}}}))}},e}())("__default__"),_={},k=function(){function e(){}return e.setItem=function(e,t){return _[e]=t,_[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(_,e)?_[e]:void 0},e.removeItem=function(e){return delete _[e]},e.clear=function(){return _={}},e}(),E=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.amplify.test-ls",1),this.storageWindow.removeItem("aws.amplify.test-ls")}catch(e){this.storageWindow=k}}return e.prototype.getStorage=function(){return this.storageWindow},e}(),I=function(){return{isBrowser:"undefined"!==typeof window&&"undefined"!==typeof window.document,isNode:"undefined"!==typeof process&&null!=process.versions&&null!=process.versions.node}},C=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!==typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),T=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},P=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},U=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;ie)&&n}}var L,M,F,N,B,j,z,V,H,K,W,q,G,Y=function(e,t,n,r){return void 0===n&&(n=O),function(e,t,n,r){return T(this,void 0,void 0,(function(){var i=this;return P(this,(function(o){if("function"!==typeof e)throw Error("functionToRetry must be a function");return[2,new Promise((function(o,a){return T(i,void 0,void 0,(function(){var i,s,u,l,c,f,h;return P(this,(function(d){switch(d.label){case 0:i=0,s=!1,l=function(){},r&&r.then((function(){s=!0,clearTimeout(u),l()})),f=function(){var r,f,h,d;return P(this,(function(p){switch(p.label){case 0:i++,x.debug("".concat(e.name," attempt #").concat(i," with this vars: ").concat(JSON.stringify(t))),p.label=1;case 1:return p.trys.push([1,3,,7]),r={},f=o,[4,e.apply(void 0,U([],A(t),!1))];case 2:return[2,(r.value=f.apply(void 0,[p.sent()]),r)];case 3:return h=p.sent(),c=h,x.debug("error on ".concat(e.name),h),(g=h)&&g.nonRetryable?(x.debug("".concat(e.name," non retryable error"),h),[2,{value:a(h)}]):(d=n(i,t,h),x.debug("".concat(e.name," retrying in ").concat(d," ms")),!1===d||s?[2,{value:a(h)}]:[3,4]);case 4:return[4,new Promise((function(e){l=e,u=setTimeout(l,d)}))];case 5:p.sent(),p.label=6;case 6:return[3,7];case 7:return[2]}var g}))},d.label=1;case 1:return s?[3,3]:[5,f()];case 2:return"object"===typeof(h=d.sent())?[2,h.value]:[3,1];case 3:return a(c),[2]}}))}))}))]}))}))}(e,t,D(n),r)},$=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},X=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},fe=function(e){var t,n,r=le.partitions;try{for(var i=ce(r),o=i.next();!o.done;o=i.next()){var a=o.value,s=a.regions,u=a.outputs,l=a.regionRegex,c=new RegExp(l);if(s.includes(e)||c.test(e))return u.dnsSuffix}}catch(f){t={error:f}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return ue.outputs.dnsSuffix},he=function(){return he=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=0;a--){o=(0,t[a])(r)(o,i)}return o(n)}},we=(n(8776),function(e){var t;return function(){return t||(t=e()),t}}),Se=function(){return Se=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]l?t.attemptsCount:l+1,t.attemptsCount=l,[4,r(c,u)];case 6:return p.sent()?!(null===o||void 0===o?void 0:o.aborted)&&l0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},Re=function(e){return Ae(void 0,void 0,void 0,(function(){var t,n,r,i,o,a,s,u,l;return Ue(this,(function(c){switch(c.label){case 0:return!e||e.statusCode<300?[2]:[4,Oe(e)];case 1:return t=c.sent(),n=function(e){var t=xe(e.toString().split(/[\,\:]+/),1)[0];return t.includes("#")?t.split("#")[1]:t}(null!==(s=null!==(a=null!==(o=e.headers["x-amzn-errortype"])&&void 0!==o?o:t.code)&&void 0!==a?a:t.__type)&&void 0!==s?s:"UnknownError"),r=null!==(l=null!==(u=t.message)&&void 0!==u?u:t.Message)&&void 0!==l?l:"Unknown error",i=new Error(r),[2,Object.assign(i,{name:n,$metadata:Te(e)})]}}))}))},Oe=function(e){return Ae(void 0,void 0,void 0,(function(){var t;return Ue(this,(function(n){switch(n.label){case 0:if(!e.body)throw new Error("Missing response payload");return[4,e.body.json()];case 1:return t=n.sent(),[2,Object.assign(t,{$metadata:Te(e)})]}}))}))},De=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch","BadRequestException"],Le=function(e){return De.includes(e)},Me=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},Fe=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},ot="aws-amplify",at=new(function(){function e(){this.userAgent="".concat(ot,"/").concat(Ke)}return Object.defineProperty(e.prototype,"framework",{get:function(){return et()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReactNative",{get:function(){return this.framework===L.ReactNative||this.framework===L.Expo},enumerable:!1,configurable:!0}),e.prototype.observeFrameworkChanges=function(e){tt(e)},e}()),st=function(e){return function(e){var t=void 0===e?{}:e,n=t.category,r=t.action,i=(t.framework,[[ot,Ke]]);return n&&i.push([n,r]),i.push(["framework",et()]),i}(e).map((function(e){var t=it(e,2),n=t[0],r=t[1];return"".concat(n,"/").concat(r)})).join(" ")},ut=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},lt=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=300?[4,Re(e)]:[3,2];case 1:throw t.sent();case 2:return[4,Oe(e)];case 3:return[2,{IdentityId:t.sent().IdentityId,$metadata:Te(e)}]}}))}))}),ft),St=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},_t=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=300?[4,Re(e)]:[3,2];case 1:throw n.sent();case 2:return[4,Oe(e)];case 3:return[2,{IdentityId:(t=n.sent()).IdentityId,Credentials:kt(t.Credentials),$metadata:Te(e)}]}}))}))}),ft),It=function(){return It=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1](new Date).getTime()?(xt.debug("token not expired"),this._setCredentialsFromFederation({provider:t,token:r,user:n,identity_id:i,expires_at:o})):a._refreshHandlers[t]&&"function"===typeof a._refreshHandlers[t]?(xt.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:a._refreshHandlers[t],provider:t,user:n})):(xt.debug("no refresh handler for provider:",t),this.clear(),Promise.reject("no refresh handler for provider"))},e.prototype._providerRefreshWithRetry=function(e){var t=this,n=e.refreshHandler,r=e.provider,i=e.user;return Y(n,[],1e4).then((function(e){return xt.debug("refresh federated token sucessfully",e),t._setCredentialsFromFederation({provider:r,token:e.token,user:i,identity_id:e.identity_id,expires_at:e.expires_at})})).catch((function(e){return"string"===typeof e&&0===e.toLowerCase().lastIndexOf("network error",e.length)||t.clear(),xt.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return xt.debug("no credentials for expiration check"),!0;xt.debug("are these credentials expired?",e);var t=Date.now();return e.expiration.getTime()<=t},e.prototype._isPastTTL=function(){return this._nextCredentialsRefresh<=Date.now()},e.prototype._setCredentialsForGuest=function(){var e;return At(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,u,l,c,f=this;return Ut(this,(function(h){switch(h.label){case 0:return xt.debug("setting credentials for guest"),(null===(e=this._config)||void 0===e?void 0:e.identityPoolId)||(this._config=Object.assign({},this._config,Tt(this._config||{}).Auth)),t=this._config,n=t.identityPoolId,r=t.region,i=t.mandatorySignIn,o=t.identityPoolRegion,i?[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")]:n?o||r?(s=this,[4,this._getGuestIdentityId()]):(xt.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):(xt.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")]);case 1:return a=s._identityId=h.sent(),u={region:null!==o&&void 0!==o?o:r},l=function(){return At(f,void 0,void 0,(function(){var e,t;return Ut(this,(function(r){switch(r.label){case 0:return a?[3,2]:[4,wt(u,{IdentityPoolId:n})];case 1:e=r.sent().IdentityId,this._identityId=e,r.label=2;case 2:return[4,Et(u,{IdentityId:this._identityId})];case 3:return t=r.sent().Credentials,[2,{identityId:this._identityId,accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretKey,sessionToken:t.SessionToken,expiration:t.Expiration}]}}))}))},c=l().catch((function(e){return At(f,void 0,void 0,(function(){return Ut(this,(function(t){throw e}))}))})),[2,this._loadCredentials(c,"guest",!1,null).then((function(e){return e})).catch((function(e){return At(f,void 0,void 0,(function(){var t,r=this;return Ut(this,(function(i){switch(i.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '".concat(a,"' not found.")?[3,2]:(xt.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return i.sent(),t=function(){return At(r,void 0,void 0,(function(){var e,t;return Ut(this,(function(r){switch(r.label){case 0:return[4,wt(u,{IdentityPoolId:n})];case 1:return e=r.sent().IdentityId,this._identityId=e,[4,Et(u,{IdentityId:e})];case 2:return t=r.sent().Credentials,[2,{identityId:e,accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretKey,sessionToken:t.SessionToken,expiration:t.Expiration}]}}))}))},c=t().catch((function(e){return At(r,void 0,void 0,(function(){return Ut(this,(function(t){throw e}))}))})),[2,this._loadCredentials(c,"guest",!1,null)];case 2:return[2,e]}}))}))}))]}}))}))},e.prototype._setCredentialsFromFederation=function(e){var t=this,n=e.provider,r=e.token,i=e.identity_id,o={google:"accounts.google.com",facebook:"graph.facebook.com",amazon:"www.amazon.com",developer:"cognito-identity.amazonaws.com"}[n]||n;if(!o)return Promise.reject("You must specify a federated provider");var a={};a[o]=r;var s=this._config,u=s.identityPoolId,l=s.region,c=s.identityPoolRegion;if(!u)return xt.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!c&&!l)return xt.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var f={region:null!==c&&void 0!==c?c:l},h=At(t,void 0,void 0,(function(){var e,t;return Ut(this,(function(n){switch(n.label){case 0:return i?[3,2]:[4,wt(f,{IdentityPoolId:u,Logins:a})];case 1:e=n.sent().IdentityId,i=e,n.label=2;case 2:return[4,Et(f,{IdentityId:i,Logins:a})];case 3:return t=n.sent().Credentials,[2,{identityId:i,accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretKey,sessionToken:t.SessionToken,expiration:t.Expiration}]}}))})).catch((function(e){return At(t,void 0,void 0,(function(){return Ut(this,(function(t){throw e}))}))}));return this._loadCredentials(h,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;xt.debug("set credentials from session");var n=e.getIdToken().getJwtToken(),r=this._config,i=r.region,o=r.userPoolId,a=r.identityPoolId,s=r.identityPoolRegion;if(!a)return xt.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!s&&!i)return xt.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var u={};u["cognito-idp."+i+".amazonaws.com/"+o]=n;var l={region:null!==s&&void 0!==s?s:i},c=At(t,void 0,void 0,(function(){var e,t,n,r,i,o,s,c,f,h;return Ut(this,(function(d){switch(d.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=d.sent())?[3,3]:[4,wt(l,{IdentityPoolId:a,Logins:u})];case 2:n=d.sent().IdentityId,t=n,d.label=3;case 3:return[4,Et(l,{IdentityId:e||t,Logins:u})];case 4:return r=d.sent(),i=r.Credentials,o=i.AccessKeyId,s=i.Expiration,c=i.SecretKey,f=i.SessionToken,h=r.IdentityId,this._identityId=h,e?(xt.debug("The guest identity ".concat(e," has been successfully linked to the logins")),e===h&&xt.debug("The guest identity ".concat(e," has become the primary identity")),[4,this._removeGuestIdentityId()]):[3,6];case 5:d.sent(),d.label=6;case 6:return[2,{accessKeyId:o,secretAccessKey:c,sessionToken:f,expiration:s,identityId:h}]}}))})).catch((function(e){return At(t,void 0,void 0,(function(){return Ut(this,(function(t){throw e}))}))}));return this._loadCredentials(c,"userPool",!0,null)},e.prototype._loadCredentials=function(e,t,n,r){var i=this,o=this;return new Promise((function(a,s){e.then((function(e){return At(i,void 0,void 0,(function(){var i,s,u,l,c;return Ut(this,(function(f){switch(f.label){case 0:if(xt.debug("Load credentials successfully",e),this._identityId&&!e.identityId&&(e.identityId=this._identityId),o._credentials=e,o._credentials.authenticated=n,o._credentials_source=t,o._nextCredentialsRefresh=(new Date).getTime()+3e6,"federated"===t){i=Object.assign({id:this._credentials.identityId},r.user),s=r.provider,u=r.token,l=r.expires_at,c=r.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:s,token:u,user:i,expires_at:l,identity_id:c}))}catch(h){xt.debug("Failed to put federated info into auth storage",h)}}return"guest"!==t?[3,2]:[4,this._setGuestIdentityId(e.identityId)];case 1:f.sent(),f.label=2;case 2:return a(o._credentials),[2]}}))}))})).catch((function(t){if(t)return xt.debug("Failed to load credentials",e),xt.debug("Error loading credentials",t),void s(t)}))}))},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(xt.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return At(this,void 0,void 0,(function(){return Ut(this,(function(e){return this._credentials=null,this._credentials_source=null,xt.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return At(this,void 0,void 0,(function(){var e,t;return Ut(this,(function(n){switch(n.label){case 0:e=this._config.identityPoolId,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._storageSync];case 2:return n.sent(),[2,this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))];case 3:return t=n.sent(),xt.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return At(this,void 0,void 0,(function(){var t,n;return Ut(this,(function(r){switch(r.label){case 0:t=this._config.identityPoolId,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),this._storage.setItem(this._getCognitoIdentityIdStorageKey(t),e),[3,4];case 3:return n=r.sent(),xt.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return At(this,void 0,void 0,(function(){var e;return Ut(this,(function(t){return e=this._config.identityPoolId,xt.debug("removing ".concat(this._getCognitoIdentityIdStorageKey(e)," from storage")),this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)),[2]}))}))},e.prototype.shear=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e}(),Dt=new Ot(null);se.g.register(Dt);var Lt=n(8208);function Mt(e,t){void 0===t&&(t={});var n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(function(e,t){return"undefined"===typeof t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(r){}return e}var Ft=function(){return Ft=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0&&this.changeListeners.splice(t,1)},e}();var Bt=function(){return Bt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")}(this)},e}(),Gt=n(3004);const Yt=$t;function $t(e,t){null!=e&&this.fromString(e,t)}function Xt(){return new $t(null)}var Jt;var Qt="undefined"!==typeof navigator;Qt&&"Microsoft Internet Explorer"==navigator.appName?($t.prototype.am=function(e,t,n,r,i,o){for(var a=32767&t,s=t>>15;--o>=0;){var u=32767&this[e],l=this[e++]>>15,c=s*u+l*a;i=((u=a*u+((32767&c)<<15)+n[r]+(1073741823&i))>>>30)+(c>>>15)+s*l+(i>>>30),n[r++]=1073741823&u}return i},Jt=30):Qt&&"Netscape"!=navigator.appName?($t.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var a=t*this[e++]+n[r]+i;i=Math.floor(a/67108864),n[r++]=67108863&a}return i},Jt=26):($t.prototype.am=function(e,t,n,r,i,o){for(var a=16383&t,s=t>>14;--o>=0;){var u=16383&this[e],l=this[e++]>>14,c=s*u+l*a;i=((u=a*u+((16383&c)<<14)+n[r]+i)>>28)+(c>>14)+s*l,n[r++]=268435455&u}return i},Jt=28),$t.prototype.DB=Jt,$t.prototype.DM=(1<>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function un(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t},un.prototype.revert=function(e){var t=Xt();return e.copyTo(t),this.reduce(t),t},un.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},un.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},un.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},$t.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},$t.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},$t.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var a=on(e,r);a<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this[this.t++]=a:o+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-o):this[this.t-1]|=a<=this.DB&&(o-=this.DB))}this.clamp(),i&&$t.ZERO.subTo(this,this)},$t.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},$t.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},$t.prototype.drShiftTo=function(e,t){for(var n=e;n=0;--n)t[n+a+1]=this[n]>>i|s,s=(this[n]&o)<=0;--n)t[n]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},$t.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var a=n+1;a>r;r>0&&(t[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},$t.prototype.multiplyTo=function(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},$t.prototype.divRemTo=function(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(u,o),i.lShiftTo(u,n)):(r.copyTo(o),i.copyTo(n));var l=o.t,c=o[l-1];if(0!=c){var f=c*(1<1?o[l-2]>>this.F2:0),h=this.FV/f,d=(1<=0&&(n[n.t++]=1,n.subTo(y,n)),$t.ONE.dlShiftTo(l,y),y.subTo(o,o);o.t=0;){var v=n[--g]==c?this.DM:Math.floor(n[g]*h+(n[g-1]+p)*d);if((n[g]+=o.am(0,v,n,m,0,l))0&&n.rShiftTo(u,n),a<0&&$t.ZERO.subTo(n,n)}}},$t.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},$t.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},$t.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");t=2}var n,r=(1<0)for(s>s)>0&&(i=!0,o=rn(n));a>=0;)s>(s+=this.DB-t)):(n=this[a]>>(s-=t)&r,s<=0&&(s+=this.DB,--a)),n>0&&(i=!0),i&&(o+=rn(n));return i?o:"0"},$t.prototype.negate=function(){var e=Xt();return $t.ZERO.subTo(this,e),e},$t.prototype.abs=function(){return this.s<0?this.negate():this},$t.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},$t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+sn(this[this.t-1]^this.s&this.DM)},$t.prototype.mod=function(e){var t=Xt();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo($t.ZERO)>0&&e.subTo(t,t),t},$t.prototype.equals=function(e){return 0==this.compareTo(e)},$t.prototype.add=function(e){var t=Xt();return this.addTo(e,t),t},$t.prototype.subtract=function(e){var t=Xt();return this.subTo(e,t),t},$t.prototype.multiply=function(e){var t=Xt();return this.multiplyTo(e,t),t},$t.prototype.divide=function(e){var t=Xt();return this.divRemTo(e,t,null),t},$t.prototype.modPow=function(e,t,n){var r,i=e.bitLength(),o=an(1),a=new un(t);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6;var s=new Array,u=3,l=r-1,c=(1<1){var f=Xt();for(a.sqrTo(s[1],f);u<=c;)s[u]=Xt(),a.mulTo(f,s[u-2],s[u]),u+=2}var h,d,p=e.t-1,g=!0,m=Xt();for(i=sn(e[p])-1;p>=0;){for(i>=l?h=e[p]>>i-l&c:(h=(e[p]&(1<0&&(h|=e[p-1]>>this.DB+i-l)),u=r;0==(1&h);)h>>=1,--u;if((i-=u)<0&&(i+=this.DB,--p),g)s[h].copyTo(o),g=!1;else{for(;u>1;)a.sqrTo(o,m),a.sqrTo(m,o),u-=2;u>0?a.sqrTo(o,m):(d=o,o=m,m=d),a.mulTo(m,s[h],o)}for(;p>=0&&0==(e[p]&1<e)&&i}}(n))})((function(t){return new Promise((function(n,i){r.request(e,t,(function(e,t){e?i(e):n(t)}))}))}),[t],5e3).then((function(e){return n(null,e)})).catch((function(e){return n(e)}))},t.request=function(e,t,n){var r,i={"Content-Type":"application/x-amz-json-1.1","X-Amz-Target":"AWSCognitoIdentityProviderService."+e,"X-Amz-User-Agent":xn(),"Cache-Control":"no-store"},o=Object.assign({},this.fetchOptions,{headers:i,method:"POST",mode:"cors",body:JSON.stringify(t)});fetch(this.endpoint,o).then((function(e){return r=e,e}),(function(e){if(e instanceof TypeError)throw new Error("Network error");throw e})).then((function(e){return e.json().catch((function(){return{}}))})).then((function(e){if(r.ok)return n(null,e);e;var t=(e.__type||e.code).split("#").pop(),i=new Error(e.message||e.Message||null);return i.name=t,i.code=t,n(i)})).catch((function(e){if(r&&r.headers&&r.headers.get("x-amzn-errortype"))try{var t=r.headers.get("x-amzn-errortype").split(":")[0],i=new Error(r.status?r.status.toString():null);return i.code=t,i.name=t,i.statusCode=r.status,n(i)}catch(o){return n(e)}else e instanceof Error&&"Network error"===e.message&&(e.code="NetworkError");return n(e)}))},e}(),Bn={debug:function(){}},jn=function(e){return e&&e.nonRetryable};function zn(e,t,n,r){if(void 0===r&&(r=1),"function"!==typeof e)throw Error("functionToRetry must be a function");return Bn.debug(e.name+" attempt #"+r+" with args: "+JSON.stringify(t)),e.apply(void 0,t).catch((function(i){if(Bn.debug("error on "+e.name,i),jn(i))throw Bn.debug(e.name+" non retryable error",i),i;var o=n(r,t,i);if(Bn.debug(e.name+" retrying in "+o+" ms"),!1!==o)return new Promise((function(e){return setTimeout(e,o)})).then((function(){return zn(e,t,n,r+1)}));throw i}))}var Vn=3e5;var Hn=function(){function e(e,t){var n=e||{},r=n.UserPoolId,i=n.ClientId,o=n.endpoint,a=n.fetchOptions,s=n.AdvancedSecurityDataCollectionFlag;if(!r||!i)throw new Error("Both UserPoolId and ClientId are required.");if(r.length>55||!/^[\w-]+_[0-9a-zA-Z]+$/.test(r))throw new Error("Invalid UserPoolId format.");var u=r.split("_")[0];this.userPoolId=r,this.clientId=i,this.client=new Nn(u,o,a),this.advancedSecurityDataCollectionFlag=!1!==s,this.storage=e.Storage||(new Cn).getStorage(),t&&(this.wrapRefreshSessionCallback=t)}var t=e.prototype;return t.getUserPoolId=function(){return this.userPoolId},t.getUserPoolName=function(){return this.getUserPoolId().split("_")[1]},t.getClientId=function(){return this.clientId},t.signUp=function(e,t,n,r,i,o){var a=this,s={ClientId:this.clientId,Username:e,Password:t,UserAttributes:n,ValidationData:r,ClientMetadata:o};this.getUserContextData(e)&&(s.UserContextData=this.getUserContextData(e)),this.client.request("SignUp",s,(function(t,n){if(t)return i(t,null);var r={Username:e,Pool:a,Storage:a.storage},o={user:new Pn(r),userConfirmed:n.UserConfirmed,userSub:n.UserSub,codeDeliveryDetails:n.CodeDeliveryDetails};return i(null,o)}))},t.getCurrentUser=function(){var e="CognitoIdentityServiceProvider."+this.clientId+".LastAuthUser",t=this.storage.getItem(e);if(t){var n={Username:t,Pool:this,Storage:this.storage};return new Pn(n)}return null},t.getUserContextData=function(e){if("undefined"!==typeof AmazonCognitoAdvancedSecurityData){var t=AmazonCognitoAdvancedSecurityData;if(this.advancedSecurityDataCollectionFlag){var n=t.getData(e,this.userPoolId,this.clientId);if(n)return{EncodedData:n}}return{}}},e}(),Kn=n(4392),Wn=function(){function e(e){if(void 0===e&&(e={}),e.domain&&(this.domain=e.domain),e.path?this.path=e.path:this.path="/",Object.prototype.hasOwnProperty.call(e,"expires")?this.expires=e.expires:this.expires=365,Object.prototype.hasOwnProperty.call(e,"secure")?this.secure=e.secure:this.secure=!0,Object.prototype.hasOwnProperty.call(e,"sameSite")){if(!["strict","lax","none"].includes(e.sameSite))throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');if("none"===e.sameSite&&!this.secure)throw new Error("sameSite = None requires the Secure attribute in latest browser versions.");this.sameSite=e.sameSite}else this.sameSite=null}var t=e.prototype;return t.setItem=function(e,t){var n={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(n.sameSite=this.sameSite),Kn.set(e,t,n),Kn.get(e)},t.getItem=function(e){return Kn.get(e)},t.removeItem=function(e){var t={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(t.sameSite=this.sameSite),Kn.remove(e,t)},t.clear=function(){for(var e=Kn.get(),t=Object.keys(e).length,n=0;n0;--n)t+=r[Math.round(61*Math.random())];return t},e.prototype._generateChallenge=function(e){var t=new $n.Sha256;t.update(e);var n=t.digestSync(),r=Yn.Sn.from(n).toString("base64");return this._base64URL(r)},e.prototype._base64URL=function(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.prototype._generateRandom=function(e){var t=new Uint8Array(e);if("undefined"!==typeof window&&window.crypto)window.crypto.getRandomValues(t);else for(var n=0;n18e4?(clearInterval(r),lr("autoSignIn_failure",null,"Please confirm your account and use your credentials to sign in."),t._storage.removeItem("amplify-auto-sign-in")):t.signInAfterUserConfirmed(e,null,r)}),5e3)},e.prototype.signInAfterUserConfirmed=function(e,t,n){return c(this,void 0,void 0,(function(){var r,i,o=this;return f(this,(function(a){switch(a.label){case 0:r=this.createCognitoUser(e.getUsername()),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.authenticateUser(e,this.authCallbacks(r,(function(r){lr("autoSignIn",r,e.getUsername()+" has signed in successfully"),t&&S.remove("auth",t),n&&(clearInterval(n),o._storage.removeItem("amplify-polling-started")),o._storage.removeItem("amplify-auto-sign-in")}),(function(e){ar.error(e),o._storage.removeItem("amplify-auto-sign-in")})))];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),ar.error(i),[3,4];case 4:return[2]}}))}))},e.prototype.confirmSignUp=function(e,t,n){var r=this;if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(s.EmptyUsername);if(!t)return this.rejectAuthError(s.EmptyCode);var i,o=this.createCognitoUser(e),a=!n||"boolean"!==typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?i=n.clientMetadata:this._config.clientMetadata&&(i=this._config.clientMetadata),new Promise((function(n,u){o.confirmRegistration(t,a,(function(t,i){t?u(t):(lr("confirmSignUp",i,e+" has been confirmed successfully"),r.isTrueStorageValue("amplify-auto-sign-in")&&!r.autoSignInInitiated&&(lr("autoSignIn_failure",null,s.AutoSignInError),r._storage.removeItem("amplify-auto-sign-in")),n(i))}),i)}))},e.prototype.isTrueStorageValue=function(e){var t=this._storage.getItem(e);return!!t&&"true"===t},e.prototype.resendSignUp=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(s.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(e,r){n.resendConfirmationCode((function(t,n){t?r(t):e(n)}),t)}))},e.prototype.signIn=function(e,t,n){if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();var r=null,i=null,o={};if("string"===typeof e)r=e,i=t;else{if(!e.username)return this.rejectAuthError(s.InvalidUsername);"undefined"!==typeof t&&ar.warn("The password should be defined under the first parameter object!"),r=e.username,i=e.password,o=e.validationData}if(!r)return this.rejectAuthError(s.EmptyUsername);var a=new Ht({Username:r,Password:i,ValidationData:o,ClientMetadata:n});return i?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var r=this,i=this;return{onSuccess:function(o){return c(r,void 0,void 0,(function(){var r,a,s,u;return f(this,(function(l){switch(l.label){case 0:ar.debug(o),delete e.challengeName,delete e.challengeParam,l.label=1;case 1:return l.trys.push([1,4,5,9]),[4,this.Credentials.clear()];case 2:return l.sent(),[4,this.Credentials.set(o,"session")];case 3:return r=l.sent(),ar.debug("succeed to get cognito credentials",r),[3,9];case 4:return a=l.sent(),ar.debug("cannot get cognito credentials",a),[3,9];case 5:return l.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return s=l.sent(),i.user=s,lr("signIn",s,"A user "+e.getUsername()+" has been signed in"),t(s),[3,8];case 7:return u=l.sent(),ar.error("Failed to get the signed in user",u),n(u),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){ar.debug("signIn failure",t),lr("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){ar.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){ar.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){ar.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){ar.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){ar.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){ar.debug("signIn selectMFAType",n),e.challengeName=n,e.challengeParam=r,t(e)}}},e.prototype.signInWithPassword=function(e){var t=this;if(this.pendingSignIn)throw new Error("Pending sign-in attempt already in progress");var n=this.createCognitoUser(e.getUsername());return this.pendingSignIn=new Promise((function(r,i){n.authenticateUser(e,t.authCallbacks(n,(function(e){t.pendingSignIn=null,r(e)}),(function(e){t.pendingSignIn=null,i(e)})))})),this.pendingSignIn},e.prototype.signInWithoutPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return n.setAuthenticationFlowType("CUSTOM_AUTH"),new Promise((function(r,i){n.initiateAuth(e,t.authCallbacks(n,r,i))}))},e.prototype.getMFAOptions=function(e){return new Promise((function(t,n){e.getMFAOptions((function(e,r){if(e)return ar.debug("get MFA Options failed",e),void n(e);ar.debug("get MFA options success",r),t(r)}))}))},e.prototype.getPreferredMFA=function(e,t){var n=this,r=this;return new Promise((function(i,o){var a=n._config.clientMetadata,s=!!t&&t.bypassCache;e.getUserData((function(t,a){return c(n,void 0,void 0,(function(){var n,s;return f(this,(function(u){switch(u.label){case 0:if(!t)return[3,5];if(ar.debug("getting preferred mfa failed",t),!this.isSessionInvalid(t))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return u.sent(),[3,4];case 3:return n=u.sent(),o(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return o(t),[2];case 5:return(s=r._getMfaTypeFromUserData(a))?(i(s),[2]):(o("invalid MFA Type"),[2])}}))}))}),{bypassCache:s,clientMetadata:a})}))},e.prototype._getMfaTypeFromUserData=function(e){var t=null,n=e.PreferredMfaSetting;if(n)t=n;else{var r=e.UserMFASettingList;if(r)0===r.length?t="NOMFA":ar.debug("invalid case for getPreferredMFA",e);else t=e.MFAOptions?"SMS_MFA":"NOMFA"}return t},e.prototype._getUserData=function(e,t){var n=this;return new Promise((function(r,i){e.getUserData((function(t,o){return c(n,void 0,void 0,(function(){var n;return f(this,(function(a){switch(a.label){case 0:if(!t)return[3,5];if(ar.debug("getting user data failed",t),!this.isSessionInvalid(t))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return a.sent(),[3,4];case 3:return n=a.sent(),i(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return i(t),[2];case 5:r(o),a.label=6;case 6:return[2]}}))}))}),t)}))},e.prototype.setPreferredMFA=function(e,t){return c(this,void 0,void 0,(function(){var n,r,i,o,a,u,l=this;return f(this,(function(h){switch(h.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(r=h.sent(),i=null,o=null,t){case"TOTP":case"SOFTWARE_TOKEN_MFA":return[3,2];case"SMS":case"SMS_MFA":return[3,3];case"NOMFA":return[3,4]}return[3,6];case 2:return o={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return i={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return a=r.UserMFASettingList,[4,this._getMfaTypeFromUserData(r)];case 5:if("NOMFA"===(u=h.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===u)i={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==u)return[2,this.rejectAuthError(s.InvalidMFA)];o={PreferredMfa:!1,Enabled:!1}}return a&&0!==a.length&&a.forEach((function(e){"SMS_MFA"===e?i={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(o={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return ar.debug("no validmfa method provided"),[2,this.rejectAuthError(s.NoMFA)];case 7:return this,[2,new Promise((function(t,r){e.setUserMfaPreference(i,o,(function(i,o){if(i)return ar.debug("Set user mfa preference error",i),r(i);ar.debug("Set user mfa success",o),ar.debug("Caching the latest user data into local"),e.getUserData((function(n,i){return c(l,void 0,void 0,(function(){var i;return f(this,(function(a){switch(a.label){case 0:if(!n)return[3,5];if(ar.debug("getting user data failed",n),!this.isSessionInvalid(n))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),r(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(n)];case 5:return[2,t(o)]}}))}))}),{bypassCache:!0,clientMetadata:n})}))}))]}}))}))},e.prototype.disableSMS=function(e){return new Promise((function(t,n){e.disableMFA((function(e,r){if(e)return ar.debug("disable mfa failed",e),void n(e);ar.debug("disable mfa succeed",r),t(r)}))}))},e.prototype.enableSMS=function(e){return new Promise((function(t,n){e.enableMFA((function(e,r){if(e)return ar.debug("enable mfa failed",e),void n(e);ar.debug("enable mfa succeed",r),t(r)}))}))},e.prototype.setupTOTP=function(e){return new Promise((function(t,n){e.associateSoftwareToken({onFailure:function(e){ar.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){ar.debug("associateSoftwareToken success",e),t(e)}})}))},e.prototype.verifyTotpToken=function(e,t){var n;ar.debug("verification totp token",e,t),e&&"function"===typeof e.getSignInUserSession&&(n=e.getSignInUserSession());var r=null===n||void 0===n?void 0:n.isValid();return new Promise((function(n,i){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){ar.debug("verifyTotpToken failed",e),i(e)},onSuccess:function(t){r||lr("signIn",e,"A user "+e.getUsername()+" has been signed in"),lr("verify",e,"A user "+e.getUsername()+" has been verified"),ar.debug("verifyTotpToken success",t),n(t)}})}))},e.prototype.confirmSignIn=function(e,t,n,r){var i=this;if(void 0===r&&(r=this._config.clientMetadata),!t)return this.rejectAuthError(s.EmptyCode);var o=this;return new Promise((function(a,s){e.sendMFACode(t,{onSuccess:function(t){return c(i,void 0,void 0,(function(){var n,r,i,s;return f(this,(function(u){switch(u.label){case 0:ar.debug(t),u.label=1;case 1:return u.trys.push([1,4,5,10]),[4,this.Credentials.clear()];case 2:return u.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=u.sent(),ar.debug("succeed to get cognito credentials",n),[3,10];case 4:return r=u.sent(),ar.debug("cannot get cognito credentials",r),[3,10];case 5:o.user=e,u.label=6;case 6:return u.trys.push([6,8,,9]),[4,this.currentUserPoolUser()];case 7:return i=u.sent(),e.attributes=i.attributes,[3,9];case 8:return s=u.sent(),ar.debug("cannot get updated Cognito User",s),[3,9];case 9:return lr("signIn",e,"A user "+e.getUsername()+" has been signed in"),a(e),[7];case 10:return[2]}}))}))},onFailure:function(e){ar.debug("confirm signIn failure",e),s(e)}},n,r)}))},e.prototype.completeNewPassword=function(e,t,n,r){var i=this;if(void 0===n&&(n={}),void 0===r&&(r=this._config.clientMetadata),!t)return this.rejectAuthError(s.EmptyPassword);var o=this;return new Promise((function(a,s){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return c(i,void 0,void 0,(function(){var n,r;return f(this,(function(i){switch(i.label){case 0:ar.debug(t),i.label=1;case 1:return i.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return i.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=i.sent(),ar.debug("succeed to get cognito credentials",n),[3,6];case 4:return r=i.sent(),ar.debug("cannot get cognito credentials",r),[3,6];case 5:return o.user=e,lr("signIn",e,"A user "+e.getUsername()+" has been signed in"),a(e),[7];case 6:return[2]}}))}))},onFailure:function(e){ar.debug("completeNewPassword failure",e),lr("completeNewPassword_failure",e,i.user+" failed to complete the new password flow"),s(e)},mfaRequired:function(t,n){ar.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,a(e)},mfaSetup:function(t,n){ar.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,a(e)},totpRequired:function(t,n){ar.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,a(e)}},r)}))},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var r=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(s.EmptyChallengeResponse);return new Promise((function(i,o){e.sendCustomChallengeAnswer(t,r.authCallbacks(e,i,o),n)}))},e.prototype.deleteUserAttributes=function(e,t){var n=this;return new Promise((function(r,i){n.userSession(e).then((function(n){e.deleteAttributes(t,(function(e,t){return e?i(e):r(t)}))}))}))},e.prototype.deleteUser=function(){return c(this,void 0,void 0,(function(){var e,t,n=this;return f(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._storageSync];case 1:return r.sent(),[3,3];case 2:throw e=r.sent(),ar.debug("Failed to sync cache info into memory",e),new Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(e,r){return c(n,void 0,void 0,(function(){var n,i=this;return f(this,(function(o){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return ar.debug("Failed to get user from user pool"),[2,r(new Error("No current user."))];n.getSession((function(o,a){return c(i,void 0,void 0,(function(){var i,a=this;return f(this,(function(s){switch(s.label){case 0:if(!o)return[3,5];if(ar.debug("Failed to get the user session",o),!this.isSessionInvalid(o))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(n)];case 2:return s.sent(),[3,4];case 3:return i=s.sent(),r(new Error("Session is invalid due to: "+o.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(o)];case 5:n.deleteUser((function(i,o){if(i)r(i);else{lr("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),a.user=null;try{a.cleanCachedItems()}catch(s){ar.debug("failed to clear cached items")}t?a.oAuthSignOutRedirect(e,r):(lr("signOut",a.user,"A user has been signed out"),e(o))}})),s.label=6;case 6:return[2]}}))}))}))}else ar.debug("no Congito User pool"),r(new Error("Cognito User pool does not exist"));return[2]}))}))}))]}}))}))},e.prototype.updateUserAttributes=function(e,t,n){var r=this;void 0===n&&(n=this._config.clientMetadata);var i=[],o=this;return new Promise((function(a,s){o.userSession(e).then((function(o){for(var u in t)if("sub"!==u&&u.indexOf("_verified")<0){var l={Name:u,Value:t[u]};i.push(l)}e.updateAttributes(i,(function(e,n,i){if(e)return lr("updateUserAttributes_failure",e,"Failed to update attributes"),s(e);var o=r.createUpdateAttributesResultList(t,null===i||void 0===i?void 0:i.CodeDeliveryDetailsList);return lr("updateUserAttributes",o,"Attributes successfully updated"),a(n)}),n)}))}))},e.prototype.createUpdateAttributesResultList=function(e,t){var n={};return Object.keys(e).forEach((function(e){n[e]={isUpdated:!0};var r=null===t||void 0===t?void 0:t.find((function(t){return t.AttributeName===e}));r&&(n[e].isUpdated=!1,n[e].codeDeliveryDetails=r)})),n},e.prototype.userAttributes=function(e){var t=this;return new Promise((function(n,r){t.userSession(e).then((function(t){e.getUserAttributes((function(e,t){e?r(e):n(t)}))}))}))},e.prototype.verifiedContact=function(e){var t=this;return this.userAttributes(e).then((function(e){var n=t.attributesToObject(e),r={},i={};return n.email&&(n.email_verified?i.email=n.email:r.email=n.email),n.phone_number&&(n.phone_number_verified?i.phone_number=n.phone_number:r.phone_number=n.phone_number),{verified:i,unverified:r}}))},e.prototype.isErrorWithMessage=function(e){return"object"===typeof e&&Object.prototype.hasOwnProperty.call(e,"message")},e.prototype.isTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Access Token has been revoked"===e.message},e.prototype.isRefreshTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has been revoked"===e.message},e.prototype.isUserDisabledError=function(e){return this.isErrorWithMessage(e)&&"User is disabled."===e.message},e.prototype.isUserDoesNotExistError=function(e){return this.isErrorWithMessage(e)&&"User does not exist."===e.message},e.prototype.isRefreshTokenExpiredError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has expired"===e.message},e.prototype.isPasswordResetRequiredError=function(e){return this.isErrorWithMessage(e)&&"Password reset required for the user"===e.message},e.prototype.isSignedInHostedUI=function(){return this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI")},e.prototype.isSessionInvalid=function(e){return this.isUserDisabledError(e)||this.isUserDoesNotExistError(e)||this.isTokenRevokedError(e)||this.isRefreshTokenRevokedError(e)||this.isRefreshTokenExpiredError(e)||this.isPasswordResetRequiredError(e)},e.prototype.cleanUpInvalidSession=function(e){return c(this,void 0,void 0,(function(){var t=this;return f(this,(function(n){switch(n.label){case 0:e.signOut(),this.user=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.cleanCachedItems()];case 2:return n.sent(),[3,4];case 3:return n.sent(),ar.debug("failed to clear cached items"),[3,4];case 4:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(lr("signOut",this.user,"A user has been signed out"),[2])}}))}))},e.prototype.currentUserPoolUser=function(e){var t=this;return this.userPool?new Promise((function(n,r){t._storageSync.then((function(){return c(t,void 0,void 0,(function(){var t,i,o,a,s,u,l=this;return f(this,(function(h){switch(h.label){case 0:return this.isOAuthInProgress()?(ar.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise((function(e){var t=setTimeout((function(){ar.debug("OAuth signIn in progress timeout"),S.remove("auth",n),e()}),1e4);function n(r){var i=r.payload.event;"cognitoHostedUI"!==i&&"cognitoHostedUI_failure"!==i||(ar.debug("OAuth signIn resolved: "+i),clearTimeout(t),S.remove("auth",n),e())}S.listen("auth",n)}))]):[3,2];case 1:h.sent(),h.label=2;case 2:if(!(t=this.userPool.getCurrentUser()))return ar.debug("Failed to get user from user pool"),r("No current user"),[2];h.label=3;case 3:return h.trys.push([3,7,,8]),[4,this._userSession(t)];case 4:return i=h.sent(),(o=!!e&&e.bypassCache)?[4,this.Credentials.clear()]:[3,6];case 5:h.sent(),h.label=6;case 6:return a=this._config.clientMetadata,s=i.getAccessToken().decodePayload().scope,(void 0===s?"":s).split(" ").includes(sr)?(t.getUserData((function(e,i){return c(l,void 0,void 0,(function(){var o,a,s,u,l,c,h;return f(this,(function(f){switch(f.label){case 0:if(!e)return[3,7];if(ar.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return f.sent(),[3,4];case 3:return o=f.sent(),r(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return r(e),[3,6];case 5:n(t),f.label=6;case 6:return[2];case 7:for(a=i.PreferredMfaSetting||"NOMFA",s=[],u=0;u{!t&&i&&(s(),o(!1))}),[t,i]);const s=()=>{cr.currentAuthenticatedUser().then((e=>{n(e)})).catch((e=>{console.error({ERROR:e})}))},u={user:t,isAuthorized:void 0!==t,signIn:()=>{cr.federatedSignIn({customProvider:a.config.providerName})},getAuthenticatedUser:s};return(0,hr.jsx)(dr.Provider,{value:u,children:e.children})}function gr(){return(0,r.useContext)(dr)}},6252:(e,t,n)=>{"use strict";n.d(t,{G:()=>s,k:()=>u});var r=n(112),i=n(7280),o=n(3768);const a=(0,r.createContext)(null);function s(e){const[t,n]=(0,r.useState)(!0),[s,u]=(0,r.useState)();(0,r.useEffect)((()=>{t&&(l().then((e=>{const t={Auth:{region:e.region,userPoolId:e.userPoolId,userPoolWebClientId:e.userPoolWebClientId,mandatorySignIn:!1,oauth:{domain:e.domain,scope:["email","openid"],redirectSignIn:e.redirectSignIn,responseType:"token"}}};i.g.configure(t),u(e)})),n(!1))}),[t]);const l=async()=>{const e=await fetch("/config.json");return await e.json()},c={config:s};return(0,o.jsx)(a.Provider,{value:c,children:e.children})}function u(){return(0,r.useContext)(a)}},5992:(e,t,n)=>{"use strict";n.d(t,{a:()=>s,u:()=>u});var r=n(112);var i=n(5044),o=n(3768);const a=(0,r.createContext)(null);function s(e){const t=(0,i.c)(),n=function(){const[e,t]=(0,r.useState)(!1),[n,i]=(0,r.useState)(null);return{closeDialog:e=>{i(null),t(!1)},item:n,open:e,openDialog:e=>{i(e),t(!0)}}}(),[s,u]=(0,r.useState)(function(){const e=[];for(let t=0;t<10;t++)e.push({label:"Message ".concat(t+1),recordingId:"".concat(t+1),audioUrl:null,hasRecording:"no",audio:null});return e}()),[l,c]=(0,r.useState)(!0),[f,h]=(0,r.useState)(!0),[d,p]=(0,r.useState)();(0,r.useEffect)((()=>{l&&(t.getRecordings().then((e=>{if(e&&"success"===e.status){const t=s.map((t=>{var n;const r=null===(n=e.response)||void 0===n?void 0:n.recordings.find((e=>e.recordingId===t.recordingId));return r||t}));u(t)}})),c(!1))}),[l]),(0,r.useEffect)((()=>{f&&d&&(t.getRecording(d).then((e=>{if(e)if("success"===e.status){const t=s.map((t=>(t.recordingId===d&&(t.audioUrl=e.response.preSignedUrl),t)));u(t)}else console.error("could not get recording")})),h(!1),p(void 0))}),[f,d]);const g={recordingDialog:n,recordings:s,updateRecording:e=>{p(e),h(!0)},refreshRecording:e=>{const t=s.map((t=>t.recordingId===e.recordingId?e:t));u(t)}};return(0,o.jsx)(a.Provider,{value:g,children:e.children})}function u(){return(0,r.useContext)(a)}},1356:(e,t,n)=>{"use strict";var r=n(3452),i=n(9696),o=n(8912);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return P(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var f=!0,h=0;hi&&(r=i):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128===(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128===(192&o)&&128===(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128===(192&o)&&128===(192&a)&&128===(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),c=e.slice(t,n),f=0;fi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return k(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function P(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,r,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function L(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function M(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,r,o){return o||M(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function N(e,t,n,r,o){return o||M(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||O(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return N(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return N(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function H(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}},8912:e=>{var t={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==t.call(e)}},7280:(e,t,n)=>{"use strict";n.d(t,{g:()=>a});var r=n(7980),i=function(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},o=new r.u("Amplify"),a=new(function(){function e(){this._components=[],this._config={},this._modules={},this.Auth=null,this.Analytics=null,this.API=null,this.Credentials=null,this.Storage=null,this.I18n=null,this.Cache=null,this.PubSub=null,this.Interactions=null,this.Pushnotification=null,this.UI=null,this.XR=null,this.Predictions=null,this.DataStore=null,this.Geo=null,this.Notifications=null,this.Logger=r.u,this.ServiceWorker=null}return e.prototype.register=function(e){o.debug("component registered in amplify",e),this._components.push(e),"function"===typeof e.getModuleName?(this._modules[e.getModuleName()]=e,this[e.getModuleName()]=e):o.debug("no getModuleName method for component",e),e.configure(this._config)},e.prototype.configure=function(e){var t=this;return e?(this._config=Object.assign(this._config,e),o.debug("amplify config",this._config),Object.entries(this._modules).forEach((function(e){var n=i(e,2),r=(n[0],n[1]);Object.keys(r).forEach((function(e){t._modules[e]&&(r[e]=t._modules[e])}))})),this._components.map((function(e){e.configure(t._config)})),this._config):this._config},e.prototype.addPluggable=function(e){e&&e.getCategory&&"function"===typeof e.getCategory&&this._components.map((function(t){t.addPluggable&&"function"===typeof t.addPluggable&&t.addPluggable(e)}))},e}())},7980:(e,t,n)=>{"use strict";n.d(t,{u:()=>u});var r,i=function(e){var t="function"===typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"===typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=function(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i=s[l]){var c=console.log.bind(console);t===r.ERROR&&console.error&&(c=console.error.bind(console)),t===r.WARN&&console.warn&&(c=console.warn.bind(console));var f="[".concat(t,"] ").concat(this._ts()," ").concat(this.name),h="";if(1===a.length&&"string"===typeof a[0])c(h="".concat(f," - ").concat(a[0]));else if(1===a.length)h="".concat(f," ").concat(a[0]),c(f,a[0]);else if("string"===typeof a[0]){var d=a.slice(1);1===d.length&&(d=d[0]),h="".concat(f," - ").concat(a[0]," ").concat(d),c("".concat(f," - ").concat(a[0]),d)}else h="".concat(f," ").concat(a),c(f,a);try{for(var p=i(this._pluggables),g=p.next();!g.done;g=p.next()){var m=g.value,y={message:h,timestamp:Date.now()};m.pushLogs([y])}}catch(v){n={error:v}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}}},e.prototype.log=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var r=n(9784),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],f=0;f>>17|h<<15)^(h>>>19|h<<13)^h>>>10,p=((h=this.temp[f-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[f]=(d+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var g=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&u^~s&l)|0)+(c+(r.KEY[f]+this.temp[f]|0)|0)|0,m=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;c=l,l=u,u=s,s=a+g|0,a=o,o=i,i=n,n=g+m|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=a,t[4]+=s,t[5]+=u,t[6]+=l,t[7]+=c},e}();t.RawSha256=i},9784:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},1880:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(216).__exportStar(n(748),t)},748:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(216),i=n(9784),o=n(7352),a=n(5504),s=function(){function e(e){this.secret=e,this.hash=new o.RawSha256,this.reset()}return e.prototype.update=function(e){if(!(0,a.isEmptyData)(e)&&!this.error)try{this.hash.update((0,a.convertToBuffer)(e))}catch(t){this.error=t}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.digestSync()]}))}))},e.prototype.reset=function(){if(this.hash=new o.RawSha256,this.secret){this.outer=new o.RawSha256;var e=function(e){var t=(0,a.convertToBuffer)(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(this.secret),t=new Uint8Array(i.BLOCK_SIZE);t.set(e);for(var n=0;n{"use strict";n.r(t),n.d(t,{__assign:()=>o,__asyncDelegator:()=>w,__asyncGenerator:()=>b,__asyncValues:()=>S,__await:()=>v,__awaiter:()=>c,__classPrivateFieldGet:()=>I,__classPrivateFieldSet:()=>C,__createBinding:()=>h,__decorate:()=>s,__exportStar:()=>d,__extends:()=>i,__generator:()=>f,__importDefault:()=>E,__importStar:()=>k,__makeTemplateObject:()=>_,__metadata:()=>l,__param:()=>u,__read:()=>g,__rest:()=>a,__spread:()=>m,__spreadArrays:()=>y,__values:()=>p});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function u(e,t){return function(n,r){t(n,r,e)}}function l(e,t){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(e,t)}function c(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function m(){for(var e=[],t=0;t1||s(e,t)}))})}function s(e,t){try{(n=i[e](t)).value instanceof v?Promise.resolve(n.value.v).then(u,l):c(o[0][2],n)}catch(r){c(o[0][3],r)}var n}function u(e){s("next",e)}function l(e){s("throw",e)}function c(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:v(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function k(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}function I(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function C(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},2077:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(868),i="undefined"!==typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"===typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}},5504:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(2077);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(1520);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(1963);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var a=n(4824);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return a.uint32ArrayFrom}})},1520:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"===typeof e?0===e.length:0===e.byteLength}},1963:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},4824:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n{"use strict";n.r(t),n.d(t,{fromUtf8:()=>r,toUtf8:()=>i});const r=e=>"function"===typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):(e=>{const t=[];for(let n=0,r=e.length;n>6|192,63&r|128);else if(n+1>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(r>>12|224,r>>6&63|128,63&r|128)}return Uint8Array.from(t)})(e),i=e=>"function"===typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):(e=>{let t="";for(let n=0,r=e.length;ne.toString(16))).join("%");t+=decodeURIComponent(i)}else t+=String.fromCharCode((15&r)<<12|(63&e[++n])<<6|63&e[++n])}return t})(e)},52:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;ty,En:()=>M,M5:()=>D,O8:()=>h,So:()=>i,_:()=>L,ay:()=>j,e8:()=>V,gv:()=>te,iU:()=>a,mc:()=>x,q4:()=>s,sZ:()=>z}),function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(i||(i={}));const o="popstate";function a(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:n,search:r,hash:i}=e.location;return c("",{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"===typeof t?t:f(t)}),null,e)}function s(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}function u(e,t){if(!e){"undefined"!==typeof console&&console.warn(t);try{throw new Error(t)}catch(n){}}}function l(e,t){return{usr:e.state,key:e.key,idx:t}}function c(e,t,n,i){return void 0===n&&(n=null),r({pathname:"string"===typeof e?e:e.pathname,search:"",hash:""},"string"===typeof t?h(t):t,{state:n,key:t&&t.key||i||Math.random().toString(36).substr(2,8)})}function f(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(t+="#"===r.charAt(0)?r:"#"+r),t}function h(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function d(e,t,n,a){void 0===a&&(a={});let{window:u=document.defaultView,v5Compat:h=!1}=a,d=u.history,p=i.Pop,g=null,m=y();function y(){return(d.state||{idx:null}).idx}function v(){p=i.Pop;let e=y(),t=null==e?null:e-m;m=e,g&&g({action:p,location:w.location,delta:t})}function b(e){let t="null"!==u.location.origin?u.location.origin:u.location.href,n="string"===typeof e?e:f(e);return s(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==m&&(m=0,d.replaceState(r({},d.state,{idx:m}),""));let w={get action(){return p},get location(){return e(u,d)},listen(e){if(g)throw new Error("A history only accepts one active listener");return u.addEventListener(o,v),g=e,()=>{u.removeEventListener(o,v),g=null}},createHref:e=>t(u,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){p=i.Push;let r=c(w.location,e,t);n&&n(r,e),m=y()+1;let o=l(r,m),a=w.createHref(r);try{d.pushState(o,"",a)}catch(s){if(s instanceof DOMException&&"DataCloneError"===s.name)throw s;u.location.assign(a)}h&&g&&g({action:p,location:w.location,delta:1})},replace:function(e,t){p=i.Replace;let r=c(w.location,e,t);n&&n(r,e),m=y();let o=l(r,m),a=w.createHref(r);d.replaceState(o,"",a),h&&g&&g({action:p,location:w.location,delta:0})},go:e=>d.go(e)};return w}var p;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(p||(p={}));const g=new Set(["lazy","caseSensitive","path","id","index","children"]);function m(e,t,n,i){return void 0===n&&(n=[]),void 0===i&&(i={}),e.map(((e,o)=>{let a=[...n,o],u="string"===typeof e.id?e.id:a.join("-");if(s(!0!==e.index||!e.children,"Cannot specify children on an index route"),s(!i[u],'Found a route id collision on id "'+u+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let n=r({},e,t(e),{id:u});return i[u]=n,n}{let n=r({},e,t(e),{id:u,children:void 0});return i[u]=n,e.children&&(n.children=m(e.children,t,a,i)),n}}))}function y(e,t,n){void 0===n&&(n="/");let r=x(("string"===typeof t?h(t):t).pathname||"/",n);if(null==r)return null;let i=v(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(i);let o=null;for(let a=0;null==o&&a{let a={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:i,route:e};a.relativePath.startsWith("/")&&(s(a.relativePath.startsWith(r),'Absolute route path "'+a.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),a.relativePath=a.relativePath.slice(r.length));let u=M([r,a.relativePath]),l=n.concat(a);e.children&&e.children.length>0&&(s(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+u+'".'),v(e.children,t,l,u)),(null!=e.path||e.index)&&t.push({path:u,score:T(u,e.index),routesMeta:l})};return e.forEach(((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let r of b(e.path))i(e,t,r);else i(e,t)})),t}function b(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return i?[o,""]:[o];let a=b(r.join("/")),s=[];return s.push(...a.map((e=>""===e?o:[o,e].join("/")))),i&&s.push(...a),s.map((t=>e.startsWith("/")&&""===t?"/":t))}const w=/^:[\w-]+$/,S=3,_=2,k=1,E=10,I=-2,C=e=>"*"===e;function T(e,t){let n=e.split("/"),r=n.length;return n.some(C)&&(r+=I),t&&(r+=_),n.filter((e=>!C(e))).reduce(((e,t)=>e+(w.test(t)?S:""===t?k:E)),r)}function P(e,t){let{routesMeta:n}=e,r={},i="/",o=[];for(let a=0;a(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(r.push({paramName:"*"}),i+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":""!==e&&"/"!==e&&(i+="(?:(?=\\/|$))");let o=new RegExp(i,t?void 0:"i");return[o,r]}(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],a=o.replace(/(.)\/+$/,"$1"),s=i.slice(1);return{params:r.reduce(((e,t,n)=>{let{paramName:r,isOptional:i}=t;if("*"===r){let e=s[n]||"";a=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const l=s[n];return e[r]=i&&!l?void 0:function(e,t){try{return decodeURIComponent(e)}catch(n){return u(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+n+")."),e}}(l||"",r),e}),{}),pathname:o,pathnameBase:a,pattern:e}}function U(e){try{return decodeURI(e)}catch(t){return u(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function x(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function R(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in and the router will parse it for you.'}function O(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function D(e,t){let n=O(e);return t?n.map(((t,n)=>n===e.length-1?t.pathname:t.pathnameBase)):n.map((e=>e.pathnameBase))}function L(e,t,n,i){let o;void 0===i&&(i=!1),"string"===typeof e?o=h(e):(o=r({},e),s(!o.pathname||!o.pathname.includes("?"),R("?","pathname","search",o)),s(!o.pathname||!o.pathname.includes("#"),R("#","pathname","hash",o)),s(!o.search||!o.search.includes("#"),R("#","search","hash",o)));let a,u=""===e||""===o.pathname,l=u?"/":o.pathname;if(null==l)a=n;else{let e=t.length-1;if(!i&&l.startsWith("..")){let t=l.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}a=e>=0?t[e]:"/"}let c=function(e,t){void 0===t&&(t="/");let{pathname:n,search:r="",hash:i=""}="string"===typeof e?h(e):e,o=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:o,search:N(r),hash:B(i)}}(o,a),f=l&&"/"!==l&&l.endsWith("/"),d=(u||"."===l)&&n.endsWith("/");return c.pathname.endsWith("/")||!f&&!d||(c.pathname+="/"),c}const M=e=>e.join("/").replace(/\/\/+/g,"/"),F=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),N=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",B=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class j extends Error{}class z{constructor(e,t,n,r){void 0===r&&(r=!1),this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function V(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"boolean"===typeof e.internal&&"data"in e}const H=["post","put","patch","delete"],K=new Set(H),W=["get",...H],q=new Set(W),G=new Set([301,302,303,307,308]),Y=new Set([307,308]),$={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},X={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Q=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Z=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),ee="remix-router-transitions";function te(e){const t=e.window?e.window:"undefined"!==typeof window?window:void 0,n="undefined"!==typeof t&&"undefined"!==typeof t.document&&"undefined"!==typeof t.document.createElement,o=!n;let a;if(s(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;a=e=>({hasErrorBoundary:t(e)})}else a=Z;let l,f,h={},d=m(e.routes,a,void 0,h),g=e.basename||"/",v=r({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),b=null,w=new Set,S=null,_=null,k=null,E=null!=e.hydrationData,I=y(d,e.history.location,g),C=null;if(null==I){let t=ve(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=ye(d);I=n,C={[r.id]:t}}let T,P=I.some((e=>e.route.lazy)),A=I.some((e=>e.route.loader));if(P)f=!1;else if(A)if(v.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;f=I.every((e=>e.route.loader&&!0!==e.route.loader.hydrate&&(t&&void 0!==t[e.route.id]||n&&void 0!==n[e.route.id])))}else f=null!=e.hydrationData;else f=!0;let U,R={historyAction:e.history.action,location:e.history.location,matches:I,initialized:f,navigation:$,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||C,fetchers:new Map,blockers:new Map},O=i.Pop,D=!1,L=!1,M=new Map,F=null,N=!1,B=!1,j=[],z=[],V=new Map,H=0,K=-1,W=new Map,q=new Set,G=new Map,te=new Map,ie=new Set,ae=new Map,se=new Map,ue=!1;function fe(e,t){void 0===t&&(t={}),R=r({},R,e);let n=[],i=[];v.v7_fetcherPersist&&R.fetchers.forEach(((e,t)=>{"idle"===e.state&&(ie.has(t)?i.push(t):n.push(t))})),[...w].forEach((e=>e(R,{deletedFetchers:i,unstable_viewTransitionOpts:t.viewTransitionOpts,unstable_flushSync:!0===t.flushSync}))),v.v7_fetcherPersist&&(n.forEach((e=>R.fetchers.delete(e))),i.forEach((e=>Fe(e))))}function he(t,n,o){var a,s;let u,{flushSync:c}=void 0===o?{}:o,f=null!=R.actionData&&null!=R.navigation.formMethod&&Ce(R.navigation.formMethod)&&"loading"===R.navigation.state&&!0!==(null==(a=t.state)?void 0:a._isRedirect);u=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:f?R.actionData:null;let h=n.loaderData?ge(R.loaderData,n.loaderData,n.matches||[],n.errors):R.loaderData,p=R.blockers;p.size>0&&(p=new Map(p),p.forEach(((e,t)=>p.set(t,J))));let g,m=!0===D||null!=R.navigation.formMethod&&Ce(R.navigation.formMethod)&&!0!==(null==(s=t.state)?void 0:s._isRedirect);if(l&&(d=l,l=void 0),N||O===i.Pop||(O===i.Push?e.history.push(t,t.state):O===i.Replace&&e.history.replace(t,t.state)),O===i.Pop){let e=M.get(R.location.pathname);e&&e.has(t.pathname)?g={currentLocation:R.location,nextLocation:t}:M.has(t.pathname)&&(g={currentLocation:t,nextLocation:R.location})}else if(L){let e=M.get(R.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),M.set(R.location.pathname,e)),g={currentLocation:R.location,nextLocation:t}}fe(r({},n,{actionData:u,loaderData:h,historyAction:O,location:t,initialized:!0,navigation:$,revalidation:"idle",restoreScrollPosition:Ge(t,n.matches||R.matches),preventScrollReset:m,blockers:p}),{viewTransitionOpts:g,flushSync:!0===c}),O=i.Pop,D=!1,L=!1,N=!1,B=!1,j=[],z=[]}async function de(t,n,o){U&&U.abort(),U=null,O=t,N=!0===(o&&o.startUninterruptedRevalidation),function(e,t){if(S&&k){let n=qe(e,t);S[n]=k()}}(R.location,R.matches),D=!0===(o&&o.preventScrollReset),L=!0===(o&&o.enableViewTransition);let s=l||d,u=o&&o.overrideNavigation,c=y(s,n,g),f=!0===(o&&o.flushSync);if(!c){let e=ve(404,{pathname:n.pathname}),{matches:t,route:r}=ye(s);return We(),void he(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:f})}if(R.initialized&&!B&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(R.location,n)&&!(o&&o.submission&&Ce(o.submission.formMethod)))return void he(n,{matches:c},{flushSync:f});U=new AbortController;let m,b,w=ce(e.history,n,U.signal,o&&o.submission);if(o&&o.pendingError)b={[me(c).route.id]:o.pendingError};else if(o&&o.submission&&Ce(o.submission.formMethod)){let e=await async function(e,t,n,r,o){void 0===o&&(o={});Ie();let s,u=function(e,t){let n={state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text};return n}(t,n);fe({navigation:u},{flushSync:!0===o.flushSync});let l=Ue(r,t);if(l.route.action||l.route.lazy){if(s=await le("action",e,l,r,h,a,g,v.v7_relativeSplatPath),e.signal.aborted)return{shortCircuited:!0}}else s={type:p.error,error:ve(405,{method:e.method,pathname:t.pathname,routeId:l.route.id})};if(ke(s)){let e;return e=o&&null!=o.replace?o.replace:s.location===R.location.pathname+R.location.search,await we(R,s,{submission:n,replace:e}),{shortCircuited:!0}}if(_e(s)){let e=me(r,l.route.id);return!0!==(o&&o.replace)&&(O=i.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:s.error}}}if(Se(s))throw ve(400,{type:"defer-action"});return{pendingActionData:{[l.route.id]:s.data}}}(w,n,o.submission,c,{replace:o.replace,flushSync:f});if(e.shortCircuited)return;m=e.pendingActionData,b=e.pendingActionError,u=Re(n,o.submission),f=!1,w=new Request(w.url,{signal:w.signal})}let{shortCircuited:_,loaderData:E,errors:I}=await async function(t,n,i,o,a,s,u,c,f,h,p){let m=o||Re(n,a),y=a||s||xe(m),b=l||d,[w,S]=oe(e.history,R,i,y,n,v.v7_partialHydration&&!0===c,B,j,z,ie,G,q,b,g,h,p);if(We((e=>!(i&&i.some((t=>t.route.id===e)))||w&&w.some((t=>t.route.id===e)))),K=++H,0===w.length&&0===S.length){let e=je();return he(n,r({matches:i,loaderData:{},errors:p||null},h?{actionData:h}:{},e?{fetchers:new Map(R.fetchers)}:{}),{flushSync:f}),{shortCircuited:!0}}if(!N&&(!v.v7_partialHydration||!c)){S.forEach((e=>{let t=R.fetchers.get(e.key),n=Oe(void 0,t?t.data:void 0);R.fetchers.set(e.key,n)}));let e=h||R.actionData;fe(r({navigation:m},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},S.length>0?{fetchers:new Map(R.fetchers)}:{}),{flushSync:f})}S.forEach((e=>{V.has(e.key)&&Ne(e.key),e.controller&&V.set(e.key,e.controller)}));let _=()=>S.forEach((e=>Ne(e.key)));U&&U.signal.addEventListener("abort",_);let{results:k,loaderResults:E,fetcherResults:I}=await Ee(R.matches,i,w,S,t);if(t.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",_);S.forEach((e=>V.delete(e.key)));let C=be(k);if(C){if(C.idx>=w.length){let e=S[C.idx-w.length].key;q.add(e)}return await we(R,C.result,{replace:u}),{shortCircuited:!0}}let{loaderData:T,errors:P}=pe(R,i,w,E,p,S,I,ae);ae.forEach(((e,t)=>{e.subscribe((n=>{(n||e.done)&&ae.delete(t)}))}));let A=je(),x=ze(K),O=A||x||S.length>0;return r({loaderData:T,errors:P},O?{fetchers:new Map(R.fetchers)}:{})}(w,n,c,u,o&&o.submission,o&&o.fetcherSubmission,o&&o.replace,o&&!0===o.initialHydration,f,m,b);_||(U=null,he(n,r({matches:c},m?{actionData:m}:{},{loaderData:E,errors:I})))}async function we(o,a,u){let{submission:l,fetcherSubmission:f,replace:h}=void 0===u?{}:u;a.revalidate&&(B=!0);let d=c(o.location,a.location,{_isRedirect:!0});if(s(d,"Expected a location on the redirect navigation"),n){let n=!1;if(a.reloadDocument)n=!0;else if(Q.test(a.location)){const r=e.history.createURL(a.location);n=r.origin!==t.location.origin||null==x(r.pathname,g)}if(n)return void(h?t.location.replace(a.location):t.location.assign(a.location))}U=null;let p=!0===h?i.Replace:i.Push,{formMethod:m,formAction:y,formEncType:v}=o.navigation;!l&&!f&&m&&y&&v&&(l=xe(o.navigation));let b=l||f;if(Y.has(a.status)&&b&&Ce(b.formMethod))await de(p,d,{submission:r({},b,{formAction:a.location}),preventScrollReset:D});else{let e=Re(d,l);await de(p,d,{overrideNavigation:e,fetcherSubmission:f,preventScrollReset:D})}}async function Ee(t,n,r,i,o){let s=await Promise.all([...r.map((e=>le("loader",o,e,n,h,a,g,v.v7_relativeSplatPath))),...i.map((t=>{if(t.matches&&t.match&&t.controller)return le("loader",ce(e.history,t.path,t.controller.signal),t.match,t.matches,h,a,g,v.v7_relativeSplatPath);return{type:p.error,error:ve(404,{pathname:t.path})}}))]),u=s.slice(0,r.length),l=s.slice(r.length);return await Promise.all([Te(t,r,u,u.map((()=>o.signal)),!1,R.loaderData),Te(t,i.map((e=>e.match)),l,i.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:s,loaderResults:u,fetcherResults:l}}function Ie(){B=!0,j.push(...We()),G.forEach(((e,t)=>{V.has(t)&&(z.push(t),Ne(t))}))}function Ae(e,t,n){void 0===n&&(n={}),R.fetchers.set(e,t),fe({fetchers:new Map(R.fetchers)},{flushSync:!0===(n&&n.flushSync)})}function Le(e,t,n,r){void 0===r&&(r={});let i=me(R.matches,t);Fe(e),fe({errors:{[i.route.id]:n},fetchers:new Map(R.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function Me(e){return v.v7_fetcherPersist&&(te.set(e,(te.get(e)||0)+1),ie.has(e)&&ie.delete(e)),R.fetchers.get(e)||X}function Fe(e){let t=R.fetchers.get(e);!V.has(e)||t&&"loading"===t.state&&W.has(e)||Ne(e),G.delete(e),W.delete(e),q.delete(e),ie.delete(e),R.fetchers.delete(e)}function Ne(e){let t=V.get(e);s(t,"Expected fetch controller: "+e),t.abort(),V.delete(e)}function Be(e){for(let t of e){let e=De(Me(t).data);R.fetchers.set(t,e)}}function je(){let e=[],t=!1;for(let n of q){let r=R.fetchers.get(n);s(r,"Expected fetcher: "+n),"loading"===r.state&&(q.delete(n),e.push(n),t=!0)}return Be(e),t}function ze(e){let t=[];for(let[n,r]of W)if(r0}function Ve(e){R.blockers.delete(e),se.delete(e)}function He(e,t){let n=R.blockers.get(e)||J;s("unblocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"proceeding"===t.state||"blocked"===n.state&&"unblocked"===t.state||"proceeding"===n.state&&"unblocked"===t.state,"Invalid blocker state transition: "+n.state+" -> "+t.state);let r=new Map(R.blockers);r.set(e,t),fe({blockers:r})}function Ke(e){let{currentLocation:t,nextLocation:n,historyAction:r}=e;if(0===se.size)return;se.size>1&&u(!1,"A router only supports one blocker at a time");let i=Array.from(se.entries()),[o,a]=i[i.length-1],s=R.blockers.get(o);return s&&"proceeding"===s.state?void 0:a({currentLocation:t,nextLocation:n,historyAction:r})?o:void 0}function We(e){let t=[];return ae.forEach(((n,r)=>{e&&!e(r)||(n.cancel(),t.push(r),ae.delete(r))})),t}function qe(e,t){if(_){return _(e,t.map((e=>function(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],handle:n.handle}}(e,R.loaderData))))||e.key}return e.key}function Ge(e,t){if(S){let n=qe(e,t),r=S[n];if("number"===typeof r)return r}return null}return T={get basename(){return g},get future(){return v},get state(){return R},get routes(){return d},get window(){return t},initialize:function(){if(b=e.history.listen((t=>{let{action:n,location:r,delta:i}=t;if(ue)return void(ue=!1);u(0===se.size||null!=i,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let o=Ke({currentLocation:R.location,nextLocation:r,historyAction:n});return o&&null!=i?(ue=!0,e.history.go(-1*i),void He(o,{state:"blocked",location:r,proceed(){He(o,{state:"proceeding",proceed:void 0,reset:void 0,location:r}),e.history.go(i)},reset(){let e=new Map(R.blockers);e.set(o,J),fe({blockers:e})}})):de(n,r)})),n){!function(e,t){try{let n=e.sessionStorage.getItem(ee);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch(n){}}(t,M);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,n]of t)r[e]=[...n];try{e.sessionStorage.setItem(ee,JSON.stringify(r))}catch(n){u(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}(t,M);t.addEventListener("pagehide",e),F=()=>t.removeEventListener("pagehide",e)}return R.initialized||de(i.Pop,R.location,{initialHydration:!0}),T},subscribe:function(e){return w.add(e),()=>w.delete(e)},enableScrollRestoration:function(e,t,n){if(S=e,k=t,_=n||null,!E&&R.navigation===$){E=!0;let e=Ge(R.location,R.matches);null!=e&&fe({restoreScrollPosition:e})}return()=>{S=null,k=null,_=null}},navigate:async function t(n,o){if("number"===typeof n)return void e.history.go(n);let a=ne(R.location,R.matches,g,v.v7_prependBasename,n,v.v7_relativeSplatPath,null==o?void 0:o.fromRouteId,null==o?void 0:o.relative),{path:s,submission:u,error:l}=re(v.v7_normalizeFormMethod,!1,a,o),f=R.location,h=c(R.location,s,o&&o.state);h=r({},h,e.history.encodeLocation(h));let d=o&&null!=o.replace?o.replace:void 0,p=i.Push;!0===d?p=i.Replace:!1===d||null!=u&&Ce(u.formMethod)&&u.formAction===R.location.pathname+R.location.search&&(p=i.Replace);let m=o&&"preventScrollReset"in o?!0===o.preventScrollReset:void 0,y=!0===(o&&o.unstable_flushSync),b=Ke({currentLocation:f,nextLocation:h,historyAction:p});if(!b)return await de(p,h,{submission:u,pendingError:l,preventScrollReset:m,replace:o&&o.replace,enableViewTransition:o&&o.unstable_viewTransition,flushSync:y});He(b,{state:"blocked",location:h,proceed(){He(b,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),t(n,o)},reset(){let e=new Map(R.blockers);e.set(b,J),fe({blockers:e})}})},fetch:function(t,n,r,i){if(o)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");V.has(t)&&Ne(t);let u=!0===(i&&i.unstable_flushSync),c=l||d,f=ne(R.location,R.matches,g,v.v7_prependBasename,r,v.v7_relativeSplatPath,n,null==i?void 0:i.relative),p=y(c,f,g);if(!p)return void Le(t,n,ve(404,{pathname:f}),{flushSync:u});let{path:m,submission:b,error:w}=re(v.v7_normalizeFormMethod,!0,f,i);if(w)return void Le(t,n,w,{flushSync:u});let S=Ue(p,m);D=!0===(i&&i.preventScrollReset),b&&Ce(b.formMethod)?async function(t,n,r,i,o,u,c){if(Ie(),G.delete(t),!i.route.action&&!i.route.lazy){let e=ve(405,{method:c.formMethod,pathname:r,routeId:n});return void Le(t,n,e,{flushSync:u})}let f=R.fetchers.get(t);Ae(t,function(e,t){let n={state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0};return n}(c,f),{flushSync:u});let p=new AbortController,m=ce(e.history,r,p.signal,c);V.set(t,p);let b=H,w=await le("action",m,i,o,h,a,g,v.v7_relativeSplatPath);if(m.signal.aborted)return void(V.get(t)===p&&V.delete(t));if(v.v7_fetcherPersist&&ie.has(t)){if(ke(w)||_e(w))return void Ae(t,De(void 0))}else{if(ke(w))return V.delete(t),K>b?void Ae(t,De(void 0)):(q.add(t),Ae(t,Oe(c)),we(R,w,{fetcherSubmission:c}));if(_e(w))return void Le(t,n,w.error)}if(Se(w))throw ve(400,{type:"defer-action"});let S=R.navigation.location||R.location,_=ce(e.history,S,p.signal),k=l||d,E="idle"!==R.navigation.state?y(k,R.navigation.location,g):R.matches;s(E,"Didn't find any matches after fetcher action");let I=++H;W.set(t,I);let C=Oe(c,w.data);R.fetchers.set(t,C);let[T,P]=oe(e.history,R,E,c,S,!1,B,j,z,ie,G,q,k,g,{[i.route.id]:w.data},void 0);P.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,n=R.fetchers.get(t),r=Oe(void 0,n?n.data:void 0);R.fetchers.set(t,r),V.has(t)&&Ne(t),e.controller&&V.set(t,e.controller)})),fe({fetchers:new Map(R.fetchers)});let A=()=>P.forEach((e=>Ne(e.key)));p.signal.addEventListener("abort",A);let{results:x,loaderResults:D,fetcherResults:L}=await Ee(R.matches,E,T,P,_);if(p.signal.aborted)return;p.signal.removeEventListener("abort",A),W.delete(t),V.delete(t),P.forEach((e=>V.delete(e.key)));let M=be(x);if(M){if(M.idx>=T.length){let e=P[M.idx-T.length].key;q.add(e)}return we(R,M.result)}let{loaderData:F,errors:N}=pe(R,R.matches,T,D,void 0,P,L,ae);if(R.fetchers.has(t)){let e=De(w.data);R.fetchers.set(t,e)}ze(I),"loading"===R.navigation.state&&I>K?(s(O,"Expected pending action"),U&&U.abort(),he(R.navigation.location,{matches:E,loaderData:F,errors:N,fetchers:new Map(R.fetchers)})):(fe({errors:N,loaderData:ge(R.loaderData,F,E,N),fetchers:new Map(R.fetchers)}),B=!1)}(t,n,m,S,p,u,b):(G.set(t,{routeId:n,path:m}),async function(t,n,r,i,o,u,l){let c=R.fetchers.get(t);Ae(t,Oe(l,c?c.data:void 0),{flushSync:u});let f=new AbortController,d=ce(e.history,r,f.signal);V.set(t,f);let p=H,m=await le("loader",d,i,o,h,a,g,v.v7_relativeSplatPath);Se(m)&&(m=await Pe(m,d.signal,!0)||m);V.get(t)===f&&V.delete(t);if(d.signal.aborted)return;if(ie.has(t))return void Ae(t,De(void 0));if(ke(m))return K>p?void Ae(t,De(void 0)):(q.add(t),void await we(R,m));if(_e(m))return void Le(t,n,m.error);s(!Se(m),"Unhandled fetcher deferred data"),Ae(t,De(m.data))}(t,n,m,S,p,u,b))},revalidate:function(){Ie(),fe({revalidation:"loading"}),"submitting"!==R.navigation.state&&("idle"!==R.navigation.state?de(O||R.historyAction,R.navigation.location,{overrideNavigation:R.navigation}):de(R.historyAction,R.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Me,deleteFetcher:function(e){if(v.v7_fetcherPersist){let t=(te.get(e)||0)-1;t<=0?(te.delete(e),ie.add(e)):te.set(e,t)}else Fe(e);fe({fetchers:new Map(R.fetchers)})},dispose:function(){b&&b(),F&&F(),w.clear(),U&&U.abort(),R.fetchers.forEach(((e,t)=>Fe(t))),R.blockers.forEach(((e,t)=>Ve(t)))},getBlocker:function(e,t){let n=R.blockers.get(e)||J;return se.get(e)!==t&&se.set(e,t),n},deleteBlocker:Ve,_internalFetchControllers:V,_internalActiveDeferreds:ae,_internalSetRoutes:function(e){h={},l=m(e,a,void 0,h)}},T}Symbol("deferred");function ne(e,t,n,r,i,o,a,s){let u,l;if(a){u=[];for(let e of t)if(u.push(e),e.route.id===a){l=e;break}}else u=t,l=t[t.length-1];let c=L(i||".",D(u,o),x(e.pathname,n)||e.pathname,"path"===s);return null==i&&(c.search=e.search,c.hash=e.hash),null!=i&&""!==i&&"."!==i||!l||!l.route.index||Ae(c.search)||(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r&&"/"!==n&&(c.pathname="/"===c.pathname?n:M([n,c.pathname])),f(c)}function re(e,t,n,r){if(!r||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(r))return{path:n};if(r.formMethod&&!Ie(r.formMethod))return{path:n,error:ve(405,{method:r.formMethod})};let i,o,a=()=>({path:n,error:ve(400,{type:"invalid-body"})}),u=r.formMethod||"get",l=e?u.toUpperCase():u.toLowerCase(),c=we(n);if(void 0!==r.body){if("text/plain"===r.formEncType){if(!Ce(l))return a();let e="string"===typeof r.body?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce(((e,t)=>{let[n,r]=t;return""+e+n+"="+r+"\n"}),""):String(r.body);return{path:n,submission:{formMethod:l,formAction:c,formEncType:r.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===r.formEncType){if(!Ce(l))return a();try{let e="string"===typeof r.body?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:l,formAction:c,formEncType:r.formEncType,formData:void 0,json:e,text:void 0}}}catch(g){return a()}}}if(s("function"===typeof FormData,"FormData is not available in this environment"),r.formData)i=fe(r.formData),o=r.formData;else if(r.body instanceof FormData)i=fe(r.body),o=r.body;else if(r.body instanceof URLSearchParams)i=r.body,o=he(i);else if(null==r.body)i=new URLSearchParams,o=new FormData;else try{i=new URLSearchParams(r.body),o=he(i)}catch(g){return a()}let d={formMethod:l,formAction:c,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:o,json:void 0,text:void 0};if(Ce(d.formMethod))return{path:n,submission:d};let p=h(n);return t&&p.search&&Ae(p.search)&&i.append("index",""),p.search="?"+i,{path:f(p),submission:d}}function ie(e,t){let n=e;if(t){let r=e.findIndex((e=>e.route.id===t));r>=0&&(n=e.slice(0,r))}return n}function oe(e,t,n,i,o,a,s,u,l,c,f,h,d,p,g,m){let v=m?Object.values(m)[0]:g?Object.values(g)[0]:void 0,b=e.createURL(t.location),w=e.createURL(o),S=m?Object.keys(m)[0]:void 0,_=ie(n,S).filter(((e,n)=>{let{route:o}=e;if(o.lazy)return!0;if(null==o.loader)return!1;if(a)return!!o.loader.hydrate||void 0===t.loaderData[o.id]&&(!t.errors||void 0===t.errors[o.id]);if(function(e,t,n){let r=!t||n.route.id!==t.route.id,i=void 0===e[n.route.id];return r||i}(t.loaderData,t.matches[n],e)||u.some((t=>t===e.route.id)))return!0;let l=t.matches[n],c=e;return se(e,r({currentUrl:b,currentParams:l.params,nextUrl:w,nextParams:c.params},i,{actionResult:v,defaultShouldRevalidate:s||b.pathname+b.search===w.pathname+w.search||b.search!==w.search||ae(l,c)}))})),k=[];return f.forEach(((e,o)=>{if(a||!n.some((t=>t.route.id===e.routeId))||c.has(o))return;let u=y(d,e.path,p);if(!u)return void k.push({key:o,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let f=t.fetchers.get(o),g=Ue(u,e.path),m=!1;m=!h.has(o)&&(!!l.includes(o)||(f&&"idle"!==f.state&&void 0===f.data?s:se(g,r({currentUrl:b,currentParams:t.matches[t.matches.length-1].params,nextUrl:w,nextParams:n[n.length-1].params},i,{actionResult:v,defaultShouldRevalidate:s})))),m&&k.push({key:o,routeId:e.routeId,path:e.path,matches:u,match:g,controller:new AbortController})})),[_,k]}function ae(e,t){let n=e.route.path;return e.pathname!==t.pathname||null!=n&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function se(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if("boolean"===typeof n)return n}return t.defaultShouldRevalidate}async function ue(e,t,n){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let o=n[e.id];s(o,"No route found in manifest");let a={};for(let r in i){let e=void 0!==o[r]&&"hasErrorBoundary"!==r;u(!e,'Route "'+o.id+'" has a static property "'+r+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+r+'" will be ignored.'),e||g.has(r)||(a[r]=i[r])}Object.assign(o,a),Object.assign(o,r({},t(o),{lazy:void 0}))}async function le(e,t,n,r,i,o,a,u,l){let c,f,h;void 0===l&&(l={});let d=e=>{let r,i=new Promise(((e,t)=>r=t));return h=()=>r(),t.signal.addEventListener("abort",h),Promise.race([e({request:t,params:n.params,context:l.requestContext}),i])};try{let r=n.route[e];if(n.route.lazy)if(r){let e,t=await Promise.all([d(r).catch((t=>{e=t})),ue(n.route,o,i)]);if(e)throw e;f=t[0]}else{if(await ue(n.route,o,i),r=n.route[e],!r){if("action"===e){let e=new URL(t.url),r=e.pathname+e.search;throw ve(405,{method:t.method,pathname:r,routeId:n.route.id})}return{type:p.data,data:void 0}}f=await d(r)}else{if(!r){let e=new URL(t.url);throw ve(404,{pathname:e.pathname+e.search})}f=await d(r)}s(void 0!==f,"You defined "+("action"===e?"an action":"a loader")+' for route "'+n.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(y){c=p.error,f=y}finally{h&&t.signal.removeEventListener("abort",h)}if(Ee(f)){let e,i=f.status;if(G.has(i)){let e=f.headers.get("Location");if(s(e,"Redirects returned/thrown from loaders/actions must have a Location header"),Q.test(e)){if(!l.isStaticRequest){let n=new URL(t.url),r=e.startsWith("//")?new URL(n.protocol+e):new URL(e),i=null!=x(r.pathname,a);r.origin===n.origin&&i&&(e=r.pathname+r.search+r.hash)}}else e=ne(new URL(t.url),r.slice(0,r.indexOf(n)+1),a,!0,e,u);if(l.isStaticRequest)throw f.headers.set("Location",e),f;return{type:p.redirect,status:i,location:e,revalidate:null!==f.headers.get("X-Remix-Revalidate"),reloadDocument:null!==f.headers.get("X-Remix-Reload-Document")}}if(l.isRouteRequest){throw{type:c===p.error?p.error:p.data,response:f}}try{let t=f.headers.get("Content-Type");e=t&&/\bapplication\/json\b/.test(t)?null==f.body?null:await f.json():await f.text()}catch(y){return{type:p.error,error:y}}return c===p.error?{type:c,error:new z(i,f.statusText,e),headers:f.headers}:{type:p.data,data:e,statusCode:f.status,headers:f.headers}}return c===p.error?{type:c,error:f}:function(e){let t=e;return t&&"object"===typeof t&&"object"===typeof t.data&&"function"===typeof t.subscribe&&"function"===typeof t.cancel&&"function"===typeof t.resolveData}(f)?{type:p.deferred,deferredData:f,statusCode:null==(g=f.init)?void 0:g.status,headers:(null==(m=f.init)?void 0:m.headers)&&new Headers(f.init.headers)}:{type:p.data,data:f};var g,m}function ce(e,t,n,r){let i=e.createURL(we(t)).toString(),o={signal:n};if(r&&Ce(r.formMethod)){let{formMethod:e,formEncType:t}=r;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(r.json)):"text/plain"===t?o.body=r.text:"application/x-www-form-urlencoded"===t&&r.formData?o.body=fe(r.formData):o.body=r.formData}return new Request(i,o)}function fe(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,"string"===typeof r?r:r.name);return t}function he(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function de(e,t,n,r,i){let o,a={},u=null,l=!1,c={};return n.forEach(((n,f)=>{let h=t[f].route.id;if(s(!ke(n),"Cannot handle redirect results in processLoaderData"),_e(n)){let t=me(e,h),i=n.error;r&&(i=Object.values(r)[0],r=void 0),u=u||{},null==u[t.route.id]&&(u[t.route.id]=i),a[h]=void 0,l||(l=!0,o=V(n.error)?n.error.status:500),n.headers&&(c[h]=n.headers)}else Se(n)?(i.set(h,n.deferredData),a[h]=n.deferredData.data):a[h]=n.data,null==n.statusCode||200===n.statusCode||l||(o=n.statusCode),n.headers&&(c[h]=n.headers)})),r&&(u=r,a[Object.keys(r)[0]]=void 0),{loaderData:a,errors:u,statusCode:o||200,loaderHeaders:c}}function pe(e,t,n,i,o,a,u,l){let{loaderData:c,errors:f}=de(t,n,i,o,l);for(let h=0;he.route.id===t))+1):[...e]).reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function ye(e){let t=1===e.length?e[0]:e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ve(e,t){let{pathname:n,routeId:r,method:i,type:o}=void 0===t?{}:t,a="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(a="Bad Request",i&&n&&r?s="You made a "+i+' request to "'+n+'" but did not provide a `loader` for route "'+r+'", so there is no way to handle the request.':"defer-action"===o?s="defer() is not supported in actions":"invalid-body"===o&&(s="Unable to encode submission body")):403===e?(a="Forbidden",s='Route "'+r+'" does not match URL "'+n+'"'):404===e?(a="Not Found",s='No route matches URL "'+n+'"'):405===e&&(a="Method Not Allowed",i&&n&&r?s="You made a "+i.toUpperCase()+' request to "'+n+'" but did not provide an `action` for route "'+r+'", so there is no way to handle the request.':i&&(s='Invalid request method "'+i.toUpperCase()+'"')),new z(e||500,a,new Error(s),!0)}function be(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(ke(n))return{result:n,idx:t}}}function we(e){return f(r({},"string"===typeof e?h(e):e,{hash:""}))}function Se(e){return e.type===p.deferred}function _e(e){return e.type===p.error}function ke(e){return(e&&e.type)===p.redirect}function Ee(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"object"===typeof e.headers&&"undefined"!==typeof e.body}function Ie(e){return q.has(e.toLowerCase())}function Ce(e){return K.has(e.toLowerCase())}async function Te(e,t,n,r,i,o){for(let a=0;ae.route.id===l.route.id)),f=null!=c&&!ae(c,l)&&void 0!==(o&&o[l.route.id]);if(Se(u)&&(i||f)){let e=r[a];s(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await Pe(u,e,i).then((e=>{e&&(n[a]=e||n[a])}))}}}async function Pe(e,t,n){if(void 0===n&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:p.data,data:e.deferredData.unwrappedData}}catch(r){return{type:p.error,error:r}}return{type:p.data,data:e.deferredData.data}}}function Ae(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Ue(e,t){let n="string"===typeof t?h(t).search:t.search;if(e[e.length-1].route.index&&Ae(n||""))return e[e.length-1];let r=O(e);return r[r.length-1]}function xe(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:o,json:a}=e;if(t&&n&&r)return null!=i?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i}:null!=o?{formMethod:t,formAction:n,formEncType:r,formData:o,json:void 0,text:void 0}:void 0!==a?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:a,text:void 0}:void 0}function Re(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Oe(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function De(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}},5812:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var r=n(3904),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],f=0;f>>17|h<<15)^(h>>>19|h<<13)^h>>>10,p=((h=this.temp[f-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[f]=(d+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var g=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&u^~s&l)|0)+(c+(r.KEY[f]+this.temp[f]|0)|0)|0,m=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;c=l,l=u,u=s,s=a+g|0,a=o,o=i,i=n,n=g+m|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=a,t[4]+=s,t[5]+=u,t[6]+=l,t[7]+=c},e}();t.RawSha256=i},3904:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},3004:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),(0,n(6712).__exportStar)(n(5800),t)},5800:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(6712),i=n(3904),o=n(5812),a=n(3752),s=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=(0,a.convertToBuffer)(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(868),i="undefined"!==typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"===typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}},3752:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(4880);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(5184);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(8224);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var a=n(5660);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return a.uint32ArrayFrom}})},5184:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"===typeof e?0===e.length:0===e.byteLength}},8224:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},5660:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Array.from){for(var t=new Uint32Array(e.length);0{"use strict";var r=n(3452),i=n(9696),o=n(3e3);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return P(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"===typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var f=!0,h=0;hi&&(r=i):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128===(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128===(192&o)&&128===(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128===(192&o)&&128===(192&a)&&128===(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),c=e.slice(t,n),f=0;fi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return k(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function P(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,r,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function L(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function M(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,r,o){return o||M(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function N(e,t,n,r,o){return o||M(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||O(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return N(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return N(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function H(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}},3e3:e=>{var t={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==t.call(e)}},6712:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__assign:()=>o,__asyncDelegator:()=>w,__asyncGenerator:()=>b,__asyncValues:()=>S,__await:()=>v,__awaiter:()=>c,__classPrivateFieldGet:()=>I,__classPrivateFieldSet:()=>C,__createBinding:()=>h,__decorate:()=>s,__exportStar:()=>d,__extends:()=>i,__generator:()=>f,__importDefault:()=>E,__importStar:()=>k,__makeTemplateObject:()=>_,__metadata:()=>l,__param:()=>u,__read:()=>g,__rest:()=>a,__spread:()=>m,__spreadArrays:()=>y,__values:()=>p});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function u(e,t){return function(n,r){t(n,r,e)}}function l(e,t){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(e,t)}function c(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function m(){for(var e=[],t=0;t1||s(e,t)}))})}function s(e,t){try{(n=i[e](t)).value instanceof v?Promise.resolve(n.value.v).then(u,l):c(o[0][2],n)}catch(r){c(o[0][3],r)}var n}function u(e){s("next",e)}function l(e){s("throw",e)}function c(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:v(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function k(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}function I(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function C(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},3452:(e,t)=>{"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,o=s(e),a=o[0],u=o[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,u)),c=0,f=u>0?a-4:a;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;2===u&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,l[c++]=255&t);1===u&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t);return l},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,l=r-i;sl?l:s+a));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=o[a],r[o.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,r){for(var i,o,a=[],s=t;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},392:(e,t,n)=>{"use strict";const r=n(3452),i=n(724),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Sn=u,t.ZK=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,n){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return l(e,t,n)}function l(e,t,n){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=s(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if($(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if($(e,ArrayBuffer)||e&&$(e.buffer,ArrayBuffer))return d(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&($(e,SharedArrayBuffer)||e&&$(e.buffer,SharedArrayBuffer)))return d(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return u.from(r,t,n);const i=function(e){if(u.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||X(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return c(e),s(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||$(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(i)return r?-1:q(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return P(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),X(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){let o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(u=(31&t)<<6|63&n,u>127&&(o=u));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(u=(15&t)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&s)&&(u=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(e,t,n,r,i){if($(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(o,a),l=this.slice(r,i),c=e.slice(t,n);for(let u=0;u>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return S(this,e,t,n);case"ascii":case"latin1":case"binary":return _(this,e,t,n);case"base64":return k(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function P(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;ir)&&(n=r);let i="";for(let o=t;on)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,r,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function D(e,t,n,r,i){V(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function L(e,t,n,r,i){V(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function M(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,r,o){return t=+t,n>>>=0,o||M(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function N(e,t,n,r,o){return t=+t,n>>>=0,o||M(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||R(e,t,this.length);let r=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,n||R(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Q((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||R(e,t,this.length);let r=this[e],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||R(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||R(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){e>>>=0,t||R(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Q((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||R(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||R(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||R(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||R(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){O(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){O(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=Q((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Q((function(e){return L(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);O(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);O(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=Q((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Q((function(e){return L(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return N(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return N(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i=r+4;n-=3)t="_".concat(e.slice(n-3,n)).concat(t);return"".concat(e.slice(0,n)).concat(t)}function V(e,t,n,r,i,o){if(e>n||e3?0===t||t===BigInt(0)?">= 0".concat(r," and < 2").concat(r," ** ").concat(8*(o+1)).concat(r):">= -(2".concat(r," ** ").concat(8*(o+1)-1).concat(r,") and < 2 ** ")+"".concat(8*(o+1)-1).concat(r):">= ".concat(t).concat(r," and <= ").concat(n).concat(r),new B.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||K(t,e.length-(n+1))}(r,i,o)}function H(e,t){if("number"!==typeof e)throw new B.ERR_INVALID_ARG_TYPE(t,"number",e)}function K(e,t,n){if(Math.floor(e)!==e)throw H(e,n),new B.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(n||"offset",">= ".concat(n?1:0," and <= ").concat(t),e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),j("ERR_OUT_OF_RANGE",(function(e,t,n){let r='The value of "'.concat(e,'" is out of range.'),i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=z(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),r+=" It must be ".concat(t,". Received ").concat(i),r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function q(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function G(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function Y(e,t,n,r){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function $(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!==e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"===typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},724:(e,t)=>{t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+f],f+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=l}return(d?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(t*u-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=p,a/=256,l-=8);e[n+d-p]|=128*g}},8208:(e,t)=>{"use strict";t.K=function(e,t){if("string"!==typeof e)throw new TypeError("argument str must be a string");for(var r={},i=t||{},a=e.split(";"),s=i.decode||n,u=0;u{t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+f],f+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+f],f+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=l}return(d?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(t*u-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=p,a/=256,l-=8);e[n+d-p]|=128*g}},8776:(e,t,n)=>{e.exports=self.fetch||(self.fetch=n(1679).default||n(1679))},4392:(e,t,n)=>{var r,i;!function(o){if(void 0===(i="function"===typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i),!0,e.exports=o(),!!0){var a=window.Cookies,s=window.Cookies=o();s.noConflict=function(){return window.Cookies=a,s}}}((function(){function e(){for(var e=0,t={};e{"use strict";function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,n,r,i){n=n||"&",r=r||"=";var o={};if("string"!==typeof e||0===e.length)return o;var a=/\+/g;e=e.split(n);var s=1e3;i&&"number"===typeof i.maxKeys&&(s=i.maxKeys);var u=e.length;s>0&&u>s&&(u=s);for(var l=0;l=0?(c=p.substr(0,g),f=p.substr(g+1)):(c=p,f=""),h=decodeURIComponent(c),d=decodeURIComponent(f),t(o,h)?Array.isArray(o[h])?o[h].push(d):o[h]=[o[h],d]:o[h]=d}return o}},7488:e=>{"use strict";var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,n,r,i){return n=n||"&",r=r||"=",null===e&&(e=void 0),"object"===typeof e?Object.keys(e).map((function(i){var o=encodeURIComponent(t(i))+r;return Array.isArray(e[i])?e[i].map((function(e){return o+encodeURIComponent(t(e))})).join(n):o+encodeURIComponent(t(e[i]))})).join(n):i?encodeURIComponent(t(i))+r+encodeURIComponent(t(e)):""}},3052:(e,t,n)=>{"use strict";t.decode=t.parse=n(5952),t.encode=t.stringify=n(7488)},4861:(e,t,n)=>{"use strict";var r=n(112),i=n(7564);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n