onairos 0.1.366 → 0.1.367

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["React"],e);else{var n="object"==typeof exports?e(require("react")):e(t.React);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(t=>(()=>{var e,n,r,i,o={317:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>r});const r={}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(431);e.default=class{BigNum;constructor(){this.BigNum=(t,e)=>new(r.BigNumber.clone({DECIMAL_PLACES:e}))(t)}winstonToAr(t,{formatted:e=!1,decimals:n=12,trim:r=!0}={}){let i=this.stringToBigNum(t,n).shiftedBy(-12);return e?i.toFormat(n):i.toFixed(n)}arToWinston(t,{formatted:e=!1}={}){let n=this.stringToBigNum(t).shiftedBy(12);return e?n.toFormat():n.toFixed(0)}compare(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.comparedTo(r)}isEqual(t,e){return 0===this.compare(t,e)}isLessThan(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.isLessThan(r)}isGreaterThan(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.isGreaterThan(r)}add(t,e){let n=this.stringToBigNum(t);this.stringToBigNum(e);return n.plus(e).toFixed(0)}sub(t,e){let n=this.stringToBigNum(t);this.stringToBigNum(e);return n.minus(e).toFixed(0)}stringToBigNum(t,e=12){return this.BigNum(t,e)}}},759:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498);n(317);class i{api;network;static HASH_ENDPOINT="block/hash/";static HEIGHT_ENDPOINT="block/height/";constructor(t,e){this.api=t,this.network=e}async get(t){const e=await this.api.get(`${i.HASH_ENDPOINT}${t}`);if(200===e.status)return e.data;throw 404===e.status?new r.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${e}`)}async getByHeight(t){const e=await this.api.get(`${i.HEIGHT_ENDPOINT}${t}`);if(200===e.status)return e.data;throw 404===e.status?new r.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${e}`)}async getCurrent(){const{current:t}=await this.network.getInfo();return await this.get(t)}}e.default=i},879:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),i=n(244);e.default=class{api;constructor(t){this.api=t}async getTransactionOffset(t){const e=await this.api.get(`tx/${t}/offset`);if(200===e.status)return e.data;throw new Error(`Unable to get transaction offset: ${(0,r.getError)(e)}`)}async getChunk(t){const e=await this.api.get(`chunk/${t}`);if(200===e.status)return e.data;throw new Error(`Unable to get chunk: ${(0,r.getError)(e)}`)}async getChunkData(t){const e=await this.getChunk(t);return i.b64UrlToBuffer(e.chunk)}firstChunkOffset(t){return parseInt(t.offset)-parseInt(t.size)+1}async downloadChunkedData(t){const e=await this.getTransactionOffset(t),n=parseInt(e.size),r=parseInt(e.offset)-n+1,i=new Uint8Array(n);let o=0;for(;o<n;){let t;this.api.config.logging&&console.log(`[chunk] ${o}/${n}`);try{t=await this.getChunkData(r+o)}catch(t){console.error(`[chunk] Failed to fetch chunk at offset ${r+o}`),console.error("[chunk] This could indicate that the chunk wasn't uploaded or hasn't yet seeded properly to a particular gateway/node")}if(!t)throw new Error(`Couldn't complete data download at ${o}/${n}`);i.set(t,o),o+=t.length}return i}}},536:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(586),i=n(874),o=n(363),s=n(248),a=n(935),c=n(927),l=n(825),u=n(244),h=n(243),d=n(879),f=n(759);class p{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new o.default;static utils=u;constructor(t){this.api=new i.default(t),this.wallets=new c.default(this.api,p.crypto),this.chunks=new d.default(this.api),this.transactions=new a.default(this.api,p.crypto,this.chunks),this.silo=new h.default(this.api,this.crypto,this.transactions),this.network=new s.default(this.api),this.blocks=new f.default(this.api,this.network),this.ar=new r.default}get crypto(){return p.crypto}get utils(){return p.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(t,e){const n={};if(Object.assign(n,t),!(t.data||t.target&&t.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(null==t.owner&&e&&"use_wallet"!==e&&(n.owner=e.n),null==t.last_tx&&(n.last_tx=await this.transactions.getTransactionAnchor()),"string"==typeof t.data&&(t.data=u.stringToBuffer(t.data)),t.data instanceof ArrayBuffer&&(t.data=new Uint8Array(t.data)),t.data&&!(t.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(null==t.reward){const e=t.data?t.data.byteLength:0;n.reward=await this.transactions.getPrice(e,n.target)}n.data_root="",n.data_size=t.data?t.data.byteLength.toString():"0",n.data=t.data||new Uint8Array(0);const r=new l.default(n);return await r.getSignatureData(),r}async createSiloTransaction(t,e,n){const r={};if(Object.assign(r,t),!t.data)throw new Error("Silo transactions must have a 'data' value");if(!n)throw new Error("No Silo URI specified.");if(t.target||t.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(null==t.owner){if(!e||!e.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");r.owner=e.n}null==t.last_tx&&(r.last_tx=await this.transactions.getTransactionAnchor());const i=await this.silo.parseUri(n);if("string"==typeof t.data){const e=await this.crypto.encrypt(u.stringToBuffer(t.data),i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=u.bufferTob64Url(e)}if(t.data instanceof Uint8Array){const e=await this.crypto.encrypt(t.data,i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=u.bufferTob64Url(e)}const o=new l.default(r);return o.addTag("Silo-Name",i.getAccessKey()),o.addTag("Silo-Version","0.1.0"),o}arql(t){return this.api.post("/arql",t).then((t=>t.data||[]))}}e.default=p},386:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0});const o=n(536),s=n(118);o.default.init=function(t={}){const e={host:"arweave.net",port:443,protocol:"https"};if("object"!=typeof location||!location.protocol||!location.hostname)return new o.default({...t,...e});const n=location.protocol.replace(":",""),r=location.hostname,i=location.port?parseInt(location.port):"https"==n?443:80,a=(0,s.getDefaultConfig)(n,r),c=t.protocol||a.protocol,l=t.host||a.host,u=t.port||a.port||i;return new o.default({...t,host:l,protocol:c,port:u})},"object"==typeof globalThis?globalThis.Arweave=o.default:"object"==typeof self&&(self.Arweave=o.default),i(n(536),e),e.default=o.default},874:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{METHOD_GET="GET";METHOD_POST="POST";config;constructor(t){this.applyConfig(t)}applyConfig(t){this.config=this.mergeDefaults(t)}getConfig(){return this.config}mergeDefaults(t){const e=t.protocol||"http",n=t.port||("https"===e?443:80);return{host:t.host||"127.0.0.1",protocol:e,port:n,timeout:t.timeout||2e4,logging:t.logging||!1,logger:t.logger||console.log,network:t.network}}async get(t,e){return await this.request(t,{...e,method:this.METHOD_GET})}async post(t,e,n){const r=new Headers(n?.headers||{});return r.get("content-type")?.includes("application/json")||r.append("content-type","application/json"),r.append("accept","application/json, text/plain, */*"),await this.request(t,{...n,method:this.METHOD_POST,body:"string"!=typeof e?JSON.stringify(e):e,headers:r})}async request(t,e){const r=new Headers(e?.headers||{}),i=`${this.config.protocol}://${this.config.host}:${this.config.port}`,o=e?.responseType;delete e?.responseType,t.startsWith("/")&&(t=t.slice(1)),this.config.network&&r.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${i}/${t}`);let s=await fetch(`${i}/${t}`,{...e||{},headers:r});this.config.logging&&this.config.logger(`Response: ${s.url} - ${s.status}`);const a=s.headers.get("content-type"),c=a?.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i)?.[1],l=s,u=async()=>{if(c)try{l.data=new TextDecoder(c).decode(await s.arrayBuffer())}catch(t){l.data=await s.text()}else l.data=await s.text()};if("arraybuffer"===o)l.data=await s.arrayBuffer();else if("text"===o)await u();else if("webstream"===o)l.data=n(s.body);else try{let t=await s.clone().json();"object"!=typeof t?await u():l.data=await s.json(),t=null}catch{await u()}return l}};const n=t=>{const e=t;return void 0===e[Symbol.asyncIterator]?(e[Symbol.asyncIterator]=r(t),e):t},r=function(t){return async function*(){const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)return;yield n}}finally{e.releaseLock()}}}},363:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(244);e.default=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let t=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),e=await this.driver.exportKey("jwk",t.privateKey);return{kty:e.kty,e:e.e,n:e.n,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}}async sign(t,e,{saltLength:n}={}){let r=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(t),e);return new Uint8Array(r)}async hash(t,e="SHA-256"){let n=await this.driver.digest(e,t);return new Uint8Array(n)}async verify(t,e,n){const r={kty:"RSA",e:"AQAB",n:t},i=await this.jwkToPublicCryptoKey(r),o=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-o.byteLength-2},i,n,e);return s||a||c}async jwkToCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if("undefined"==typeof crypto)return!1;const t=crypto?.subtle;if(void 0===t)return!1;return["generateKey","importKey","exportKey","digest","sign"].every((e=>"function"==typeof t[e]))}async encrypt(t,e,n){const i=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=new Uint8Array(16);crypto.getRandomValues(s);const a=await this.driver.encrypt({name:"AES-CBC",iv:s},o,t);return r.concatBuffers([s,a])}async decrypt(t,e,n){const i=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},o,t.slice(16));return r.concatBuffers([a])}}},921:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(536);async function i(t){if(Array.isArray(t)){const e=r.default.utils.concatBuffers([r.default.utils.stringToBuffer("list"),r.default.utils.stringToBuffer(t.length.toString())]);return await o(t,await r.default.crypto.hash(e,"SHA-384"))}const e=r.default.utils.concatBuffers([r.default.utils.stringToBuffer("blob"),r.default.utils.stringToBuffer(t.byteLength.toString())]),n=r.default.utils.concatBuffers([await r.default.crypto.hash(e,"SHA-384"),await r.default.crypto.hash(t,"SHA-384")]);return await r.default.crypto.hash(n,"SHA-384")}async function o(t,e){if(t.length<1)return e;const n=r.default.utils.concatBuffers([e,await i(t[0])]),s=await r.default.crypto.hash(n,"SHA-384");return await o(t.slice(1),s)}e.default=i},498:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getError=void 0;class n extends Error{type;response;constructor(t,e={}){e.message?super(e.message):super(),this.type=t,this.response=e.response}getType(){return this.type}}e.default=n,e.getError=function(t){let e=t.data;if("string"==typeof t.data)try{e=JSON.parse(t.data)}catch(t){}if(t.data instanceof ArrayBuffer||t.data instanceof Uint8Array)try{e=JSON.parse(e.toString())}catch(t){}return e?e.error||e:t.statusText||"unknown"}},224:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.debug=e.validatePath=e.arrayCompare=e.bufferToInt=e.intToBuffer=e.arrayFlatten=e.generateProofs=e.buildLayers=e.generateTransactionChunks=e.generateTree=e.computeRootHash=e.generateLeaves=e.chunkData=e.MIN_CHUNK_SIZE=e.MAX_CHUNK_SIZE=void 0;const r=n(536),i=n(244);e.MAX_CHUNK_SIZE=262144,e.MIN_CHUNK_SIZE=32768;const o=32,s=32;async function a(t){let n=[],i=t,o=0;for(;i.byteLength>=e.MAX_CHUNK_SIZE;){let t=e.MAX_CHUNK_SIZE,s=i.byteLength-e.MAX_CHUNK_SIZE;s>0&&s<e.MIN_CHUNK_SIZE&&(t=Math.ceil(i.byteLength/2));const a=i.slice(0,t),c=await r.default.crypto.hash(a);o+=a.byteLength,n.push({dataHash:c,minByteRange:o-a.byteLength,maxByteRange:o}),i=i.slice(t)}return n.push({dataHash:await r.default.crypto.hash(i),minByteRange:o,maxByteRange:o+i.byteLength}),n}async function c(t){return Promise.all(t.map((async({dataHash:t,minByteRange:e,maxByteRange:n})=>({type:"leaf",id:await m(await Promise.all([m(t),m(g(n))])),dataHash:t,minByteRange:e,maxByteRange:n}))))}async function l(t){return await u(await c(await a(t)))}async function u(t,e=0){if(t.length<2){return t[0]}const n=[];for(let e=0;e<t.length;e+=2)n.push(await p(t[e],t[e+1]));return u(n,e+1)}function h(t){const e=d(t);return Array.isArray(e)?f(e):[e]}function d(t,e=new Uint8Array,n=0){if("leaf"==t.type)return{offset:t.maxByteRange-1,proof:(0,i.concatBuffers)([e,t.dataHash,g(t.maxByteRange)])};if("branch"==t.type){const r=(0,i.concatBuffers)([e,t.leftChild.id,t.rightChild.id,g(t.byteRange)]);return[d(t.leftChild,r,n+1),d(t.rightChild,r,n+1)]}throw new Error("Unexpected node type")}function f(t){const e=[];return t.forEach((t=>{Array.isArray(t)?e.push(...f(t)):e.push(t)})),e}async function p(t,e){if(!e)return t;return{type:"branch",id:await m([await m(t.id),await m(e.id),await m(g(t.maxByteRange))]),byteRange:t.maxByteRange,maxByteRange:e.maxByteRange,leftChild:t,rightChild:e}}async function m(t){return Array.isArray(t)&&(t=r.default.utils.concatBuffers(t)),new Uint8Array(await r.default.crypto.hash(t))}function g(t){const e=new Uint8Array(o);for(var n=e.length-1;n>=0;n--){var r=t%256;e[n]=r,t=(t-r)/256}return e}function y(t){let e=0;for(var n=0;n<t.length;n++)e*=256,e+=t[n];return e}e.chunkData=a,e.generateLeaves=c,e.computeRootHash=async function(t){return(await l(t)).id},e.generateTree=l,e.generateTransactionChunks=async function(t){const e=await a(t),n=await c(e),r=await u(n),i=await h(r),o=e.slice(-1)[0];return o.maxByteRange-o.minByteRange==0&&(e.splice(e.length-1,1),i.splice(i.length-1,1)),{data_root:r.id,chunks:e,proofs:i}},e.buildLayers=u,e.generateProofs=h,e.arrayFlatten=f,e.intToBuffer=g,e.bufferToInt=y;e.arrayCompare=(t,e)=>t.every(((t,n)=>e[n]===t)),e.validatePath=async function t(n,r,i,a,c){if(a<=0)return!1;if(r>=a)return t(n,0,a-1,a,c);if(r<0)return t(n,0,0,a,c);if(c.length==s+o){const t=c.slice(0,s),r=c.slice(t.length,t.length+o),l=await m([await m(t),await m(r)]);return!!(0,e.arrayCompare)(n,l)&&{offset:a-1,leftBound:i,rightBound:a,chunkSize:a-i}}const l=c.slice(0,s),u=c.slice(l.length,l.length+s),h=c.slice(l.length+u.length,l.length+u.length+o),d=y(h),f=c.slice(l.length+u.length+h.length),p=await m([await m(l),await m(u),await m(h)]);return!!(0,e.arrayCompare)(n,p)&&(r<d?await t(l,r,i,Math.min(a,d),f):await t(u,r,Math.max(i,d),a,f))},e.debug=async function t(e,n=""){if(e.byteLength<1)return n;const r=e.slice(0,s),i=e.slice(r.length,r.length+s),a=e.slice(r.length+i.length,r.length+i.length+o),c=y(a),l=e.slice(r.length+i.length+a.length),u=await m([await m(r),await m(i),await m(a)]);return t(l,`${n}\n${JSON.stringify(Buffer.from(r))},${JSON.stringify(Buffer.from(i))},${c} => ${JSON.stringify(u)}`)}},246:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionUploader=void 0;const r=n(825),i=n(244),o=n(498),s=n(224),a=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"];class c{api;chunkIndex=0;txPosted=!1;transaction;lastRequestTimeEnd=0;totalErrors=0;data;lastResponseStatus=0;lastResponseError="";get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(t,e){if(this.api=t,!e.id)throw new Error("Transaction is not signed");if(!e.chunks)throw new Error("Transaction chunks not prepared");this.data=e.data,this.transaction=new r.default(Object.assign({},e,{data:new Uint8Array(0)}))}async uploadChunk(t){if(this.isComplete)throw new Error("Upload is already complete");if(""!==this.lastResponseError?this.totalErrors++:this.totalErrors=0,100===this.totalErrors)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let e=""===this.lastResponseError?0:Math.max(this.lastRequestTimeEnd+4e4-Date.now(),4e4);if(e>0&&(e-=e*Math.random()*.3,await new Promise((t=>setTimeout(t,e)))),this.lastResponseError="",!this.txPosted)return void await this.postTransaction();t&&(this.chunkIndex=t);const n=this.transaction.getChunk(t||this.chunkIndex,this.data);if(!await(0,s.validatePath)(this.transaction.chunks.data_root,parseInt(n.offset),0,parseInt(n.data_size),i.b64UrlToBuffer(n.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);const r=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch((t=>(console.error(t.message),{status:-1,data:{error:t.message}})));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=r.status,200==this.lastResponseStatus)this.chunkIndex++;else if(this.lastResponseError=(0,o.getError)(r),a.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(t,e,n){if(!e||"number"!=typeof e.chunkIndex||"object"!=typeof e.transaction)throw new Error("Serialized object does not match expected format.");var i=new r.default(e.transaction);i.chunks||await i.prepareChunks(n);const o=new c(t,i);if(o.chunkIndex=e.chunkIndex,o.lastRequestTimeEnd=e.lastRequestTimeEnd,o.lastResponseError=e.lastResponseError,o.lastResponseStatus=e.lastResponseStatus,o.txPosted=e.txPosted,o.data=n,o.transaction.data_root!==e.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return o}static async fromTransactionId(t,e){const n=await t.get(`tx/${e}`);if(200!==n.status)throw new Error(`Tx ${e} not found: ${n.status}`);const r=n.data;r.data=new Uint8Array(0);return{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:r}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=1){this.transaction.data=this.data;const t=await this.api.post("tx",this.transaction).catch((t=>(console.error(t),{status:-1,data:{error:t.message}})));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,this.transaction.data=new Uint8Array(0),t.status>=200&&t.status<300)return this.txPosted=!0,void(this.chunkIndex=1);throw this.lastResponseError=(0,o.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`)}const t=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,!(t.status>=200&&t.status<300))throw this.lastResponseError=(0,o.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`);this.txPosted=!0}}e.TransactionUploader=c},825:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Tag=void 0;const r=n(244),i=n(921),o=n(224);class s{get(t,e){if(!Object.getOwnPropertyNames(this).includes(t))throw new Error(`Field "${t}" is not a property of the Arweave Transaction class.`);if(this[t]instanceof Uint8Array)return e&&e.decode&&e.string?r.bufferToString(this[t]):e&&e.decode&&!e.string?this[t]:r.bufferTob64Url(this[t]);if(this[t]instanceof Array){if(void 0!==e?.decode||void 0!==e?.string)throw"tags"===t&&console.warn("Did you mean to use 'transaction[\"tags\"]' ?"),new Error("Cannot decode or stringify an array.");return this[t]}return e&&1==e.decode?e&&e.string?r.b64UrlToString(this[t]):r.b64UrlToBuffer(this[t]):this[t]}}class a extends s{name;value;constructor(t,e,n=!1){super(),this.name=t,this.value=e}}e.Tag=a;e.default=class extends s{format=2;id="";last_tx="";owner="";tags=[];target="";quantity="0";data_size="0";data=new Uint8Array;data_root="";reward="0";signature="";chunks;constructor(t={}){super(),Object.assign(this,t),"string"==typeof this.data&&(this.data=r.b64UrlToBuffer(this.data)),t.tags&&(this.tags=t.tags.map((t=>new a(t.name,t.value))))}addTag(t,e){this.tags.push(new a(r.stringToB64Url(t),r.stringToB64Url(e)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:r.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(t){this.owner=t}setSignature({id:t,owner:e,reward:n,tags:r,signature:i}){this.id=t,this.owner=e,n&&(this.reward=n),r&&(this.tags=r),this.signature=i}async prepareChunks(t){!this.chunks&&t.byteLength>0&&(this.chunks=await(0,o.generateTransactionChunks)(t),this.data_root=r.bufferTob64Url(this.chunks.data_root)),this.chunks||0!==t.byteLength||(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(t,e){if(!this.chunks)throw new Error("Chunks have not been prepared");const n=this.chunks.proofs[t],i=this.chunks.chunks[t];return{data_root:this.data_root,data_size:this.data_size,data_path:r.bufferTob64Url(n.proof),offset:n.offset.toString(),chunk:r.bufferTob64Url(e.slice(i.minByteRange,i.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let t=this.tags.reduce(((t,e)=>r.concatBuffers([t,e.get("name",{decode:!0,string:!1}),e.get("value",{decode:!0,string:!1})])),new Uint8Array);return r.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),r.stringToBuffer(this.quantity),r.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),t]);case 2:this.data_root||await this.prepareChunks(this.data);const e=this.tags.map((t=>[t.get("name",{decode:!0,string:!1}),t.get("value",{decode:!0,string:!1})]));return await(0,i.default)([r.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),r.stringToBuffer(this.quantity),r.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),e,r.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}}},244:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.b64UrlDecode=e.b64UrlEncode=e.bufferTob64Url=e.bufferTob64=e.b64UrlToBuffer=e.stringToB64Url=e.stringToBuffer=e.bufferToString=e.b64UrlToString=e.concatBuffers=void 0;const r=n(742);function i(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function o(t){return(new TextEncoder).encode(t)}function s(t){return new Uint8Array(r.toByteArray(u(t)))}function a(t){return r.fromByteArray(new Uint8Array(t))}function c(t){return l(a(t))}function l(t){try{return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}catch(t){throw new Error("Failed to encode string",{cause:t})}}function u(t){try{let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}catch(t){throw new Error("Failed to decode string",{cause:t})}}e.concatBuffers=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;let n=new Uint8Array(e),r=0;n.set(new Uint8Array(t[0]),r),r+=t[0].byteLength;for(let e=1;e<t.length;e++)n.set(new Uint8Array(t[e]),r),r+=t[e].byteLength;return n},e.b64UrlToString=function(t){return i(s(t))},e.bufferToString=i,e.stringToBuffer=o,e.stringToB64Url=function(t){return c(o(t))},e.b64UrlToBuffer=s,e.bufferTob64=a,e.bufferTob64Url=c,e.b64UrlEncode=l,e.b64UrlDecode=u},118:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultConfig=void 0;e.getDefaultConfig=(t,e)=>{if(((t,e)=>{const n=/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,r=e.split("."),i=r[r.length-1],o=["localhost","[::1]"];return o.includes(e)||"file"==t||o.includes(i)||!!e.match(n)||!!i.match(n)})(t,e))return{protocol:"https",host:"arweave.net",port:443};if(!(t=>{const e="["===t.charAt(0);return!!t.match(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/)||e})(e)){let n=e.split(".");if(n.length>=3){n.shift();return{protocol:t,host:n.join(".")}}}return{protocol:t,host:e}}},248:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{api;constructor(t){this.api=t}getInfo(){return this.api.get("info").then((t=>t.data))}getPeers(){return this.api.get("peers").then((t=>t.data))}}},243:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SiloResource=void 0;const r=n(244);e.default=class{api;crypto;transactions;constructor(t,e,n){this.api=t,this.crypto=e,this.transactions=n}async get(t){if(!t)throw new Error("No Silo URI specified");const e=await this.parseUri(t),n=await this.transactions.search("Silo-Name",e.getAccessKey());if(0==n.length)throw new Error(`No data could be found for the Silo URI: ${t}`);const r=await this.transactions.get(n[0]);if(!r)throw new Error(`No data could be found for the Silo URI: ${t}`);const i=r.get("data",{decode:!0,string:!1});return this.crypto.decrypt(i,e.getEncryptionKey())}async readTransactionData(t,e){if(!e)throw new Error("No Silo URI specified");const n=await this.parseUri(e),r=t.get("data",{decode:!0,string:!1});return this.crypto.decrypt(r,n.getEncryptionKey())}async parseUri(t){const e=t.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!e)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");const n=e[1],o=Math.pow(2,parseInt(e[2])),s=await this.hash(r.stringToBuffer(n),o),a=r.bufferTob64(s.slice(0,15)),c=await this.hash(s.slice(16,31),1);return new i(t,a,c)}async hash(t,e){let n=await this.crypto.hash(t);for(let t=0;t<e-1;t++)n=await this.crypto.hash(n);return n}};class i{uri;accessKey;encryptionKey;constructor(t,e,n){this.uri=t,this.accessKey=e,this.encryptionKey=n}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}}e.SiloResource=i},935:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),i=n(825),o=n(244),s=n(246);n(317);e.default=class{api;crypto;chunks;constructor(t,e,n){this.api=t,this.crypto=e,this.chunks=n}async getTransactionAnchor(){const t=await this.api.get("tx_anchor");if(!t.data.match(/^[a-z0-9_-]{43,}/i)||!t.ok)throw new Error(`Could not getTransactionAnchor. Received: ${t.data}. Status: ${t.status}, ${t.statusText}`);return t.data}async getPrice(t,e){let n=e?`price/${t}/${e}`:`price/${t}`;const r=await this.api.get(n);if(!/^\d+$/.test(r.data)||!r.ok)throw new Error(`Could not getPrice. Received: ${r.data}. Status: ${r.status}, ${r.statusText}`);return r.data}async get(t){const e=await this.api.get(`tx/${t}`);if(200==e.status){const n=parseInt(e.data.data_size);if(e.data.format>=2&&n>0&&n<=12582912){const n=await this.getData(t);return new i.default({...e.data,data:n})}return new i.default({...e.data,format:e.data.format||1})}if(404==e.status)throw new r.default("TX_NOT_FOUND");if(410==e.status)throw new r.default("TX_FAILED");throw new r.default("TX_INVALID")}fromRaw(t){return new i.default(t)}async search(t,e){return this.api.post("arql",{op:"equals",expr1:t,expr2:e}).then((t=>t.data?t.data:[]))}getStatus(t){return this.api.get(`tx/${t}/status`).then((t=>200==t.status?{status:200,confirmed:t.data}:{status:t.status,confirmed:null}))}async getData(t,e){let n;try{n=await this.chunks.downloadChunkedData(t)}catch(e){console.error(`Error while trying to download chunked data for ${t}`),console.error(e)}if(!n){console.warn(`Falling back to gateway cache for ${t}`);try{const{data:e,ok:r,status:i,statusText:o}=await this.api.get(`/${t}`,{responseType:"arraybuffer"});if(!r)throw new Error("Bad http status code",{cause:{status:i,statusText:o}});n=e}catch(e){console.error(`Error while trying to download contiguous data from gateway cache for ${t}`),console.error(e)}}if(!n)throw new Error(`${t} data was not found!`);return e&&e.decode&&!e.string?n:e&&e.decode&&e.string?o.bufferToString(n):o.bufferTob64Url(n)}async sign(t,e,n){const r="object"==typeof e&&(t=>{let e=!0;return["n","e","d","p","q","dp","dq","qi"].map((n=>!(n in t)&&(e=!1))),e})(e),i="object"==typeof arweaveWallet;if(!r&&!i)throw new Error("No valid JWK or external wallet found to sign transaction.");if(r){t.setOwner(e.n);let r=await t.getSignatureData(),i=await this.crypto.sign(e,r,n),s=await this.crypto.hash(i);t.setSignature({id:o.bufferTob64Url(s),owner:e.n,signature:o.bufferTob64Url(i)})}else{if(!i)throw new Error("An error occurred while signing. Check wallet is valid");{try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}const e=await arweaveWallet.sign(t,n);t.setSignature({id:e.id,owner:e.owner,reward:e.reward,tags:e.tags,signature:e.signature})}}}async verify(t){const e=await t.getSignatureData(),n=t.get("signature",{decode:!0,string:!1}),r=o.bufferTob64Url(await this.crypto.hash(n));if(t.id!==r)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(t.owner,e,n)}async post(t){if("string"==typeof t?t=new i.default(JSON.parse(t)):"function"==typeof t.readInt32BE?t=new i.default(JSON.parse(t.toString())):"object"!=typeof t||t instanceof i.default||(t=new i.default(t)),!(t instanceof i.default))throw new Error("Must be Transaction object");t.chunks||await t.prepareChunks(t.data);const e=await this.getUploader(t,t.data);try{for(;!e.isComplete;)await e.uploadChunk()}catch(t){if(e.lastResponseStatus>0)return{status:e.lastResponseStatus,statusText:e.lastResponseError,data:{error:e.lastResponseError}};throw t}return{status:200,statusText:"OK",data:{}}}async getUploader(t,e){let n;if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t instanceof i.default){if(e||(e=t.data),!(e instanceof Uint8Array))throw new Error("Data format is invalid");t.chunks||await t.prepareChunks(e),n=new s.TransactionUploader(this.api,t),n.data&&0!==n.data.length||(n.data=e)}else{if("string"==typeof t&&(t=await s.TransactionUploader.fromTransactionId(this.api,t)),!(e&&e instanceof Uint8Array))throw new Error("Must provide data when resuming upload");n=await s.TransactionUploader.fromSerialized(this.api,t,e)}return n}async*upload(t,e){const n=await this.getUploader(t,e);for(;!n.isComplete;)await n.uploadChunk(),yield n;return n}}},927:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(244);n(317);e.default=class{api;crypto;constructor(t,e){this.api=t,this.crypto=e}getBalance(t){return this.api.get(`wallet/${t}/balance`).then((t=>t.data))}getLastTransactionID(t){return this.api.get(`wallet/${t}/last_tx`).then((t=>t.data))}generate(){return this.crypto.generateJWK()}async jwkToAddress(t){return t&&"use_wallet"!==t?this.getAddress(t):this.getAddress()}async getAddress(t){if(t&&"use_wallet"!==t)return this.ownerToAddress(t.n);try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}async ownerToAddress(t){return r.bufferTob64Url(await this.crypto.hash(r.b64UrlToBuffer(t)))}}},742:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],c=o[1],l=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,c)),u=0,h=c>0?s-4:s;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[u++]=255&e);1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e);return l},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(c(t,a,a+s>l?l:a+s));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},431:function(t,e,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,l="[BigNumber Error] ",u=l+"Number primitive has more than 15 significant digits: ",h=1e14,d=14,f=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,g=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function w(t){for(var e,n,r=1,i=t.length,o=t[0]+"";r<i;){for(e=t[r++]+"",n=d-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(t,e){var n,r,i=t.c,o=e.c,s=t.s,a=e.s,c=t.e,l=e.e;if(!s||!a)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=c==l,!i||!o)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(a=(c=i.length)<(l=o.length)?c:l,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return c==l?0:c>l^n?1:-1}function b(t,e,n,r){if(t<e||t>n||t!==c(t))throw Error(l+(r||"Argument")+("number"==typeof t?t<e||t>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function E(t){var e=t.c.length-1;return y(t.e/d)==e&&t.c[e]%2!=0}function S(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function T(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else e<r&&(t=t.slice(0,e)+"."+t.slice(e));return t}o=function t(e){var n,r,i,o,x,A,k,R,P,C,O=W.prototype={constructor:W,toString:null,valueOf:null},I=new W(1),B=20,U=4,L=-7,N=21,_=-1e7,j=1e7,D=!1,M=1,V=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",z=!0;function W(t,e){var n,o,a,l,h,p,m,g,y=this;if(!(y instanceof W))return new W(t,e);if(null==e){if(t&&!0===t._isBigNumber)return y.s=t.s,void(!t.c||t.e>j?y.c=y.e=null:t.e<_?y.c=[y.e=0]:(y.e=t.e,y.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(y.s=1/t<0?(t=-t,-1):1,t===~~t){for(l=0,h=t;h>=10;h/=10,l++);return void(l>j?y.c=y.e=null:(y.e=l,y.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(y,g,p);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(l=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(l<0&&(l=h),l+=+g.slice(h+1),g=g.substring(0,h)):l<0&&(l=g.length)}else{if(b(e,2,K.length,"Base"),10==e&&z)return X(y=new W(t),B+y.e+1,U);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(y,g,p,e);if(y.s=1/t<0?(g=g.slice(1),-1):1,W.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(u+t)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(n=K.slice(0,e),l=h=0,m=g.length;h<m;h++)if(n.indexOf(o=g.charAt(h))<0){if("."==o){if(h>l){l=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,l=0;continue}return i(y,String(t),p,e)}p=!1,(l=(g=r(g,e,10,y.s)).indexOf("."))>-1?g=g.replace(".",""):l=g.length}for(h=0;48===g.charCodeAt(h);h++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(h,++m)){if(m-=h,p&&W.DEBUG&&m>15&&(t>f||t!==c(t)))throw Error(u+y.s*t);if((l=l-h-1)>j)y.c=y.e=null;else if(l<_)y.c=[y.e=0];else{if(y.e=l,y.c=[],h=(l+1)%d,l<0&&(h+=d),h<m){for(h&&y.c.push(+g.slice(0,h)),m-=d;h<m;)y.c.push(+g.slice(h,h+=d));h=d-(g=g.slice(h)).length}else h-=m;for(;h--;g+="0");y.c.push(+g)}}else y.c=[y.e=0]}function H(t,e,n,r){var i,o,s,a,c;if(null==n?n=U:b(n,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)c=w(t.c),c=1==r||2==r&&(s<=L||s>=N)?S(c,s):T(c,s,"0");else if(o=(t=X(new W(t),e,n)).e,a=(c=w(t.c)).length,1==r||2==r&&(e<=o||o<=L)){for(;a<e;c+="0",a++);c=S(c,o)}else if(e-=s,c=T(c,o,"0"),o+1>a){if(--e>0)for(c+=".";e--;c+="0");}else if((e+=o-a)>0)for(o+1==a&&(c+=".");e--;c+="0");return t.s<0&&i?"-"+c:c}function $(t,e){for(var n,r,i=1,o=new W(t[0]);i<t.length;i++)(!(r=new W(t[i])).s||(n=v(o,r))===e||0===n&&o.s===e)&&(o=r);return o}function Z(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*d-1)>j?t.c=t.e=null:n<_?t.c=[t.e=0]:(t.e=n,t.c=e),t}function X(t,e,n,r){var i,o,s,l,u,f,m,g=t.c,y=p;if(g){t:{for(i=1,l=g[0];l>=10;l/=10,i++);if((o=e-i)<0)o+=d,s=e,u=g[f=0],m=c(u/y[i-s-1]%10);else if((f=a((o+1)/d))>=g.length){if(!r)break t;for(;g.length<=f;g.push(0));u=m=0,i=1,s=(o%=d)-d+1}else{for(u=l=g[f],i=1;l>=10;l/=10,i++);m=(s=(o%=d)-d+i)<0?0:c(u/y[i-s-1]%10)}if(r=r||e<0||null!=g[f+1]||(s<0?u:u%y[i-s-1]),r=n<4?(m||r)&&(0==n||n==(t.s<0?3:2)):m>5||5==m&&(4==n||r||6==n&&(o>0?s>0?u/y[i-s]:0:g[f-1])%10&1||n==(t.s<0?8:7)),e<1||!g[0])return g.length=0,r?(e-=t.e+1,g[0]=y[(d-e%d)%d],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=f,l=1,f--):(g.length=f+1,l=y[d-o],g[f]=s>0?c(u/y[i-s]%y[s])*l:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=l,l=1;s>=10;s/=10,l++);o!=l&&(t.e++,g[0]==h&&(g[0]=1));break}if(g[f]+=l,g[f]!=h)break;g[f--]=0,l=1}for(o=g.length;0===g[--o];g.pop());}t.e>j?t.c=t.e=null:t.e<_&&(t.c=[t.e=0])}return t}function Y(t){var e,n=t.e;return null===n?t.toString():(e=w(t.c),e=n<=L||n>=N?S(e,n):T(e,n,"0"),t.s<0?"-"+e:e)}return W.clone=t,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(l+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(b(n=t[e],0,g,e),B=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(b(n=t[e],0,8,e),U=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(b(n[0],-g,0,e),b(n[1],0,g,e),L=n[0],N=n[1]):(b(n,-g,g,e),L=-(N=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)b(n[0],-g,-1,e),b(n[1],1,g,e),_=n[0],j=n[1];else{if(b(n,-g,g,e),!n)throw Error(l+e+" cannot be zero: "+n);_=-(j=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(l+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!n,Error(l+"crypto unavailable");D=n}else D=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(b(n=t[e],0,9,e),M=n),t.hasOwnProperty(e="POW_PRECISION")&&(b(n=t[e],0,g,e),V=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(l+e+" not an object: "+n);F=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(l+e+" invalid: "+n);z="0123456789"==n.slice(0,10),K=n}}return{DECIMAL_PLACES:B,ROUNDING_MODE:U,EXPONENTIAL_AT:[L,N],RANGE:[_,j],CRYPTO:D,MODULO_MODE:M,POW_PRECISION:V,FORMAT:F,ALPHABET:K}},W.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!W.DEBUG)return!0;var e,n,r=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break t}if((e=(i+1)%d)<1&&(e+=d),String(r[0]).length==e){for(e=0;e<r.length;e++)if((n=r[e])<0||n>=h||n!==c(n))break t;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(l+"Invalid BigNumber: "+t)},W.maximum=W.max=function(){return $(arguments,-1)},W.minimum=W.min=function(){return $(arguments,1)},W.random=(o=9007199254740992,x=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,i,o,s=0,u=[],h=new W(I);if(null==t?t=B:b(t,0,g),i=a(t/d),D)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[s]=n[0],e[s+1]=n[1]):(u.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw D=!1,Error(l+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(u.push(o%1e14),s+=7);s=i/7}if(!D)for(;s<i;)(o=x())<9e15&&(u[s++]=o%1e14);for(i=u[--s],t%=d,i&&t&&(o=p[d-t],u[s]=c(i/o)*o);0===u[s];u.pop(),s--);if(s<0)u=[r=0];else{for(r=-1;0===u[0];u.splice(0,1),r-=d);for(s=1,o=u[0];o>=10;o/=10,s++);s<d&&(r-=d-s)}return h.e=r,h.c=u,h}),W.sum=function(){for(var t=1,e=arguments,n=new W(e[0]);t<e.length;)n=n.plus(e[t++]);return n},r=function(){var t="0123456789";function e(t,e,n,r){for(var i,o,s=[0],a=0,c=t.length;a<c;){for(o=s.length;o--;s[o]*=e);for(s[0]+=r.indexOf(t.charAt(a++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var c,l,u,h,d,f,p,m,g=r.indexOf("."),y=B,v=U;for(g>=0&&(h=V,V=0,r=r.replace(".",""),f=(m=new W(i)).pow(r.length-g),V=h,m.c=e(T(w(f.c),f.e,"0"),10,o,t),m.e=m.c.length),u=h=(p=e(r,i,o,a?(c=K,t):(c=t,K))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--u:(f.c=p,f.e=u,f.s=s,p=(f=n(f,m,y,v,o)).c,d=f.r,u=f.e),g=p[l=u+y+1],h=o/2,d=d||l<0||null!=p[l+1],d=v<4?(null!=g||d)&&(0==v||v==(f.s<0?3:2)):g>h||g==h&&(4==v||d||6==v&&1&p[l-1]||v==(f.s<0?8:7)),l<1||!p[0])r=d?T(c.charAt(1),-y,c.charAt(0)):c.charAt(0);else{if(p.length=l,d)for(--o;++p[--l]>o;)p[l]=0,l||(++u,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,r="";g<=h;r+=c.charAt(p[g++]));r=T(r,u,c.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,c=t.length,l=e%m,u=e/m|0;for(t=t.slice();c--;)a=((i=l*(o=t[c]%m)+(r=u*o+(s=t[c]/m|0)*l)%m*m+a)/n|0)+(r/m|0)+u*s,t[c]=i%n;return a&&(t=[a].concat(t)),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]<e[n]?1:0,t[n]=i*r+t[n]-e[n];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(r,i,o,s,a){var l,u,f,p,m,g,w,v,b,E,S,T,x,A,k,R,P,C=r.s==i.s?1:-1,O=r.c,I=i.c;if(!(O&&O[0]&&I&&I[0]))return new W(r.s&&i.s&&(O?!I||O[0]!=I[0]:I)?O&&0==O[0]||!I?0*C:C/0:NaN);for(b=(v=new W(C)).c=[],C=o+(u=r.e-i.e)+1,a||(a=h,u=y(r.e/d)-y(i.e/d),C=C/d|0),f=0;I[f]==(O[f]||0);f++);if(I[f]>(O[f]||0)&&u--,C<0)b.push(1),p=!0;else{for(A=O.length,R=I.length,f=0,C+=2,(m=c(a/(I[0]+1)))>1&&(I=t(I,m,a),O=t(O,m,a),R=I.length,A=O.length),x=R,S=(E=O.slice(0,R)).length;S<R;E[S++]=0);P=I.slice(),P=[0].concat(P),k=I[0],I[1]>=a/2&&k++;do{if(m=0,(l=e(I,E,R,S))<0){if(T=E[0],R!=S&&(T=T*a+(E[1]||0)),(m=c(T/k))>1)for(m>=a&&(m=a-1),w=(g=t(I,m,a)).length,S=E.length;1==e(g,E,w,S);)m--,n(g,R<w?P:I,w,a),w=g.length,l=1;else 0==m&&(l=m=1),w=(g=I.slice()).length;if(w<S&&(g=[0].concat(g)),n(E,g,S,a),S=E.length,-1==l)for(;e(I,E,R,S)<1;)m++,n(E,R<S?P:I,S,a),S=E.length}else 0===l&&(m++,E=[0]);b[f++]=m,E[0]?E[S++]=O[x]||0:(E=[O[x]],S=1)}while((x++<A||null!=E[0])&&C--);p=null!=E[0],b[0]||b.splice(0,1)}if(a==h){for(f=1,C=b[0];C>=10;C/=10,f++);X(v,o+(v.e=f+u*d-1)+1,s,p)}else v.e=u,v.r=+p;return v}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,k=/^([^.]+)\.$/,R=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(C,"");if(P.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(A,(function(t,e,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?t:e})),r&&(i=r,o=o.replace(k,"$1").replace(R,"0.$1")),e!=o))return new W(o,i);if(W.DEBUG)throw Error(l+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},O.absoluteValue=O.abs=function(){var t=new W(this);return t.s<0&&(t.s=1),t},O.comparedTo=function(t,e){return v(this,new W(t,e))},O.decimalPlaces=O.dp=function(t,e){var n,r,i,o=this;if(null!=t)return b(t,0,g),null==e?e=U:b(e,0,8),X(new W(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-y(this.e/d))*d,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},O.dividedBy=O.div=function(t,e){return n(this,new W(t,e),B,U)},O.dividedToIntegerBy=O.idiv=function(t,e){return n(this,new W(t,e),0,1)},O.exponentiatedBy=O.pow=function(t,e){var n,r,i,o,s,u,h,f,p=this;if((t=new W(t)).c&&!t.isInteger())throw Error(l+"Exponent not an integer: "+Y(t));if(null!=e&&(e=new W(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return f=new W(Math.pow(+Y(p),s?t.s*(2-E(t)):+Y(t))),e?f.mod(e):f;if(u=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new W(NaN);(r=!u&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&E(t)?-0:0,p.e>-1&&(o=1/o),new W(u?1/o:o);V&&(o=a(V/d+2))}for(s?(n=new W(.5),u&&(t.s=1),h=E(t)):h=(i=Math.abs(+Y(t)))%2,f=new W(I);;){if(h){if(!(f=f.times(p)).c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(e))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(X(t=t.times(n),t.e+1,1),t.e>14)h=E(t);else{if(0===(i=+Y(t)))break;h=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(e))}return r?f:(u&&(f=I.div(f)),e?f.mod(e):o?X(f,V,U,undefined):f)},O.integerValue=function(t){var e=new W(this);return null==t?t=U:b(t,0,8),X(e,e.e+1,t)},O.isEqualTo=O.eq=function(t,e){return 0===v(this,new W(t,e))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(t,e){return v(this,new W(t,e))>0},O.isGreaterThanOrEqualTo=O.gte=function(t,e){return 1===(e=v(this,new W(t,e)))||0===e},O.isInteger=function(){return!!this.c&&y(this.e/d)>this.c.length-2},O.isLessThan=O.lt=function(t,e){return v(this,new W(t,e))<0},O.isLessThanOrEqualTo=O.lte=function(t,e){return-1===(e=v(this,new W(t,e)))||0===e},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.minus=function(t,e){var n,r,i,o,s=this,a=s.s;if(e=(t=new W(t,e)).s,!a||!e)return new W(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/d,l=t.e/d,u=s.c,f=t.c;if(!c||!l){if(!u||!f)return u?(t.s=-e,t):new W(f?s:NaN);if(!u[0]||!f[0])return f[0]?(t.s=-e,t):new W(u[0]?s:3==U?-0:0)}if(c=y(c),l=y(l),u=u.slice(),a=c-l){for((o=a<0)?(a=-a,i=u):(l=c,i=f),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=u.length)<(e=f.length))?a:e,a=e=0;e<r;e++)if(u[e]!=f[e]){o=u[e]<f[e];break}if(o&&(i=u,u=f,f=i,t.s=-t.s),(e=(r=f.length)-(n=u.length))>0)for(;e--;u[n++]=0);for(e=h-1;r>a;){if(u[--r]<f[r]){for(n=r;n&&!u[--n];u[n]=e);--u[n],u[r]+=h}u[r]-=f[r]}for(;0==u[0];u.splice(0,1),--l);return u[0]?Z(t,u,l):(t.s=3==U?-1:1,t.c=[t.e=0],t)},O.modulo=O.mod=function(t,e){var r,i,o=this;return t=new W(t,e),!o.c||!t.s||t.c&&!t.c[0]?new W(NaN):!t.c||o.c&&!o.c[0]?new W(o):(9==M?(i=t.s,t.s=1,r=n(o,t,0,3),t.s=i,r.s*=i):r=n(o,t,0,M),(t=o.minus(r.times(t))).c[0]||1!=M||(t.s=o.s),t)},O.multipliedBy=O.times=function(t,e){var n,r,i,o,s,a,c,l,u,f,p,g,w,v,b,E=this,S=E.c,T=(t=new W(t,e)).c;if(!(S&&T&&S[0]&&T[0]))return!E.s||!t.s||S&&!S[0]&&!T||T&&!T[0]&&!S?t.c=t.e=t.s=null:(t.s*=E.s,S&&T?(t.c=[0],t.e=0):t.c=t.e=null),t;for(r=y(E.e/d)+y(t.e/d),t.s*=E.s,(c=S.length)<(f=T.length)&&(w=S,S=T,T=w,i=c,c=f,f=i),i=c+f,w=[];i--;w.push(0));for(v=h,b=m,i=f;--i>=0;){for(n=0,p=T[i]%b,g=T[i]/b|0,o=i+(s=c);o>i;)n=((l=p*(l=S[--s]%b)+(a=g*l+(u=S[s]/b|0)*p)%b*b+w[o]+n)/v|0)+(a/b|0)+g*u,w[o--]=l%v;w[o]=n}return n?++r:w.splice(0,1),Z(t,w,r)},O.negated=function(){var t=new W(this);return t.s=-t.s||null,t},O.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new W(t,e)).s,!i||!e)return new W(NaN);if(i!=e)return t.s=-e,r.minus(t);var o=r.e/d,s=t.e/d,a=r.c,c=t.c;if(!o||!s){if(!a||!c)return new W(i/0);if(!a[0]||!c[0])return c[0]?t:new W(a[0]?r:0*i)}if(o=y(o),s=y(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=c):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(e=c.length)<0&&(n=c,c=a,a=n,e=i),i=0;e;)i=(a[--e]=a[e]+c[e]+i)/h|0,a[e]=h===a[e]?0:a[e]%h;return i&&(a=[i].concat(a),++s),Z(t,a,s)},O.precision=O.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return b(t,1,g),null==e?e=U:b(e,0,8),X(new W(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*d+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&o.e+1>r&&(r=o.e+1),r},O.shiftedBy=function(t){return b(t,-9007199254740991,f),this.times("1e"+t)},O.squareRoot=O.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,c=s.s,l=s.e,u=B+4,h=new W("0.5");if(1!==c||!a||!a[0])return new W(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Y(s)))||c==1/0?(((e=w(a)).length+l)%2==0&&(e+="0"),c=Math.sqrt(+e),l=y((l+1)/2)-(l<0||l%2),r=new W(e=c==1/0?"5e"+l:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+l)):r=new W(c+""),r.c[0])for((c=(l=r.e)+u)<3&&(c=0);;)if(o=r,r=h.times(o.plus(n(s,o,u,1))),w(o.c).slice(0,c)===(e=w(r.c)).slice(0,c)){if(r.e<l&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(X(r,r.e+B+2,1),t=!r.times(r).eq(s));break}if(!i&&(X(o,o.e+B+2,0),o.times(o).eq(s))){r=o;break}u+=4,c+=4,i=1}return X(r,r.e+B+1,U,t)},O.toExponential=function(t,e){return null!=t&&(b(t,0,g),t++),H(this,t,e,1)},O.toFixed=function(t,e){return null!=t&&(b(t,0,g),t=t+this.e+1),H(this,t,e)},O.toFormat=function(t,e,n){var r,i=this;if(null==n)null!=t&&e&&"object"==typeof e?(n=e,e=null):t&&"object"==typeof t?(n=t,t=e=null):n=F;else if("object"!=typeof n)throw Error(l+"Argument not an object: "+n);if(r=i.toFixed(t,e),i.c){var o,s=r.split("."),a=+n.groupSize,c=+n.secondaryGroupSize,u=n.groupSeparator||"",h=s[0],d=s[1],f=i.s<0,p=f?h.slice(1):h,m=p.length;if(c&&(o=a,a=c,c=o,m-=o),a>0&&m>0){for(o=m%a||a,h=p.substr(0,o);o<m;o+=a)h+=u+p.substr(o,a);c>0&&(h+=u+p.slice(o)),f&&(h="-"+h)}r=d?h+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):h}return(n.prefix||"")+r+(n.suffix||"")},O.toFraction=function(t){var e,r,i,o,s,a,c,u,h,f,m,g,y=this,v=y.c;if(null!=t&&(!(c=new W(t)).isInteger()&&(c.c||1!==c.s)||c.lt(I)))throw Error(l+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!v)return new W(y);for(e=new W(I),h=r=new W(I),i=u=new W(I),g=w(v),s=e.e=g.length-y.e-1,e.c[0]=p[(a=s%d)<0?d+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=j,j=1/0,c=new W(g),u.c[0]=0;f=n(c,e,0,1),1!=(o=r.plus(f.times(i))).comparedTo(t);)r=i,i=o,h=u.plus(f.times(o=h)),u=o,e=c.minus(f.times(o=e)),c=o;return o=n(t.minus(r),i,0,1),u=u.plus(o.times(h)),r=r.plus(o.times(i)),u.s=h.s=y.s,m=n(h,i,s*=2,U).minus(y).abs().comparedTo(n(u,r,s,U).minus(y).abs())<1?[h,i]:[u,r],j=a,m},O.toNumber=function(){return+Y(this)},O.toPrecision=function(t,e){return null!=t&&b(t,1,g),H(this,t,e,2)},O.toString=function(t){var e,n=this,i=n.s,o=n.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=L||o>=N?S(w(n.c),o):T(w(n.c),o,"0"):10===t&&z?e=T(w((n=X(new W(n),B+o+1,U)).c),n.e,"0"):(b(t,2,K.length,"Base"),e=r(T(w(n.c),o,"0"),10,t,i,!0)),i<0&&n.c[0]&&(e="-"+e)),e},O.valueOf=O.toJSON=function(){return Y(this)},O._isBigNumber=!0,null!=e&&W.set(e),W}(),o.default=o.BigNumber=o,void 0===(r=function(){return o}.call(e,n,e,t))||(t.exports=r)}()},764:(t,e,n)=>{"use strict";const r=n(742),i=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.lW=c,e.h2=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return l(t,e,n)}function l(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let r=a(n);const i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return f(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return f(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return c.from(r,e,n);const i=function(t){if(c.isBuffer(t)){const e=0|p(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||G(t.length)?a(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return u(t),a(t<0?0:0|p(t))}function d(t){const e=t.length<0?0:0|p(t.length),n=a(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function f(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,c.prototype),r}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(t).length;default:if(i)return r?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,n);case"utf8":case"utf-8":return k(this,e,n);case"ascii":return P(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function w(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(l(t,o+r)!==l(e,r)){n=!1;break}if(n)return o}return-1}function b(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(G(r))return s;t[n+s]=r}return s}function E(t,e,n,r){return X($(e,t.length-n),t,n,r)}function S(t,e,n,r){return X(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function T(t,e,n,r){return X(Z(e),t,n,r)}function x(t,e,n,r){return X(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function k(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(o=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=R));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(t,e,n){return l(t,e,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(t,e,n){return function(t,e,n){return u(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},c.allocUnsafe=function(t){return h(t)},c.allocUnsafeSlow=function(t){return h(t)},c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=c.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(Y(e,Uint8Array))i+e.length>r.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)y(this,e,e+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},c.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?k(this,0,t):g.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){let t="";const n=e.h2;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(t,e,n,r,i){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),l=this.slice(r,i),u=t.slice(e,n);for(let t=0;t<a;++t)if(l[t]!==u[t]){o=l[t],s=u[t];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return w(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return w(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return S(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function O(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=q[t[r]];return i}function I(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function B(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function U(t,e,n,r,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function L(t,e,n,r,i){K(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function N(t,e,n,r,i){K(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function _(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,o){return e=+e,n>>>=0,o||_(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function D(t,e,n,r,o){return e=+e,n>>>=0,o||_(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),c.prototype.readBigInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),c.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){U(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){U(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=J((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(t,e=0){return N(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=J((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(t,e=0){return N(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=c.isBuffer(t)?t:c.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const M={};function V(t,e,n){M[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function F(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function K(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new M.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function z(t,e){if("number"!=typeof t)throw new M.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw z(t,n),new M.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=F(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function $(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=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((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}const q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},470:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===n.call(t)},s=function(t){if(!t||"[object Object]"!==n.call(t))return!1;var r,i=e.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!i&&!o)return!1;for(r in t);return void 0===r||e.call(t,r)},a=function(t,e){r&&"__proto__"===e.name?r(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},c=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(i)return i(t,n).value}return t[n]};t.exports=function t(){var e,n,r,i,l,u,h=arguments[0],d=1,f=arguments.length,p=!1;for("boolean"==typeof h&&(p=h,h=arguments[1]||{},d=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});d<f;++d)if(null!=(e=arguments[d]))for(n in e)r=c(h,n),h!==(i=c(e,n))&&(p&&i&&(s(i)||(l=o(i)))?(l?(l=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},a(h,{name:n,newValue:t(p,u,i)})):void 0!==i&&a(h,{name:n,newValue:i}));return h}},645:(t,e)=>{e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[n+f]=255&s,f+=p,s/=256,l-=8);t[n+f-p]|=128*m}},703:(t,e,n)=>{"use strict";var r=n(414);function i(){}function o(){}o.resetWarningCache=i,t.exports=function(){function t(t,e,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},697:(t,e,n)=>{t.exports=n(703)()},414:t=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},251:(t,e,n)=>{"use strict";var r=n(639),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(t,e,n){var r,o={},l=null,u=null;for(r in void 0!==n&&(l=""+n),void 0!==e.key&&(l=""+e.key),void 0!==e.ref&&(u=e.ref),e)s.call(e,r)&&!c.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===o[r]&&(o[r]=e[r]);return{$$typeof:i,type:t,key:l,ref:u,props:o,_owner:a.current}}e.jsx=l,e.jsxs=l},893:(t,e,n)=>{"use strict";t.exports=n(251)},639:e=>{"use strict";e.exports=t}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={exports:{}};return o[t].call(n.exports,n,n.exports,a),n.exports}a.m=o,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},n=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(t,r){if(1&r&&(t=this(t)),8&r)return t;if("object"==typeof t&&t){if(4&r&&t.__esModule)return t;if(16&r&&"function"==typeof t.then)return t}var i=Object.create(null);a.r(i);var o={};e=e||[null,n({}),n([]),n(n)];for(var s=2&r&&t;"object"==typeof s&&!~e.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,a.d(i,o),i},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce(((e,n)=>(a.f[n](t,e),e)),[])),a.u=t=>t+".onairos.bundle.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r={},i="onairos:",a.l=(t,e,n,o)=>{if(r[t])r[t].push(e);else{var s,c;if(void 0!==n)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var h=l[u];if(h.getAttribute("src")==t||h.getAttribute("data-webpack")==i+n){s=h;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",i+n),s.src=t),r[t]=[e];var d=(e,n)=>{s.onerror=s.onload=null,clearTimeout(f);var i=r[t];if(delete r[t],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((t=>t(n))),e)return e(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),c&&document.head.appendChild(s)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&!t;)t=n[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{var t={179:0};a.f.j=(e,n)=>{var r=a.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise(((n,i)=>r=t[e]=[n,i]));n.push(r[2]=i);var o=a.p+a.u(e),s=new Error;a.l(o,(n=>{if(a.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",s.name="ChunkLoadError",s.type=i,s.request=o,r[1](s)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,i,o=n[0],s=n[1],c=n[2],l=0;if(o.some((e=>0!==t[e]))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(c)c(a)}for(e&&e(n);l<o.length;l++)i=o[l],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},n=this.webpackChunkonairos=this.webpackChunkonairos||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var c={};return(()=>{"use strict";a.r(c),a.d(c,{Onairos:()=>Yh,default:()=>Gh});var t={};a.r(t),a.d(t,{hasBrowserEnv:()=>ee,hasStandardBrowserEnv:()=>ne,hasStandardBrowserWebWorkerEnv:()=>ie});var e=a(639),n=a.n(e),r=a(764);function i(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}"function"==typeof SuppressedError&&SuppressedError;var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==a.g?a.g:"undefined"!=typeof self?self:{};function s(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function l(t,e){return t(e={exports:{}},e.exports),e.exports}var u=l((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){var t=this;this.locked=new Map,this.addToLocked=function(e,n){var r=t.locked.get(e);void 0===r?void 0===n?t.locked.set(e,[]):t.locked.set(e,[n]):void 0!==n&&(r.unshift(n),t.locked.set(e,r))},this.isLocked=function(e){return t.locked.has(e)},this.lock=function(e){return new Promise((function(n,r){t.isLocked(e)?t.addToLocked(e,n):(t.addToLocked(e),n())}))},this.unlock=function(e){var n=t.locked.get(e);if(void 0!==n&&0!==n.length){var r=n.pop();t.locked.set(e,n),void 0!==r&&setTimeout(r,0)}else t.locked.delete(e)}}return t.getInstance=function(){return void 0===t.instance&&(t.instance=new t),t.instance},t}();e.default=function(){return n.getInstance()}}));s(u);var h=s(l((function(t,e){var n=o&&o.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(s,a)}c((r=r.apply(t,e||[])).next())}))},r=o&&o.__generator||function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=o;Object.defineProperty(e,"__esModule",{value:!0});var s="browser-tabs-lock-key",a={key:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},getItem:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},clear:function(){return n(i,void 0,void 0,(function(){return r(this,(function(t){return[2,window.localStorage.clear()]}))}))},removeItem:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},setItem:function(t,e){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},keySync:function(t){return window.localStorage.key(t)},getItemSync:function(t){return window.localStorage.getItem(t)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(t){return window.localStorage.removeItem(t)},setItemSync:function(t,e){return window.localStorage.setItem(t,e)}};function c(t){return new Promise((function(e){return setTimeout(e,t)}))}function l(t){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",n="",r=0;r<t;r++)n+=e[Math.floor(61*Math.random())];return n}var h=function(){function t(e){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+l(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=e,void 0===t.waiters&&(t.waiters=[])}return t.prototype.acquireLock=function(e,i){return void 0===i&&(i=5e3),n(this,void 0,void 0,(function(){var n,o,u,h,d,f,p;return r(this,(function(r){switch(r.label){case 0:n=Date.now()+l(4),o=Date.now()+i,u=s+"-"+e,h=void 0===this.storageHandler?a:this.storageHandler,r.label=1;case 1:return Date.now()<o?[4,c(30)]:[3,8];case 2:return r.sent(),null!==h.getItemSync(u)?[3,5]:(d=this.id+"-"+e+"-"+n,[4,c(Math.floor(25*Math.random()))]);case 3:return r.sent(),h.setItemSync(u,JSON.stringify({id:this.id,iat:n,timeoutKey:d,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,c(30)];case 4:return r.sent(),null!==(f=h.getItemSync(u))&&(p=JSON.parse(f)).id===this.id&&p.iat===n?(this.acquiredIatSet.add(n),this.refreshLockWhileAcquired(u,n),[2,!0]):[3,7];case 5:return t.lockCorrector(void 0===this.storageHandler?a:this.storageHandler),[4,this.waitForSomethingToChange(o)];case 6:r.sent(),r.label=7;case 7:return n=Date.now()+l(4),[3,1];case 8:return[2,!1]}}))}))},t.prototype.refreshLockWhileAcquired=function(t,e){return n(this,void 0,void 0,(function(){var i=this;return r(this,(function(o){return setTimeout((function(){return n(i,void 0,void 0,(function(){var n,i,o;return r(this,(function(r){switch(r.label){case 0:return[4,u.default().lock(e)];case 1:return r.sent(),this.acquiredIatSet.has(e)?(n=void 0===this.storageHandler?a:this.storageHandler,null===(i=n.getItemSync(t))?(u.default().unlock(e),[2]):((o=JSON.parse(i)).timeRefreshed=Date.now(),n.setItemSync(t,JSON.stringify(o)),u.default().unlock(e),this.refreshLockWhileAcquired(t,e),[2])):(u.default().unlock(e),[2])}}))}))}),1e3),[2]}))}))},t.prototype.waitForSomethingToChange=function(e){return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){var r=!1,i=Date.now(),o=!1;function s(){if(o||(window.removeEventListener("storage",s),t.removeFromWaiting(s),clearTimeout(a),o=!0),!r){r=!0;var e=50-(Date.now()-i);e>0?setTimeout(n,e):n(null)}}window.addEventListener("storage",s),t.addToWaiting(s);var a=setTimeout(s,Math.max(0,e-Date.now()))}))];case 1:return n.sent(),[2]}}))}))},t.addToWaiting=function(e){this.removeFromWaiting(e),void 0!==t.waiters&&t.waiters.push(e)},t.removeFromWaiting=function(e){void 0!==t.waiters&&(t.waiters=t.waiters.filter((function(t){return t!==e})))},t.notifyWaiters=function(){void 0!==t.waiters&&t.waiters.slice().forEach((function(t){return t()}))},t.prototype.releaseLock=function(t){return n(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.releaseLock__private__(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.releaseLock__private__=function(e){return n(this,void 0,void 0,(function(){var n,i,o,c;return r(this,(function(r){switch(r.label){case 0:return n=void 0===this.storageHandler?a:this.storageHandler,i=s+"-"+e,null===(o=n.getItemSync(i))?[2]:(c=JSON.parse(o)).id!==this.id?[3,2]:[4,u.default().lock(c.iat)];case 1:r.sent(),this.acquiredIatSet.delete(c.iat),n.removeItemSync(i),u.default().unlock(c.iat),t.notifyWaiters(),r.label=2;case 2:return[2]}}))}))},t.lockCorrector=function(e){for(var n=Date.now()-5e3,r=e,i=[],o=0;;){var a=r.keySync(o);if(null===a)break;i.push(a),o++}for(var c=!1,l=0;l<i.length;l++){var u=i[l];if(u.includes(s)){var h=r.getItemSync(u);if(null!==h){var d=JSON.parse(h);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(r.removeItemSync(u),c=!0)}}}c&&t.notifyWaiters()},t.waiters=void 0,t}();e.default=h})));const d={timeoutInSeconds:60},f={name:"auth0-spa-js",version:"2.1.3"},p=()=>Date.now();class m extends Error{constructor(t,e){super(e),this.error=t,this.error_description=e,Object.setPrototypeOf(this,m.prototype)}static fromPayload({error:t,error_description:e}){return new m(t,e)}}class g extends m{constructor(t,e,n,r=null){super(t,e),this.state=n,this.appState=r,Object.setPrototypeOf(this,g.prototype)}}class y extends m{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,y.prototype)}}class w extends y{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,w.prototype)}}class v extends m{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,v.prototype)}}class b extends m{constructor(t,e,n){super(t,e),this.mfa_token=n,Object.setPrototypeOf(this,b.prototype)}}class E extends m{constructor(t,e){super("missing_refresh_token",`Missing Refresh Token (audience: '${S(t,["default"])}', scope: '${S(e)}')`),this.audience=t,this.scope=e,Object.setPrototypeOf(this,E.prototype)}}function S(t,e=[]){return t&&!e.includes(t)?t:""}const T=()=>window.crypto,x=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(T().getRandomValues(new Uint8Array(43))).forEach((n=>e+=t[n%66])),e},A=t=>btoa(t),k=t=>{var{clientId:e}=t,n=i(t,["clientId"]);return new URLSearchParams((t=>Object.keys(t).filter((e=>void 0!==t[e])).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:t[n]})),{}))(Object.assign({client_id:e},n))).toString()},R=t=>(t=>decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),P=async(t,e)=>{const n=await fetch(t,e);return{ok:n.ok,json:await n.json()}},C=async(t,e,n,r,i,o,s=1e4)=>i?(async(t,e,n,r,i,o,s)=>{return a={auth:{audience:e,scope:n},timeout:i,fetchUrl:t,fetchOptions:r,useFormData:s},c=o,new Promise((function(t,e){const n=new MessageChannel;n.port1.onmessage=function(r){r.data.error?e(new Error(r.data.error)):t(r.data),n.port1.close()},c.postMessage(a,[n.port2])}));var a,c})(t,e,n,r,s,i,o):(async(t,e,n)=>{const r=new AbortController;let i;return e.signal=r.signal,Promise.race([P(t,e),new Promise(((t,e)=>{i=setTimeout((()=>{r.abort(),e(new Error("Timeout when executing 'fetch'"))}),n)}))]).finally((()=>{clearTimeout(i)}))})(t,r,s);async function O(t,e){var{baseUrl:n,timeout:r,audience:o,scope:s,auth0Client:a,useFormData:c}=t,l=i(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const u=c?k(l):JSON.stringify(l);return await async function(t,e,n,r,o,s,a){let c,l=null;for(let i=0;i<3;i++)try{c=await C(t,n,r,o,s,a,e),l=null;break}catch(t){l=t}if(l)throw l;const u=c.json,{error:h,error_description:d}=u,f=i(u,["error","error_description"]),{ok:p}=c;if(!p){const e=d||`HTTP error. Unable to fetch ${t}`;if("mfa_required"===h)throw new b(h,e,f.mfa_token);if("missing_refresh_token"===h)throw new E(n,r);throw new m(h||"request_error",e)}return f}(`${n}/oauth/token`,r,o||"default",s,{method:"POST",body:u,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||f))}},e,c)}const I=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e};class B{constructor(t,e="@@auth0spajs@@",n){this.prefix=e,this.suffix=n,this.clientId=t.clientId,this.scope=t.scope,this.audience=t.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(t){const[e,n,r,i]=t.split("::");return new B({clientId:n,scope:i,audience:r},e)}static fromCacheEntry(t){const{scope:e,audience:n,client_id:r}=t;return new B({scope:e,audience:n,clientId:r})}}class U{set(t,e){localStorage.setItem(t,JSON.stringify(e))}get(t){const e=window.localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(t){return}}remove(t){localStorage.removeItem(t)}allKeys(){return Object.keys(window.localStorage).filter((t=>t.startsWith("@@auth0spajs@@")))}}class L{constructor(){this.enclosedCache=function(){let t={};return{set(e,n){t[e]=n},get(e){const n=t[e];if(n)return n},remove(e){delete t[e]},allKeys:()=>Object.keys(t)}}()}}class N{constructor(t,e,n){this.cache=t,this.keyManifest=e,this.nowProvider=n||p}async setIdToken(t,e,n){var r;const i=this.getIdTokenCacheKey(t);await this.cache.set(i,{id_token:e,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(i))}async getIdToken(t){const e=await this.cache.get(this.getIdTokenCacheKey(t.clientId));if(!e&&t.scope&&t.audience){const e=await this.get(t);if(!e)return;if(!e.id_token||!e.decodedToken)return;return{id_token:e.id_token,decodedToken:e.decodedToken}}if(e)return{id_token:e.id_token,decodedToken:e.decodedToken}}async get(t,e=0){var n;let r=await this.cache.get(t.toKey());if(!r){const e=await this.getCacheKeys();if(!e)return;const n=this.matchExistingCacheKey(t,e);n&&(r=await this.cache.get(n))}if(!r)return;const i=await this.nowProvider(),o=Math.floor(i/1e3);return r.expiresAt-e<o?r.body.refresh_token?(r.body={refresh_token:r.body.refresh_token},await this.cache.set(t.toKey(),r),r.body):(await this.cache.remove(t.toKey()),void await(null===(n=this.keyManifest)||void 0===n?void 0:n.remove(t.toKey()))):r.body}async set(t){var e;const n=new B({clientId:t.client_id,scope:t.scope,audience:t.audience}),r=await this.wrapCacheEntry(t);await this.cache.set(n.toKey(),r),await(null===(e=this.keyManifest)||void 0===e?void 0:e.add(n.toKey()))}async clear(t){var e;const n=await this.getCacheKeys();n&&(await n.filter((e=>!t||e.includes(t))).reduce((async(t,e)=>{await t,await this.cache.remove(e)}),Promise.resolve()),await(null===(e=this.keyManifest)||void 0===e?void 0:e.clear()))}async wrapCacheEntry(t){const e=await this.nowProvider();return{body:t,expiresAt:Math.floor(e/1e3)+t.expires_in}}async getCacheKeys(){var t;return this.keyManifest?null===(t=await this.keyManifest.get())||void 0===t?void 0:t.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(t){return new B({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,e){return e.filter((e=>{var n;const r=B.fromKey(e),i=new Set(r.scope&&r.scope.split(" ")),o=(null===(n=t.scope)||void 0===n?void 0:n.split(" "))||[],s=r.scope&&o.reduce(((t,e)=>t&&i.has(e)),!0);return"@@auth0spajs@@"===r.prefix&&r.clientId===t.clientId&&r.audience===t.audience&&s}))[0]}}class _{constructor(t,e,n){this.storage=t,this.clientId=e,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(t){this.storage.save(this.storageKey,t,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const j=t=>"number"==typeof t,D=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"];var M=l((function(t,e){var n=o&&o.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function r(t,e){if(!e)return"";var n="; "+t;return!0===e?n:n+"="+e}function i(t,e,n){return encodeURIComponent(t).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(e).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(t){if("number"==typeof t.expires){var e=new Date;e.setMilliseconds(e.getMilliseconds()+864e5*t.expires),t.expires=e}return r("Expires",t.expires?t.expires.toUTCString():"")+r("Domain",t.domain)+r("Path",t.path)+r("Secure",t.secure)+r("SameSite",t.sameSite)}(n)}function s(t){for(var e={},n=t?t.split("; "):[],r=/(%[\dA-F]{2})+/gi,i=0;i<n.length;i++){var o=n[i].split("="),s=o.slice(1).join("=");'"'===s.charAt(0)&&(s=s.slice(1,-1));try{e[o[0].replace(r,decodeURIComponent)]=s.replace(r,decodeURIComponent)}catch(t){}}return e}function a(){return s(document.cookie)}function c(t,e,r){document.cookie=i(t,e,n({path:"/"},r))}e.__esModule=!0,e.encode=i,e.parse=s,e.getAll=a,e.get=function(t){return a()[t]},e.set=c,e.remove=function(t,e){c(t,"",n(n({},e),{expires:-1}))}}));s(M),M.encode,M.parse,M.getAll;var V=M.get,F=M.set,K=M.remove;const z={get(t){const e=V(t);if(void 0!==e)return JSON.parse(e)},save(t,e,n){let r={};"https:"===window.location.protocol&&(r={secure:!0,sameSite:"none"}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),F(t,JSON.stringify(e),r)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n)}},W={get:t=>z.get(t)||z.get(`_legacy_${t}`),save(t,e,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),F(`_legacy_${t}`,JSON.stringify(e),r),z.save(t,e,n)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n),z.remove(t,e),z.remove(`_legacy_${t}`,e)}},H={get(t){if("undefined"==typeof sessionStorage)return;const e=sessionStorage.getItem(t);return null!=e?JSON.parse(e):void 0},save(t,e){sessionStorage.setItem(t,JSON.stringify(e))},remove(t){sessionStorage.removeItem(t)}};var $,Z=("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,!1,function(t){return $=$||function(t,e,n){var r=void 0===e?null:e,i=function(t,e){var n=atob(t);if(e){for(var r=new Uint8Array(n.length),i=0,o=n.length;i<o;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(t,void 0!==n&&n),o=i.indexOf("\n",10)+1,s=i.substring(o)+(r?"//# sourceMappingURL="+r:""),a=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(a)}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,false),new Worker($,t)});const X={};class Y{constructor(t,e){this.cache=t,this.clientId=e,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(t){var e;const n=new Set((null===(e=await this.cache.get(this.manifestKey))||void 0===e?void 0:e.keys)||[]);n.add(t),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(t){const e=await this.cache.get(this.manifestKey);if(e){const n=new Set(e.keys);return n.delete(t),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(t){return`@@auth0spajs@@::${t}`}}const G={memory:()=>(new L).enclosedCache,localstorage:()=>new U},q=t=>G[t],J=t=>{const{openUrl:e,onRedirect:n}=t,r=i(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===e||e?e:n})},Q=new h;class tt{constructor(t){let e,n;if(this.userCache=(new L).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await Q.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),t),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),t.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!T())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===T().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),t.cache&&t.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),t.cache)n=t.cache;else{if(e=t.cacheLocation||"memory",!q(e))throw new Error(`Invalid cache location "${e}"`);n=q(e)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===t.legacySameSiteCookie?z:W,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(t=>`auth0.${this.options.clientId}.is.authenticated`)(),this.sessionCheckExpiryDays=t.sessionCheckExpiryDays||1;const r=t.useCookiesForTransactions?this.cookieStorage:H;var i;this.scope=I("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new _(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||p,this.cacheManager=new N(n,n.allKeys?void 0:new Y(n,this.options.clientId),this.nowProvider),this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:`https://${i}`),this.tokenIssuer=((t,e)=>t?t.startsWith("https://")?t:`https://${t}/`:`${e}/`)(this.options.issuer,this.domainUrl),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===e&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Z)}_url(t){const e=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||f)));return`${this.domainUrl}${t}&auth0Client=${e}`}_authorizeUrl(t){return this._url(`/authorize?${k(t)}`)}async _verifyIdToken(t,e,n){const r=await this.nowProvider();return(t=>{if(!t.id_token)throw new Error("ID token is required but missing");const e=(t=>{const e=t.split("."),[n,r,i]=e;if(3!==e.length||!n||!r||!i)throw new Error("ID token could not be decoded");const o=JSON.parse(R(r)),s={__raw:t},a={};return Object.keys(o).forEach((t=>{s[t]=o[t],D.includes(t)||(a[t]=o[t])})),{encoded:{header:n,payload:r,signature:i},header:JSON.parse(R(n)),claims:s,user:a}})(t.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==t.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${t.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==e.header.alg)throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||"string"!=typeof e.claims.aud&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==t.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${t.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==t.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but found "${e.claims.aud}"`);if(t.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==t.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`)}if(t.max_age&&!j(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==e.claims.exp||!j(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!j(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=t.leeway||60,r=new Date(t.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(e.claims.exp+n),r>i)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${i})`);if(null!=e.claims.nbf&&j(e.claims.nbf)){const t=new Date(0);if(t.setUTCSeconds(e.claims.nbf-n),r<t)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${r}) is before ${t}`)}if(null!=e.claims.auth_time&&j(e.claims.auth_time)){const i=new Date(0);if(i.setUTCSeconds(parseInt(e.claims.auth_time)+t.max_age+n),r>i)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${r}) is after last auth at ${i}`)}if(t.organization){const n=t.organization.trim();if(n.startsWith("org_")){const t=n;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(t!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${t}", found "${e.claims.org_id}"`)}else{const t=n.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(t!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${t}", found "${e.claims.org_name}"`)}}return e})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:t,nonce:e,organization:n,leeway:this.options.leeway,max_age:(i=this.options.authorizationParams.max_age,"string"!=typeof i?i:parseInt(i,10)||void 0),now:r});var i}_processOrgHint(t){t?this.cookieStorage.save(this.orgHintCookieName,t,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(t,e,n){const r=A(x()),i=A(x()),o=x(),s=(t=>{const e=new Uint8Array(t);return(t=>{const e={"+":"-","/":"_","=":""};return t.replace(/[+/=]/g,(t=>e[t]))})(window.btoa(String.fromCharCode(...Array.from(e))))})(await(async t=>{const e=T().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(t));return await e})(o)),a=((t,e,n,r,i,o,s,a)=>Object.assign(Object.assign(Object.assign({client_id:t.clientId},t.authorizationParams),n),{scope:I(e,n.scope),response_type:"code",response_mode:a||"query",state:r,nonce:i,redirect_uri:s||t.authorizationParams.redirect_uri,code_challenge:o,code_challenge_method:"S256"}))(this.options,this.scope,t,r,i,s,t.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==e?void 0:e.response_mode),c=this._authorizeUrl(a);return{nonce:i,code_verifier:o,scope:a.scope,audience:a.audience||"default",redirect_uri:a.redirect_uri,state:r,url:c}}async loginWithPopup(t,e){var n;if(t=t||{},!(e=e||{}).popup&&(e.popup=(t=>{const e=window.screenX+(window.innerWidth-400)/2,n=window.screenY+(window.innerHeight-600)/2;return window.open("","auth0:authorize:popup",`left=${e},top=${n},width=400,height=600,resizable,scrollbars=yes,status=1`)})(),!e.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const r=await this._prepareAuthorizeUrl(t.authorizationParams||{},{response_mode:"web_message"},window.location.origin);e.popup.location.href=r.url;const i=await(t=>new Promise(((e,n)=>{let r;const i=setInterval((()=>{t.popup&&t.popup.closed&&(clearInterval(i),clearTimeout(o),window.removeEventListener("message",r,!1),n(new v(t.popup)))}),1e3),o=setTimeout((()=>{clearInterval(i),n(new w(t.popup)),window.removeEventListener("message",r,!1)}),1e3*(t.timeoutInSeconds||60));r=function(s){if(s.data&&"authorization_response"===s.data.type){if(clearTimeout(o),clearInterval(i),window.removeEventListener("message",r,!1),t.popup.close(),s.data.response.error)return n(m.fromPayload(s.data.response));e(s.data.response)}},window.addEventListener("message",r)})))(Object.assign(Object.assign({},e),{timeoutInSeconds:e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==i.state)throw new m("state_mismatch","Invalid state");const o=(null===(n=t.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:o})}async getUser(){var t;const e=await this._getIdTokenFromCache();return null===(t=null==e?void 0:e.decodedToken)||void 0===t?void 0:t.user}async getIdTokenClaims(){var t;const e=await this._getIdTokenFromCache();return null===(t=null==e?void 0:e.decodedToken)||void 0===t?void 0:t.claims}async loginWithRedirect(t={}){var e;const n=J(t),{openUrl:r,fragment:o,appState:s}=n,a=i(n,["openUrl","fragment","appState"]),c=(null===(e=a.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,l=await this._prepareAuthorizeUrl(a.authorizationParams||{}),{url:u}=l,h=i(l,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},h),{appState:s}),c&&{organization:c}));const d=o?`${u}#${o}`:u;r?await r(d):window.location.assign(d)}async handleRedirectCallback(t=window.location.href){const e=t.split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const{state:n,code:r,error:i,error_description:o}=(t=>{t.indexOf("#")>-1&&(t=t.substring(0,t.indexOf("#")));const e=new URLSearchParams(t);return{state:e.get("state"),code:e.get("code")||void 0,error:e.get("error")||void 0,error_description:e.get("error_description")||void 0}})(e.join("")),s=this.transactionManager.get();if(!s)throw new m("missing_transaction","Invalid state");if(this.transactionManager.remove(),i)throw new g(i,o||i,n,s.appState);if(!s.code_verifier||s.state&&s.state!==n)throw new m("state_mismatch","Invalid state");const a=s.organization,c=s.nonce,l=s.redirect_uri;return await this._requestToken(Object.assign({audience:s.audience,scope:s.scope,code_verifier:s.code_verifier,grant_type:"authorization_code",code:r},l?{redirect_uri:l}:{}),{nonceIn:c,organization:a}),{appState:s.appState}}async checkSession(t){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(t)}catch(t){}}async getTokenSilently(t={}){var e;const n=Object.assign(Object.assign({cacheMode:"on"},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:I(this.scope,null===(e=t.authorizationParams)||void 0===e?void 0:e.scope)})}),r=await((t,e)=>{let n=X[e];return n||(n=t().finally((()=>{delete X[e],n=null})),X[e]=n),n})((()=>this._getTokenSilently(n)),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return t.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(t){const{cacheMode:e}=t,n=i(t,["cacheMode"]);if("off"!==e){const t=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(t)return t}if("cache-only"!==e){if(!await(async(t,e=3)=>{for(let n=0;n<e;n++)if(await t())return!0;return!1})((()=>Q.acquireLock("auth0.lock.getTokenSilently",5e3)),10))throw new y;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),"off"!==e){const t=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(t)return t}const t=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,access_token:i,oauthTokenScope:o,expires_in:s}=t;return Object.assign(Object.assign({id_token:r,access_token:i},o?{scope:o}:null),{expires_in:s})}finally{await Q.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(t={},e={}){var n;const r=Object.assign(Object.assign({},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:I(this.scope,null===(n=t.authorizationParams)||void 0===n?void 0:n.scope)})});return e=Object.assign(Object.assign({},d),e),await this.loginWithPopup(r,e),(await this.cacheManager.get(new B({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(t){null!==t.clientId?t.clientId=t.clientId||this.options.clientId:delete t.clientId;const e=t.logoutParams||{},{federated:n}=e,r=i(e,["federated"]),o=n?"&federated":"";return this._url(`/v2/logout?${k(Object.assign({clientId:t.clientId},r))}`)+o}async logout(t={}){const e=J(t),{openUrl:n}=e,r=i(e,["openUrl"]);null===t.clientId?await this.cacheManager.clear():await this.cacheManager.clear(t.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");const o=this._buildLogoutUrl(r);n?await n(o):!1!==n&&window.location.assign(o)}async _getTokenFromIFrame(t){const e=Object.assign(Object.assign({},t.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!e.organization&&(e.organization=n);const{url:r,state:i,nonce:o,code_verifier:s,redirect_uri:a,scope:c,audience:l}=await this._prepareAuthorizeUrl(e,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new m("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const n=t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,u=await((t,e,n=60)=>new Promise(((r,i)=>{const o=window.document.createElement("iframe");o.setAttribute("width","0"),o.setAttribute("height","0"),o.style.display="none";const s=()=>{window.document.body.contains(o)&&(window.document.body.removeChild(o),window.removeEventListener("message",a,!1))};let a;const c=setTimeout((()=>{i(new y),s()}),1e3*n);a=function(t){if(t.origin!=e)return;if(!t.data||"authorization_response"!==t.data.type)return;const n=t.source;n&&n.close(),t.data.response.error?i(m.fromPayload(t.data.response)):r(t.data.response),clearTimeout(c),window.removeEventListener("message",a,!1),setTimeout(s,2e3)},window.addEventListener("message",a,!1),window.document.body.appendChild(o),o.setAttribute("src",t)})))(r,this.domainUrl,n);if(i!==u.state)throw new m("state_mismatch","Invalid state");const h=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:s,code:u.code,grant_type:"authorization_code",redirect_uri:a,timeout:t.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:o,organization:e.organization});return Object.assign(Object.assign({},h),{scope:c,oauthTokenScope:h.scope,audience:l})}catch(t){throw"login_required"===t.error&&this.logout({openUrl:!1}),t}}async _getTokenUsingRefreshToken(t){const e=await this.cacheManager.get(new B({scope:t.authorizationParams.scope,audience:t.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(e&&e.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw new E(t.authorizationParams.audience||"default",t.authorizationParams.scope)}const n=t.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,r="number"==typeof t.timeoutInSeconds?1e3*t.timeoutInSeconds:null;try{const i=await this._requestToken(Object.assign(Object.assign(Object.assign({},t.authorizationParams),{grant_type:"refresh_token",refresh_token:e&&e.refresh_token,redirect_uri:n}),r&&{timeout:r}));return Object.assign(Object.assign({},i),{scope:t.authorizationParams.scope,oauthTokenScope:i.scope,audience:t.authorizationParams.audience||"default"})}catch(e){if((e.message.indexOf("Missing Refresh Token")>-1||e.message&&e.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw e}}async _saveEntryInCache(t){const{id_token:e,decodedToken:n}=t,r=i(t,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:e,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,t.id_token,t.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const t=this.options.authorizationParams.audience||"default",e=await this.cacheManager.getIdToken(new B({clientId:this.options.clientId,audience:t,scope:this.scope})),n=this.userCache.get("@@user@@");return e&&e.id_token===(null==n?void 0:n.id_token)?n:(this.userCache.set("@@user@@",e),e)}async _getEntryFromCache({scope:t,audience:e,clientId:n}){const r=await this.cacheManager.get(new B({scope:t,audience:e,clientId:n}),60);if(r&&r.access_token){const{access_token:t,oauthTokenScope:e,expires_in:n}=r,i=await this._getIdTokenFromCache();return i&&Object.assign(Object.assign({id_token:i.id_token,access_token:t},e?{scope:e}:null),{expires_in:n})}}async _requestToken(t,e){const{nonceIn:n,organization:r}=e||{},i=await O(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},t),this.worker),o=await this._verifyIdToken(i.id_token,n,r);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},i),{decodedToken:o,scope:t.scope,audience:t.audience||"default"}),i.scope?{oauthTokenScope:i.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(r||o.claims.org_id),Object.assign(Object.assign({},i),{decodedToken:o})}}var et=a(470);function nt(t,e){return function(){return t.apply(e,arguments)}}const{toString:rt}=Object.prototype,{getPrototypeOf:it}=Object,ot=(st=Object.create(null),t=>{const e=rt.call(t);return st[e]||(st[e]=e.slice(8,-1).toLowerCase())});var st;const at=t=>(t=t.toLowerCase(),e=>ot(e)===t),ct=t=>e=>typeof e===t,{isArray:lt}=Array,ut=ct("undefined");const ht=at("ArrayBuffer");const dt=ct("string"),ft=ct("function"),pt=ct("number"),mt=t=>null!==t&&"object"==typeof t,gt=t=>{if("object"!==ot(t))return!1;const e=it(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},yt=at("Date"),wt=at("File"),vt=at("Blob"),bt=at("FileList"),Et=at("URLSearchParams");function St(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),lt(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let s;for(r=0;r<o;r++)s=i[r],e.call(null,t[s],s,t)}}function Tt(t,e){e=e.toLowerCase();const n=Object.keys(t);let r,i=n.length;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}const xt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,At=t=>!ut(t)&&t!==xt;const kt=(Rt="undefined"!=typeof Uint8Array&&it(Uint8Array),t=>Rt&&t instanceof Rt);var Rt;const Pt=at("HTMLFormElement"),Ct=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Ot=at("RegExp"),It=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};St(n,((n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)})),Object.defineProperties(t,r)},Bt="abcdefghijklmnopqrstuvwxyz",Ut="0123456789",Lt={DIGIT:Ut,ALPHA:Bt,ALPHA_DIGIT:Bt+Bt.toUpperCase()+Ut};const Nt=at("AsyncFunction"),_t={isArray:lt,isArrayBuffer:ht,isBuffer:function(t){return null!==t&&!ut(t)&&null!==t.constructor&&!ut(t.constructor)&&ft(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||ft(t.append)&&("formdata"===(e=ot(t))||"object"===e&&ft(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&ht(t.buffer),e},isString:dt,isNumber:pt,isBoolean:t=>!0===t||!1===t,isObject:mt,isPlainObject:gt,isUndefined:ut,isDate:yt,isFile:wt,isBlob:vt,isRegExp:Ot,isFunction:ft,isStream:t=>mt(t)&&ft(t.pipe),isURLSearchParams:Et,isTypedArray:kt,isFileList:bt,forEach:St,merge:function t(){const{caseless:e}=At(this)&&this||{},n={},r=(r,i)=>{const o=e&&Tt(n,i)||i;gt(n[o])&&gt(r)?n[o]=t(n[o],r):gt(r)?n[o]=t({},r):lt(r)?n[o]=r.slice():n[o]=r};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&St(arguments[t],r);return n},extend:(t,e,n,{allOwnKeys:r}={})=>(St(e,((e,r)=>{n&&ft(e)?t[r]=nt(e,n):t[r]=e}),{allOwnKeys:r}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],r&&!r(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&it(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:ot,kindOfTest:at,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return-1!==r&&r===n},toArray:t=>{if(!t)return null;if(lt(t))return t;let e=t.length;if(!pt(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const r=[];for(;null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:Pt,hasOwnProperty:Ct,hasOwnProp:Ct,reduceDescriptors:It,freezeMethods:t=>{It(t,((e,n)=>{if(ft(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];ft(r)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(t,e)=>{const n={},r=t=>{t.forEach((t=>{n[t]=!0}))};return lt(t)?r(t):r(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,n){return e.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(t,e)=>(t=+t,Number.isFinite(t)?t:e),findKey:Tt,global:xt,isContextDefined:At,ALPHABET:Lt,generateString:(t=16,e=Lt.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n},isSpecCompliantForm:function(t){return!!(t&&ft(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(mt(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const i=lt(t)?[]:{};return St(t,((t,e)=>{const o=n(t,r+1);!ut(o)&&(i[e]=o)})),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Nt,isThenable:t=>t&&(mt(t)||ft(t))&&ft(t.then)&&ft(t.catch)};function jt(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}_t.inherits(jt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_t.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Dt=jt.prototype,Mt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{Mt[t]={value:t}})),Object.defineProperties(jt,Mt),Object.defineProperty(Dt,"isAxiosError",{value:!0}),jt.from=(t,e,n,r,i,o)=>{const s=Object.create(Dt);return _t.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),jt.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const Vt=jt;function Ft(t){return _t.isPlainObject(t)||_t.isArray(t)}function Kt(t){return _t.endsWith(t,"[]")?t.slice(0,-2):t}function zt(t,e,n){return t?t.concat(e).map((function(t,e){return t=Kt(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const Wt=_t.toFlatObject(_t,{},null,(function(t){return/^is[A-Z]/.test(t)}));const Ht=function(t,e,n){if(!_t.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=_t.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!_t.isUndefined(e[t])}))).metaTokens,i=n.visitor||l,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&_t.isSpecCompliantForm(e);if(!_t.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(_t.isDate(t))return t.toISOString();if(!a&&_t.isBlob(t))throw new Vt("Blob is not supported. Use a Buffer instead.");return _t.isArrayBuffer(t)||_t.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function l(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(_t.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(_t.isArray(t)&&function(t){return _t.isArray(t)&&!t.some(Ft)}(t)||(_t.isFileList(t)||_t.endsWith(n,"[]"))&&(a=_t.toArray(t)))return n=Kt(n),a.forEach((function(t,r){!_t.isUndefined(t)&&null!==t&&e.append(!0===s?zt([n],r,o):null===s?n:n+"[]",c(t))})),!1;return!!Ft(t)||(e.append(zt(i,n,o),c(t)),!1)}const u=[],h=Object.assign(Wt,{defaultVisitor:l,convertValue:c,isVisitable:Ft});if(!_t.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!_t.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),_t.forEach(n,(function(n,o){!0===(!(_t.isUndefined(n)||null===n)&&i.call(e,n,_t.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])})),u.pop()}}(t),e};function $t(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function Zt(t,e){this._pairs=[],t&&Ht(t,this,e)}const Xt=Zt.prototype;Xt.append=function(t,e){this._pairs.push([t,e])},Xt.toString=function(t){const e=t?function(e){return t.call(this,e,$t)}:$t;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const Yt=Zt;function Gt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qt(t,e,n){if(!e)return t;const r=n&&n.encode||Gt,i=n&&n.serialize;let o;if(o=i?i(e,n):_t.isURLSearchParams(e)?e.toString():new Yt(e,n).toString(r),o){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}const Jt=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_t.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},Qt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},te={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Yt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ee="undefined"!=typeof window&&"undefined"!=typeof document,ne=(re="undefined"!=typeof navigator&&navigator.product,ee&&["ReactNative","NativeScript","NS"].indexOf(re)<0);var re;const ie="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,oe={...t,...te};const se=function(t){function e(t,n,r,i){let o=t[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=t.length;if(o=!o&&_t.isArray(r)?r.length:o,a)return _t.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&_t.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&_t.isArray(r[o])&&(r[o]=function(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],e[o]=t[o];return e}(r[o])),!s}if(_t.isFormData(t)&&_t.isFunction(t.entries)){const n={};return _t.forEachEntry(t,((t,r)=>{e(function(t){return _t.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),r,n,0)})),n}return null};const ae={transitional:Qt,adapter:["xhr","http"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=_t.isObject(t);i&&_t.isHTMLForm(t)&&(t=new FormData(t));if(_t.isFormData(t))return r&&r?JSON.stringify(se(t)):t;if(_t.isArrayBuffer(t)||_t.isBuffer(t)||_t.isStream(t)||_t.isFile(t)||_t.isBlob(t))return t;if(_t.isArrayBufferView(t))return t.buffer;if(_t.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Ht(t,new oe.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,r){return oe.isNode&&_t.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=_t.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Ht(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(_t.isString(t))try{return(e||JSON.parse)(t),_t.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||ae.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(t&&_t.isString(t)&&(n&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw Vt.from(t,Vt.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oe.classes.FormData,Blob:oe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_t.forEach(["delete","get","head","post","put","patch"],(t=>{ae.headers[t]={}}));const ce=ae,le=_t.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ue=Symbol("internals");function he(t){return t&&String(t).trim().toLowerCase()}function de(t){return!1===t||null==t?t:_t.isArray(t)?t.map(de):String(t)}function fe(t,e,n,r,i){return _t.isFunction(r)?r.call(this,e,n):(i&&(e=n),_t.isString(e)?_t.isString(r)?-1!==e.indexOf(r):_t.isRegExp(r)?r.test(e):void 0:void 0)}class pe{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=he(e);if(!i)throw new Error("header name must be a non-empty string");const o=_t.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=de(t))}const o=(t,e)=>_t.forEach(t,((t,n)=>i(t,n,e)));return _t.isPlainObject(t)||t instanceof this.constructor?o(t,e):_t.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim())?o((t=>{const e={};let n,r,i;return t&&t.split("\n").forEach((function(t){i=t.indexOf(":"),n=t.substring(0,i).trim().toLowerCase(),r=t.substring(i+1).trim(),!n||e[n]&&le[n]||("set-cookie"===n?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)})),e})(t),e):null!=t&&i(e,t,n),this}get(t,e){if(t=he(t)){const n=_t.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}(t);if(_t.isFunction(e))return e.call(this,t,n);if(_t.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=he(t)){const n=_t.findKey(this,t);return!(!n||void 0===this[n]||e&&!fe(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=he(t)){const i=_t.findKey(n,t);!i||e&&!fe(0,n[i],i,e)||(delete n[i],r=!0)}}return _t.isArray(t)?t.forEach(i):i(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const i=e[n];t&&!fe(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return _t.forEach(this,((r,i)=>{const o=_t.findKey(n,i);if(o)return e[o]=de(r),void delete e[i];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(i):String(i).trim();s!==i&&delete e[i],e[s]=de(r),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return _t.forEach(this,((n,r)=>{null!=n&&!1!==n&&(e[r]=t&&_t.isArray(n)?n.join(", "):n)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach((t=>n.set(t))),n}static accessor(t){const e=(this[ue]=this[ue]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=he(t);e[r]||(!function(t,e){const n=_t.toCamelCase(" "+e);["get","set","has"].forEach((r=>{Object.defineProperty(t,r+n,{value:function(t,n,i){return this[r].call(this,e,t,n,i)},configurable:!0})}))}(n,t),e[r]=!0)}return _t.isArray(t)?t.forEach(r):r(t),this}}pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_t.reduceDescriptors(pe.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),_t.freezeMethods(pe);const me=pe;function ge(t,e){const n=this||ce,r=e||n,i=me.from(r.headers);let o=r.data;return _t.forEach(t,(function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)})),i.normalize(),o}function ye(t){return!(!t||!t.__CANCEL__)}function we(t,e,n){Vt.call(this,null==t?"canceled":t,Vt.ERR_CANCELED,e,n),this.name="CanceledError"}_t.inherits(we,Vt,{__CANCEL__:!0});const ve=we;const be=oe.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];_t.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),_t.isString(r)&&s.push("path="+r),_t.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ee(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Se=oe.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let n;function r(n){let r=n;return t&&(e.setAttribute("href",r),r=e.href),e.setAttribute("href",r),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return n=r(window.location.href),function(t){const e=_t.isString(t)?r(t):t;return e.protocol===n.protocol&&e.host===n.host}}():function(){return!0};const Te=function(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const c=Date.now(),l=r[s];i||(i=c),n[o]=a,r[o]=c;let u=s,h=0;for(;u!==o;)h+=n[u++],u%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-i<e)return;const d=l&&c-l;return d?Math.round(1e3*h/d):void 0}};function xe(t,e){let n=0;const r=Te(50,250);return i=>{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-n,c=r(a);n=o;const l={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:i};l[e?"download":"upload"]=!0,t(l)}}const Ae={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){let r=t.data;const i=me.from(t.headers).normalize();let o,s,{responseType:a,withXSRFToken:c}=t;function l(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}if(_t.isFormData(r))if(oe.hasStandardBrowserEnv||oe.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(s=i.getContentType())){const[t,...e]=s?s.split(";").map((t=>t.trim())).filter(Boolean):[];i.setContentType([t||"multipart/form-data",...e].join("; "))}let u=new XMLHttpRequest;if(t.auth){const e=t.auth.username||"",n=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(e+":"+n))}const h=Ee(t.baseURL,t.url);function d(){if(!u)return;const r=me.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new Vt("Request failed with status code "+n.status,[Vt.ERR_BAD_REQUEST,Vt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}((function(t){e(t),l()}),(function(t){n(t),l()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:t,request:u}),u=null}if(u.open(t.method.toUpperCase(),qt(h,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=d:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=function(){u&&(n(new Vt("Request aborted",Vt.ECONNABORTED,t,u)),u=null)},u.onerror=function(){n(new Vt("Network Error",Vt.ERR_NETWORK,t,u)),u=null},u.ontimeout=function(){let e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const r=t.transitional||Qt;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new Vt(e,r.clarifyTimeoutError?Vt.ETIMEDOUT:Vt.ECONNABORTED,t,u)),u=null},oe.hasStandardBrowserEnv&&(c&&_t.isFunction(c)&&(c=c(t)),c||!1!==c&&Se(h))){const e=t.xsrfHeaderName&&t.xsrfCookieName&&be.read(t.xsrfCookieName);e&&i.set(t.xsrfHeaderName,e)}void 0===r&&i.setContentType(null),"setRequestHeader"in u&&_t.forEach(i.toJSON(),(function(t,e){u.setRequestHeader(e,t)})),_t.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),a&&"json"!==a&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",xe(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",xe(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=e=>{u&&(n(!e||e.type?new ve(null,t,u):e),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const f=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(h);f&&-1===oe.protocols.indexOf(f)?n(new Vt("Unsupported protocol "+f+":",Vt.ERR_BAD_REQUEST,t)):u.send(r||null)}))}};_t.forEach(Ae,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const ke=t=>`- ${t}`,Re=t=>_t.isFunction(t)||null===t||!1===t,Pe=t=>{t=_t.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o<e;o++){let e;if(n=t[o],r=n,!Re(n)&&(r=Ae[(e=String(n)).toLowerCase()],void 0===r))throw new Vt(`Unknown adapter '${e}'`);if(r)break;i[e||"#"+o]=r}if(!r){const t=Object.entries(i).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));let n=e?t.length>1?"since :\n"+t.map(ke).join("\n"):" "+ke(t[0]):"as no adapter specified";throw new Vt("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return r};function Ce(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ve(null,t)}function Oe(t){Ce(t),t.headers=me.from(t.headers),t.data=ge.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Pe(t.adapter||ce.adapter)(t).then((function(e){return Ce(t),e.data=ge.call(t,t.transformResponse,e),e.headers=me.from(e.headers),e}),(function(e){return ye(e)||(Ce(t),e&&e.response&&(e.response.data=ge.call(t,t.transformResponse,e.response),e.response.headers=me.from(e.response.headers))),Promise.reject(e)}))}const Ie=t=>t instanceof me?t.toJSON():t;function Be(t,e){e=e||{};const n={};function r(t,e,n){return _t.isPlainObject(t)&&_t.isPlainObject(e)?_t.merge.call({caseless:n},t,e):_t.isPlainObject(e)?_t.merge({},e):_t.isArray(e)?e.slice():e}function i(t,e,n){return _t.isUndefined(e)?_t.isUndefined(t)?void 0:r(void 0,t,n):r(t,e,n)}function o(t,e){if(!_t.isUndefined(e))return r(void 0,e)}function s(t,e){return _t.isUndefined(e)?_t.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function a(n,i,o){return o in e?r(n,i):o in t?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e)=>i(Ie(t),Ie(e),!0)};return _t.forEach(Object.keys(Object.assign({},t,e)),(function(r){const o=c[r]||i,s=o(t[r],e[r],r);_t.isUndefined(s)&&o!==a||(n[r]=s)})),n}const Ue="1.6.5",Le={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Le[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const Ne={};Le.transitional=function(t,e,n){function r(t,e){return"[Axios v1.6.5] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,i,o)=>{if(!1===t)throw new Vt(r(i," has been removed"+(e?" in "+e:"")),Vt.ERR_DEPRECATED);return e&&!Ne[i]&&(Ne[i]=!0,console.warn(r(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,i,o)}};const _e={assertOptions:function(t,e,n){if("object"!=typeof t)throw new Vt("options must be an object",Vt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const e=t[o],n=void 0===e||s(e,o,t);if(!0!==n)throw new Vt("option "+o+" must be "+n,Vt.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Vt("Unknown option "+o,Vt.ERR_BAD_OPTION)}},validators:Le},je=_e.validators;class De{constructor(t){this.defaults=t,this.interceptors={request:new Jt,response:new Jt}}request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Be(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&_e.assertOptions(n,{silentJSONParsing:je.transitional(je.boolean),forcedJSONParsing:je.transitional(je.boolean),clarifyTimeoutError:je.transitional(je.boolean)},!1),null!=r&&(_t.isFunction(r)?e.paramsSerializer={serialize:r}:_e.assertOptions(r,{encode:je.function,serialize:je.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&_t.merge(i.common,i[e.method]);i&&_t.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=me.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let u,h=0;if(!a){const t=[Oe.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,c),u=t.length,l=Promise.resolve(e);h<u;)l=l.then(t[h++],t[h++]);return l}u=s.length;let d=e;for(h=0;h<u;){const t=s[h++],e=s[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{l=Oe.call(this,d)}catch(t){return Promise.reject(t)}for(h=0,u=c.length;h<u;)l=l.then(c[h++],c[h++]);return l}getUri(t){return qt(Ee((t=Be(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}_t.forEach(["delete","get","head","options"],(function(t){De.prototype[t]=function(e,n){return this.request(Be(n||{},{method:t,url:e,data:(n||{}).data}))}})),_t.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(Be(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}De.prototype[t]=e(),De.prototype[t+"Form"]=e(!0)}));const Me=De;class Ve{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const n=this;this.promise.then((t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null})),this.promise.then=t=>{let e;const r=new Promise((t=>{n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t,r,i){n.reason||(n.reason=new ve(t,r,i),e(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;const e=new Ve((function(e){t=e}));return{token:e,cancel:t}}}const Fe=Ve;const Ke={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ke).forEach((([t,e])=>{Ke[e]=t}));const ze=Ke;const We=function t(e){const n=new Me(e),r=nt(Me.prototype.request,n);return _t.extend(r,Me.prototype,n,{allOwnKeys:!0}),_t.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Be(e,n))},r}(ce);We.Axios=Me,We.CanceledError=ve,We.CancelToken=Fe,We.isCancel=ye,We.VERSION=Ue,We.toFormData=Ht,We.AxiosError=Vt,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=function(t){return function(e){return t.apply(null,e)}},We.isAxiosError=function(t){return _t.isObject(t)&&!0===t.isAxiosError},We.mergeConfig=Be,We.AxiosHeaders=me,We.formToJSON=t=>se(_t.isHTMLForm(t)?new FormData(t):t),We.getAdapter=Pe,We.HttpStatusCode=ze,We.default=We;const He=We;var $e=a(742),Ze=Object.create,Xe=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ge=Object.getOwnPropertyNames,qe=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty,Qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),tn=(t,e,n)=>(n=null!=t?Ze(qe(t)):{},((t,e,n,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of Ge(e))!Je.call(t,i)&&i!==n&&Xe(t,i,{get:()=>e[i],enumerable:!(r=Ye(e,i))||r.enumerable});return t})(!e&&t&&t.__esModule?n:Xe(n,"default",{value:t,enumerable:!0}),t)),en=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var e=t.length,n=e%4;if(!n)return t;var r=e,i=4-n,o=e+i,s=Buffer.alloc(o);for(s.write(t);i--;)s.write("=",r++);return s.toString()}})),nn=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=en();function n(t,e){return void 0===e&&(e="utf8"),Buffer.isBuffer(t)?i(t.toString("base64")):i(Buffer.from(t,e).toString("base64"))}function r(t){return t=t.toString(),e.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function i(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var o=n;o.encode=n,o.decode=function(t,e){return void 0===e&&(e="utf8"),Buffer.from(r(t),"base64").toString(e)},o.toBase64=r,o.fromBase64=i,o.toBuffer=function(t){return Buffer.from(r(t),"base64")},t.default=o})),rn=Qe(((t,e)=>{e.exports=nn().default,e.exports.default=e.exports})),on=Qe((t=>{t.byteLength=function(t){var e=s(t),n=e[0],r=e[1];return 3*(n+r)/4-r},t.toByteArray=function(t){var e,n,o=s(t),a=o[0],c=o[1],l=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,c)),u=0,h=c>0?a-4:a;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[u++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e),l},t.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(c(t,a,a+s>l?l:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};var e,n=[],r=[],i=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(e=0,64;e<64;++e)n[e]=o[e],r[o.charCodeAt(e)]=e;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function a(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function c(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(a(r));return i.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63})),sn=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=on();function n(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function r(t){return(new TextEncoder).encode(t)}function i(t){return new Uint8Array(e.toByteArray(c(t)))}function o(t){return e.fromByteArray(new Uint8Array(t))}function s(t){return a(o(t))}function a(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}function c(t){let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}t.concatBuffers=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;let n=new Uint8Array(e),r=0;n.set(new Uint8Array(t[0]),r),r+=t[0].byteLength;for(let e=1;e<t.length;e++)n.set(new Uint8Array(t[e]),r),r+=t[e].byteLength;return n},t.b64UrlToString=function(t){return n(i(t))},t.bufferToString=n,t.stringToBuffer=r,t.stringToB64Url=function(t){return s(r(t))},t.b64UrlToBuffer=i,t.bufferTob64=o,t.bufferTob64Url=s,t.b64UrlEncode=a,t.b64UrlDecode=c})),an=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=sn();t.default=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let t=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),e=await this.driver.exportKey("jwk",t.privateKey);return{kty:e.kty,e:e.e,n:e.n,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}}async sign(t,e,{saltLength:n}={}){let r=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(t),e);return new Uint8Array(r)}async hash(t,e="SHA-256"){let n=await this.driver.digest(e,t);return new Uint8Array(n)}async verify(t,e,n){let r={kty:"RSA",e:"AQAB",n:t},i=await this.jwkToPublicCryptoKey(r),o=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-o.byteLength-2},i,n,e);return s||a||c}async jwkToCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let t=crypto?.subtle;return void 0!==t&&["generateKey","importKey","exportKey","digest","sign"].every((e=>"function"==typeof t[e]))}async encrypt(t,n,r){let i=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=new Uint8Array(16);crypto.getRandomValues(s);let a=await this.driver.encrypt({name:"AES-CBC",iv:s},o,t);return e.concatBuffers([s,a])}async decrypt(t,n,r){let i=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},o,t.slice(16));return e.concatBuffers([a])}}})),cn=Qe((t=>{t.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)},t.write=function(t,e,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[n+f]=255&s,f+=p,s/=256,l-=8);t[n+f-p]|=128*m}})),ln=Qe((t=>{var e=on(),n=cn(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;var i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if(("string"!=typeof e||""===e)&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=0|f(t,e),r=o(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Z(t,Uint8Array)){let e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return u(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Z(t,ArrayBuffer)||t&&Z(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Z(t,SharedArrayBuffer)||t&&Z(t.buffer,SharedArrayBuffer)))return h(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);let i=function(t){if(s.isBuffer(t)){let e=0|d(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||X(t.length)?o(0):u(t);if("Buffer"===t.type&&Array.isArray(t.data))return u(t.data)}(t);if(i)return i;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return c(t),o(t<0?0:0|d(t))}function u(t){let e=t.length<0?0:0|d(t.length),n=o(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function h(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,s.prototype),r}function d(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function f(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Z(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return x(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return R(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.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:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(l(t,o+r)!==l(e,r)){n=!1;break}if(n)return o}return-1}function w(t,e,n,r){n=Number(n)||0;let i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;let o,s=e.length;for(r>s/2&&(r=s/2),o=0;o<r;++o){let r=parseInt(e.substr(2*o,2),16);if(X(r))return o;t[n+o]=r}return o}function v(t,e,n,r){return $(W(e,t.length-n),t,n,r)}function b(t,e,n,r){return $(function(t){let e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function E(t,e,n,r){return $(H(e),t,n,r)}function S(t,e,n,r){return $(function(t,e){let n,r,i,o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function T(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function x(t,e,n){n=Math.min(t.length,n);let r=[],i=e;for(;i<n;){let e=t[i],o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(o=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){let e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=A));return n}(r)}t.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch{return!1}}(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,n){return a(t,e,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,n){return function(t,e,n){return c(t),t<=0?o(t):void 0!==e?"string"==typeof n?o(t).fill(e,n):o(t).fill(e):o(t)}(t,e,n)},s.allocUnsafe=function(t){return l(t)},s.allocUnsafeSlow=function(t){return l(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Z(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let r=s.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){let e=t[n];if(Z(e,Uint8Array))i+e.length>r.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},s.prototype.swap32=function(){let t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},s.prototype.swap64=function(){let t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},s.prototype.toString=function(){let t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){let e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,i){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),c=Math.min(o,a),l=this.slice(r,i),u=t.slice(e,n);for(let t=0;t<c;++t)if(l[t]!==u[t]){o=l[t],a=u[t];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},s.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},s.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}let i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>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,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function k(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function R(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function P(t,e,n){let r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=Y[t[r]];return i}function C(t,e,n){let r=t.slice(e,n),i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function O(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,n,r,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function B(t,e,n,r,i){V(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function U(t,e,n,r,i){V(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function L(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(t,e,r,i,o){return e=+e,r>>>=0,o||L(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function _(t,e,r,i,o){return e=+e,r>>>=0,o||L(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){let n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);let r=this.subarray(t,e);return Object.setPrototypeOf(r,s.prototype),r},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=G((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=G((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);let n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);let n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=G((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),s.prototype.readBigInt64BE=G((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){I(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){I(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=G((function(t,e=0){return B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=G((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){let r=Math.pow(2,8*n-1);I(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){let r=Math.pow(2,8*n-1);I(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=G((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=G((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return N(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return _(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return _(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!r&&0!==r&&(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n||0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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),t.length-e<r-n&&(r=t.length-e+n);let i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},s.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){let e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{let o=s.isBuffer(t)?t:s.from(t,r),a=o.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%a]}return this};var j={};function D(t,e,n){j[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function M(t){let e="",n=t.length,r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function V(t,e,n,r,i,o){if(t>n||t<e){let r,i="bigint"==typeof e?"n":"";throw r=o>3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${e}${i} and <= ${n}${i}`,new j.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){F(e,"offset"),(void 0===t[e]||void 0===t[e+n])&&K(e,t.length-(n+1))}(r,i,o)}function F(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,n){throw Math.floor(t)!==t?(F(t,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new j.ERR_BUFFER_OUT_OF_BOUNDS:new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=M(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=M(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);var z=/[^+/0-9A-Za-z-_]/g;function W(t,e){e=e||1/0;let n,r=t.length,i=null,o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=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((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function $(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function X(t){return t!=t}var Y=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function G(t){return typeof BigInt>"u"?q:t}function q(){throw new Error("BigInt not supported")}})),un=Qe(((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:ln().Buffer,Crypto:window.crypto}):e.exports={Buffer:ln().Buffer,Crypto:crypto}})),hn={};((t,e)=>{for(var n in e)Xe(t,n,{get:e[n],enumerable:!0})})(hn,{AVSCTap:()=>Cn,ArweaveSigner:()=>xn,DataItem:()=>Mn,MAX_TAG_BYTES:()=>jn,MIN_BINARY_SIZE:()=>Dn,SIG_CONFIG:()=>Tn,SignatureConfig:()=>wn,Signer:()=>dn,createData:()=>Fn,deserializeTags:()=>Bn,indexToType:()=>An,serializeTags:()=>On,tagsExceedLimit:()=>In});var dn=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,n,r){throw new Error("You must implement verify method on child")}},fn=tn(rn(),1),pn=tn(sn(),1);async function mn(t){if(Array.isArray(t)){let e=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("list"),(0,pn.stringToBuffer)(t.length.toString())]);return await gn(t,await Sn().hash(e,"SHA-384"))}let e=t,n=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("blob"),(0,pn.stringToBuffer)(e.byteLength.toString())]),r=(0,pn.concatBuffers)([await Sn().hash(n,"SHA-384"),await Sn().hash(e,"SHA-384")]);return await Sn().hash(r,"SHA-384")}async function gn(t,e){if(t.length<1)return e;let n=(0,pn.concatBuffers)([e,await mn(t[0])]),r=await Sn().hash(n,"SHA-384");return await gn(t.slice(1),r)}var yn,wn,vn=tn(an(),1),bn=vn.default.default?vn.default.default:vn.default,En=class extends bn{getPublicKey(t){throw new Error("Unimplemented")}};function Sn(){return yn??=new En}!function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"}(wn||(wn={}));var Tn={[wn.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[wn.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[wn.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[wn.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[wn.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[wn.MULTIAPTOS]:{sigLength:2052,pubLength:1025,sigName:"multiAptos"},[wn.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},xn=class{signatureType=1;ownerLength=Tn[1].pubLength;signatureLength=Tn[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return fn.default.toBuffer(this.pk)}sign(t){return Sn().sign(this.jwk,t)}static async verify(t,e,n){return await Sn().verify(t,e,n)}},An={1:xn},kn=tn(rn(),1);async function Rn(t){return mn([(0,pn.stringToBuffer)("dataitem"),(0,pn.stringToBuffer)("1"),(0,pn.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function Pn(t,e){let{signature:n,id:r}=await async function(t,e){let n=await Rn(t),r=await e.sign(n),i=await Sn().hash(r);return{signature:Buffer.from(r),id:Buffer.from(i)}}(t,e);return t.getRaw().set(n,2),r}var Cn=class{buf;pos;constructor(t=Buffer.alloc(jn),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e,n=t.length;if(n)for(this.writeLong(n),e=0;e<n;e++){let n=t[e];if(void 0===n?.name||void 0===n?.value)throw new Error(`Invalid tag format for ${n}, expected {name:string, value: string}`);this.writeString(n.name),this.writeString(n.value)}this.writeLong(0)}toBuffer(){let t=Buffer.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e,n,r=this.buf;if(t>=-1073741824&&t<1073741824){n=t>=0?t<<1:~t<<1|1;do{r[this.pos]=127&n,n>>=7}while(n&&(r[this.pos++]|=128))}else{e=t>=0?2*t:2*-t-1;do{r[this.pos]=127&e,e/=128}while(e>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(t){let e=Buffer.byteLength(t),n=this.buf;this.writeLong(e);let r=this.pos;if(this.pos+=e,!(this.pos>n.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,o,s,a;for(i=0,o=e;i<o;i++)s=t.charCodeAt(i),s<128?n[r++]=s:s<2048?(n[r++]=s>>6|192,n[r++]=63&s|128):55296==(64512&s)&&56320==(64512&(a=t.charCodeAt(i+1)))?(s=65536+((1023&s)<<10)+(1023&a),i++,n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}this.buf=n}}readLong(){let t,e,n,r,i=0,o=0,s=this.buf;do{t=s[this.pos++],e=128&t,i|=(127&t)<<o,o+=7}while(e&&o<28);if(e){n=i,r=268435456;do{t=s[this.pos++],n+=(127&t)*r,r*=128}while(128&t);return(n%2?-(n+1):n)/2}return i>>1^-(1&i)}skipLong(){let t=this.buf;for(;128&t[this.pos++];);}readTags(){let t,e=[];for(;t=this.readLong();)for(t<0&&(t=-t,this.skipLong());t--;){let t=this.readString(),n=this.readString();e.push({name:t,value:n})}return e}readString(){let t=this.readLong(),e=this.pos,n=this.buf;if(this.pos+=t,!(this.pos>n.length))return this.buf.slice(e,e+t).toString()}};function On(t){let e=new Cn;return e.writeTags(t),e.toBuffer()}function In(t){let e=new Cn;return e.writeTags(t),e.tagsExceedLimit()}function Bn(t){return new Cn(t).readTags()}function Un(t){let e=0;for(let n=t.length-1;n>=0;n--)e=256*e+t[n];return e}function Ln(t){let e=[0,0,0,0,0,0,0,0];for(let n=0;n<e.length;n++){let r=255&t;e[n]=r,t=(t-r)/256}return Uint8Array.from(e)}var Nn=tn(un(),1),_n=tn(ln(),1),jn=4096,Dn=80,Mn=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return void 0!==t.binary}get signatureType(){let t=Un(this.binary.subarray(0,2));if(void 0!==wn?.[t])return t;throw new Error("Unknown signature type: "+t)}async isValid(){return Mn.verify(this.binary)}get id(){return(async()=>kn.default.encode(await this.rawId))()}set id(t){this._id=kn.default.toBuffer(t)}get rawId(){return(async()=>_n.Buffer.from(await Nn.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return kn.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return Tn[this.signatureType].sigLength}get owner(){return kn.default.encode(this.rawOwner)}get ownerLength(){return Tn[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):_n.Buffer.alloc(0)}get target(){return kn.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):_n.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Un(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(0==Un(this.binary.subarray(t,t+8)))return[];let e=Un(this.binary.subarray(t+8,t+16));return Bn(_n.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map((t=>({name:kn.default.encode(t.name),value:kn.default.encode(t.value)})))}getStartOfData(){let t=this.getTagsStart();return t+16+Un(this.binary.subarray(t+8,t+16))}get rawData(){let t=this.getTagsStart(),e=t+16+Un(this.binary.subarray(t+8,t+16));return this.binary.subarray(e,this.binary.length)}get data(){return kn.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Pn(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=_n.Buffer.from(await Sn().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map((t=>({name:kn.default.encode(t.name),value:kn.default.encode(t.value)}))),data:this.data}}static async verify(t){if(t.byteLength<Dn)return!1;let e=new Mn(t),n=e.signatureType,r=e.getTagsStart(),i=Un(t.subarray(r,r+8)),o=Un(t.subarray(r+8,r+16));if(o>jn)return!1;if(i>0)try{if(Bn(_n.Buffer.from(t.subarray(r+16,r+16+o))).length!==i)return!1}catch{return!1}let s=An[n],a=await Rn(e);return await s.verify(e.rawOwner,a,e.rawSignature)}async getSignatureData(){return Rn(this)}getTagsStart(){let t=this.getTargetStart(),e=t+(1==this.binary[t]?33:1);return e+=1==this.binary[e]?33:1,e}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1;return t+=1==this.binary[this.getTargetStart()]?32:0,t}},Vn=tn(rn(),1);function Fn(t,e,n){let r=e.publicKey,i=n?.target?Vn.default.toBuffer(n.target):null,o=1+(i?.byteLength??0),s=n?.anchor?Buffer.from(n.anchor):null,a=1+(s?.byteLength??0),c=(n?.tags?.length??0)>0?On(n.tags):null,l=16+(c?c.byteLength:0),u=Buffer.from(t),h=u.byteLength,d=2+e.signatureLength+e.ownerLength+o+a+l+h,f=Buffer.alloc(d);if(f.set(function(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let n=0;n<e.length;n++){let r=255&t;e[n]=r,t=(t-r)/256}return Uint8Array.from(e)}(e.signatureType),0),f.set(new Uint8Array(e.signatureLength).fill(0),2),r.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${r.byteLength}`);f.set(r,2+e.signatureLength);let p=2+e.signatureLength+e.ownerLength;if(f[p]=i?1:0,i){if(32!==i.byteLength)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);f.set(i,p+1)}let m=p+o,g=m+1;if(f[m]=s?1:0,s){if(g+=s.byteLength,32!==s.byteLength)throw new Error("Anchor must be 32 bytes");f.set(s,m+1)}f.set(Ln(n?.tags?.length??0),g);let y=Ln(c?.byteLength??0);f.set(y,g+8),c&&f.set(c,g+16);let w=g+l;return f.set(u,w),new Mn(f)}var Kn={...hn};globalThis.arbundles??=Kn;const{Axios:zn,AxiosError:Wn,CanceledError:Hn,isCancel:$n,CancelToken:Zn,VERSION:Xn,all:Yn,Cancel:Gn,isAxiosError:qn,spread:Jn,toFormData:Qn,AxiosHeaders:tr,HttpStatusCode:er,formToJSON:nr,getAdapter:rr,mergeConfig:ir}=He;var or=a(386),sr={debug:!1,inject:!1,auth0Domain:"auth.othent.io",auth0ClientId:"uXkRmJoIa0NfzYgYEDAgj6Rss4wR1tIc",auth0Strategy:"refresh-tokens",auth0Cache:"memory",auth0RefreshTokenExpirationMs:1296e6,auth0LogInMethod:"popup",auth0RedirectURI:null,auth0ReturnToURI:null,serverBaseURL:"https://kms-server.othent.io",autoConnect:"lazy",cookieKey:null,localStorageKey:null,throwErrors:!0,tags:[]},ar={...sr,appName:"",appVersion:"",persistCookie:!1,persistLocalStorage:!1,auth0Cache:"memory"},cr={host:"arweave.net",protocol:"https",port:443},lr="othentUserDetails",ur="Othent KMS",hr="2.0.0-beta.10",dr=[{name:"Client",value:ur},{name:"Client-Version",value:hr}],fr=class{constructor(t){this.listeners=new Set,this.initializedListeners=new Set,this.lastEmittedUpdateId="",this.lastEmittedParams=null,this.options={diffParams:!1,replyOnListen:!1},this.options={...this.options,...t}}getUpdateId(t){const{getUpdateIdTransform:e}=this.options,n=e?e(t):t;return JSON.stringify(n,((t,e)=>e&&"oject"===e&&!Array.isArray(e)?Object.entries(e).sort(((t,e)=>t[0].localeCompare(e[0]))):e))}get hasListeners(){return this.listeners.size>0}add(t){this.listeners.add(t),this.options.replyOnListen&&this.lastEmittedParams&&this.emit(...this.lastEmittedParams)}delete(t){this.listeners.add(t)}emit(...t){const{initializedListeners:e,lastEmittedUpdateId:n}=this,r=this.getUpdateId(t),i=n===r;return this.lastEmittedUpdateId=r,this.lastEmittedParams=t,this.listeners.forEach((n=>{if(!i||!e.has(n)){e.add(n);try{n(...t)}catch(t){}}})),i}};function pr(t,e){return et(!0,{},e,t)}var mr={secure:!0,domain:!0,ttlHours:360},gr=class t{constructor(e=mr){this.secureParam=null,this.domainParam=null,this.ttlMs=1296e6;const{secureParam:n,domainParam:r,ttlMs:i}=this.parseCookieOptions(pr(e,mr));return this.secureParam=n,this.domainParam=r,this.ttlMs=i,new Proxy(this,{get:(t,e)=>e in t||"string"!=typeof e?t[e]:t.getItem(e),ownKeys:e=>document.cookie.split(t.COOKIE_SEPARATOR).map((e=>e.split(t.COOKIE_VALUE_SEPARATOR)[0])),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0})})}parseCookieOptions({secure:t,domain:e,ttlHours:n}={}){return{secureParam:t?"secure":void 0===t?this.secureParam:null,domainParam:e?`domain=${!0===e?location.host:e}`:void 0===e?this.domainParam:null,ttlMs:n?36e5*n:void 0===n?this.ttlMs:0}}getCookieParams(t){const{secureParam:e,domainParam:n,ttlMs:r}=this.parseCookieOptions(t),i=[`expires=${new Date(Date.now()+r).toUTCString()}`,e,n,"path=/"].filter(Boolean).join("; ");return i?` ${i};`:""}get length(){return document.cookie?document.cookie.split(t.COOKIE_SEPARATOR).length:0}key(e){return(document.cookie.split(t.COOKIE_SEPARATOR)[e]||"").split(t.COOKIE_VALUE_SEPARATOR)[0]||null}getItem(e){const n=document.cookie.split(t.COOKIE_SEPARATOR).find((n=>n.split(t.COOKIE_VALUE_SEPARATOR)[0]===e));return n&&n.split(t.COOKIE_VALUE_SEPARATOR)[1]||null}setItem(t,e,n){const r=`${t}=${"string"==typeof e?e:JSON.stringify(e)};${this.getCookieParams(n)}`;return document.cookie=r,r}removeItem(t,e){return this.setItem(t,"",{...e,ttlHours:-1})}clear(){document.cookie.split(t.COOKIE_SEPARATOR).forEach((e=>{this.removeItem(e.split(t.COOKIE_VALUE_SEPARATOR)[0])}))}};gr.COOKIE_SEPARATOR=/\s*;\s*/,gr.COOKIE_VALUE_SEPARATOR=/\s*=\s*/;var yr=gr,wr=null;var vr=class t{constructor({debug:t,domain:e,clientId:n,strategy:r,cache:i,refreshTokenExpirationMs:o,loginMethod:s,redirectURI:a,returnToURI:c,appInfo:l,initialUserDetails:u,cookieKey:h,localStorageKey:d}){this.debug=!1,this.auth0ClientPromise=Promise.resolve(null),this.authEventListenerHandler=new fr({diffParams:!0,replyOnListen:!0}),this.userDetails=null,this.userDetailsExpirationTimeoutID=0,this.cookieKey=null,this.localStorageKey=null,this.refreshTokenExpirationMs=+sr.auth0RefreshTokenExpirationMs,this.appInfo={name:"",version:""},this.isReady=!1,this.isAuthenticated=!1,this.debug=t,this.loginMethod=s,this.redirectURI=a,this.returnToURI=c,this.auth0ClientPromise=async function(t){const e=new tt(t);return await e.checkSession(),e}({domain:e,clientId:n,useRefreshTokens:"refresh-tokens"===r,cacheLocation:"string"==typeof i?i:void 0,cache:"object"==typeof i?i:void 0,authorizationParams:{redirect_uri:this.redirectURI}}).then((t=>(this.isReady=!0,t))),this.cookieKey=h,this.localStorageKey=d,this.refreshTokenExpirationMs=o,this.appInfo=l,this.restoreUserDetails(u||null),this.handleStorage=this.handleStorage.bind(this)}static isIdTokenValidUser(t){return!!(t&&t.sub&&t.owner&&t.walletAddress&&"KMS"===t.authSystem)}static async getUserDetails(e){const{email:n="",walletAddress:r}=e,i=e.sub||"",o=i.split("|")[0];let s=await async function(t){try{const e=(await He.get("https://api.mem.tech/api/state/Tih8T1uESATJNzdwBIY3rpe25kWTzjw8uNiMRYe9I5M",{timeout:2e3})).data.balances.find((e=>e.address===t)),n=e&&(e.primary_domain||e.ownedDomains[0].domain)||null;return n?`${n}.ar`:null}catch(e){return console.warn(`Error resolving ANS domain for ${t} =\n`,e),null}}(r);if(!s){s=`${t.PROVIDER_LABELS[o]||"Unknown Provider"} (${n})`}return{sub:i,name:e.name||"",givenName:e.given_name||"",middleName:e.middle_name||"",familyName:e.family_name||"",nickname:e.nickname||"",preferredUsername:e.preferred_username||"",profile:e.profile||"",picture:e.picture||"",website:e.website||"",locale:e.locale||"",updatedAt:e.updated_at||"",email:n,emailVerified:!!e.email_verified,owner:e.owner,walletAddress:e.walletAddress,walletAddressLabel:s,authSystem:e.authSystem,authProvider:o}}getAuthEventListenerHandler(){return this.authEventListenerHandler}setAppInfo(t){this.appInfo=t}initStorageSyncing(){this.localStorageKey&&window.addEventListener("storage",this.handleStorage)}stopStorageSyncing(){window.removeEventListener("storage",this.handleStorage)}handleStorage(t){t.key===this.localStorageKey&&(t.newValue?this.restoreUserDetails():this.logOut())}persistUserDetails(t){const{cookieKey:e,localStorageKey:n}=this;if(e){const n=function(){if(!wr){const t=!1;wr=new yr({secure:!t&&void 0,domain:!t&&void 0})}return wr}();t?n.setItem(e,JSON.stringify(t)):null!==n.getItem(e)&&n.removeItem(e)}if(n)if(t){const e=new Date,r=JSON.stringify({userDetails:t,createdAt:e.toUTCString(),expiredBy:new Date(e.getTime()+this.refreshTokenExpirationMs).toUTCString()});localStorage.setItem(n,r)}else this.clearStoredUserDetails()}setUserDetails(t,e=!0){window.clearTimeout(this.userDetailsExpirationTimeoutID),t&&(this.userDetailsExpirationTimeoutID=window.setTimeout(this.logOut,this.refreshTokenExpirationMs));return this.authEventListenerHandler.emit(t,e?!!t:this.isAuthenticated)||(this.userDetails=t),e&&(this.isAuthenticated=!!t,this.persistUserDetails(t)),t}restoreUserDetails(t){let e=t||null;if(!e&&this.localStorageKey)try{const t=JSON.parse(localStorage.getItem(this.localStorageKey)||"null");if(t){const n=new Date(t.expiredBy).getTime();!isNaN(n)&&n>Date.now()?e=t.userDetails:this.clearStoredUserDetails()}}catch(t){}this.setUserDetails(e,!1)}clearStoredUserDetails(){Object.keys(localStorage).forEach((t=>{t.startsWith("othent")&&localStorage.removeItem(t)}))}async updateUserDetails(e){const n=e&&t.isIdTokenValidUser(e)?await t.getUserDetails(e):null;return this.setUserDetails(n)}getAuthorizationParams(t={}){const{authorizationParams:e,data:n}=t.hasOwnProperty("keyName")?{authorizationParams:null,data:t}:{authorizationParams:t,data:null},r={othentFunction:"KMS",othentSDKVersion:ur,othentAPIVersion:hr,appName:this.appInfo.name,appVersion:this.appInfo.version};return n&&(r.data=n),{...e,transaction_input:JSON.stringify(r,((t,e)=>{let n=[];if(e instanceof Buffer||e instanceof DataView||ArrayBuffer.isView(e))n=Array.from(new Uint8Array(e.buffer));else{if(!(e instanceof ArrayBuffer))return e;n=Array.from(new Uint8Array(e))}return"data"===t?Object.fromEntries(Object.entries(n)):{type:"Buffer",data:n}}))}}async getTokenSilently(t){const e=await this.auth0ClientPromise;if(!e)throw new Error("Missing Auth0 Client");const n=this.getAuthorizationParams(t);if(this.debug)try{console.log("getTokenSilently() =",{...n,transaction_input:JSON.parse(n.transaction_input)})}catch(t){console.error("Error logging/parsing `authorizationParams`:",t)}try{const t=await e.getTokenSilently({detailedResponse:!0,authorizationParams:n,cacheMode:"off"}),r=await e.getUser();if(!r)throw new Error("Could not get the user's details");const i=await this.updateUserDetails(r);return{...t,idToken:r,userDetails:i}}catch(t){throw t}}async logIn(){const t=await this.auth0ClientPromise;if(!t)throw new Error("Missing Auth0 Client");this.debug&&console.log("logIn()");if(await t.isAuthenticated())throw new Error("Already logged in");const e=this.getAuthorizationParams({redirect_uri:this.redirectURI});if("popup"!==this.loginMethod)throw t.loginWithRedirect({authorizationParams:e}),new Error("Redirecting...");return await t.loginWithPopup({authorizationParams:e},{}),this.getTokenSilently()}async handleRedirectCallback(t){this.debug&&console.log(`handleRedirectCallback(${t})`);const e=await this.auth0ClientPromise;if(!e)throw new Error("Missing Auth0 Client");await e.handleRedirectCallback(t);const n=await e.getUser();if(!n)throw new Error("Could not get the user's details");return this.updateUserDetails(n)}async logOut(){this.setUserDetails(null);const t=await this.auth0ClientPromise;if(!t)throw new Error("Missing Auth0 Client");return t.logout({logoutParams:{returnTo:this.returnToURI}}).catch((t=>{console.warn(t instanceof Error?t.message:t),"undefined"!=typeof location&&location.reload()}))}async encodeToken(t){return(await this.getTokenSilently(t)).id_token}getCachedUserDetails(){return this.userDetails}getCachedUserPublicKey(){var t;return(null==(t=this.userDetails)?void 0:t.owner)||null}getCachedUserSub(){var t;return(null==(t=this.userDetails)?void 0:t.sub)||null}getCachedUserAddress(){var t;return(null==(t=this.userDetails)?void 0:t.walletAddress)||null}getCachedUserAddressLabel(){var t;return(null==(t=this.userDetails)?void 0:t.walletAddressLabel)||null}getCachedUserEmail(){var t;return(null==(t=this.userDetails)?void 0:t.email)||null}};vr.PROVIDER_LABELS={apple:"Apple",auth0:"E-Mail","google-oauth2":"Google","<LinkedIn>":"LinkedIn","<X>":"X","<Meta>":"Meta","<Twitch>":"Twitch",github:"GitHub"};var br=vr;function Er(t){return"string"==typeof t?Sr(t):t}function Sr(t){return(new TextEncoder).encode(t)}function Tr(t){return e=function(t){return $e.fromByteArray(new Uint8Array(t))}(t),e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");var e}async function xr(t,e="SHA-256"){let n=await crypto.subtle.digest(e,t);return new Uint8Array(n)}var Ar=(t=>(t.Unexpected="Unexpected",t.Validation="Validation",t.UserCreation="UserCreation",t.Encryption="Encryption",t.Decryption="Decryption",t.Signing="Signing",t.PublicKey="PublicKey",t))(Ar||{}),kr=class extends Error{constructor(t,e,n,r=!1){super(),this.name=t,this.message=e||"",r?this.stack=`${t} (from server): ${e}\n`:Error.captureStackTrace(this),this.id=t,this.developerMessage=e,n instanceof Error?this.cause=n:"string"!=typeof n&&"number"!=typeof n||(this.cause=new Error(`${n}`))}};function Rr(t){var e;if(qn(t)){const n=null==(e=t.response)?void 0:e.data;if(!function(t){return"object"==typeof t&&!0===t.error&&!!t.id&&!!Ar[t.id]}(n))return t;const{id:r,developerMessage:i,cause:o}=n;let s;return o&&(s=new Error(o.message),s.name=o.name,s.stack=o.stack),new kr(r,i||"",s,!0)}return t instanceof Error?t:new Error("Unknown error")}async function Pr(t,e,n,r){var i;const o=await e.encodeToken({ciphertext:n,keyName:r});let s=null;try{s=null!=(i=(await t.post("/decrypt",{encodedData:o})).data.data)?i:null}catch(t){throw Rr(t)}if(null===s)throw new Error("Error decrypting on server.");return"string"==typeof s?s:(a=new Uint8Array(s.data),(new TextDecoder).decode(a));var a}var Cr=class{constructor(t,e){this.api=He.create({baseURL:t}),this.auth0=e}async createUser(t){return async function(t,e){let n=!1;try{n=(await t.post("/create-user",{encodedData:e})).data.data}catch(t){throw Rr(t)}if(!n)throw new Error("Error creating user on server.");return!0}(this.api,t)}async decrypt(t,e){return Pr(this.api,this.auth0,t,e)}async encrypt(t,e){return async function(t,e,n,r){var i;const o=await e.encodeToken({plaintext:n,keyName:r});let s=null;try{s=null!=(i=(await t.post("/encrypt",{encodedData:o})).data.data)?i:null}catch(t){throw Rr(t)}if(null===s)throw new Error("Error encrypting on server.");return"string"==typeof s?Sr(s):new Uint8Array(s.data)}(this.api,this.auth0,t,e)}async sign(t,e){return async function(t,e,n,r){const i=await e.encodeToken({data:n,keyName:r});let o=null;try{o=(await t.post("/sign",{encodedData:i})).data.data}catch(t){throw Rr(t)}if(null===o)throw new Error("Error signing data on server.");return"string"==typeof o?Sr(o):new Uint8Array(o.data)}(this.api,this.auth0,t,e)}getSignerSignFn(t){return async e=>await this.sign(e,t)}};function Or(t,e="utf8"){return r.lW.isBuffer(t)?Br(t.toString("base64")):Br(r.lW.from(t,e).toString("base64"))}function Ir(t){return function(t){let e=t.length,n=e%4;if(!n)return t;let i=e,o=4-n,s=e+o,a=r.lW.alloc(s);for(a.write(t);o--;)a.write("=",i++);return a.toString()}(t=t.toString()).replace(/\-/g,"+").replace(/_/g,"/")}function Br(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ur(t){return r.lW.from(Ir(t),"base64")}var Lr=Or;function Nr(t){return or.default.init(t)}Lr.encode=Or,Lr.decode=function(t,e="utf8"){return r.lW.from(Ir(t),"base64").toString(e)},Lr.toBase64=Ir,Lr.fromBase64=Br,Lr.toBuffer=Ur;var _r=class t{constructor(t=ar){this.errorEventListenerHandler=new fr,this.tokens=new Set,this.walletName=ur,this.walletVersion=hr,this.config=sr,this.appInfo={name:"",version:""},this.gatewayConfig=cr;let{appName:e,appVersion:n,persistCookie:r,persistLocalStorage:i,auth0Cache:o=sr.auth0Cache,auth0RedirectURI:s,auth0ReturnToURI:a,gatewayConfig:c,initialUserDetails:l,...u}=t;const h="undefined"==typeof location?null:location.origin;this.config={...pr(u,sr),cookieKey:"string"==typeof r?r:r?lr:null,localStorageKey:"string"==typeof i?i:i?lr:null,auth0Cache:"object"==typeof o?"custom":o,auth0RedirectURI:s||h,auth0ReturnToURI:a||h};const{config:d}=this,{cookieKey:f,localStorageKey:p}=d;if("string"==typeof f&&!f.startsWith("othent"))throw new Error('`persistCookie` / `cookieKey` must start with "othent".');if("string"==typeof p&&!p.startsWith("othent"))throw new Error('`persistLocalStorage` / `localStorageKey` must start with "othent".');if(!d.auth0RedirectURI)throw new Error("`auth0RedirectURI` is required.");if(!d.auth0ReturnToURI)throw new Error("`auth0ReturnToURI` is required.");this.appInfo={name:e,version:n},this.gatewayConfig=c||cr;let m=null;if("undefined"!=typeof window)m=window.crypto;else{if("undefined"==typeof global)throw new Error("A Crypto module is needed for Othent to work. If your environment doesn't natively provide one, you should polyfill it.");m=global.crypto}if(this.crypto=m,"eager"===d.autoConnect&&"popup"===d.auth0LogInMethod&&"refresh-tokens"===d.auth0Strategy&&"memory"===o)throw new Error('The browser cannot open the authentication modal automatically before an user interaction. Use `autoConnect = "lazy"` or change any of these other options: `auth0LogInMethod`, `auth0Strategy` or `auth0Cache`.');if(this.auth0=new br({debug:d.debug,domain:d.auth0Domain,clientId:d.auth0ClientId,strategy:d.auth0Strategy,cache:o,refreshTokenExpirationMs:d.auth0RefreshTokenExpirationMs,redirectURI:d.auth0RedirectURI,returnToURI:d.auth0ReturnToURI,loginMethod:d.auth0LogInMethod,appInfo:this.appInfo,initialUserDetails:l,cookieKey:d.cookieKey,localStorageKey:d.localStorageKey}),"eager"===this.config.autoConnect){let t="undefined"==typeof location;if(!t){const e=new URL(location.href),{searchParams:n}=e;n.has("code")||n.has("state")||(t=!0)}t&&this.connect()}if(d.inject&&(window.arweaveWallet=this),!d.throwErrors){["connect","disconnect","getActiveAddress","getActivePublicKey","getAllAddresses","getWalletNames","getUserDetails","getSyncActiveAddress","getSyncActivePublicKey","getSyncAllAddresses","getSyncWalletNames","getSyncUserDetails","sign","dispatch","encrypt","decrypt","signature","signDataItem","signMessage","verifyMessage","privateHash","getArweaveConfig","getPermissions"].forEach((t=>{let e=this[t];"function"==typeof e&&(e=e.bind(this),this[t]=(...t)=>{try{let r=e(...t);return!(n=r)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then||(r=r.catch((t=>(this.onError(t),null)))),r}catch(t){this.onError(t)}var n;return null})}))}this.api=new Cr(this.config.serverBaseURL,this.auth0)}startTabSynching(){return this.config.localStorageKey||console.warn("Calling `Othent.startTabSynching()` is a NOOP unless the `persistLocalStorage` option is used."),this.auth0.initStorageSyncing(),()=>{this.auth0.stopStorageSyncing()}}async completeConnectionAfterRedirect(t){"redirect"!==this.config.auth0LogInMethod&&console.warn('Calling `Othent.completeConnectionAfterRedirect()` is a NOOP unless the `auth0LogInMethod` options is `"redirect"`.');const e=t||("undefined"==typeof location?"":location.href),n=new URL(e.replace(/.+\.auth0:\/\//,"https://")),{searchParams:r}=n;if(!r.has("code")||!r.has("state")||!e)return null;let i=null;try{i=await this.auth0.handleRedirectCallback(e)}finally{"undefined"!=typeof location&&"undefined"!=typeof history&&(r.delete("code"),r.delete("state"),history.replaceState(null,"",n))}return i}get isReady(){return this.auth0.isReady}onError(t){t instanceof Error?this.errorEventListenerHandler.hasListeners?this.errorEventListenerHandler.emit(t):console.warn("Unhandled unthrown error:\n",t,'\nWhen using `throwErrors = false`, you must add at least one error event listener with `othent.addEventListener("error", () => { ... })`'):console.warn("Unknown error type",t)}addEventListener(t,e){let n=null;if("auth"===t)n=this.auth0.getAuthEventListenerHandler();else if("error"===t){if(this.config.throwErrors)throw new Error("You can only listen for `error` events if `throwErrors = false`.");n=this.errorEventListenerHandler}if(!n)throw new Error("Unknown event type");return n.add(e),()=>{n.delete(e)}}removeEventListener(t,e){let n=null;if("auth"===t?n=this.auth0.getAuthEventListenerHandler():"error"===t&&(n=this.errorEventListenerHandler),!n)throw new Error("Unknown event type");n.delete(e)}get isAuthenticated(){return this.auth0.isAuthenticated}requireAuth(){return this.requireUserDataOrThrow().then((()=>{}))}async requireUserDataOrThrow(){"off"===this.config.autoConnect||this.auth0.isAuthenticated||await this.connect(void 0,void 0,this.gatewayConfig);const{sub:t,owner:e}=this.auth0.getCachedUserDetails()||{};if(!t||!e)throw new Error("Missing cached user.");return{sub:t,publicKey:e}}async connect(e,n,r){if(e&&e.toSorted().join("-")!==t.ALL_PERMISSIONS.join("-"))throw new Error("Othent implicitly has access to all available permissions. You should pass `permissions = undefined` or include all of them.");n&&(this.appInfo=n,this.auth0.setAppInfo(n)),this.gatewayConfig=r||cr;let i="",o=null;try{const t=await this.auth0.getTokenSilently();i=t.id_token,o=t.userDetails}catch(t){if(!(t instanceof Error))throw t;if("Login required"!==t.message&&!(t instanceof E))throw t;console.warn(t.message)}if(!i)try{const t=await this.auth0.logIn();i=t.id_token,o=t.userDetails}catch(t){if(!(t instanceof Error))throw t;if("Redirecting..."===t.message&&await new Promise((()=>{})),t.message.startsWith("Unable to open a popup")||t instanceof v||t instanceof w)return t instanceof w&&t.popup.close(),console.warn(t.message),null;throw t}if(i&&!o){await this.api.createUser(i);const t=await this.auth0.getTokenSilently();i=t.id_token,o=t.userDetails}if(i&&o)return o;throw this.auth0.logOut(),new Error("Unexpected authentication error")}async disconnect(){return this.auth0.logOut()}getActiveAddress(){return Promise.resolve(this.getSyncActiveAddress())}getActivePublicKey(){return Promise.resolve(this.getSyncActivePublicKey())}getAllAddresses(){return Promise.resolve(this.getSyncAllAddresses())}getWalletNames(){return Promise.resolve(this.getSyncWalletNames())}getUserDetails(){return Promise.resolve(this.getSyncUserDetails())}getSyncActiveAddress(){return this.auth0.getCachedUserAddress()||""}getSyncActivePublicKey(){return this.auth0.getCachedUserPublicKey()||""}getSyncAllAddresses(){const t=this.auth0.getCachedUserAddress();return t?[t]:[]}getSyncWalletNames(){const t=this.auth0.getCachedUserAddress(),e=this.auth0.getCachedUserAddressLabel();return Promise.resolve(t&&e?{[t]:e}:{})}getSyncUserDetails(){return this.auth0.getCachedUserDetails()}addCommonTags(t=[]){if(Array.isArray(t)){const e=[{name:"App-Name",value:this.appInfo.name},{name:"App-Version",value:this.appInfo.version}];return[...t,...this.config.tags,...e,...dr]}for(const{name:e,value:n}of this.config.tags)t.addTag(e,n);t.addTag("App-Name",this.appInfo.name),t.addTag("App-Version",this.appInfo.version);for(const{name:e,value:n}of dr)t.addTag(e,n)}async sign(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),r=Nr(this.gatewayConfig),i=t.get("tags").map((t=>({name:t.get("name",{decode:!0,string:!0}),value:t.get("value",{decode:!0,string:!0})}))),o=this.addCommonTags(i),s=await r.createTransaction({data:t.data,owner:n,reward:t.reward});o.forEach((t=>{s.addTag(t.name,t.value)}));const a=await s.getSignatureData(),c=await this.api.sign(a,e),l=await xr(c);return s.setSignature({id:Tr(l),owner:n,signature:Tr(c),tags:s.tags,reward:s.reward}),s}async dispatch(t,e){var n;const r=t.get("tags").map((t=>({name:t.get("name",{decode:!0,string:!0}),value:t.get("value",{decode:!0,string:!0})}))),i=await this.signDataItem({data:t.data,tags:r,target:t.target}),o=`${(null==e?void 0:e.node)||"https://turbo.ardrive.io"}/tx`;try{const t=await He.post(o,i,{headers:{"Content-Type":"application/octet-stream"},maxBodyLength:1/0,maxContentLength:1/0,responseType:"json"});if(t.status>=400)throw new Error(`${t.status} - ${JSON.stringify(t.data)}`);return{...t.data,type:"BUNDLED"}}catch(r){console.warn(`Error dispatching transaction to ${o} =\n`,r);const i=await this.sign(t),s=null!=(n=null==e?void 0:e.arweave)?n:Nr(this.gatewayConfig),a=await s.transactions.getUploader(i);for(;!a.isComplete;)await a.uploadChunk();return{id:i.id,signature:i.signature,owner:i.owner,type:"BASE"}}}async encrypt(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.encrypt(t,e)}async decrypt(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.decrypt(t,e)}async signature(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.sign(t,e)}async signDataItem(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),{data:r,tags:i,...o}=t,s={publicKey:Ur(n),signatureType:1,signatureLength:512,ownerLength:512,sign:this.api.getSignerSignFn(e)},a=Fn(r,s,{...o,tags:this.addCommonTags(i)});return await a.sign(s),a.getRaw().buffer}async signMessage(t,e){const{sub:n}=await this.requireUserDataOrThrow(),r=(null==e?void 0:e.hashAlgorithm)||"SHA-256",i=await this.crypto.subtle.digest(r,Er(t));return await this.api.sign(i,n)}async verifyMessage(t,e,n,r={hashAlgorithm:"SHA-256"}){if(!n){const t=await this.requireUserDataOrThrow();n||(n=t.publicKey)}const i=(null==r?void 0:r.hashAlgorithm)||"SHA-256",o=await this.crypto.subtle.digest(i,Er(t)),s={e:"AQAB",ext:!0,kty:"RSA",n},a=await this.crypto.subtle.importKey("jwk",s,{name:"RSA-PSS",hash:r.hashAlgorithm},!1,["verify"]);return await this.crypto.subtle.verify({name:"RSA-PSS",saltLength:32},a,Er(e),o)}async privateHash(t,e){return xr(Er(t),null==e?void 0:e.hashAlgorithm)}getArweaveConfig(){return Promise.resolve(this.gatewayConfig)}getPermissions(){return Promise.resolve(t.ALL_PERMISSIONS)}addToken(t,e,n){return console.warn("Othent doesn't currently support this feature and only tracks added tokens temporarily in memory."),this.tokens.add(t),Promise.resolve()}isTokenAdded(t){return console.warn("Othent doesn't currently support this feature and only tracks added tokens temporarily in memory."),Promise.resolve(this.tokens.has(t))}};_r.walletName=ur,_r.walletVersion=hr,_r.ALL_PERMISSIONS=["ACCESS_ADDRESS","ACCESS_ALL_ADDRESSES","ACCESS_ARWEAVE_CONFIG","ACCESS_PUBLIC_KEY","DECRYPT","DISPATCH","ENCRYPT","SIGN_TRANSACTION","SIGNATURE"];var jr=_r;async function Dr(t,e){try{const n=function(t){const e=t.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=window.atob(e),r=new Uint8Array(n.length);for(let t=0;t<n.length;t++)r[t]=n.charCodeAt(t);return r.buffer}(t),r=await window.crypto.subtle.importKey("spki",n,{name:"RSA-OAEP",hash:{name:"SHA-256"}},!0,["encrypt"]);return function(t){try{let e="";const n=new Uint8Array(t),r=n.byteLength;for(let t=0;t<r;t++)e+=String.fromCharCode(n[t]);return window.btoa(e)}catch(t){console.error("Eror in buffertoBase64 : ",t)}}(await window.crypto.subtle.encrypt({name:"RSA-OAEP"},r,(new TextEncoder).encode(e)))}catch(t){return console.error("rsaEncrypt error:",t),null}}async function Mr(t){const e={Info:{hashedOthentSub:t},request:"PIN"};return await fetch("https://api2.onairos.uk/getAccountInfoFromOthentSub",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then((t=>t.json())).then((t=>t)).catch((t=>console.error(t)))}window.Buffer=r.lW;const Vr=async()=>{if(!window.PublicKeyCredential)throw new Error("WebAuthn not supported");try{if(!await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())throw new Error("Biometric authentication not available");return!!await navigator.credentials.get({publicKey:{challenge:new Uint8Array(32),rpId:window.location.hostname,userVerification:"required"}})}catch(t){return console.error("Biometric authentication failed:",t),!1}};function Fr(t){let{onLoginSuccess:n}=t;const[r,i]=(0,e.useState)(!1);return React.createElement("div",{className:"flex flex-col items-center"},React.createElement("button",{onClick:async()=>{i(!0);try{const t=await(async()=>{const t=localStorage.getItem("onairosCredentials");if(!t)return null;try{const e=JSON.parse(t);return(await fetch("https://api2.onairos.uk/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e.username,token:e.token})})).ok?e:(localStorage.removeItem("onairosCredentials"),null)}catch(t){return console.error("Verification failed:",t),null}})();if(t){if(await Vr())return void await n(t.username)}const e=Date.now(),r=encodeURIComponent(window.location.origin+"/auth/callback"),i="onairos://authenticate?nonce=".concat(e,"&callback=").concat(r,"&appName=google");window.location.href=i,setTimeout((()=>{window.location.href="https://apps.apple.com/app/onairos/id123456789"}),2500)}catch(t){console.error("App login failed:",t)}finally{i(!1)}},disabled:r,className:"w-12 h-12 rounded-full shadow-md hover:shadow-lg transition-shadow duration-200 flex items-center justify-center bg-white"},React.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos",className:"w-10 h-6"})),React.createElement("span",{className:"text-xs mt-2 text-gray-600"},"Login with App"))}function Kr(){const[t,r]=(0,e.useState)(null),[i,o]=(0,e.useState)([]),s=t=>{o((e=>[...e,t]))};return n().createElement("div",{className:"flex flex-col items-center p-4"},n().createElement("button",{onClick:()=>{try{s("Opening external browser...");const t=new URLSearchParams({key:"value"}).toString(),e="https://internship.onairos.uk/auth?".concat(t);window.open(e,"_blank")}catch(t){console.error("Failed to open link:",t),s("Failed to open link: ".concat(t.message)),r("Failed to open link: ".concat(t.message))}},className:"flex flex-col items-center justify-center px-4 py-2 border border-gray-300 rounded-full shadow-sm bg-white hover:bg-gray-50"},n().createElement("div",{className:"relative"},n().createElement("img",{src:"google-icon.png",alt:"Google",className:"w-10 h-10 rounded-full"}),n().createElement("svg",{className:"absolute bottom-0 right-0 w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20"},n().createElement("path",{d:"M10 3a1 1 0 011 1v6h6a1 1 0 110 2h-6v6a1 1 0 11-2 0v-6H3a1 1 0 110-2h6V4a1 1 0 011-1z"}))),n().createElement("span",{className:"text-gray-700 mt-2"},"Google")))}function zr(t){let{onLoginSuccess:n,setOthent:r,setHashedOthentSub:i,setEncryptedPin:o}=t;const[s,a]=(0,e.useState)(!1);(0,e.useEffect)((()=>{c()}),[]);const c=async()=>{const t=localStorage.getItem("onairosCredentials");a(!!t)};return React.createElement("div",{className:"flex flex-row justify-center items-center space-x-4"},React.createElement(Kr,null),React.createElement(Fr,{hasSavedCredentials:s,onSuccess:n}))}var Wr=a(697),Hr=a.n(Wr);function $r(t){let{active:e,title:r,id:i,number:o,descriptions:s,rewards:a,size:c,isChecked:l,onCheckboxChange:u}=t;return n().createElement("div",{className:"bg-white rounded-lg p-4 shadow border border-gray-200"},n().createElement("div",{className:"flex items-center justify-between"},n().createElement("div",{className:"flex items-center space-x-4"},n().createElement("div",{className:"group"},n().createElement("div",null,n().createElement("input",{disabled:!e,type:"checkbox",checked:l,onChange:t=>u(t.target.checked)})))),n().createElement("div",{className:"flex items-center"}),s&&"Avatar"!==r&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Intent: ",s),a&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Rewards: ",a)))}function Zr(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}function Xr(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}$r.propTypes={active:Hr().bool.isRequired,title:Hr().string.isRequired,id:Hr().any.isRequired,number:Hr().number.isRequired,descriptions:Hr().string,rewards:Hr().string,size:Hr().string.isRequired,isChecked:Hr().bool.isRequired,onCheckboxChange:Hr().func.isRequired};const Yr=t=>Array.isArray(t);function Gr(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function qr(t){return"string"==typeof t||Array.isArray(t)}function Jr(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Qr(t,e,n,r){if("function"==typeof e){const[i,o]=Jr(r);e=e(void 0!==n?n:t.custom,i,o)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,o]=Jr(r);e=e(void 0!==n?n:t.custom,i,o)}return e}function ti(t,e,n){const r=t.getProps();return Qr(r,e,void 0!==n?n:r.custom,t)}const ei=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ni=["initial",...ei],ri=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ii=new Set(ri),oi=t=>1e3*t,si=t=>t/1e3,ai={type:"spring",stiffness:500,damping:25,restSpeed:10},ci={type:"keyframes",duration:.8},li={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ui=(t,{keyframes:e})=>e.length>2?ci:ii.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:ai:li;function hi(t,e){return t?t[e]||t.default||t:void 0}const di=!1,fi=!1,pi=!1,mi=t=>null!==t;function gi(t,{repeat:e,repeatType:n="loop"},r){const i=t.filter(mi),o=e&&"loop"!==n&&e%2==1?0:i.length-1;return o&&void 0!==r?r:i[o]}const yi=t=>t;const wi=["read","resolveKeyframes","update","preRender","render","postRender"];function vi(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=wi.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,i=!1;const o=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function a(e){o.has(e)&&(c.schedule(e),t()),e(s)}const c={schedule:(t,i=!1,s=!1)=>{const a=s&&r?e:n;return i&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),o.delete(t)},process:t=>{s=t,r?i=!0:(r=!0,[e,n]=[n,e],e.forEach(a),e.clear(),r=!1,i&&(i=!1,c.process(t)))}};return c}(o),t)),{}),{read:a,resolveKeyframes:c,update:l,preRender:u,render:h,postRender:d}=s,f=()=>{const o=fi?i.timestamp:performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,40),1),i.timestamp=o,i.isProcessing=!0,a.process(i),c.process(i),l.process(i),u.process(i),h.process(i),d.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(f))};return{schedule:wi.reduce(((e,o)=>{const a=s[o];return e[o]=(e,o=!1,s=!1)=>(n||(n=!0,r=!0,i.isProcessing||t(f)),a.schedule(e,o,s)),e}),{}),cancel:t=>{for(let e=0;e<wi.length;e++)s[wi[e]].cancel(t)},state:i,steps:s}}const{schedule:bi,cancel:Ei,state:Si,steps:Ti}=vi("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:yi,!0),xi=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Ai=1e-7,ki=12;function Ri(t,e,n,r){if(t===e&&n===r)return yi;const i=e=>function(t,e,n,r,i){let o,s,a=0;do{s=e+(n-e)/2,o=xi(s,r,i)-t,o>0?n=s:e=s}while(Math.abs(o)>Ai&&++a<ki);return s}(e,0,1,t,n);return t=>0===t||1===t?t:xi(i(t),e,r)}const Pi=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Ci=t=>e=>1-t(1-e),Oi=Ri(.33,1.53,.69,.99),Ii=Ci(Oi),Bi=Pi(Ii),Ui=t=>(t*=2)<1?.5*Ii(t):.5*(2-Math.pow(2,-10*(t-1))),Li=t=>1-Math.sin(Math.acos(t)),Ni=Ci(Li),_i=Pi(Li),ji=t=>/^0[^.\s]+$/u.test(t);let Di=yi,Mi=yi;const Vi=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Fi=t=>e=>"string"==typeof e&&e.startsWith(t),Ki=Fi("--"),zi=Fi("var(--"),Wi=t=>!!zi(t)&&Hi.test(t.split("/*")[0].trim()),Hi=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,$i=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Zi(t,e,n=1){Mi(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,i]=function(t){const e=$i.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${null!=n?n:r}`,i]}(t);if(!r)return;const o=window.getComputedStyle(e).getPropertyValue(r);if(o){const t=o.trim();return Vi(t)?parseFloat(t):t}return Wi(i)?Zi(i,e,n+1):i}const Xi=(t,e,n)=>n>e?e:n<t?t:n,Yi={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Gi={...Yi,transform:t=>Xi(0,1,t)},qi={...Yi,default:1},Ji=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Qi=Ji("deg"),to=Ji("%"),eo=Ji("px"),no=Ji("vh"),ro=Ji("vw"),io={...to,parse:t=>to.parse(t)/100,transform:t=>to.transform(100*t)},oo=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),so=t=>t===Yi||t===eo,ao=(t,e)=>parseFloat(t.split(", ")[e]),co=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return ao(i[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?ao(e[1],t):0}},lo=new Set(["x","y","z"]),uo=ri.filter((t=>!lo.has(t)));const ho={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:co(4,13),y:co(5,14)};ho.translateX=ho.x,ho.translateY=ho.y;const fo=t=>e=>e.test(t),po=[Yi,eo,to,Qi,ro,no,{test:t=>"auto"===t,parse:t=>t}],mo=t=>po.find(fo(t)),go=new Set;let yo=!1,wo=!1;function vo(){if(wo){const t=Array.from(go).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return uo.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}wo=!1,yo=!1,go.forEach((t=>t.complete())),go.clear()}function bo(){go.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(wo=!0)}))}class Eo{constructor(t,e,n,r,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(go.add(this),yo||(yo=!0,bi.read(bo),bi.resolveKeyframes(vo))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let i=0;i<t.length;i++)if(null===t[i])if(0===i){const i=null==r?void 0:r.get(),o=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const r=n.readValue(e,o);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=o),r&&void 0===i&&r.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),go.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,go.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const So=t=>Math.round(1e5*t)/1e5,To=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const xo=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ao=(t,e)=>n=>Boolean("string"==typeof n&&xo.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),ko=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[i,o,s,a]=r.match(To);return{[t]:parseFloat(i),[e]:parseFloat(o),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},Ro={...Yi,transform:t=>Math.round((t=>Xi(0,255,t))(t))},Po={test:Ao("rgb","red"),parse:ko("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Ro.transform(t)+", "+Ro.transform(e)+", "+Ro.transform(n)+", "+So(Gi.transform(r))+")"};const Co={test:Ao("#"),parse:function(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}},transform:Po.transform},Oo={test:Ao("hsl","hue"),parse:ko("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+to.transform(So(e))+", "+to.transform(So(n))+", "+So(Gi.transform(r))+")"},Io={test:t=>Po.test(t)||Co.test(t)||Oo.test(t),parse:t=>Po.test(t)?Po.parse(t):Oo.test(t)?Oo.parse(t):Co.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Po.transform(t):Oo.transform(t)},Bo=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Uo="number",Lo="color",No="var",_o="var(",jo="${}",Do=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Mo(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const s=e.replace(Do,(t=>(Io.test(t)?(r.color.push(o),i.push(Lo),n.push(Io.parse(t))):t.startsWith(_o)?(r.var.push(o),i.push(No),n.push(t)):(r.number.push(o),i.push(Uo),n.push(parseFloat(t))),++o,jo))).split(jo);return{values:n,split:s,indexes:r,types:i}}function Vo(t){return Mo(t).values}function Fo(t){const{split:e,types:n}=Mo(t),r=e.length;return t=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],void 0!==t[o]){const e=n[o];i+=e===Uo?So(t[o]):e===Lo?Io.transform(t[o]):t[o]}return i}}const Ko=t=>"number"==typeof t?0:t;const zo={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(To))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Bo))||void 0===n?void 0:n.length)||0)>0},parse:Vo,createTransformer:Fo,getAnimatableNone:function(t){const e=Vo(t);return Fo(t)(e.map(Ko))}},Wo=new Set(["brightness","contrast","saturate","opacity"]);function Ho(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(To)||[];if(!r)return t;const i=n.replace(r,"");let o=Wo.has(e)?1:0;return r!==n&&(o*=100),e+"("+o+i+")"}const $o=/\b([a-z-]*)\(.*?\)/gu,Zo={...zo,getAnimatableNone:t=>{const e=t.match($o);return e?e.map(Ho).join(" "):t}},Xo={borderWidth:eo,borderTopWidth:eo,borderRightWidth:eo,borderBottomWidth:eo,borderLeftWidth:eo,borderRadius:eo,radius:eo,borderTopLeftRadius:eo,borderTopRightRadius:eo,borderBottomRightRadius:eo,borderBottomLeftRadius:eo,width:eo,maxWidth:eo,height:eo,maxHeight:eo,top:eo,right:eo,bottom:eo,left:eo,padding:eo,paddingTop:eo,paddingRight:eo,paddingBottom:eo,paddingLeft:eo,margin:eo,marginTop:eo,marginRight:eo,marginBottom:eo,marginLeft:eo,backgroundPositionX:eo,backgroundPositionY:eo},Yo={rotate:Qi,rotateX:Qi,rotateY:Qi,rotateZ:Qi,scale:qi,scaleX:qi,scaleY:qi,scaleZ:qi,skew:Qi,skewX:Qi,skewY:Qi,distance:eo,translateX:eo,translateY:eo,translateZ:eo,x:eo,y:eo,z:eo,perspective:eo,transformPerspective:eo,opacity:Gi,originX:io,originY:io,originZ:eo},Go={...Yi,transform:Math.round},qo={...Xo,...Yo,zIndex:Go,size:eo,fillOpacity:Gi,strokeOpacity:Gi,numOctaves:Go},Jo={...qo,color:Io,backgroundColor:Io,outlineColor:Io,fill:Io,stroke:Io,borderColor:Io,borderTopColor:Io,borderRightColor:Io,borderBottomColor:Io,borderLeftColor:Io,filter:Zo,WebkitFilter:Zo},Qo=t=>Jo[t];function ts(t,e){let n=Qo(t);return n!==Zo&&(n=zo),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const es=new Set(["auto","none","0"]);class ns extends Eo{constructor(t,e,n,r,i){super(t,e,n,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),Wi(r))){const i=Zi(r,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!oo.has(n)||2!==t.length)return;const[r,i]=t,o=mo(r),s=mo(i);if(o!==s)if(so(o)&&so(s))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||ji(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,i=0;for(;i<t.length&&!r;){const e=t[i];"string"==typeof e&&!es.has(e)&&Mo(e).values.length&&(r=t[i]),i++}if(r&&n)for(const i of e)t[i]=ts(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ho[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const o=r.length-1,s=r[o];r[o]=ho[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}function rs(t){return"function"==typeof t}let is;function os(){is=void 0}const ss={now:()=>(void 0===is&&ss.set(Si.isProcessing||fi?Si.timestamp:performance.now()),is),set:t=>{is=t,queueMicrotask(os)}},as=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!zo.test(t)&&"0"!==t||t.startsWith("url(")));function cs(t,e,n,r){const i=t[0];if(null===i)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],s=as(i,e),a=as(o,e);return Di(s===a,`You are trying to animate ${e} from "${i}" to "${o}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${o} via the \`style\` property.`),!(!s||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||rs(n))&&r)}class ls{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",...s}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=ss.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:i,repeatType:o,...s},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(bo(),vo()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=ss.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:i,delay:o,onComplete:s,onUpdate:a,isGenerator:c}=this.options;if(!c&&!cs(t,n,r,i)){if(pi||!o)return null==a||a(gi(t,this.options,e)),null==s||s(),void this.resolveFinishedPromise();this.options.duration=0}const l=this.initPlayback(t,e);!1!==l&&(this._resolved={keyframes:t,finalKeyframe:e,...l},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}const us=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},hs=(t,e,n=10)=>{let r="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)r+=t(us(0,i-1,e))+", ";return`linear(${r.substring(0,r.length-2)})`};function ds(t,e){return e?t*(1e3/e):0}const fs=5;function ps(t,e,n){const r=Math.max(e-fs,0);return ds(n-t(r),e-r)}const ms={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},gs=.001;function ys({duration:t=ms.duration,bounce:e=ms.bounce,velocity:n=ms.velocity,mass:r=ms.mass}){let i,o;Di(t<=oi(ms.maxDuration),"Spring duration must be 10 seconds or less");let s=1-e;s=Xi(ms.minDamping,ms.maxDamping,s),t=Xi(ms.minDuration,ms.maxDuration,si(t)),s<1?(i=e=>{const r=e*s,i=r*t,o=r-n,a=vs(e,s),c=Math.exp(-i);return gs-o/a*c},o=e=>{const r=e*s*t,o=r*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,c=Math.exp(-r),l=vs(Math.pow(e,2),s);return(-i(e)+gs>0?-1:1)*((o-a)*c)/l}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-gs,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let r=n;for(let n=1;n<ws;n++)r-=t(r)/e(r);return r}(i,o,5/t);if(t=oi(t),isNaN(a))return{stiffness:ms.stiffness,damping:ms.damping,duration:t};{const e=Math.pow(a,2)*r;return{stiffness:e,damping:2*s*Math.sqrt(r*e),duration:t}}}const ws=12;function vs(t,e){return t*Math.sqrt(1-e*e)}const bs=2e4;function Es(t){let e=0;let n=t.next(e);for(;!n.done&&e<bs;)e+=50,n=t.next(e);return e>=bs?1/0:e}const Ss=["duration","bounce"],Ts=["stiffness","damping","mass"];function xs(t,e){return e.some((e=>void 0!==t[e]))}function As(t=ms.visualDuration,e=ms.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:c,damping:l,mass:u,duration:h,velocity:d,isResolvedFromDuration:f}=function(t){let e={velocity:ms.velocity,stiffness:ms.stiffness,damping:ms.damping,mass:ms.mass,isResolvedFromDuration:!1,...t};if(!xs(t,Ts)&&xs(t,Ss))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(1.2*n),i=r*r,o=2*Xi(.05,1,1-t.bounce)*Math.sqrt(i);e={...e,mass:ms.mass,stiffness:i,damping:o}}else{const n=ys(t);e={...e,...n,mass:ms.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-si(n.velocity||0)}),p=d||0,m=l/(2*Math.sqrt(c*u)),g=s-o,y=si(Math.sqrt(c/u)),w=Math.abs(g)<5;let v;if(r||(r=w?ms.restSpeed.granular:ms.restSpeed.default),i||(i=w?ms.restDelta.granular:ms.restDelta.default),m<1){const t=vs(y,m);v=e=>{const n=Math.exp(-m*y*e);return s-n*((p+m*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===m)v=t=>s-Math.exp(-y*t)*(g+(p+y*g)*t);else{const t=y*Math.sqrt(m*m-1);v=e=>{const n=Math.exp(-m*y*e),r=Math.min(t*e,300);return s-n*((p+m*y*g)*Math.sinh(r)+t*g*Math.cosh(r))/t}}const b={calculatedDuration:f&&h||null,next:t=>{const e=v(t);if(f)a.done=t>=h;else{let n=0;m<1&&(n=0===t?oi(p):ps(v,t,e));const o=Math.abs(n)<=r,c=Math.abs(s-e)<=i;a.done=o&&c}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(Es(b),bs),e=hs((e=>b.next(t*e).value),t,30);return t+"ms "+e}};return b}function ks({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:c,restDelta:l=.5,restSpeed:u}){const h=t[0],d={done:!1,value:h},f=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let p=n*e;const m=h+p,g=void 0===s?m:s(m);g!==m&&(p=g-h);const y=t=>-p*Math.exp(-t/r),w=t=>g+y(t),v=t=>{const e=y(t),n=w(t);d.done=Math.abs(e)<=l,d.value=d.done?g:n};let b,E;const S=t=>{(t=>void 0!==a&&t<a||void 0!==c&&t>c)(d.value)&&(b=t,E=As({keyframes:[d.value,f(d.value)],velocity:ps(w,t,d.value),damping:i,stiffness:o,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return E||void 0!==b||(e=!0,v(t),S(t)),void 0!==b&&t>=b?E.next(t-b):(!e&&v(t),d)}}}const Rs=Ri(.42,0,1,1),Ps=Ri(0,0,.58,1),Cs=Ri(.42,0,.58,1),Os=t=>Array.isArray(t)&&"number"==typeof t[0],Is={linear:yi,easeIn:Rs,easeInOut:Cs,easeOut:Ps,circIn:Li,circInOut:_i,circOut:Ni,backIn:Ii,backInOut:Bi,backOut:Oi,anticipate:Ui},Bs=t=>{if(Os(t)){Mi(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,i]=t;return Ri(e,n,r,i)}return"string"==typeof t?(Mi(void 0!==Is[t],`Invalid easing type '${t}'`),Is[t]):t},Us=(t,e)=>n=>e(t(n)),Ls=(...t)=>t.reduce(Us),Ns=(t,e,n)=>t+(e-t)*n;function _s(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function js(t,e){return n=>n>0?e:t}const Ds=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},Ms=[Co,Po,Oo];function Vs(t){const e=(t=>Ms.find((e=>e.test(t))))(t);if(Di(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let n=e.parse(t);return e===Oo&&(n=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let i=0,o=0,s=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r;i=_s(a,r,t+1/3),o=_s(a,r,t),s=_s(a,r,t-1/3)}else i=o=s=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*s),alpha:r}}(n)),n}const Fs=(t,e)=>{const n=Vs(t),r=Vs(e);if(!n||!r)return js(t,e);const i={...n};return t=>(i.red=Ds(n.red,r.red,t),i.green=Ds(n.green,r.green,t),i.blue=Ds(n.blue,r.blue,t),i.alpha=Ns(n.alpha,r.alpha,t),Po.transform(i))},Ks=new Set(["none","hidden"]);function zs(t,e){return n=>Ns(t,e,n)}function Ws(t){return"number"==typeof t?zs:"string"==typeof t?Wi(t)?js:Io.test(t)?Fs:Zs:Array.isArray(t)?Hs:"object"==typeof t?Io.test(t)?Fs:$s:js}function Hs(t,e){const n=[...t],r=n.length,i=t.map(((t,n)=>Ws(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=i[e](t);return n}}function $s(t,e){const n={...t,...e},r={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(r[i]=Ws(t[i])(t[i],e[i]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Zs=(t,e)=>{const n=zo.createTransformer(e),r=Mo(t),i=Mo(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Ks.has(t)&&!i.values.length||Ks.has(e)&&!r.values.length?function(t,e){return Ks.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Ls(Hs(function(t,e){var n;const r=[],i={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const s=e.types[o],a=t.indexes[s][i[s]],c=null!==(n=t.values[a])&&void 0!==n?n:0;r[o]=c,i[s]++}return r}(r,i),i.values),n):(Di(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),js(t,e))};function Xs(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Ns(t,e,n);return Ws(t)(t,e)}function Ys(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const o=t.length;if(Mi(o===e.length,"Both input and output ranges must be the same length"),1===o)return()=>e[0];if(2===o&&t[0]===t[1])return()=>e[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const s=function(t,e,n){const r=[],i=n||Xs,o=t.length-1;for(let n=0;n<o;n++){let o=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||yi:e;o=Ls(t,o)}r.push(o)}return r}(e,r,i),a=s.length,c=e=>{let n=0;if(a>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=us(t[n],t[n+1],e);return s[n](r)};return n?e=>c(Xi(t[0],t[o-1],e)):c}function Gs(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=us(0,e,r);t.push(Ns(n,1,i))}}(e,t.length-1),e}function qs({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(r)?r.map(Bs):Bs(r),o={done:!1,value:e[0]},s=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Gs(e),t),a=Ys(s,e,{ease:Array.isArray(i)?i:(c=e,l=i,c.map((()=>l||Cs)).splice(0,c.length-1))});var c,l;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}const Js=t=>{const e=({timestamp:e})=>t(e);return{start:()=>bi.update(e,!0),stop:()=>Ei(e),now:()=>Si.isProcessing?Si.timestamp:ss.now()}},Qs={decay:ks,inertia:ks,tween:qs,keyframes:qs,spring:As},ta=t=>t/100;class ea extends ls{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:i}=this.options,o=(null==r?void 0:r.KeyframeResolver)||Eo;this.resolver=new o(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=this.options,s=rs(e)?e:Qs[e]||qs;let a,c;s!==qs&&"number"!=typeof t[0]&&(a=Ls(ta,Xs(t[0],t[1])),t=[0,100]);const l=s({...this.options,keyframes:t});"mirror"===i&&(c=s({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=Es(l));const{calculatedDuration:u}=l,h=u+r;return{generator:l,mirroredGenerator:c,mapPercentToKeyframes:a,calculatedDuration:u,resolvedDuration:h,totalDuration:h*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:i,mirroredGenerator:o,mapPercentToKeyframes:s,keyframes:a,calculatedDuration:c,totalDuration:l,resolvedDuration:u}=n;if(null===this.startTime)return i.next(0);const{delay:h,repeat:d,repeatType:f,repeatDelay:p,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-l/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>l;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=l);let w=this.currentTime,v=i;if(d){const t=Math.min(this.currentTime,l)/u;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===f?(n=1-n,p&&(n-=p/u)):"mirror"===f&&(v=o)),w=Xi(0,1,n)*u}const b=y?{done:!1,value:a[0]}:v.next(w);s&&(b.value=s(b.value));let{done:E}=b;y||null===c||(E=this.speed>=0?this.currentTime>=l:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&E);return S&&void 0!==r&&(b.value=gi(a,this.options,r)),m&&m(b.value),S&&this.finish(),b}get duration(){const{resolved:t}=this;return t?si(t.calculatedDuration):0}get time(){return si(this.currentTime)}set time(t){t=oi(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=si(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Js,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const na=new Set(["opacity","clipPath","filter","transform"]);function ra(t){let e;return()=>(void 0===e&&(e=t()),e)}const ia={linearEasing:void 0};function oa(t,e){const n=ra(t);return()=>{var t;return null!==(t=ia[e])&&void 0!==t?t:n()}}const sa=oa((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function aa(t){return Boolean("function"==typeof t&&sa()||!t||"string"==typeof t&&(t in la||sa())||Os(t)||Array.isArray(t)&&t.every(aa))}const ca=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,la={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ca([0,.65,.55,1]),circOut:ca([.55,0,1,.45]),backIn:ca([.31,.01,.66,-.59]),backOut:ca([.33,1.53,.69,.99])};function ua(t,e){return t?"function"==typeof t&&sa()?hs(t,e):Os(t)?ca(t):Array.isArray(t)?t.map((t=>ua(t,e)||la.easeOut)):la[t]:void 0}function ha(t,e,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeInOut",times:c}={}){const l={[e]:n};c&&(l.offset=c);const u=ua(a,i);return Array.isArray(u)&&(l.easing=u),t.animate(l,{delay:r,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"})}function da(t,e){t.timeline=e,t.onfinish=null}const fa=ra((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const pa={anticipate:Ui,backInOut:Bi,circInOut:_i};class ma extends ls{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new ns(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:i,ease:o,type:s,motionValue:a,name:c,startTime:l}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;var u;if("string"==typeof o&&sa()&&o in pa&&(o=pa[o]),rs((u=this.options).type)||"spring"===u.type||!aa(u.ease)){const{onComplete:e,onUpdate:n,motionValue:a,element:c,...l}=this.options,u=function(t,e){const n=new ea({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const i=[];let o=0;for(;!r.done&&o<2e4;)r=n.sample(o),i.push(r.value),o+=10;return{times:void 0,keyframes:i,duration:o-10,ease:"linear"}}(t,l);1===(t=u.keyframes).length&&(t[1]=t[0]),r=u.duration,i=u.times,o=u.ease,s="keyframes"}const h=ha(a.owner.current,c,t,{...this.options,duration:r,times:i,ease:o});return h.startTime=null!=l?l:this.calcStartTime(),this.pendingTimeline?(da(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;a.set(gi(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:r,times:i,type:s,ease:o,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return si(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return si(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=oi(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return yi;const{animation:n}=e;da(n,t)}else this.pendingTimeline=t;return yi}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:i,ease:o,times:s}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:c,...l}=this.options,u=new ea({...l,keyframes:n,duration:r,type:i,ease:o,times:s,isGenerator:!0}),h=oi(this.time);t.setWithVelocity(u.sample(h-10).value,u.sample(h).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:i,damping:o,type:s}=t;return fa()&&n&&na.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==i&&0!==o&&"inertia"!==s}}const ga=ra((()=>void 0!==window.ScrollTimeline));class ya{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>ga()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const wa=(t,e,n,r={},i,o)=>s=>{const a=hi(r,t)||{},c=a.delay||r.delay||0;let{elapsed:l=0}=r;l-=oi(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:i};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:o,repeatType:s,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length})(a)||(u={...u,...ui(t,u)}),u.duration&&(u.duration=oi(u.duration)),u.repeatDelay&&(u.repeatDelay=oi(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let h=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(u.duration=0,0===u.delay&&(h=!0)),(pi||di)&&(h=!0,u.duration=0,u.delay=0),h&&!o&&void 0!==e.get()){const t=gi(u.keyframes,a);if(void 0!==t)return bi.update((()=>{u.onUpdate(t),u.onComplete()})),new ya([])}return!o&&ma.supports(u)?new ma(u):new ea(u)},va=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),ba=t=>Yr(t)?t[t.length-1]||0:t;function Ea(t,e){-1===t.indexOf(e)&&t.push(e)}function Sa(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Ta{constructor(){this.subscriptions=[]}add(t){return Ea(this.subscriptions,t),()=>Sa(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let i=0;i<r;i++){const r=this.subscriptions[i];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const xa={current:void 0};class Aa{constructor(t,e={}){this.version="11.15.0",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=ss.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=ss.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Ta);const n=this.events[t].add(e);return"change"===t?()=>{n(),bi.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return xa.current&&xa.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=ss.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return ds(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ka(t,e){return new Aa(t,e)}function Ra(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ka(n))}const Pa=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ca="data-"+Pa("framerAppearId");function Oa(t){return t.props[Ca]}const Ia=t=>Boolean(t&&t.getVelocity);function Ba(t,e){const n=t.getValue("willChange");if(r=n,Boolean(Ia(r)&&r.add))return n.add(e);var r}function Ua({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function La(t,e,{delay:n=0,transitionOverride:r,type:i}={}){var o;let{transition:s=t.getDefaultTransition(),transitionEnd:a,...c}=e;r&&(s=r);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const e in c){const r=t.getValue(e,null!==(o=t.latestValues[e])&&void 0!==o?o:null),i=c[e];if(void 0===i||u&&Ua(u,e))continue;const a={delay:n,...hi(s||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Oa(t);if(n){const t=window.MotionHandoffAnimation(n,e,bi);null!==t&&(a.startTime=t,h=!0)}}Ba(t,e),r.start(wa(e,r,i,t.shouldReduceMotion&&ii.has(e)?{type:!1}:a,t,h));const d=r.animation;d&&l.push(d)}return a&&Promise.all(l).then((()=>{bi.update((()=>{a&&function(t,e){const n=ti(t,e);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const e in o)Ra(t,e,ba(o[e]))}(t,a)}))})),l}function Na(t,e,n={}){var r;const i=ti(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(o=n.transitionOverride);const s=i?()=>Promise.all(La(t,i,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:i=0,staggerChildren:s,staggerDirection:a}=o;return function(t,e,n=0,r=0,i=1,o){const s=[],a=(t.variantChildren.size-1)*r,c=1===i?(t=0)=>t*r:(t=0)=>a-t*r;return Array.from(t.variantChildren).sort(_a).forEach(((t,r)=>{t.notify("AnimationStart",e),s.push(Na(t,e,{...o,delay:n+c(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(s)}(t,e,i+r,s,a,n)}:()=>Promise.resolve(),{when:c}=o;if(c){const[t,e]="beforeChildren"===c?[s,a]:[a,s];return t().then((()=>e()))}return Promise.all([s(),a(n.delay)])}function _a(t,e){return t.sortNodePosition(e)}const ja=ni.length;function Da(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Da(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<ja;n++){const r=ni[n],i=t.props[r];(qr(i)||!1===i)&&(e[r]=i)}return e}const Ma=[...ei].reverse(),Va=ei.length;function Fa(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const i=e.map((e=>Na(t,e,n)));r=Promise.all(i)}else if("string"==typeof e)r=Na(t,e,n);else{const i="function"==typeof e?ti(t,e,n.custom):e;r=Promise.all(La(t,i,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Ka(t){let e=Fa(t),n=Ha(),r=!0;const i=e=>(n,r)=>{var i;const o=ti(t,r,"exit"===e?null===(i=t.presenceContext)||void 0===i?void 0:i.custom:void 0);if(o){const{transition:t,transitionEnd:e,...r}=o;n={...n,...r,...e}}return n};function o(o){const{props:s}=t,a=Da(t.parent)||{},c=[],l=new Set;let u={},h=1/0;for(let e=0;e<Va;e++){const d=Ma[e],f=n[d],p=void 0!==s[d]?s[d]:a[d],m=qr(p),g=d===o?f.isActive:null;!1===g&&(h=e);let y=p===a[d]&&p!==s[d]&&m;if(y&&r&&t.manuallyAnimateOnMount&&(y=!1),f.protectedKeys={...u},!f.isActive&&null===g||!p&&!f.prevProp||Xr(p)||"boolean"==typeof p)continue;const w=za(f.prevProp,p);let v=w||d===o&&f.isActive&&!y&&m||e>h&&m,b=!1;const E=Array.isArray(p)?p:[p];let S=E.reduce(i(d),{});!1===g&&(S={});const{prevResolvedValues:T={}}=f,x={...T,...S},A=e=>{v=!0,l.has(e)&&(b=!0,l.delete(e)),f.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=S[t],n=T[t];if(u.hasOwnProperty(t))continue;let r=!1;r=Yr(e)&&Yr(n)?!Gr(e,n):e!==n,r?null!=e?A(t):l.add(t):void 0!==e&&l.has(t)?A(t):f.protectedKeys[t]=!0}f.prevProp=p,f.prevResolvedValues=S,f.isActive&&(u={...u,...S}),r&&t.blockInitialAnimation&&(v=!1);v&&(!(y&&w)||b)&&c.push(...E.map((t=>({animation:t,options:{type:d}}))))}if(l.size){const e={};l.forEach((n=>{const r=t.getBaseTarget(n),i=t.getValue(n);i&&(i.liveStyle=!0),e[n]=null!=r?r:null})),c.push({animation:e})}let d=Boolean(c.length);return!r||!1!==s.initial&&s.initial!==s.animate||t.manuallyAnimateOnMount||(d=!1),r=!1,d?e(c):Promise.resolve()}return{animateChanges:o,setActive:function(e,r){var i;if(n[e].isActive===r)return Promise.resolve();null===(i=t.variantChildren)||void 0===i||i.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const s=o(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Ha(),r=!0}}}function za(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Gr(e,t)}function Wa(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ha(){return{animate:Wa(!0),whileInView:Wa(),whileHover:Wa(),whileTap:Wa(),whileDrag:Wa(),whileFocus:Wa(),exit:Wa()}}class $a{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Za=0;const Xa={animation:{Feature:class extends $a{constructor(t){super(t),t.animationState||(t.animationState=Ka(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Xr(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends $a{constructor(){super(...arguments),this.id=Za++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}},Ya={x:!1,y:!1};function Ga(){return Ya.x||Ya.y}function qa(t,e){const n=function(t,e,n){var r;if(t instanceof Element)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const o=null!==(r=null==n?void 0:n[t])&&void 0!==r?r:i.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}(t),r=new AbortController;return[n,{passive:!0,...e,signal:r.signal},()=>r.abort()]}function Ja(t){return e=>{"touch"===e.pointerType||Ga()||t(e)}}const Qa=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,tc=new WeakSet;function ec(t){return e=>{"Enter"===e.key&&t(e)}}function nc(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const rc=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const ic=(t,e)=>!!e&&(t===e||ic(t,e.parentElement));function oc(t){return Qa(t)&&!Ga()}function sc(t,e,n={}){const[r,i,o]=qa(t,n),s=t=>{const r=t.currentTarget;if(!oc(t)||tc.has(r))return;tc.add(r);const o=e(t),s=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",c),oc(t)&&tc.has(r)&&(tc.delete(r),o&&o(t,{success:e}))},a=t=>{s(t,n.useGlobalTarget||ic(r,t.target))},c=t=>{s(t,!1)};window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",c,i)};return r.forEach((t=>{(function(t){return rc.has(t.tagName)||-1!==t.tabIndex})(t)||(t.tabIndex=0);(n.useGlobalTarget?window:t).addEventListener("pointerdown",s,i),t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const r=ec((()=>{if(tc.has(n))return;nc(n,"down");const t=ec((()=>{nc(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>nc(n,"cancel")),e)}));n.addEventListener("keydown",r,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",r)),e)})(t,i)),i)})),o}function ac(t){return{point:{x:t.pageX,y:t.pageY}}}function cc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function lc(t,e,n,r){return cc(t,e,(t=>e=>Qa(e)&&t(e,ac(e)))(n),r)}const uc=(t,e)=>Math.abs(t-e);class hc{constructor(t,e,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=pc(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=uc(t.x,e.x),r=uc(t.y,e.y);return Math.sqrt(n**2+r**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:r}=t,{timestamp:i}=Si;this.history.push({...r,timestamp:i});const{onStart:o,onMove:s}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),s&&s(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=dc(e,this.transformPagePoint),bi.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if(this.dragSnapToOrigin&&i&&i(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=pc("pointercancel"===t.type?this.lastMoveEventInfo:dc(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,o),r&&r(t,o)},!Qa(t))return;this.dragSnapToOrigin=i,this.handlers=e,this.transformPagePoint=n,this.contextWindow=r||window;const o=dc(ac(t),this.transformPagePoint),{point:s}=o,{timestamp:a}=Si;this.history=[{...s,timestamp:a}];const{onSessionStart:c}=e;c&&c(t,pc(o,this.history)),this.removeListeners=Ls(lc(this.contextWindow,"pointermove",this.handlePointerMove),lc(this.contextWindow,"pointerup",this.handlePointerUp),lc(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ei(this.updatePoint)}}function dc(t,e){return e?{point:e(t.point)}:t}function fc(t,e){return{x:t.x-e.x,y:t.y-e.y}}function pc({point:t},e){return{point:t,delta:fc(t,gc(e)),offset:fc(t,mc(e)),velocity:yc(e,.1)}}function mc(t){return t[0]}function gc(t){return t[t.length-1]}function yc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=gc(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>oi(e)));)n--;if(!r)return{x:0,y:0};const o=si(i.timestamp-r.timestamp);if(0===o)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function wc(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const vc=.9999,bc=1.0001,Ec=-.01,Sc=.01;function Tc(t){return t.max-t.min}function xc(t,e,n,r=.5){t.origin=r,t.originPoint=Ns(e.min,e.max,t.origin),t.scale=Tc(n)/Tc(e),t.translate=Ns(n.min,n.max,t.origin)-t.originPoint,(t.scale>=vc&&t.scale<=bc||isNaN(t.scale))&&(t.scale=1),(t.translate>=Ec&&t.translate<=Sc||isNaN(t.translate))&&(t.translate=0)}function Ac(t,e,n,r){xc(t.x,e.x,n.x,r?r.originX:void 0),xc(t.y,e.y,n.y,r?r.originY:void 0)}function kc(t,e,n){t.min=n.min+e.min,t.max=t.min+Tc(e)}function Rc(t,e,n){t.min=e.min-n.min,t.max=t.min+Tc(e)}function Pc(t,e,n){Rc(t.x,e.x,n.x),Rc(t.y,e.y,n.y)}function Cc(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function Oc(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}const Ic=.35;function Bc(t,e,n){return{min:Uc(t,e),max:Uc(t,n)}}function Uc(t,e){return"number"==typeof t?t:t[e]||0}const Lc=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),Nc=()=>({x:{min:0,max:0},y:{min:0,max:0}});function _c(t){return[t("x"),t("y")]}function jc({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Dc(t){return void 0===t||1===t}function Mc({scale:t,scaleX:e,scaleY:n}){return!Dc(t)||!Dc(e)||!Dc(n)}function Vc(t){return Mc(t)||Fc(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Fc(t){return Kc(t.x)||Kc(t.y)}function Kc(t){return t&&"0%"!==t}function zc(t,e,n){return n+e*(t-n)}function Wc(t,e,n,r,i){return void 0!==i&&(t=zc(t,i,r)),zc(t,n,r)+e}function Hc(t,e=0,n=1,r,i){t.min=Wc(t.min,e,n,r,i),t.max=Wc(t.max,e,n,r,i)}function $c(t,{x:e,y:n}){Hc(t.x,e.translate,e.scale,e.originPoint),Hc(t.y,n.translate,n.scale,n.originPoint)}const Zc=.999999999999,Xc=1.0000000000001;function Yc(t,e){t.min=t.min+e,t.max=t.max+e}function Gc(t,e,n,r,i=.5){Hc(t,e,n,Ns(t.min,t.max,i),r)}function qc(t,e){Gc(t.x,e.x,e.scaleX,e.scale,e.originX),Gc(t.y,e.y,e.scaleY,e.scale,e.originY)}function Jc(t,e){return jc(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}const Qc=({current:t})=>t?t.ownerDocument.defaultView:null,tl=new WeakMap;class el{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Nc(),this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:r}=this.getProps();this.panSession=new hc(t,{onSessionStart:t=>{const{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(ac(t).point)},onStart:(t,e)=>{const{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=n)||"y"===o?Ya[o]?null:(Ya[o]=!0,()=>{Ya[o]=!1}):Ya.x||Ya.y?null:(Ya.x=Ya.y=!0,()=>{Ya.x=Ya.y=!1}),!this.openDragLock))return;var o;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),_c((t=>{let e=this.getAxisMotionValue(t).get()||0;if(to.test(e)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[t];if(r){e=Tc(r)*(parseFloat(e)/100)}}}this.originPoint[t]=e})),i&&bi.postRender((()=>i(t,e))),Ba(this.visualElement,"transform");const{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:o}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:s}=e;if(r&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(s),void(null!==this.currentDirection&&i&&i(this.currentDirection));this.updateAxis("x",e.point,s),this.updateAxis("y",e.point,s),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>this.stop(t,e),resumeAnimation:()=>_c((t=>{var e;return"paused"===this.getAnimationState(t)&&(null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.play())}))},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:r,contextWindow:Qc(this.visualElement)})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:r}=e;this.startAnimation(r);const{onDragEnd:i}=this.getProps();i&&bi.postRender((()=>i(t,e)))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(t,e,n){const{drag:r}=this.getProps();if(!n||!nl(t,r,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:n},r){return void 0!==e&&t<e?t=r?Ns(e,t,r.min):Math.max(t,e):void 0!==n&&t>n&&(t=r?Ns(n,t,r.max):Math.min(t,n)),t}(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(t=this.visualElement.projection)||void 0===t?void 0:t.layout,i=this.constraints;e&&wc(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(t,{top:e,left:n,bottom:r,right:i}){return{x:Cc(t.x,n,i),y:Cc(t.y,e,r)}}(r.layoutBox,e),this.elastic=function(t=Ic){return!1===t?t=0:!0===t&&(t=Ic),{x:Bc(t,"left","right"),y:Bc(t,"top","bottom")}}(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&_c((t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(r.layoutBox[t],this.constraints[t]))}))}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!wc(t))return!1;const n=t.current;Mi(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=function(t,e,n){const r=Jc(t,n),{scroll:i}=e;return i&&(Yc(r.x,i.offset.x),Yc(r.y,i.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Oc(t.x,e.x),y:Oc(t.y,e.y)}}(r.layout.layoutBox,i);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=jc(t))}return o}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{},c=_c((s=>{if(!nl(s,e,this.currentDirection))return;let c=a&&a[s]||{};o&&(c={min:0,max:0});const l=r?200:1e6,u=r?40:1e7,h={type:"inertia",velocity:n?t[s]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(s,h)}));return Promise.all(c).then(s)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return Ba(this.visualElement,t),n.start(wa(t,n,0,e,this.visualElement,!1))}stopAnimation(){_c((t=>this.getAxisMotionValue(t).stop()))}pauseAnimation(){_c((t=>{var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.pause()}))}getAnimationState(t){var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),r=n[e];return r||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){_c((e=>{const{drag:n}=this.getProps();if(!nl(e,n,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(e);if(r&&r.layout){const{min:n,max:o}=r.layout.layoutBox[e];i.set(t[e]-Ns(n,o,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:n}=this.visualElement;if(!wc(e)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};_c((t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const n=e.get();r[t]=function(t,e){let n=.5;const r=Tc(t),i=Tc(e);return i>r?n=us(e.min,e.max-r,t.min):r>i&&(n=us(t.min,t.max-i,e.min)),Xi(0,1,n)}({min:n,max:n},this.constraints[t])}}));const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),_c((e=>{if(!nl(e,t,null))return;const n=this.getAxisMotionValue(e),{min:i,max:o}=this.constraints[e];n.set(Ns(i,o,r[e]))}))}addListeners(){if(!this.visualElement.current)return;tl.set(this.visualElement,this);const t=lc(this.visualElement.current,"pointerdown",(t=>{const{drag:e,dragListener:n=!0}=this.getProps();e&&n&&this.start(t)})),e=()=>{const{dragConstraints:t}=this.getProps();wc(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,r=n.addEventListener("measure",e);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),bi.read(e);const i=cc(window,"resize",(()=>this.scalePositionWithinConstraints())),o=n.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(_c((e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))})),this.visualElement.render())}));return()=>{i(),t(),r(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=Ic,dragMomentum:s=!0}=t;return{...t,drag:e,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:s}}}function nl(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}const rl=t=>(e,n)=>{t&&bi.postRender((()=>t(e,n)))};var il=a(893);const ol=(0,e.createContext)(null);const sl=(0,e.createContext)({}),al=(0,e.createContext)({}),cl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ll(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ul={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!eo.test(t))return t;t=parseFloat(t)}return`${ll(t,e.target.x)}% ${ll(t,e.target.y)}%`}},hl={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=zo.parse(t);if(i.length>5)return r;const o=zo.createTransformer(t),s="number"!=typeof i[0]?1:0,a=n.x.scale*e.x,c=n.y.scale*e.y;i[0+s]/=a,i[1+s]/=c;const l=Ns(a,c,.5);return"number"==typeof i[2+s]&&(i[2+s]/=l),"number"==typeof i[3+s]&&(i[3+s]/=l),o(i)}},dl={};const{schedule:fl,cancel:pl}=vi(queueMicrotask,!1);class ml extends e.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=t;var o;o=yl,Object.assign(dl,o),i&&(e.group&&e.group.add(i),n&&n.register&&r&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",(()=>{this.safeToRemove()})),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),cl.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:n,drag:r,isPresent:i}=this.props,o=n.projection;return o?(o.isPresent=i,r||t.layoutDependency!==e||void 0===e?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||bi.postRender((()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()}))),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),fl.postRender((()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()})))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n}=this.props,{projection:r}=t;r&&(r.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function gl(t){const[n,r]=function(){const t=(0,e.useContext)(ol);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,o=(0,e.useId)();(0,e.useEffect)((()=>i(o)),[]);const s=(0,e.useCallback)((()=>r&&r(o)),[o,r]);return!n&&r?[!1,s]:[!0]}(),i=(0,e.useContext)(sl);return(0,il.jsx)(ml,{...t,layoutGroup:i,switchLayoutGroup:(0,e.useContext)(al),isPresent:n,safeToRemove:r})}const yl={borderRadius:{...ul,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ul,borderTopRightRadius:ul,borderBottomLeftRadius:ul,borderBottomRightRadius:ul,boxShadow:hl},wl=["TopLeft","TopRight","BottomLeft","BottomRight"],vl=wl.length,bl=t=>"string"==typeof t?parseFloat(t):t,El=t=>"number"==typeof t||eo.test(t);function Sl(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Tl=Al(0,.5,Ni),xl=Al(.5,.95,yi);function Al(t,e,n){return r=>r<t?0:r>e?1:n(us(t,e,r))}function kl(t,e){t.min=e.min,t.max=e.max}function Rl(t,e){kl(t.x,e.x),kl(t.y,e.y)}function Pl(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Cl(t,e,n,r,i){return t=zc(t-=e,1/n,r),void 0!==i&&(t=zc(t,1/i,r)),t}function Ol(t,e,[n,r,i],o,s){!function(t,e=0,n=1,r=.5,i,o=t,s=t){to.test(e)&&(e=parseFloat(e),e=Ns(s.min,s.max,e/100)-s.min);if("number"!=typeof e)return;let a=Ns(o.min,o.max,r);t===o&&(a-=e),t.min=Cl(t.min,e,n,a,i),t.max=Cl(t.max,e,n,a,i)}(t,e[n],e[r],e[i],e.scale,o,s)}const Il=["x","scaleX","originX"],Bl=["y","scaleY","originY"];function Ul(t,e,n,r){Ol(t.x,e,Il,n?n.x:void 0,r?r.x:void 0),Ol(t.y,e,Bl,n?n.y:void 0,r?r.y:void 0)}function Ll(t){return 0===t.translate&&1===t.scale}function Nl(t){return Ll(t.x)&&Ll(t.y)}function _l(t,e){return t.min===e.min&&t.max===e.max}function jl(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Dl(t,e){return jl(t.x,e.x)&&jl(t.y,e.y)}function Ml(t){return Tc(t.x)/Tc(t.y)}function Vl(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Fl{constructor(){this.members=[]}add(t){Ea(this.members,t),t.scheduleRender()}remove(t){if(Sa(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex((e=>t===e));if(0===e)return!1;let n;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,e&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;!1===r&&n.hide()}}exitAnimationComplete(){this.members.forEach((t=>{const{options:e,resumingFrom:n}=t;e.onExitComplete&&e.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()}))}scheduleRender(){this.members.forEach((t=>{t.instance&&t.scheduleRender(!1)}))}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Kl=(t,e)=>t.depth-e.depth;class zl{constructor(){this.children=[],this.isDirty=!1}add(t){Ea(this.children,t),this.isDirty=!0}remove(t){Sa(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Kl),this.isDirty=!1,this.children.forEach(t)}}function Wl(t){const e=Ia(t)?t.get():t;return va(e)?e.toValue():e}function Hl(t,e){const n=ss.now(),r=({timestamp:i})=>{const o=i-n;o>=e&&(Ei(r),t(o-e))};return bi.read(r,!0),()=>Ei(r)}const $l={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Zl="undefined"!=typeof window&&void 0!==window.MotionDebug,Xl=["","X","Y","Z"],Yl={visibility:"hidden"};let Gl=0;function ql(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Jl(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Oa(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",bi,!(e||r))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Jl(r)}function Ql({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(t={},n=(null==e?void 0:e())){this.id=Gl++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Zl&&($l.totalNodes=$l.resolvedTargetDeltas=$l.recalculatedProjection=0),this.nodes.forEach(nu),this.nodes.forEach(lu),this.nodes.forEach(uu),this.nodes.forEach(ru),Zl&&window.MotionDebug.record($l)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new zl)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new Ta),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const n=this.eventHandlers.get(t);n&&n.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e,n=this.root.hasTreeAnimated){if(this.instance)return;var r;this.isSVG=(r=e)instanceof SVGElement&&"svg"!==r.tagName,this.instance=e;const{layoutId:i,layout:o,visualElement:s}=this.options;if(s&&!s.current&&s.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(o||i)&&(this.isLayoutDirty=!0),t){let n;const r=()=>this.root.updateBlockedByResize=!1;t(e,(()=>{this.root.updateBlockedByResize=!0,n&&n(),n=Hl(r,250),cl.hasAnimatedSinceResize&&(cl.hasAnimatedSinceResize=!1,this.nodes.forEach(cu))}))}i&&this.root.registerSharedNode(i,this),!1!==this.options.animate&&s&&(i||o)&&this.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const i=this.options.transition||s.getDefaultTransition()||gu,{onLayoutAnimationStart:o,onLayoutAnimationComplete:a}=s.getProps(),c=!this.targetLayout||!Dl(this.targetLayout,r)||n,l=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||l||e&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,l);const e={...hi(i,"layout"),onPlay:o,onComplete:a};(s.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||cu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ei(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(hu),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Jl(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:n}=this.options;if(void 0===e&&!n)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(ou);this.isUpdating||this.nodes.forEach(su),this.isUpdating=!1,this.nodes.forEach(au),this.nodes.forEach(tu),this.nodes.forEach(eu),this.clearAllSnapshots();const t=ss.now();Si.delta=Xi(0,1e3/60,t-Si.timestamp),Si.timestamp=t,Si.isProcessing=!0,Ti.update.process(Si),Ti.preRender.process(Si),Ti.render.process(Si),Si.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,fl.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(iu),this.sharedNodes.forEach(du)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,bi.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){bi.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Nc(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(t="measure"){let e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e){const e=r(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!i)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!Nl(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,o=r!==this.prevTransformTemplateValue;t&&(e||Vc(this.latestValues)||o)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let n=this.removeElementScroll(e);var r;return t&&(n=this.removeTransform(n)),vu((r=n).x),vu(r.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){var t;const{visualElement:e}=this.options;if(!e)return Nc();const n=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(Eu))){const{scroll:t}=this.root;t&&(Yc(n.x,t.offset.x),Yc(n.y,t.offset.y))}return n}removeElementScroll(t){var e;const n=Nc();if(Rl(n,t),null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)return n;for(let e=0;e<this.path.length;e++){const r=this.path[e],{scroll:i,options:o}=r;r!==this.root&&i&&o.layoutScroll&&(i.wasRoot&&Rl(n,t),Yc(n.x,i.offset.x),Yc(n.y,i.offset.y))}return n}applyTransform(t,e=!1){const n=Nc();Rl(n,t);for(let t=0;t<this.path.length;t++){const r=this.path[t];!e&&r.options.layoutScroll&&r.scroll&&r!==r.root&&qc(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),Vc(r.latestValues)&&qc(n,r.latestValues)}return Vc(this.latestValues)&&qc(n,this.latestValues),n}removeTransform(t){const e=Nc();Rl(e,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];if(!n.instance)continue;if(!Vc(n.latestValues))continue;Mc(n.latestValues)&&n.updateSnapshot();const r=Nc();Rl(r,n.measurePageBox()),Ul(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return Vc(this.latestValues)&&Ul(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Si.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){var e;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==n;if(!(t||r&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:i,layoutId:o}=this.options;if(this.layout&&(i||o)){if(this.resolvedRelativeTargetAt=Si.timestamp,!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nc(),this.relativeTargetOrigin=Nc(),Pc(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),Rl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var s,a,c;if(this.target||(this.target=Nc(),this.targetWithTransforms=Nc()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),s=this.target,a=this.relativeTarget,c=this.relativeParent.target,kc(s.x,a.x,c.x),kc(s.y,a.y,c.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):Rl(this.target,this.layout.layoutBox),$c(this.target,this.targetDelta)):Rl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const t=this.getClosestProjectingParent();t&&Boolean(t.resumingFrom)===Boolean(this.resumingFrom)&&!t.options.layoutScroll&&t.target&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nc(),this.relativeTargetOrigin=Nc(),Pc(this.relativeTargetOrigin,this.target,t.target),Rl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Zl&&$l.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!Mc(this.parent.latestValues)&&!Fc(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var t;const e=this.getLead(),n=Boolean(this.resumingFrom)||this!==e;let r=!0;if((this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty))&&(r=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===Si.timestamp&&(r=!1),r)return;const{layout:i,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!i&&!o)return;Rl(this.layoutCorrected,this.layout.layoutBox);const s=this.treeScale.x,a=this.treeScale.y;!function(t,e,n,r=!1){const i=n.length;if(!i)return;let o,s;e.x=e.y=1;for(let a=0;a<i;a++){o=n[a],s=o.projectionDelta;const{visualElement:i}=o.options;i&&i.props.style&&"contents"===i.props.style.display||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&qc(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),s&&(e.x*=s.x.scale,e.y*=s.y.scale,$c(t,s)),r&&Vc(o.latestValues)&&qc(t,o.latestValues))}e.x<Xc&&e.x>Zc&&(e.x=1),e.y<Xc&&e.y>Zc&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms=Nc());const{target:c}=e;c?(this.projectionDelta&&this.prevProjectionDelta?(Pl(this.prevProjectionDelta.x,this.projectionDelta.x),Pl(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),Ac(this.projectionDelta,this.layoutCorrected,c,this.latestValues),this.treeScale.x===s&&this.treeScale.y===a&&Vl(this.projectionDelta.x,this.prevProjectionDelta.x)&&Vl(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",c)),Zl&&$l.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){var e;if(null===(e=this.options.visualElement)||void 0===e||e.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Lc(),this.projectionDelta=Lc(),this.projectionDeltaWithTransform=Lc()}setAnimationOrigin(t,e=!1){const n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},o=Lc();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const s=Nc(),a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=Boolean(a&&!l&&!0===this.options.crossfade&&!this.path.some(mu));let h;this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;fu(o.x,t.x,n),fu(o.y,t.y,n),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Pc(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox),function(t,e,n,r){pu(t.x,e.x,n.x,r),pu(t.y,e.y,n.y,r)}(this.relativeTarget,this.relativeTargetOrigin,s,n),h&&function(t,e){return _l(t.x,e.x)&&_l(t.y,e.y)}(this.relativeTarget,h)&&(this.isProjectionDirty=!1),h||(h=Nc()),Rl(h,this.relativeTarget)),a&&(this.animationValues=i,function(t,e,n,r,i,o){i?(t.opacity=Ns(0,void 0!==n.opacity?n.opacity:1,Tl(r)),t.opacityExit=Ns(void 0!==e.opacity?e.opacity:1,0,xl(r))):o&&(t.opacity=Ns(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let i=0;i<vl;i++){const o=`border${wl[i]}Radius`;let s=Sl(e,o),a=Sl(n,o);void 0===s&&void 0===a||(s||(s=0),a||(a=0),0===s||0===a||El(s)===El(a)?(t[o]=Math.max(Ns(bl(s),bl(a),r),0),(to.test(a)||to.test(s))&&(t[o]+="%")):t[o]=a)}(e.rotate||n.rotate)&&(t.rotate=Ns(e.rotate||0,n.rotate||0,r))}(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ei(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=bi.update((()=>{cl.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,n){const r=Ia(t)?t:ka(t);return r.start(wa("",r,e,n)),r.animation}(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:n,layout:r,latestValues:i}=t;if(e&&n&&r){if(this!==t&&this.layout&&r&&bu(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Nc();const e=Tc(this.layout.layoutBox.x);n.x.min=t.target.x.min,n.x.max=n.x.min+e;const r=Tc(this.layout.layoutBox.y);n.y.min=t.target.y.min,n.y.max=n.y.min+r}Rl(e,n),qc(e,i),Ac(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Fl);this.sharedNodes.get(t).add(e);const n=e.options.initialPromotionConfig;e.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){var t;const{layoutId:e}=this.options;return e&&(null===(t=this.getStack())||void 0===t?void 0:t.lead)||this}getPrevLead(){var t;const{layoutId:e}=this.options;return e?null===(t=this.getStack())||void 0===t?void 0:t.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:n}={}){const r=this.getStack();r&&r.promote(this,n),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:n}=t;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(e=!0),!e)return;const r={};n.z&&ql("z",t,r,this.animationValues);for(let e=0;e<Xl.length;e++)ql(`rotate${Xl[e]}`,t,r,this.animationValues),ql(`skew${Xl[e]}`,t,r,this.animationValues);t.render();for(const e in r)t.setStaticValue(e,r[e]),this.animationValues&&(this.animationValues[e]=r[e]);t.scheduleRender()}getProjectionStyles(t){var e,n;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Yl;const r={visibility:""},i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=Wl(null==t?void 0:t.pointerEvents)||"",r.transform=i?i(this.latestValues,""):"none",r;const o=this.getLead();if(!this.projectionDelta||!this.layout||!o.target){const e={};return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=Wl(null==t?void 0:t.pointerEvents)||""),this.hasProjected&&!Vc(this.latestValues)&&(e.transform=i?i({},""):"none",this.hasProjected=!1),e}const s=o.animationValues||o.latestValues;this.applyTransformsToTarget(),r.transform=function(t,e,n){let r="";const i=t.x.translate/e.x,o=t.y.translate/e.y,s=(null==n?void 0:n.z)||0;if((i||o||s)&&(r=`translate3d(${i}px, ${o}px, ${s}px) `),1===e.x&&1===e.y||(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:t,rotate:e,rotateX:i,rotateY:o,skewX:s,skewY:a}=n;t&&(r=`perspective(${t}px) ${r}`),e&&(r+=`rotate(${e}deg) `),i&&(r+=`rotateX(${i}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),a&&(r+=`skewY(${a}deg) `)}const a=t.x.scale*e.x,c=t.y.scale*e.y;return 1===a&&1===c||(r+=`scale(${a}, ${c})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,s),i&&(r.transform=i(s,r.transform));const{x:a,y:c}=this.projectionDelta;r.transformOrigin=`${100*a.origin}% ${100*c.origin}% 0`,o.animationValues?r.opacity=o===this?null!==(n=null!==(e=s.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==n?n:1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:r.opacity=o===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0;for(const t in dl){if(void 0===s[t])continue;const{correct:e,applyTo:n}=dl[t],i="none"===r.transform?s[t]:e(s[t],o);if(n){const t=n.length;for(let e=0;e<t;e++)r[n[e]]=i}else r[t]=i}return this.options.layoutId&&(r.pointerEvents=o===this?Wl(null==t?void 0:t.pointerEvents)||"":"none"),r}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>{var e;return null===(e=t.currentAnimation)||void 0===e?void 0:e.stop()})),this.root.nodes.forEach(ou),this.root.sharedNodes.clear()}}}function tu(t){t.updateLayout()}function eu(t){var e;const n=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:r}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;"size"===i?_c((t=>{const r=o?n.measuredBox[t]:n.layoutBox[t],i=Tc(r);r.min=e[t].min,r.max=r.min+i})):bu(i,n.layoutBox,e)&&_c((r=>{const i=o?n.measuredBox[r]:n.layoutBox[r],s=Tc(e[r]);i.max=i.min+s,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[r].max=t.relativeTarget[r].min+s)}));const s=Lc();Ac(s,e,n.layoutBox);const a=Lc();o?Ac(a,t.applyTransform(r,!0),n.measuredBox):Ac(a,e,n.layoutBox);const c=!Nl(s);let l=!1;if(!t.resumeFrom){const r=t.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:i,layout:o}=r;if(i&&o){const s=Nc();Pc(s,n.layoutBox,i.layoutBox);const a=Nc();Pc(a,e,o.layoutBox),Dl(s,a)||(l=!0),r.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=s,t.relativeParent=r)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:n,delta:a,layoutDelta:s,hasLayoutChanged:c,hasRelativeTargetChanged:l})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function nu(t){Zl&&$l.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ru(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function iu(t){t.clearSnapshot()}function ou(t){t.clearMeasurements()}function su(t){t.isLayoutDirty=!1}function au(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function cu(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function lu(t){t.resolveTargetDelta()}function uu(t){t.calcProjection()}function hu(t){t.resetSkewAndRotation()}function du(t){t.removeLeadSnapshot()}function fu(t,e,n){t.translate=Ns(e.translate,0,n),t.scale=Ns(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function pu(t,e,n,r){t.min=Ns(e.min,n.min,r),t.max=Ns(e.max,n.max,r)}function mu(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const gu={duration:.45,ease:[.4,0,.1,1]},yu=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),wu=yu("applewebkit/")&&!yu("chrome/")?Math.round:yi;function vu(t){t.min=wu(t.min),t.max=wu(t.max)}function bu(t,e,n){return"position"===t||"preserve-aspect"===t&&(r=Ml(e),i=Ml(n),o=.2,!(Math.abs(r-i)<=o));var r,i,o}function Eu(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const Su=Ql({attachResizeListener:(t,e)=>cc(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Tu={current:void 0},xu=Ql({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Tu.current){const t=new Su({});t.mount(window),t.setOptions({layoutScroll:!0}),Tu.current=t}return Tu.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),Au={pan:{Feature:class extends $a{constructor(){super(...arguments),this.removePointerDownListener=yi}onPointerDown(t){this.session=new hc(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Qc(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:rl(t),onStart:rl(e),onMove:n,onEnd:(t,e)=>{delete this.session,r&&bi.postRender((()=>r(t,e)))}}}mount(){this.removePointerDownListener=lc(this.node.current,"pointerdown",(t=>this.onPointerDown(t)))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends $a{constructor(t){super(t),this.removeGroupControls=yi,this.removeListeners=yi,this.controls=new el(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yi}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:xu,MeasureLayout:gl}};function ku(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover","Start"===n);const i=r["onHover"+n];i&&bi.postRender((()=>i(e,ac(e))))}function Ru(t,e,n){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap","Start"===n);const i=r["onTap"+("End"===n?"":n)];i&&bi.postRender((()=>i(e,ac(e))))}const Pu=new WeakMap,Cu=new WeakMap,Ou=t=>{const e=Pu.get(t.target);e&&e(t)},Iu=t=>{t.forEach(Ou)};function Bu(t,e,n){const r=function({root:t,...e}){const n=t||document;Cu.has(n)||Cu.set(n,{});const r=Cu.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(Iu,{root:t,...e})),r[i]}(e);return Pu.set(t,n),r.observe(t),()=>{Pu.delete(t),r.unobserve(t)}}const Uu={some:0,all:1};const Lu={inView:{Feature:class extends $a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:i}=t,o={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:Uu[r]};return Bu(this.node.current,o,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,i&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),o=e?n:r;o&&o(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends $a{mount(){const{current:t}=this.node;t&&(this.unmount=sc(t,(t=>(Ru(this.node,t,"Start"),(t,{success:e})=>Ru(this.node,t,e?"End":"Cancel"))),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends $a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ls(cc(this.node.current,"focus",(()=>this.onFocus())),cc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends $a{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[r,i,o]=qa(t,n),s=Ja((t=>{const{target:n}=t,r=e(t);if(!r||!n)return;const o=Ja((t=>{r(t),n.removeEventListener("pointerleave",o)}));n.addEventListener("pointerleave",o,i)}));return r.forEach((t=>{t.addEventListener("pointerenter",s,i)})),o}(t,(t=>(ku(this.node,t,"Start"),t=>ku(this.node,t,"End")))))}unmount(){}}}},Nu={layout:{ProjectionNode:xu,MeasureLayout:gl}},_u=(0,e.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),ju=(0,e.createContext)({}),Du="undefined"!=typeof window,Mu=Du?e.useLayoutEffect:e.useEffect,Vu=(0,e.createContext)({strict:!1});function Fu(t,n,r,i,o){var s,a;const{visualElement:c}=(0,e.useContext)(ju),l=(0,e.useContext)(Vu),u=(0,e.useContext)(ol),h=(0,e.useContext)(_u).reducedMotion,d=(0,e.useRef)(null);i=i||l.renderer,!d.current&&i&&(d.current=i(t,{visualState:n,parent:c,props:r,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:h}));const f=d.current,p=(0,e.useContext)(al);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:c,layoutRoot:l}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Ku(t.parent)),t.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:Boolean(s)||a&&wc(a),visualElement:t,animationType:"string"==typeof o?o:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:l})}(d.current,r,o,p);const m=(0,e.useRef)(!1);(0,e.useInsertionEffect)((()=>{f&&m.current&&f.update(r,u)}));const g=r[Ca],y=(0,e.useRef)(Boolean(g)&&!(null===(s=window.MotionHandoffIsComplete)||void 0===s?void 0:s.call(window,g))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,g)));return Mu((()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),fl.render(f.render),y.current&&f.animationState&&f.animationState.animateChanges())})),(0,e.useEffect)((()=>{f&&(!y.current&&f.animationState&&f.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,g)})),y.current=!1))})),f}function Ku(t){if(t)return!1!==t.options.allowProjection?t.projection:Ku(t.parent)}function zu(t,n,r){return(0,e.useCallback)((e=>{e&&t.mount&&t.mount(e),n&&(e?n.mount(e):n.unmount()),r&&("function"==typeof r?r(e):wc(r)&&(r.current=e))}),[n])}function Wu(t){return Xr(t.animate)||ni.some((e=>qr(t[e])))}function Hu(t){return Boolean(Wu(t)||t.variants)}function $u(t){const{initial:n,animate:r}=function(t,e){if(Wu(t)){const{initial:e,animate:n}=t;return{initial:!1===e||qr(e)?e:void 0,animate:qr(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,e.useContext)(ju));return(0,e.useMemo)((()=>({initial:n,animate:r})),[Zu(n),Zu(r)])}function Zu(t){return Array.isArray(t)?t.join(" "):t}const Xu={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Yu={};for(const t in Xu)Yu[t]={isEnabled:e=>Xu[t].some((t=>!!e[t]))};const Gu=Symbol.for("motionComponentSymbol");function qu({preloadedFeatures:t,createVisualElement:n,useRender:r,useVisualState:i,Component:o}){t&&function(t){for(const e in t)Yu[e]={...Yu[e],...t[e]}}(t);const s=(0,e.forwardRef)((function(t,s){let a;const c={...(0,e.useContext)(_u),...t,layoutId:Ju(t)},{isStatic:l}=c,u=$u(t),h=i(t,l);if(!l&&Du){!function(t,n){(0,e.useContext)(Vu).strict;0}();const t=function(t){const{drag:e,layout:n}=Yu;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(c);a=t.MeasureLayout,u.visualElement=Fu(o,h,c,n,t.ProjectionNode)}return(0,il.jsxs)(ju.Provider,{value:u,children:[a&&u.visualElement?(0,il.jsx)(a,{visualElement:u.visualElement,...c}):null,r(o,t,zu(h,u.visualElement,s),h,l,u.visualElement)]})}));return s[Gu]=o,s}function Ju({layoutId:t}){const n=(0,e.useContext)(sl).id;return n&&void 0!==t?n+"-"+t:t}const Qu=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function th(t){return"string"==typeof t&&!t.includes("-")&&!!(Qu.indexOf(t)>-1||/[A-Z]/u.test(t))}function eh(t,{style:e,vars:n},r,i){Object.assign(t.style,e,i&&i.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}const nh=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function rh(t,e,n,r){eh(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(nh.has(n)?n:Pa(n),e.attrs[n])}function ih(t,{layout:e,layoutId:n}){return ii.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!dl[t]||"opacity"===t)}function oh(t,e,n){var r;const{style:i}=t,o={};for(const s in i)(Ia(i[s])||e.style&&Ia(e.style[s])||ih(s,t)||void 0!==(null===(r=null==n?void 0:n.getValue(s))||void 0===r?void 0:r.liveStyle))&&(o[s]=i[s]);return o}function sh(t,e,n){const r=oh(t,e,n);for(const n in t)if(Ia(t[n])||Ia(e[n])){r[-1!==ri.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const ah=t=>(n,r)=>{const i=(0,e.useContext)(ju),o=(0,e.useContext)(ol),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,i,o){const s={latestValues:ch(r,i,o,t),renderState:e()};return n&&(s.mount=t=>n(r,t,s)),s}(t,n,i,o);return r?s():function(t){const n=(0,e.useRef)(null);return null===n.current&&(n.current=t()),n.current}(s)};function ch(t,e,n,r){const i={},o=r(t,{});for(const t in o)i[t]=Wl(o[t]);let{initial:s,animate:a}=t;const c=Wu(t),l=Hu(t);e&&l&&!c&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let u=!!n&&!1===n.initial;u=u||!1===s;const h=u?a:s;if(h&&"boolean"!=typeof h&&!Xr(h)){const e=Array.isArray(h)?h:[h];for(let n=0;n<e.length;n++){const r=Qr(t,e[n]);if(r){const{transitionEnd:t,transition:e,...n}=r;for(const t in n){let e=n[t];if(Array.isArray(e)){e=e[u?e.length-1:0]}null!==e&&(i[t]=e)}for(const e in t)i[e]=t[e]}}}return i}const lh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),uh=()=>({...lh(),attrs:{}}),hh=(t,e)=>e&&"number"==typeof t?e.transform(t):t,dh={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fh=ri.length;function ph(t,e,n){const{style:r,vars:i,transformOrigin:o}=t;let s=!1,a=!1;for(const t in e){const n=e[t];if(ii.has(t))s=!0;else if(Ki(t))i[t]=n;else{const e=hh(n,qo[t]);t.startsWith("origin")?(a=!0,o[t]=e):r[t]=e}}if(e.transform||(s||n?r.transform=function(t,e,n){let r="",i=!0;for(let o=0;o<fh;o++){const s=ri[o],a=t[s];if(void 0===a)continue;let c=!0;if(c="number"==typeof a?a===(s.startsWith("scale")?1:0):0===parseFloat(a),!c||n){const t=hh(a,qo[s]);c||(i=!1,r+=`${dh[s]||s}(${t}) `),n&&(e[s]=t)}}return r=r.trim(),n?r=n(e,i?"":r):i&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),a){const{originX:t="50%",originY:e="50%",originZ:n=0}=o;r.transformOrigin=`${t} ${e} ${n}`}}function mh(t,e,n){return"string"==typeof t?t:eo.transform(e+n*t)}const gh={offset:"stroke-dashoffset",array:"stroke-dasharray"},yh={offset:"strokeDashoffset",array:"strokeDasharray"};function wh(t,{attrX:e,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:c=0,...l},u,h){if(ph(t,l,h),u)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:d,style:f,dimensions:p}=t;d.transform&&(p&&(f.transform=d.transform),delete d.transform),p&&(void 0!==i||void 0!==o||f.transform)&&(f.transformOrigin=function(t,e,n){return`${mh(e,t.x,t.width)} ${mh(n,t.y,t.height)}`}(p,void 0!==i?i:.5,void 0!==o?o:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==s&&function(t,e,n=1,r=0,i=!0){t.pathLength=1;const o=i?gh:yh;t[o.offset]=eo.transform(-r);const s=eo.transform(e),a=eo.transform(n);t[o.array]=`${s} ${a}`}(d,s,a,c,!1)}const vh=t=>"string"==typeof t&&"svg"===t.toLowerCase(),bh={useVisualState:ah({scrapeMotionValuesFromProps:sh,createRenderState:uh,onMount:(t,e,{renderState:n,latestValues:r})=>{bi.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),bi.render((()=>{wh(n,r,vh(e.tagName),t.transformTemplate),rh(e,n)}))}})},Eh={useVisualState:ah({scrapeMotionValuesFromProps:oh,createRenderState:lh})};function Sh(t,e,n){for(const r in e)Ia(e[r])||ih(r,n)||(t[r]=e[r])}function Th(t,n){const r={};return Sh(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},n){return(0,e.useMemo)((()=>{const e=lh();return ph(e,n,t),Object.assign({},e.vars,e.style)}),[n])}(t,n)),r}function xh(t,e){const n={},r=Th(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Ah=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function kh(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Ah.has(t)}let Rh=t=>!kh(t);try{(Ph=require("@emotion/is-prop-valid").default)&&(Rh=t=>t.startsWith("on")?!kh(t):Ph(t))}catch(t){}var Ph;function Ch(t,n,r,i){const o=(0,e.useMemo)((()=>{const e=uh();return wh(e,n,vh(i),t.transformTemplate),{...e.attrs,style:{...e.style}}}),[n]);if(t.style){const e={};Sh(e,t.style,t),o.style={...e,...o.style}}return o}function Oh(t=!1){return(n,r,i,{latestValues:o},s)=>{const a=(th(n)?Ch:xh)(r,o,s,n),c=function(t,e,n){const r={};for(const i in t)"values"===i&&"object"==typeof t.values||(Rh(i)||!0===n&&kh(i)||!e&&!kh(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}(r,"string"==typeof n,t),l=n!==e.Fragment?{...c,...a,ref:i}:{},{children:u}=r,h=(0,e.useMemo)((()=>Ia(u)?u.get():u),[u]);return(0,e.createElement)(n,{...l,children:h})}}function Ih(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return qu({...th(n)?bh:Eh,preloadedFeatures:t,useRender:Oh(r),createVisualElement:e,Component:n})}}const Bh={current:null},Uh={current:!1};const Lh=new WeakMap,Nh=[...po,Io,zo],_h=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class jh{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Eo,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=ss.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,bi.render(this.render,!1,!0))};const{latestValues:a,renderState:c}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=e.initial?{...a}:{},this.renderState=c,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=s,this.blockInitialAnimation=Boolean(i),this.isControllingVariants=Wu(e),this.isVariantNode=Hu(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in u){const e=u[t];void 0!==a[t]&&Ia(e)&&e.set(a[t],!1)}}mount(t){this.current=t,Lh.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),Uh.current||function(){if(Uh.current=!0,Du)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Bh.current=t.matches;t.addListener(e),e()}else Bh.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Bh.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Lh.delete(this.current),this.projection&&this.projection.unmount(),Ei(this.notifyUpdate),Ei(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=ii.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&bi.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),i=e.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),i(),o&&o(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in Yu){const e=Yu[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Nc()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<_h.length;e++){const n=_h[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const i=e[r],o=n[r];if(Ia(i))t.addValue(r,i);else if(Ia(o))t.addValue(r,ka(i,{owner:t}));else if(o!==i)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(r);t.addValue(r,ka(void 0!==e?e:i,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=ka(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];return null!=r&&("string"==typeof r&&(Vi(r)||ji(r))?r=parseFloat(r):!(t=>Nh.find(fo(t)))(r)&&zo.test(e)&&(r=ts(t,e)),this.setBaseTarget(t,Ia(r)?r.get():r)),Ia(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const i=Qr(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);i&&(r=i[t])}if(n&&void 0!==r)return r;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||Ia(i)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new Ta),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Dh extends jh{constructor(){super(...arguments),this.KeyframeResolver=ns}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ia(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class Mh extends Dh{constructor(){super(...arguments),this.type="html",this.renderInstance=eh}readValueFromInstance(t,e){if(ii.has(e)){const t=Qo(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),i=(Ki(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof i?i.trim():i}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Jc(t,e)}build(t,e,n){ph(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return oh(t,e,n)}}class Vh extends Dh{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Nc}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(ii.has(e)){const t=Qo(e);return t&&t.default||0}return e=nh.has(e)?e:Pa(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return sh(t,e,n)}build(t,e,n){wh(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){rh(t,e,0,r)}mount(t){this.isSVGTag=vh(t.tagName),super.mount(t)}}const Fh=Zr(Ih({...Xa,...Lu,...Au,...Nu},((t,n)=>th(t)?new Vh(n):new Mh(n,{allowProjection:t!==e.Fragment}))));function Kh(t){let{onComplete:r}=t;const[i,o]=(0,e.useState)(""),[s,a]=(0,e.useState)(null),[c,l]=(0,e.useState)({length:!1,capital:!1,number:!1,symbol:!1});(0,e.useEffect)((()=>{l({length:i.length>=8,capital:/[A-Z]/.test(i),number:/[0-9]/.test(i),symbol:/[!@#$%^&*(),.?":{}|<>]/.test(i)})}),[i]);const u=Object.values(c).every((t=>t));return n().createElement(Fh.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-col items-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Secure Your Account"),n().createElement("p",{className:"text-gray-600 text-center"},"Choose how you want to secure your data"),s?"pin"===s?n().createElement(Fh.div,{initial:{opacity:0},animate:{opacity:1},className:"w-full max-w-md space-y-4"},n().createElement("input",{type:"password",value:i,onChange:t=>o(t.target.value),placeholder:"Enter your PIN",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"}),n().createElement("div",{className:"space-y-2"},Object.entries(c).map((t=>{let[e,r]=t;return n().createElement("div",{key:e,className:"flex items-center"},n().createElement("span",{className:"material-icons text-sm ".concat(r?"text-green-500":"text-gray-400")},r?"check_circle":"radio_button_unchecked"),n().createElement("span",{className:"ml-2 text-sm ".concat(r?"text-green-600":"text-gray-600")},"length"===e?"At least 8 characters":"capital"===e?"One capital letter":"number"===e?"One number":"One special character"))}))),n().createElement("button",{onClick:async()=>{u&&r({method:"pin",value:i})},disabled:!u,className:"w-full py-3 px-4 rounded-lg font-semibold ".concat(u?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Set PIN")):n().createElement(Fh.div,{initial:{opacity:0},animate:{opacity:1},className:"w-full max-w-md"},n().createElement("button",{onClick:()=>{r({method:"othent"})},className:"w-full py-3 px-4 rounded-lg font-semibold bg-blue-500 text-white hover:bg-blue-600"},"Continue with Othent")):n().createElement("div",{className:"grid grid-cols-1 gap-4 w-full max-w-md"},n().createElement(Fh.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>a("othent"),className:"flex items-center justify-center p-6 rounded-lg border border-gray-300 hover:border-blue-500 bg-white"},n().createElement("img",{src:"https://onairos.sirv.com/Images/othent-icon.png",alt:"Othent",className:"w-8 h-8 mr-3"}),n().createElement("span",{className:"text-gray-700"},"Secure with Google (Othent)")),n().createElement(Fh.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>a("pin"),className:"flex items-center justify-center p-6 rounded-lg border border-gray-300 hover:border-blue-500 bg-white"},n().createElement("span",{className:"material-icons mr-3"},"lock"),n().createElement("span",{className:"text-gray-700"},"Set up PIN"))))}const zh=[{name:"YouTube",icon:"https://onairos.sirv.com/Images/youtube-icon.png",connected:!1},{name:"Reddit",icon:"https://onairos.sirv.com/Images/reddit-icon.png",connected:!1},{name:"Instagram",icon:"https://onairos.sirv.com/Images/instagram-icon.png",connected:!1},{name:"Pinterest",icon:"https://onairos.sirv.com/Images/pinterest-icon.png",connected:!1}];function Wh(t){let{onComplete:r}=t;const[i,o]=(0,e.useState)(zh),[s,a]=(0,e.useState)(!1),[c,l]=(0,e.useState)(0);(0,e.useEffect)((()=>{if(s){const t=setInterval((()=>{l((e=>e>=100?(clearInterval(t),a(!1),r(),100):e+2))}),100);return()=>clearInterval(t)}}),[s,r]);return s?n().createElement(Fh.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Unifying Your Data"),n().createElement("p",{className:"text-gray-600 text-center"},"Please wait while we process your information"),n().createElement("div",{className:"w-full max-w-md"},n().createElement("div",{className:"relative pt-1"},n().createElement("div",{className:"flex mb-2 items-center justify-between"},n().createElement("div",null,n().createElement("span",{className:"text-xs font-semibold inline-block py-1 px-2 uppercase rounded-full text-blue-600 bg-blue-200"},"Progress")),n().createElement("div",{className:"text-right"},n().createElement("span",{className:"text-xs font-semibold inline-block text-blue-600"},c,"%"))),n().createElement(Fh.div,{className:"overflow-hidden h-2 mb-4 text-xs flex rounded bg-blue-200"},n().createElement(Fh.div,{initial:{width:0},animate:{width:"".concat(c,"%")},transition:{duration:.5},className:"shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-blue-500"})))),n().createElement(Fh.div,{animate:{rotate:360},transition:{duration:2,repeat:1/0,ease:"linear"},className:"w-12 h-12"},n().createElement("svg",{className:"w-full h-full text-blue-500",viewBox:"0 0 24 24"},n().createElement("path",{fill:"currentColor",d:"M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"})))):n().createElement("div",{className:"flex flex-col items-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Connect Your Accounts"),n().createElement("p",{className:"text-gray-600 text-center"},"Connect at least one account to create your personality model"),n().createElement("div",{className:"grid grid-cols-2 gap-4 w-full max-w-md"},i.map((t=>n().createElement("button",{key:t.name,onClick:()=>(async t=>{try{(await fetch("https://api2.onairos.uk/connect/".concat(t.toLowerCase()),{method:"POST",headers:{Authorization:"Bearer ".concat(localStorage.getItem("onairosToken")),"Content-Type":"application/json"}})).ok&&o(i.map((e=>e.name===t?{...e,connected:!0}:e)))}catch(e){console.error("Failed to connect to ".concat(t,":"),e)}})(t.name),className:"flex items-center justify-center p-4 rounded-lg border ".concat(t.connected?"bg-green-50 border-green-500":"border-gray-300 hover:border-blue-500")},n().createElement("img",{src:t.icon,alt:t.name,className:"w-8 h-8 mr-2"}),n().createElement("span",{className:t.connected?"text-green-600":"text-gray-700"},t.connected?"Connected":"Connect ".concat(t.name)))))),n().createElement("button",{onClick:async()=>{if(i.some((t=>t.connected))){a(!0);try{(await fetch("https://api2.onairos.uk/unify",{method:"POST",headers:{Authorization:"Bearer ".concat(localStorage.getItem("onairosToken")),"Content-Type":"application/json"}})).ok&&r()}catch(t){console.error("Failed to unify data:",t)}}},disabled:!i.some((t=>t.connected)),className:"w-full max-w-md py-3 px-4 rounded-lg font-semibold ".concat(i.some((t=>t.connected))?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Unify and Create Model"))}(0,e.createContext)(null);function Hh(t){let{onSignUpSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}=t;const[a,c]=(0,e.useState)({email:"",username:"",password:"",confirmPassword:""}),[l,u]=(0,e.useState)(null),h=t=>{c({...a,[t.target.name]:t.target.value})};return n().createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},l&&n().createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},l),n().createElement(zr,{onLoginSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}),n().createElement("div",{className:"w-full flex items-center justify-center space-x-4"},n().createElement("hr",{className:"flex-grow border-gray-300"}),n().createElement("span",{className:"text-gray-500"},"or"),n().createElement("hr",{className:"flex-grow border-gray-300"})),n().createElement("form",{onSubmit:async t=>{if(t.preventDefault(),a.password===a.confirmPassword)try{const t=await fetch("https://api2.onairos.uk/signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a.email,username:a.username,password:a.password})}),e=await t.json();t.ok?(localStorage.setItem("onairosToken",e.token),localStorage.setItem("username",a.username),r(a.username)):u(e.message||"Sign up failed")}catch(t){u("Sign up failed. Please try again.")}else u("Passwords don't match")},className:"w-full space-y-4"},n().createElement("input",{type:"email",name:"email",value:a.email,onChange:h,placeholder:"Email",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"text",name:"username",value:a.username,onChange:h,placeholder:"Username",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"password",name:"password",value:a.password,onChange:h,placeholder:"Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"password",name:"confirmPassword",value:a.confirmPassword,onChange:h,placeholder:"Confirm Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("button",{type:"submit",className:"w-full bg-blue-500 text-white font-semibold py-3 px-4 rounded-lg hover:bg-blue-600 transition-colors"},"Sign Up")))}function $h(t){let{setOthentConnected:n,dataRequester:r,NoAccount:i,NoModel:o,activeModels:s,avatar:a,setAvatar:c,traits:l,setTraits:u,requestData:h,handleConnectionSelection:d,changeGranted:f,granted:p,allowSubmit:m,rejectDataRequest:g,sendDataRequest:y,isAuthenticated:w,onClose:v,onLoginSuccess:b,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T,accountInfo:x}=t;const[A,k]=(0,e.useState)(null),[R,P]=(0,e.useState)(!1),C=(0,e.useRef)(null),[O,I]=(0,e.useState)({}),B=(t,e)=>{console.log(t," is being changed check to:",e),I((n=>({...n,[t]:e}))),f(e?1:-1);const n=h[t];d(r,t,n.index,n.type,n.reward,e),console.log(n," Selection registered"),d(r,t,n.index,n.type,n.reward,!0)},[U,L]=(0,e.useState)((()=>{var t;return w?x&&(null===(t=x.models)||void 0===t?void 0:t.length)>0?"datarequests":"onboarding":"login"})),[N,_]=(0,e.useState)({username:"",password:""}),[j,D]=(0,e.useState)(!1);(0,e.useEffect)((()=>{const t=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty("--vh","".concat(t,"px"))};return t(),window.addEventListener("resize",t),window.addEventListener("orientationchange",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("orientationchange",t)}}),[]);const M=()=>{v()};(0,e.useEffect)((()=>{const t=t=>{C.current&&!C.current.contains(t.target)&&(null==M||M())};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[M]);const V=t=>{_({...N,[t.target.name]:t.target.value})},F=async t=>{t.preventDefault();try{k(null);const t={details:{username:N.username,password:N.password}},e=await fetch("".concat("https://api2.onairos.uk","/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await e.json();if("Accepted"!==n.authentication)throw new Error("Invalid credentials");localStorage.setItem("onairosToken",n.token),localStorage.setItem("username",N.username),await K(N.username)}catch(t){console.error("Login failed:",t),k("Invalid username or password")}},K=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];P(!0);try{await b(t,e);k(null)}catch(t){console.error("Login process failed:",t),k("Failed to complete login process")}finally{P(!1)}},z=()=>{L("security")},W=t=>{"othent"===t.method?E(!0):"pin"===t.method&&T(t.value),L("datarequests")},H=t=>{let{dataRequester:e,granted:n,allowSubmit:r,rejectDataRequest:i,sendDataRequest:o,activeModels:s,requestData:a,handleConnectionSelection:c,changeGranted:l,avatar:u,traits:h}=t;return React.createElement("div",{className:"flex flex-col h-full"},React.createElement("div",{className:"px-6"},React.createElement("h1",{className:"text-lg font-semibold text-gray-900 mb-6"},"Data Requests from ",e),React.createElement("div",{className:"flex items-center justify-between mb-6"},React.createElement("button",{className:"bg-gray-500 hover:bg-gray-600 text-white font-bold py-2 px-8 rounded-full",onClick:i},"Reject All"),React.createElement("button",{disabled:!r||0===n,className:"".concat(r&&n>0?"bg-blue-500 hover:bg-blue-600":"bg-gray-300 cursor-not-allowed"," text-white font-bold py-2 px-8 rounded-full"),onClick:o},"Confirm (",n,")"))),React.createElement("div",{className:"flex-1 overflow-y-auto px-6"},0===s.length?React.createElement("div",{className:"flex flex-col items-center justify-center py-8"},React.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosWhite.png",alt:"Onairos Logo",className:"w-24 h-24 mb-4"}),React.createElement("p",{className:"text-center text-gray-800 font-medium"},"Please connect ",React.createElement("a",{href:"https://onairos.uk/connections",className:"text-blue-500 hover:underline"},"Onairos")," Personality to send ",e," your data")):React.createElement("div",{className:"space-y-4"},Object.keys(a).sort(((t,e)=>{const n=s.includes(a[t].type),r=s.includes(a[e].type);return"Avatar"===a[t].type?1:"Avatar"===a[e].type?-1:"Traits"===a[e].type?1:"Traits"===a[t].type||n&&!r?-1:r&&!n?1:0})).map(((t,e)=>{const n=a[t],r="Personality"===n.type?s.includes(n.type):"Avatar"===n.type?u:"Traits"===n.type&&h;return React.createElement($r,{key:t,active:r,title:n.type,id:n,number:e,descriptions:n.descriptions,rewards:n.reward,size:t,isChecked:!!O[t],onCheckboxChange:e=>B(t,e)})})))))};return(0,e.useEffect)((()=>{var t;w&&x&&((null===(t=x.models)||void 0===t?void 0:t.length)>0?L("datarequests"):L("onboarding"))}),[w,x]),(0,e.useEffect)((()=>()=>{D(!1)}),[]),(0,e.useEffect)((()=>{}),[w,x]),React.createElement(React.Fragment,null,React.createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:M,style:{touchAction:"none"}}),React.createElement("div",{ref:C,className:"fixed bottom-0 left-0 right-0 w-full bg-white rounded-t-3xl shadow-2xl transform transition-transform duration-300 ease-out flex flex-col",style:{maxHeight:"60vh",minHeight:"45vh",height:"auto",touchAction:"none"}},React.createElement("div",{className:"sticky top-0 bg-white z-10 px-6 pt-3 pb-2"},React.createElement("div",{className:"w-12 h-1.5 bg-gray-300 rounded-full mx-auto"})),React.createElement("div",{className:"flex-1 overflow-y-auto px-6 pb-8",style:{touchAction:"pan-y"}},(()=>{switch(U){case"signup":return React.createElement(Hh,{onSignUpSuccess:K,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T});case"onboarding":return React.createElement(Wh,{onComplete:z});case"security":return React.createElement(Kh,{onComplete:W});case"datarequests":return React.createElement(H,{dataRequester:r,granted:p,allowSubmit:m,rejectDataRequest:g,sendDataRequest:y,activeModels:s,requestData:h,handleConnectionSelection:d,changeGranted:f,avatar:a,traits:l});default:return React.createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},A&&React.createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},A),React.createElement(zr,{onLoginSuccess:K,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T}),React.createElement("div",{className:"w-full flex items-center justify-center space-x-4"},React.createElement("hr",{className:"flex-grow border-gray-300"}),React.createElement("span",{className:"text-gray-500"},"or"),React.createElement("hr",{className:"flex-grow border-gray-300"})),React.createElement("form",{onSubmit:F,className:"w-full space-y-4"},React.createElement("input",{type:"text",name:"username",value:N.username,onChange:V,placeholder:"Username",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),React.createElement("input",{type:"password",name:"password",value:N.password,onChange:V,placeholder:"Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),React.createElement("button",{type:"submit",className:"w-full bg-blue-500 text-white font-semibold py-3 px-4 rounded-lg hover:bg-blue-600 transition-colors"},"Sign In")),React.createElement("button",{onClick:()=>L("signup"),className:"w-full text-center text-blue-500 hover:text-blue-600"},"Don't have an account? Sign up"))}})())))}const Zh=async()=>(await a.e(423).then(a.t.bind(a,153,23))).default;function Xh(t){var r,i;let{requestData:o,webpageName:s,inferenceData:a=null,onComplete:c=null,autoFetch:l=!0,proofMode:u=!1,textLayout:h="below",textColor:d="white",login:f=!1,buttonType:p="pill",loginReturn:m=null,loginType:g="signIn",visualType:y="full"}=t;const[w,v]=(0,e.useState)(null),[b,E]=(0,e.useState)(!1),[S,T]=(0,e.useState)([]),[x,A]=(0,e.useState)(0),[k,R]=(0,e.useState)({}),[P,C]=(0,e.useState)(!1),[O,I]=(0,e.useState)(!1),[B,U]=(0,e.useState)(!1),[L,N]=(0,e.useState)(!1),_=(0,e.useRef)(!1),j=(0,e.useRef)(!1),[D,M]=(0,e.useState)(!1),[V,F]=(0,e.useState)(null),[K,z]=(0,e.useState)(!0),[W,H]=(0,e.useState)(null),[$,Z]=(0,e.useState)(null),[X,Y]=(0,e.useState)({show:!1,type:null,data:null}),[G,q]=(0,e.useState)(null),[J,Q]=(0,e.useState)(!1),[tt,et]=(0,e.useState)(!1),nt=(0,e.useRef)(!1),[rt,it]=(0,e.useState)(null),[ot,st]=(0,e.useState)({show:!1,color:null,message:null}),at="https://api2.onairos.uk";(0,e.useEffect)((()=>{const t=new URLSearchParams(window.location.search).get("callbackURL");t&&ct(t);(async()=>{const t=new URL(window.location.href),e=t.searchParams.get("code"),n=t.searchParams.get("state");if(e&&n&&!nt.current&&!tt){nt.current=!0,et(!0);try{await ct(t.toString()),N(!0),window.history.replaceState({},document.title,window.location.pathname)}catch(t){console.error("Auth callback processing failed:",t),it(t.message)}finally{et(!1)}}})()}),[]);const ct=async t=>{try{const e=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!0,auth0LogInMethod:"redirect",auth0RedirectURI:window.location.href,auth0ReturnToURI:window.location.href}),n=await e.completeConnectionAfterRedirect(t);if(!e)throw new Error("Failed to initialize Othent");if(!n||!n.sub)throw new Error("Invalid user details received from Othent");M(!0);const r=(await Zh())(n.sub).toString();H(r);const i=await Mr(r);Z(i.result),F(i.token),await gt(n.email,!0),E(!0),localStorage.setItem("othentToken",JSON.stringify(n)),localStorage.setItem("onairosToken",n.token)}catch(t){throw st({show:!0,color:"red",message:"An error has occured, please try again"}),console.error("Authentication failed:",t),t}};(0,e.useEffect)((()=>{rt&&console.error("Authentication error:",rt)}),[rt]);const lt=()=>{const t=navigator.userAgent||navigator.vendor||window.opera;return/android|iphone|ipad|ipod|windows phone/i.test(t)};(0,e.useEffect)((()=>{if(l&&a&&"function"==typeof c){const t=async t=>{if(t.data&&"content-script"===t.data.source&&"API_URL_RESPONSE"===t.data.type&&"Onairos-Response"===t.data.unique){const{APIurl:e,approved:n,accessToken:r}=t.data,i=(t=>{const e={Small:16,Medium:32,Large:64};let n=null,r=0;return t.forEach((t=>{const i=e[t.data];i>r&&(r=i,n=t)})),r})(n),o={Input:a.slice(0,i)};try{const t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify(o)}),n=await t.json();c(n)}catch(t){console.error(t),c(null,t)}}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}}),[]);const ut=async(t,e,n)=>{const r={Info:{EncryptedUserPin:e,confirmations:t,web3Type:"othent",Domain:window.location.href,proofMode:!1,OthentSub:n}};try{const t=await fetch("https://api2.onairos.uk/getAPIurl",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await t.json();l&&c?c(n):Y({show:!0,type:"apiURL",data:{code:n,state:e}})}catch(t){console.error(t),c&&c(null,t)}},ht=window.location.href;(0,e.useEffect)((()=>{const t=t=>{console.log("Message received in useEffect:",t.data),t.data&&"terminalOpened"===t.data.action&&dt()};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}),[]);const dt=async()=>{try{if(lt())return void await(async()=>{lt()&&E(!0)})();const t=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),e=await t.connect(),n=(await Zh())(e.sub).toString();function r(t){try{const e=window.atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n.buffer}catch(t){console.error("Error converting to Buffer :",t)}}const i=r((await Mr(n)).result);Dr("\n -----BEGIN PUBLIC KEY-----\n MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4wkWvRPaJiY8CwQ5BoJI\n amcGAYV91Bk8NrvWq4PXM+J/RJugfgTNCYKQ/c6g4xa1YES/tJEzFS7nf0Kdoqxm\n 5aav0ru5vS4fc4vCOLTI9W1T7nj02NY91rogsQm2/KMxUQ8DaLeTZKi+0Wjsa9YO\n 6XGGd1wh4azgQkj04MWW5J1EBCcBavKoY+C85oA9jkkklQ8nGWgbugmZs7eXHNQb\n qH8/ZHcB9Kx1CZ6XjQuVd6YE/A+swV+DksbkXANcYjr6SY/2TbB8GfpcOMM3bkyN\n Q8e0A51q5a8abfuAkDZXe67MwKMWu/626abwPZhJrKr5HhRZZDwPtnXlktYHhOK6\n lQIDAQAB\n -----END PUBLIC KEY-----\n ",await t.decrypt(i)).then((t=>{window.postMessage({source:"webpage",type:"GET_API_URL",webpageName:s,domain:ht,requestData:o,proofMode:u,HashedOthentSub:n,EncryptedUserPin:t})})).catch((t=>{console.error("Encryption failed:",t)}))}catch(a){console.error("Error Sending Data to Terminal: ",a)}},ft="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===p?"px-4 py-2":"w-12 h-12"," ").concat(f?"bg-white border border-gray-300":"bg-transparent","\n ").concat(lt()?"":"OnairosConnect","\n "),pt={flexDirection:"below"===h?"column":"row",backgroundColor:f?"#ffffff":"transparent",color:f?"black":d,border:f?"1px solid #ddd":"1px solid transparent"},mt={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"},gt=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=e?{Info:{identifier:t}}:{Info:{userName:t}},r=e?"/getAccountInfo/email":"/getAccountInfo",i=await fetch("".concat(at).concat(r),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("onairosToken"))},body:JSON.stringify(n)});if(!i.ok)throw new Error("Failed to fetch account info");const o=await i.json();return"No Account Found"===o.AccountInfo?(_.current=!0,q(null),null):(q(o.AccountInfo),o.AccountInfo.models?T(o.AccountInfo.models):j.current=!0,o.AccountInfo.avatar&&C(!0),o.AccountInfo.UserTraits&&I(!0),o.AccountInfo.othent&&U(!0),o.AccountInfo)}catch(t){throw console.error("Error fetching account info:",t),t}};(0,e.useEffect)((()=>{lt()&&(async()=>{try{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("token"),n=t||e;if(n){const t=await fetch("https://api2.onairos.uk/verifyToken",{headers:{Authorization:"Bearer ".concat(n)}});if(t.ok)if((await t.json()).valid){F(n),M(!0);const t=localStorage.getItem("username");await gt(t)}else localStorage.removeItem("onairosToken"),localStorage.removeItem("token")}}catch(t){console.error("Token verification failed:",t)}finally{z(!1)}})()}),[]);(0,e.useEffect)((()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username");t&&e&&gt(e,!1)}),[]);return(0,e.useEffect)((()=>{(async()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username"),n=localStorage.getItem("othentToken");if(t)try{if((await fetch("".concat(at,"/verifyToken"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})).ok){if(M(!0),e)await gt(e,!1);else if(n){const t=JSON.parse(n);await gt(t.email,!0)}}else localStorage.removeItem("onairosToken"),localStorage.removeItem("username"),localStorage.removeItem("othentToken")}catch(t){console.error("Token verification failed:",t)}})()}),[]),n().createElement(n().Fragment,null,n().createElement("div",{className:"flex items-center justify-center"},n().createElement("button",{className:ft,onClick:async()=>{console.log("openTerminal clicked"),window.postMessage({source:"webpage",type:"openTerminal",webpageName:s,domain:ht,key:"Key"})},style:pt},("full"===y||"icon"===y)&&n().createElement("img",{src:f?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:mt,className:"".concat("pill"===p?"w-6 h-6":"w-8 h-8"," object-contain")}),("full"===y||"textOnly"===y)&&n().createElement("span",{className:"".concat(f||"black"===d?"text-black":"text-white"," ").concat("icon"===y?"sr-only":""," ").concat("right"===h?"ml-2":"left"===h?"mr-2":"")},(()=>{switch(g){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})()))),ot.show&&n().createElement(Notification,{message:ot.message,color:ot.color}),X.show&&n().createElement("div",{className:"fixed inset-0 z-50 flex items-center justify-center"},n().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>Y({show:!1,type:null,data:null})}),n().createElement("div",{className:"relative bg-white rounded-lg p-6 max-w-lg w-full mx-4 max-h-[80vh] overflow-y-auto"},n().createElement("button",{onClick:()=>Y({show:!1,type:null,data:null}),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600"},n().createElement("span",{className:"sr-only"},"Close"),n().createElement("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},n().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"callback"===X.type?"Callback Details":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"debug"===X.type?"Debug Results":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"apiURL"===X.type?"API Url Returned":"Authentication Result"),n().createElement("div",{className:"bg-gray-50 rounded p-4 overflow-x-auto"},n().createElement("pre",{className:"text-sm"},JSON.stringify(X.data,null,2))),"auth"===X.type&&n().createElement("div",{className:"mt-4 p-3 rounded ".concat(null!==(r=X.data)&&void 0!==r&&r.success?"bg-green-100 text-green-700":"bg-red-100 text-red-700")},null!==(i=X.data)&&void 0!==i&&i.success?"Authentication successful!":"Authentication failed"))),J&&n().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},n().createElement("div",{className:"bg-white p-6 rounded-lg shadow-xl"},n().createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),n().createElement("p",{className:"mt-4 text-gray-600"},"Loading your account..."))),b&&!J&&n().createElement($h,{setOthentConnected:N,dataRequester:s,NoAccount:_,NoModel:j,accountInfo:G,activeModels:S,avatar:P,traits:O,requestData:o,handleConnectionSelection:(t,e,n,r,i,o)=>{R((s=>({...s,["".concat(t,"-").concat(e,"-").concat(n)]:{type:r,reward:i,isSelected:o}})))},changeGranted:t=>{A((e=>Math.max(e+t,0)))},granted:x,allowSubmit:x>0,rejectDataRequest:()=>{E(!1),c&&c("rejected")},sendDataRequest:async()=>{if(!(x<=0))try{const t=Object.values(k).filter((t=>t.isSelected)).map((t=>({type:t.type,reward:t.reward})));if(null==$&&B&&!L){Y({show:!0,type:"debug",data:{code:"Connecting Othent Details",state1:$,state2:L,state3:B}});const e=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),n=await e.connect(),r=(await Zh())(n.sub).toString();H(r);const i=await Mr(n.sub.toString()),o=i.result;Z(o),N(!0),Y({show:!0,type:"callback",data:{code:"Just Before API",state:i.token}}),await ut(t,o,r)}else $&&W?await ut(t,$,W):console.error("Missing required authentication data")}catch(t){console.error("Error in sendDataRequest:",t)}finally{E(!1)}},isAuthenticated:D,onLoginSuccess:async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=await gt(t,e);return M(!0),E(!0),n}catch(t){throw console.error("Login process failed:",t),t}},onClose:()=>{A(0),E(!1)},setOthentUser:U,setHashedOthentSub:H,setEncryptedPin:Z}))}function Yh(t){return n().createElement(n().Fragment,null,n().createElement(Xh,t))}const Gh=Yh})(),c})()));
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["React"],e);else{var n="object"==typeof exports?e(require("react")):e(t.React);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(t=>(()=>{var e,n,r,i,o={317:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>r});const r={}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(431);e.default=class{BigNum;constructor(){this.BigNum=(t,e)=>new(r.BigNumber.clone({DECIMAL_PLACES:e}))(t)}winstonToAr(t,{formatted:e=!1,decimals:n=12,trim:r=!0}={}){let i=this.stringToBigNum(t,n).shiftedBy(-12);return e?i.toFormat(n):i.toFixed(n)}arToWinston(t,{formatted:e=!1}={}){let n=this.stringToBigNum(t).shiftedBy(12);return e?n.toFormat():n.toFixed(0)}compare(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.comparedTo(r)}isEqual(t,e){return 0===this.compare(t,e)}isLessThan(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.isLessThan(r)}isGreaterThan(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.isGreaterThan(r)}add(t,e){let n=this.stringToBigNum(t);this.stringToBigNum(e);return n.plus(e).toFixed(0)}sub(t,e){let n=this.stringToBigNum(t);this.stringToBigNum(e);return n.minus(e).toFixed(0)}stringToBigNum(t,e=12){return this.BigNum(t,e)}}},759:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498);n(317);class i{api;network;static HASH_ENDPOINT="block/hash/";static HEIGHT_ENDPOINT="block/height/";constructor(t,e){this.api=t,this.network=e}async get(t){const e=await this.api.get(`${i.HASH_ENDPOINT}${t}`);if(200===e.status)return e.data;throw 404===e.status?new r.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${e}`)}async getByHeight(t){const e=await this.api.get(`${i.HEIGHT_ENDPOINT}${t}`);if(200===e.status)return e.data;throw 404===e.status?new r.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${e}`)}async getCurrent(){const{current:t}=await this.network.getInfo();return await this.get(t)}}e.default=i},879:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),i=n(244);e.default=class{api;constructor(t){this.api=t}async getTransactionOffset(t){const e=await this.api.get(`tx/${t}/offset`);if(200===e.status)return e.data;throw new Error(`Unable to get transaction offset: ${(0,r.getError)(e)}`)}async getChunk(t){const e=await this.api.get(`chunk/${t}`);if(200===e.status)return e.data;throw new Error(`Unable to get chunk: ${(0,r.getError)(e)}`)}async getChunkData(t){const e=await this.getChunk(t);return i.b64UrlToBuffer(e.chunk)}firstChunkOffset(t){return parseInt(t.offset)-parseInt(t.size)+1}async downloadChunkedData(t){const e=await this.getTransactionOffset(t),n=parseInt(e.size),r=parseInt(e.offset)-n+1,i=new Uint8Array(n);let o=0;for(;o<n;){let t;this.api.config.logging&&console.log(`[chunk] ${o}/${n}`);try{t=await this.getChunkData(r+o)}catch(t){console.error(`[chunk] Failed to fetch chunk at offset ${r+o}`),console.error("[chunk] This could indicate that the chunk wasn't uploaded or hasn't yet seeded properly to a particular gateway/node")}if(!t)throw new Error(`Couldn't complete data download at ${o}/${n}`);i.set(t,o),o+=t.length}return i}}},536:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(586),i=n(874),o=n(363),s=n(248),a=n(935),c=n(927),l=n(825),u=n(244),h=n(243),d=n(879),f=n(759);class p{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new o.default;static utils=u;constructor(t){this.api=new i.default(t),this.wallets=new c.default(this.api,p.crypto),this.chunks=new d.default(this.api),this.transactions=new a.default(this.api,p.crypto,this.chunks),this.silo=new h.default(this.api,this.crypto,this.transactions),this.network=new s.default(this.api),this.blocks=new f.default(this.api,this.network),this.ar=new r.default}get crypto(){return p.crypto}get utils(){return p.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(t,e){const n={};if(Object.assign(n,t),!(t.data||t.target&&t.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(null==t.owner&&e&&"use_wallet"!==e&&(n.owner=e.n),null==t.last_tx&&(n.last_tx=await this.transactions.getTransactionAnchor()),"string"==typeof t.data&&(t.data=u.stringToBuffer(t.data)),t.data instanceof ArrayBuffer&&(t.data=new Uint8Array(t.data)),t.data&&!(t.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(null==t.reward){const e=t.data?t.data.byteLength:0;n.reward=await this.transactions.getPrice(e,n.target)}n.data_root="",n.data_size=t.data?t.data.byteLength.toString():"0",n.data=t.data||new Uint8Array(0);const r=new l.default(n);return await r.getSignatureData(),r}async createSiloTransaction(t,e,n){const r={};if(Object.assign(r,t),!t.data)throw new Error("Silo transactions must have a 'data' value");if(!n)throw new Error("No Silo URI specified.");if(t.target||t.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(null==t.owner){if(!e||!e.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");r.owner=e.n}null==t.last_tx&&(r.last_tx=await this.transactions.getTransactionAnchor());const i=await this.silo.parseUri(n);if("string"==typeof t.data){const e=await this.crypto.encrypt(u.stringToBuffer(t.data),i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=u.bufferTob64Url(e)}if(t.data instanceof Uint8Array){const e=await this.crypto.encrypt(t.data,i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=u.bufferTob64Url(e)}const o=new l.default(r);return o.addTag("Silo-Name",i.getAccessKey()),o.addTag("Silo-Version","0.1.0"),o}arql(t){return this.api.post("/arql",t).then((t=>t.data||[]))}}e.default=p},386:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0});const o=n(536),s=n(118);o.default.init=function(t={}){const e={host:"arweave.net",port:443,protocol:"https"};if("object"!=typeof location||!location.protocol||!location.hostname)return new o.default({...t,...e});const n=location.protocol.replace(":",""),r=location.hostname,i=location.port?parseInt(location.port):"https"==n?443:80,a=(0,s.getDefaultConfig)(n,r),c=t.protocol||a.protocol,l=t.host||a.host,u=t.port||a.port||i;return new o.default({...t,host:l,protocol:c,port:u})},"object"==typeof globalThis?globalThis.Arweave=o.default:"object"==typeof self&&(self.Arweave=o.default),i(n(536),e),e.default=o.default},874:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{METHOD_GET="GET";METHOD_POST="POST";config;constructor(t){this.applyConfig(t)}applyConfig(t){this.config=this.mergeDefaults(t)}getConfig(){return this.config}mergeDefaults(t){const e=t.protocol||"http",n=t.port||("https"===e?443:80);return{host:t.host||"127.0.0.1",protocol:e,port:n,timeout:t.timeout||2e4,logging:t.logging||!1,logger:t.logger||console.log,network:t.network}}async get(t,e){return await this.request(t,{...e,method:this.METHOD_GET})}async post(t,e,n){const r=new Headers(n?.headers||{});return r.get("content-type")?.includes("application/json")||r.append("content-type","application/json"),r.append("accept","application/json, text/plain, */*"),await this.request(t,{...n,method:this.METHOD_POST,body:"string"!=typeof e?JSON.stringify(e):e,headers:r})}async request(t,e){const r=new Headers(e?.headers||{}),i=`${this.config.protocol}://${this.config.host}:${this.config.port}`,o=e?.responseType;delete e?.responseType,t.startsWith("/")&&(t=t.slice(1)),this.config.network&&r.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${i}/${t}`);let s=await fetch(`${i}/${t}`,{...e||{},headers:r});this.config.logging&&this.config.logger(`Response: ${s.url} - ${s.status}`);const a=s.headers.get("content-type"),c=a?.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i)?.[1],l=s,u=async()=>{if(c)try{l.data=new TextDecoder(c).decode(await s.arrayBuffer())}catch(t){l.data=await s.text()}else l.data=await s.text()};if("arraybuffer"===o)l.data=await s.arrayBuffer();else if("text"===o)await u();else if("webstream"===o)l.data=n(s.body);else try{let t=await s.clone().json();"object"!=typeof t?await u():l.data=await s.json(),t=null}catch{await u()}return l}};const n=t=>{const e=t;return void 0===e[Symbol.asyncIterator]?(e[Symbol.asyncIterator]=r(t),e):t},r=function(t){return async function*(){const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)return;yield n}}finally{e.releaseLock()}}}},363:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(244);e.default=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let t=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),e=await this.driver.exportKey("jwk",t.privateKey);return{kty:e.kty,e:e.e,n:e.n,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}}async sign(t,e,{saltLength:n}={}){let r=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(t),e);return new Uint8Array(r)}async hash(t,e="SHA-256"){let n=await this.driver.digest(e,t);return new Uint8Array(n)}async verify(t,e,n){const r={kty:"RSA",e:"AQAB",n:t},i=await this.jwkToPublicCryptoKey(r),o=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-o.byteLength-2},i,n,e);return s||a||c}async jwkToCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if("undefined"==typeof crypto)return!1;const t=crypto?.subtle;if(void 0===t)return!1;return["generateKey","importKey","exportKey","digest","sign"].every((e=>"function"==typeof t[e]))}async encrypt(t,e,n){const i=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=new Uint8Array(16);crypto.getRandomValues(s);const a=await this.driver.encrypt({name:"AES-CBC",iv:s},o,t);return r.concatBuffers([s,a])}async decrypt(t,e,n){const i=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},o,t.slice(16));return r.concatBuffers([a])}}},921:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(536);async function i(t){if(Array.isArray(t)){const e=r.default.utils.concatBuffers([r.default.utils.stringToBuffer("list"),r.default.utils.stringToBuffer(t.length.toString())]);return await o(t,await r.default.crypto.hash(e,"SHA-384"))}const e=r.default.utils.concatBuffers([r.default.utils.stringToBuffer("blob"),r.default.utils.stringToBuffer(t.byteLength.toString())]),n=r.default.utils.concatBuffers([await r.default.crypto.hash(e,"SHA-384"),await r.default.crypto.hash(t,"SHA-384")]);return await r.default.crypto.hash(n,"SHA-384")}async function o(t,e){if(t.length<1)return e;const n=r.default.utils.concatBuffers([e,await i(t[0])]),s=await r.default.crypto.hash(n,"SHA-384");return await o(t.slice(1),s)}e.default=i},498:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getError=void 0;class n extends Error{type;response;constructor(t,e={}){e.message?super(e.message):super(),this.type=t,this.response=e.response}getType(){return this.type}}e.default=n,e.getError=function(t){let e=t.data;if("string"==typeof t.data)try{e=JSON.parse(t.data)}catch(t){}if(t.data instanceof ArrayBuffer||t.data instanceof Uint8Array)try{e=JSON.parse(e.toString())}catch(t){}return e?e.error||e:t.statusText||"unknown"}},224:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.debug=e.validatePath=e.arrayCompare=e.bufferToInt=e.intToBuffer=e.arrayFlatten=e.generateProofs=e.buildLayers=e.generateTransactionChunks=e.generateTree=e.computeRootHash=e.generateLeaves=e.chunkData=e.MIN_CHUNK_SIZE=e.MAX_CHUNK_SIZE=void 0;const r=n(536),i=n(244);e.MAX_CHUNK_SIZE=262144,e.MIN_CHUNK_SIZE=32768;const o=32,s=32;async function a(t){let n=[],i=t,o=0;for(;i.byteLength>=e.MAX_CHUNK_SIZE;){let t=e.MAX_CHUNK_SIZE,s=i.byteLength-e.MAX_CHUNK_SIZE;s>0&&s<e.MIN_CHUNK_SIZE&&(t=Math.ceil(i.byteLength/2));const a=i.slice(0,t),c=await r.default.crypto.hash(a);o+=a.byteLength,n.push({dataHash:c,minByteRange:o-a.byteLength,maxByteRange:o}),i=i.slice(t)}return n.push({dataHash:await r.default.crypto.hash(i),minByteRange:o,maxByteRange:o+i.byteLength}),n}async function c(t){return Promise.all(t.map((async({dataHash:t,minByteRange:e,maxByteRange:n})=>({type:"leaf",id:await m(await Promise.all([m(t),m(g(n))])),dataHash:t,minByteRange:e,maxByteRange:n}))))}async function l(t){return await u(await c(await a(t)))}async function u(t,e=0){if(t.length<2){return t[0]}const n=[];for(let e=0;e<t.length;e+=2)n.push(await p(t[e],t[e+1]));return u(n,e+1)}function h(t){const e=d(t);return Array.isArray(e)?f(e):[e]}function d(t,e=new Uint8Array,n=0){if("leaf"==t.type)return{offset:t.maxByteRange-1,proof:(0,i.concatBuffers)([e,t.dataHash,g(t.maxByteRange)])};if("branch"==t.type){const r=(0,i.concatBuffers)([e,t.leftChild.id,t.rightChild.id,g(t.byteRange)]);return[d(t.leftChild,r,n+1),d(t.rightChild,r,n+1)]}throw new Error("Unexpected node type")}function f(t){const e=[];return t.forEach((t=>{Array.isArray(t)?e.push(...f(t)):e.push(t)})),e}async function p(t,e){if(!e)return t;return{type:"branch",id:await m([await m(t.id),await m(e.id),await m(g(t.maxByteRange))]),byteRange:t.maxByteRange,maxByteRange:e.maxByteRange,leftChild:t,rightChild:e}}async function m(t){return Array.isArray(t)&&(t=r.default.utils.concatBuffers(t)),new Uint8Array(await r.default.crypto.hash(t))}function g(t){const e=new Uint8Array(o);for(var n=e.length-1;n>=0;n--){var r=t%256;e[n]=r,t=(t-r)/256}return e}function y(t){let e=0;for(var n=0;n<t.length;n++)e*=256,e+=t[n];return e}e.chunkData=a,e.generateLeaves=c,e.computeRootHash=async function(t){return(await l(t)).id},e.generateTree=l,e.generateTransactionChunks=async function(t){const e=await a(t),n=await c(e),r=await u(n),i=await h(r),o=e.slice(-1)[0];return o.maxByteRange-o.minByteRange==0&&(e.splice(e.length-1,1),i.splice(i.length-1,1)),{data_root:r.id,chunks:e,proofs:i}},e.buildLayers=u,e.generateProofs=h,e.arrayFlatten=f,e.intToBuffer=g,e.bufferToInt=y;e.arrayCompare=(t,e)=>t.every(((t,n)=>e[n]===t)),e.validatePath=async function t(n,r,i,a,c){if(a<=0)return!1;if(r>=a)return t(n,0,a-1,a,c);if(r<0)return t(n,0,0,a,c);if(c.length==s+o){const t=c.slice(0,s),r=c.slice(t.length,t.length+o),l=await m([await m(t),await m(r)]);return!!(0,e.arrayCompare)(n,l)&&{offset:a-1,leftBound:i,rightBound:a,chunkSize:a-i}}const l=c.slice(0,s),u=c.slice(l.length,l.length+s),h=c.slice(l.length+u.length,l.length+u.length+o),d=y(h),f=c.slice(l.length+u.length+h.length),p=await m([await m(l),await m(u),await m(h)]);return!!(0,e.arrayCompare)(n,p)&&(r<d?await t(l,r,i,Math.min(a,d),f):await t(u,r,Math.max(i,d),a,f))},e.debug=async function t(e,n=""){if(e.byteLength<1)return n;const r=e.slice(0,s),i=e.slice(r.length,r.length+s),a=e.slice(r.length+i.length,r.length+i.length+o),c=y(a),l=e.slice(r.length+i.length+a.length),u=await m([await m(r),await m(i),await m(a)]);return t(l,`${n}\n${JSON.stringify(Buffer.from(r))},${JSON.stringify(Buffer.from(i))},${c} => ${JSON.stringify(u)}`)}},246:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionUploader=void 0;const r=n(825),i=n(244),o=n(498),s=n(224),a=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"];class c{api;chunkIndex=0;txPosted=!1;transaction;lastRequestTimeEnd=0;totalErrors=0;data;lastResponseStatus=0;lastResponseError="";get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(t,e){if(this.api=t,!e.id)throw new Error("Transaction is not signed");if(!e.chunks)throw new Error("Transaction chunks not prepared");this.data=e.data,this.transaction=new r.default(Object.assign({},e,{data:new Uint8Array(0)}))}async uploadChunk(t){if(this.isComplete)throw new Error("Upload is already complete");if(""!==this.lastResponseError?this.totalErrors++:this.totalErrors=0,100===this.totalErrors)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let e=""===this.lastResponseError?0:Math.max(this.lastRequestTimeEnd+4e4-Date.now(),4e4);if(e>0&&(e-=e*Math.random()*.3,await new Promise((t=>setTimeout(t,e)))),this.lastResponseError="",!this.txPosted)return void await this.postTransaction();t&&(this.chunkIndex=t);const n=this.transaction.getChunk(t||this.chunkIndex,this.data);if(!await(0,s.validatePath)(this.transaction.chunks.data_root,parseInt(n.offset),0,parseInt(n.data_size),i.b64UrlToBuffer(n.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);const r=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch((t=>(console.error(t.message),{status:-1,data:{error:t.message}})));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=r.status,200==this.lastResponseStatus)this.chunkIndex++;else if(this.lastResponseError=(0,o.getError)(r),a.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(t,e,n){if(!e||"number"!=typeof e.chunkIndex||"object"!=typeof e.transaction)throw new Error("Serialized object does not match expected format.");var i=new r.default(e.transaction);i.chunks||await i.prepareChunks(n);const o=new c(t,i);if(o.chunkIndex=e.chunkIndex,o.lastRequestTimeEnd=e.lastRequestTimeEnd,o.lastResponseError=e.lastResponseError,o.lastResponseStatus=e.lastResponseStatus,o.txPosted=e.txPosted,o.data=n,o.transaction.data_root!==e.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return o}static async fromTransactionId(t,e){const n=await t.get(`tx/${e}`);if(200!==n.status)throw new Error(`Tx ${e} not found: ${n.status}`);const r=n.data;r.data=new Uint8Array(0);return{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:r}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=1){this.transaction.data=this.data;const t=await this.api.post("tx",this.transaction).catch((t=>(console.error(t),{status:-1,data:{error:t.message}})));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,this.transaction.data=new Uint8Array(0),t.status>=200&&t.status<300)return this.txPosted=!0,void(this.chunkIndex=1);throw this.lastResponseError=(0,o.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`)}const t=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,!(t.status>=200&&t.status<300))throw this.lastResponseError=(0,o.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`);this.txPosted=!0}}e.TransactionUploader=c},825:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Tag=void 0;const r=n(244),i=n(921),o=n(224);class s{get(t,e){if(!Object.getOwnPropertyNames(this).includes(t))throw new Error(`Field "${t}" is not a property of the Arweave Transaction class.`);if(this[t]instanceof Uint8Array)return e&&e.decode&&e.string?r.bufferToString(this[t]):e&&e.decode&&!e.string?this[t]:r.bufferTob64Url(this[t]);if(this[t]instanceof Array){if(void 0!==e?.decode||void 0!==e?.string)throw"tags"===t&&console.warn("Did you mean to use 'transaction[\"tags\"]' ?"),new Error("Cannot decode or stringify an array.");return this[t]}return e&&1==e.decode?e&&e.string?r.b64UrlToString(this[t]):r.b64UrlToBuffer(this[t]):this[t]}}class a extends s{name;value;constructor(t,e,n=!1){super(),this.name=t,this.value=e}}e.Tag=a;e.default=class extends s{format=2;id="";last_tx="";owner="";tags=[];target="";quantity="0";data_size="0";data=new Uint8Array;data_root="";reward="0";signature="";chunks;constructor(t={}){super(),Object.assign(this,t),"string"==typeof this.data&&(this.data=r.b64UrlToBuffer(this.data)),t.tags&&(this.tags=t.tags.map((t=>new a(t.name,t.value))))}addTag(t,e){this.tags.push(new a(r.stringToB64Url(t),r.stringToB64Url(e)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:r.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(t){this.owner=t}setSignature({id:t,owner:e,reward:n,tags:r,signature:i}){this.id=t,this.owner=e,n&&(this.reward=n),r&&(this.tags=r),this.signature=i}async prepareChunks(t){!this.chunks&&t.byteLength>0&&(this.chunks=await(0,o.generateTransactionChunks)(t),this.data_root=r.bufferTob64Url(this.chunks.data_root)),this.chunks||0!==t.byteLength||(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(t,e){if(!this.chunks)throw new Error("Chunks have not been prepared");const n=this.chunks.proofs[t],i=this.chunks.chunks[t];return{data_root:this.data_root,data_size:this.data_size,data_path:r.bufferTob64Url(n.proof),offset:n.offset.toString(),chunk:r.bufferTob64Url(e.slice(i.minByteRange,i.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let t=this.tags.reduce(((t,e)=>r.concatBuffers([t,e.get("name",{decode:!0,string:!1}),e.get("value",{decode:!0,string:!1})])),new Uint8Array);return r.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),r.stringToBuffer(this.quantity),r.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),t]);case 2:this.data_root||await this.prepareChunks(this.data);const e=this.tags.map((t=>[t.get("name",{decode:!0,string:!1}),t.get("value",{decode:!0,string:!1})]));return await(0,i.default)([r.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),r.stringToBuffer(this.quantity),r.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),e,r.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}}},244:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.b64UrlDecode=e.b64UrlEncode=e.bufferTob64Url=e.bufferTob64=e.b64UrlToBuffer=e.stringToB64Url=e.stringToBuffer=e.bufferToString=e.b64UrlToString=e.concatBuffers=void 0;const r=n(742);function i(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function o(t){return(new TextEncoder).encode(t)}function s(t){return new Uint8Array(r.toByteArray(u(t)))}function a(t){return r.fromByteArray(new Uint8Array(t))}function c(t){return l(a(t))}function l(t){try{return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}catch(t){throw new Error("Failed to encode string",{cause:t})}}function u(t){try{let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}catch(t){throw new Error("Failed to decode string",{cause:t})}}e.concatBuffers=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;let n=new Uint8Array(e),r=0;n.set(new Uint8Array(t[0]),r),r+=t[0].byteLength;for(let e=1;e<t.length;e++)n.set(new Uint8Array(t[e]),r),r+=t[e].byteLength;return n},e.b64UrlToString=function(t){return i(s(t))},e.bufferToString=i,e.stringToBuffer=o,e.stringToB64Url=function(t){return c(o(t))},e.b64UrlToBuffer=s,e.bufferTob64=a,e.bufferTob64Url=c,e.b64UrlEncode=l,e.b64UrlDecode=u},118:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultConfig=void 0;e.getDefaultConfig=(t,e)=>{if(((t,e)=>{const n=/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,r=e.split("."),i=r[r.length-1],o=["localhost","[::1]"];return o.includes(e)||"file"==t||o.includes(i)||!!e.match(n)||!!i.match(n)})(t,e))return{protocol:"https",host:"arweave.net",port:443};if(!(t=>{const e="["===t.charAt(0);return!!t.match(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/)||e})(e)){let n=e.split(".");if(n.length>=3){n.shift();return{protocol:t,host:n.join(".")}}}return{protocol:t,host:e}}},248:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{api;constructor(t){this.api=t}getInfo(){return this.api.get("info").then((t=>t.data))}getPeers(){return this.api.get("peers").then((t=>t.data))}}},243:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SiloResource=void 0;const r=n(244);e.default=class{api;crypto;transactions;constructor(t,e,n){this.api=t,this.crypto=e,this.transactions=n}async get(t){if(!t)throw new Error("No Silo URI specified");const e=await this.parseUri(t),n=await this.transactions.search("Silo-Name",e.getAccessKey());if(0==n.length)throw new Error(`No data could be found for the Silo URI: ${t}`);const r=await this.transactions.get(n[0]);if(!r)throw new Error(`No data could be found for the Silo URI: ${t}`);const i=r.get("data",{decode:!0,string:!1});return this.crypto.decrypt(i,e.getEncryptionKey())}async readTransactionData(t,e){if(!e)throw new Error("No Silo URI specified");const n=await this.parseUri(e),r=t.get("data",{decode:!0,string:!1});return this.crypto.decrypt(r,n.getEncryptionKey())}async parseUri(t){const e=t.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!e)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");const n=e[1],o=Math.pow(2,parseInt(e[2])),s=await this.hash(r.stringToBuffer(n),o),a=r.bufferTob64(s.slice(0,15)),c=await this.hash(s.slice(16,31),1);return new i(t,a,c)}async hash(t,e){let n=await this.crypto.hash(t);for(let t=0;t<e-1;t++)n=await this.crypto.hash(n);return n}};class i{uri;accessKey;encryptionKey;constructor(t,e,n){this.uri=t,this.accessKey=e,this.encryptionKey=n}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}}e.SiloResource=i},935:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),i=n(825),o=n(244),s=n(246);n(317);e.default=class{api;crypto;chunks;constructor(t,e,n){this.api=t,this.crypto=e,this.chunks=n}async getTransactionAnchor(){const t=await this.api.get("tx_anchor");if(!t.data.match(/^[a-z0-9_-]{43,}/i)||!t.ok)throw new Error(`Could not getTransactionAnchor. Received: ${t.data}. Status: ${t.status}, ${t.statusText}`);return t.data}async getPrice(t,e){let n=e?`price/${t}/${e}`:`price/${t}`;const r=await this.api.get(n);if(!/^\d+$/.test(r.data)||!r.ok)throw new Error(`Could not getPrice. Received: ${r.data}. Status: ${r.status}, ${r.statusText}`);return r.data}async get(t){const e=await this.api.get(`tx/${t}`);if(200==e.status){const n=parseInt(e.data.data_size);if(e.data.format>=2&&n>0&&n<=12582912){const n=await this.getData(t);return new i.default({...e.data,data:n})}return new i.default({...e.data,format:e.data.format||1})}if(404==e.status)throw new r.default("TX_NOT_FOUND");if(410==e.status)throw new r.default("TX_FAILED");throw new r.default("TX_INVALID")}fromRaw(t){return new i.default(t)}async search(t,e){return this.api.post("arql",{op:"equals",expr1:t,expr2:e}).then((t=>t.data?t.data:[]))}getStatus(t){return this.api.get(`tx/${t}/status`).then((t=>200==t.status?{status:200,confirmed:t.data}:{status:t.status,confirmed:null}))}async getData(t,e){let n;try{n=await this.chunks.downloadChunkedData(t)}catch(e){console.error(`Error while trying to download chunked data for ${t}`),console.error(e)}if(!n){console.warn(`Falling back to gateway cache for ${t}`);try{const{data:e,ok:r,status:i,statusText:o}=await this.api.get(`/${t}`,{responseType:"arraybuffer"});if(!r)throw new Error("Bad http status code",{cause:{status:i,statusText:o}});n=e}catch(e){console.error(`Error while trying to download contiguous data from gateway cache for ${t}`),console.error(e)}}if(!n)throw new Error(`${t} data was not found!`);return e&&e.decode&&!e.string?n:e&&e.decode&&e.string?o.bufferToString(n):o.bufferTob64Url(n)}async sign(t,e,n){const r="object"==typeof e&&(t=>{let e=!0;return["n","e","d","p","q","dp","dq","qi"].map((n=>!(n in t)&&(e=!1))),e})(e),i="object"==typeof arweaveWallet;if(!r&&!i)throw new Error("No valid JWK or external wallet found to sign transaction.");if(r){t.setOwner(e.n);let r=await t.getSignatureData(),i=await this.crypto.sign(e,r,n),s=await this.crypto.hash(i);t.setSignature({id:o.bufferTob64Url(s),owner:e.n,signature:o.bufferTob64Url(i)})}else{if(!i)throw new Error("An error occurred while signing. Check wallet is valid");{try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}const e=await arweaveWallet.sign(t,n);t.setSignature({id:e.id,owner:e.owner,reward:e.reward,tags:e.tags,signature:e.signature})}}}async verify(t){const e=await t.getSignatureData(),n=t.get("signature",{decode:!0,string:!1}),r=o.bufferTob64Url(await this.crypto.hash(n));if(t.id!==r)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(t.owner,e,n)}async post(t){if("string"==typeof t?t=new i.default(JSON.parse(t)):"function"==typeof t.readInt32BE?t=new i.default(JSON.parse(t.toString())):"object"!=typeof t||t instanceof i.default||(t=new i.default(t)),!(t instanceof i.default))throw new Error("Must be Transaction object");t.chunks||await t.prepareChunks(t.data);const e=await this.getUploader(t,t.data);try{for(;!e.isComplete;)await e.uploadChunk()}catch(t){if(e.lastResponseStatus>0)return{status:e.lastResponseStatus,statusText:e.lastResponseError,data:{error:e.lastResponseError}};throw t}return{status:200,statusText:"OK",data:{}}}async getUploader(t,e){let n;if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t instanceof i.default){if(e||(e=t.data),!(e instanceof Uint8Array))throw new Error("Data format is invalid");t.chunks||await t.prepareChunks(e),n=new s.TransactionUploader(this.api,t),n.data&&0!==n.data.length||(n.data=e)}else{if("string"==typeof t&&(t=await s.TransactionUploader.fromTransactionId(this.api,t)),!(e&&e instanceof Uint8Array))throw new Error("Must provide data when resuming upload");n=await s.TransactionUploader.fromSerialized(this.api,t,e)}return n}async*upload(t,e){const n=await this.getUploader(t,e);for(;!n.isComplete;)await n.uploadChunk(),yield n;return n}}},927:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(244);n(317);e.default=class{api;crypto;constructor(t,e){this.api=t,this.crypto=e}getBalance(t){return this.api.get(`wallet/${t}/balance`).then((t=>t.data))}getLastTransactionID(t){return this.api.get(`wallet/${t}/last_tx`).then((t=>t.data))}generate(){return this.crypto.generateJWK()}async jwkToAddress(t){return t&&"use_wallet"!==t?this.getAddress(t):this.getAddress()}async getAddress(t){if(t&&"use_wallet"!==t)return this.ownerToAddress(t.n);try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}async ownerToAddress(t){return r.bufferTob64Url(await this.crypto.hash(r.b64UrlToBuffer(t)))}}},742:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],c=o[1],l=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,c)),u=0,h=c>0?s-4:s;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[u++]=255&e);1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e);return l},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(c(t,a,a+s>l?l:a+s));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},431:function(t,e,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,l="[BigNumber Error] ",u=l+"Number primitive has more than 15 significant digits: ",h=1e14,d=14,f=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,g=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function w(t){for(var e,n,r=1,i=t.length,o=t[0]+"";r<i;){for(e=t[r++]+"",n=d-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(t,e){var n,r,i=t.c,o=e.c,s=t.s,a=e.s,c=t.e,l=e.e;if(!s||!a)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=c==l,!i||!o)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(a=(c=i.length)<(l=o.length)?c:l,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return c==l?0:c>l^n?1:-1}function b(t,e,n,r){if(t<e||t>n||t!==c(t))throw Error(l+(r||"Argument")+("number"==typeof t?t<e||t>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function E(t){var e=t.c.length-1;return y(t.e/d)==e&&t.c[e]%2!=0}function S(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function T(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else e<r&&(t=t.slice(0,e)+"."+t.slice(e));return t}o=function t(e){var n,r,i,o,x,A,k,R,P,C,O=W.prototype={constructor:W,toString:null,valueOf:null},I=new W(1),B=20,U=4,L=-7,N=21,_=-1e7,j=1e7,D=!1,M=1,V=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",z=!0;function W(t,e){var n,o,a,l,h,p,m,g,y=this;if(!(y instanceof W))return new W(t,e);if(null==e){if(t&&!0===t._isBigNumber)return y.s=t.s,void(!t.c||t.e>j?y.c=y.e=null:t.e<_?y.c=[y.e=0]:(y.e=t.e,y.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(y.s=1/t<0?(t=-t,-1):1,t===~~t){for(l=0,h=t;h>=10;h/=10,l++);return void(l>j?y.c=y.e=null:(y.e=l,y.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(y,g,p);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(l=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(l<0&&(l=h),l+=+g.slice(h+1),g=g.substring(0,h)):l<0&&(l=g.length)}else{if(b(e,2,K.length,"Base"),10==e&&z)return X(y=new W(t),B+y.e+1,U);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(y,g,p,e);if(y.s=1/t<0?(g=g.slice(1),-1):1,W.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(u+t)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(n=K.slice(0,e),l=h=0,m=g.length;h<m;h++)if(n.indexOf(o=g.charAt(h))<0){if("."==o){if(h>l){l=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,l=0;continue}return i(y,String(t),p,e)}p=!1,(l=(g=r(g,e,10,y.s)).indexOf("."))>-1?g=g.replace(".",""):l=g.length}for(h=0;48===g.charCodeAt(h);h++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(h,++m)){if(m-=h,p&&W.DEBUG&&m>15&&(t>f||t!==c(t)))throw Error(u+y.s*t);if((l=l-h-1)>j)y.c=y.e=null;else if(l<_)y.c=[y.e=0];else{if(y.e=l,y.c=[],h=(l+1)%d,l<0&&(h+=d),h<m){for(h&&y.c.push(+g.slice(0,h)),m-=d;h<m;)y.c.push(+g.slice(h,h+=d));h=d-(g=g.slice(h)).length}else h-=m;for(;h--;g+="0");y.c.push(+g)}}else y.c=[y.e=0]}function H(t,e,n,r){var i,o,s,a,c;if(null==n?n=U:b(n,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)c=w(t.c),c=1==r||2==r&&(s<=L||s>=N)?S(c,s):T(c,s,"0");else if(o=(t=X(new W(t),e,n)).e,a=(c=w(t.c)).length,1==r||2==r&&(e<=o||o<=L)){for(;a<e;c+="0",a++);c=S(c,o)}else if(e-=s,c=T(c,o,"0"),o+1>a){if(--e>0)for(c+=".";e--;c+="0");}else if((e+=o-a)>0)for(o+1==a&&(c+=".");e--;c+="0");return t.s<0&&i?"-"+c:c}function $(t,e){for(var n,r,i=1,o=new W(t[0]);i<t.length;i++)(!(r=new W(t[i])).s||(n=v(o,r))===e||0===n&&o.s===e)&&(o=r);return o}function Z(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*d-1)>j?t.c=t.e=null:n<_?t.c=[t.e=0]:(t.e=n,t.c=e),t}function X(t,e,n,r){var i,o,s,l,u,f,m,g=t.c,y=p;if(g){t:{for(i=1,l=g[0];l>=10;l/=10,i++);if((o=e-i)<0)o+=d,s=e,u=g[f=0],m=c(u/y[i-s-1]%10);else if((f=a((o+1)/d))>=g.length){if(!r)break t;for(;g.length<=f;g.push(0));u=m=0,i=1,s=(o%=d)-d+1}else{for(u=l=g[f],i=1;l>=10;l/=10,i++);m=(s=(o%=d)-d+i)<0?0:c(u/y[i-s-1]%10)}if(r=r||e<0||null!=g[f+1]||(s<0?u:u%y[i-s-1]),r=n<4?(m||r)&&(0==n||n==(t.s<0?3:2)):m>5||5==m&&(4==n||r||6==n&&(o>0?s>0?u/y[i-s]:0:g[f-1])%10&1||n==(t.s<0?8:7)),e<1||!g[0])return g.length=0,r?(e-=t.e+1,g[0]=y[(d-e%d)%d],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=f,l=1,f--):(g.length=f+1,l=y[d-o],g[f]=s>0?c(u/y[i-s]%y[s])*l:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=l,l=1;s>=10;s/=10,l++);o!=l&&(t.e++,g[0]==h&&(g[0]=1));break}if(g[f]+=l,g[f]!=h)break;g[f--]=0,l=1}for(o=g.length;0===g[--o];g.pop());}t.e>j?t.c=t.e=null:t.e<_&&(t.c=[t.e=0])}return t}function Y(t){var e,n=t.e;return null===n?t.toString():(e=w(t.c),e=n<=L||n>=N?S(e,n):T(e,n,"0"),t.s<0?"-"+e:e)}return W.clone=t,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(l+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(b(n=t[e],0,g,e),B=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(b(n=t[e],0,8,e),U=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(b(n[0],-g,0,e),b(n[1],0,g,e),L=n[0],N=n[1]):(b(n,-g,g,e),L=-(N=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)b(n[0],-g,-1,e),b(n[1],1,g,e),_=n[0],j=n[1];else{if(b(n,-g,g,e),!n)throw Error(l+e+" cannot be zero: "+n);_=-(j=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(l+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!n,Error(l+"crypto unavailable");D=n}else D=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(b(n=t[e],0,9,e),M=n),t.hasOwnProperty(e="POW_PRECISION")&&(b(n=t[e],0,g,e),V=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(l+e+" not an object: "+n);F=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(l+e+" invalid: "+n);z="0123456789"==n.slice(0,10),K=n}}return{DECIMAL_PLACES:B,ROUNDING_MODE:U,EXPONENTIAL_AT:[L,N],RANGE:[_,j],CRYPTO:D,MODULO_MODE:M,POW_PRECISION:V,FORMAT:F,ALPHABET:K}},W.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!W.DEBUG)return!0;var e,n,r=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break t}if((e=(i+1)%d)<1&&(e+=d),String(r[0]).length==e){for(e=0;e<r.length;e++)if((n=r[e])<0||n>=h||n!==c(n))break t;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(l+"Invalid BigNumber: "+t)},W.maximum=W.max=function(){return $(arguments,-1)},W.minimum=W.min=function(){return $(arguments,1)},W.random=(o=9007199254740992,x=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,i,o,s=0,u=[],h=new W(I);if(null==t?t=B:b(t,0,g),i=a(t/d),D)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[s]=n[0],e[s+1]=n[1]):(u.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw D=!1,Error(l+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(u.push(o%1e14),s+=7);s=i/7}if(!D)for(;s<i;)(o=x())<9e15&&(u[s++]=o%1e14);for(i=u[--s],t%=d,i&&t&&(o=p[d-t],u[s]=c(i/o)*o);0===u[s];u.pop(),s--);if(s<0)u=[r=0];else{for(r=-1;0===u[0];u.splice(0,1),r-=d);for(s=1,o=u[0];o>=10;o/=10,s++);s<d&&(r-=d-s)}return h.e=r,h.c=u,h}),W.sum=function(){for(var t=1,e=arguments,n=new W(e[0]);t<e.length;)n=n.plus(e[t++]);return n},r=function(){var t="0123456789";function e(t,e,n,r){for(var i,o,s=[0],a=0,c=t.length;a<c;){for(o=s.length;o--;s[o]*=e);for(s[0]+=r.indexOf(t.charAt(a++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var c,l,u,h,d,f,p,m,g=r.indexOf("."),y=B,v=U;for(g>=0&&(h=V,V=0,r=r.replace(".",""),f=(m=new W(i)).pow(r.length-g),V=h,m.c=e(T(w(f.c),f.e,"0"),10,o,t),m.e=m.c.length),u=h=(p=e(r,i,o,a?(c=K,t):(c=t,K))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--u:(f.c=p,f.e=u,f.s=s,p=(f=n(f,m,y,v,o)).c,d=f.r,u=f.e),g=p[l=u+y+1],h=o/2,d=d||l<0||null!=p[l+1],d=v<4?(null!=g||d)&&(0==v||v==(f.s<0?3:2)):g>h||g==h&&(4==v||d||6==v&&1&p[l-1]||v==(f.s<0?8:7)),l<1||!p[0])r=d?T(c.charAt(1),-y,c.charAt(0)):c.charAt(0);else{if(p.length=l,d)for(--o;++p[--l]>o;)p[l]=0,l||(++u,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,r="";g<=h;r+=c.charAt(p[g++]));r=T(r,u,c.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,c=t.length,l=e%m,u=e/m|0;for(t=t.slice();c--;)a=((i=l*(o=t[c]%m)+(r=u*o+(s=t[c]/m|0)*l)%m*m+a)/n|0)+(r/m|0)+u*s,t[c]=i%n;return a&&(t=[a].concat(t)),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]<e[n]?1:0,t[n]=i*r+t[n]-e[n];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(r,i,o,s,a){var l,u,f,p,m,g,w,v,b,E,S,T,x,A,k,R,P,C=r.s==i.s?1:-1,O=r.c,I=i.c;if(!(O&&O[0]&&I&&I[0]))return new W(r.s&&i.s&&(O?!I||O[0]!=I[0]:I)?O&&0==O[0]||!I?0*C:C/0:NaN);for(b=(v=new W(C)).c=[],C=o+(u=r.e-i.e)+1,a||(a=h,u=y(r.e/d)-y(i.e/d),C=C/d|0),f=0;I[f]==(O[f]||0);f++);if(I[f]>(O[f]||0)&&u--,C<0)b.push(1),p=!0;else{for(A=O.length,R=I.length,f=0,C+=2,(m=c(a/(I[0]+1)))>1&&(I=t(I,m,a),O=t(O,m,a),R=I.length,A=O.length),x=R,S=(E=O.slice(0,R)).length;S<R;E[S++]=0);P=I.slice(),P=[0].concat(P),k=I[0],I[1]>=a/2&&k++;do{if(m=0,(l=e(I,E,R,S))<0){if(T=E[0],R!=S&&(T=T*a+(E[1]||0)),(m=c(T/k))>1)for(m>=a&&(m=a-1),w=(g=t(I,m,a)).length,S=E.length;1==e(g,E,w,S);)m--,n(g,R<w?P:I,w,a),w=g.length,l=1;else 0==m&&(l=m=1),w=(g=I.slice()).length;if(w<S&&(g=[0].concat(g)),n(E,g,S,a),S=E.length,-1==l)for(;e(I,E,R,S)<1;)m++,n(E,R<S?P:I,S,a),S=E.length}else 0===l&&(m++,E=[0]);b[f++]=m,E[0]?E[S++]=O[x]||0:(E=[O[x]],S=1)}while((x++<A||null!=E[0])&&C--);p=null!=E[0],b[0]||b.splice(0,1)}if(a==h){for(f=1,C=b[0];C>=10;C/=10,f++);X(v,o+(v.e=f+u*d-1)+1,s,p)}else v.e=u,v.r=+p;return v}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,k=/^([^.]+)\.$/,R=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(C,"");if(P.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(A,(function(t,e,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?t:e})),r&&(i=r,o=o.replace(k,"$1").replace(R,"0.$1")),e!=o))return new W(o,i);if(W.DEBUG)throw Error(l+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},O.absoluteValue=O.abs=function(){var t=new W(this);return t.s<0&&(t.s=1),t},O.comparedTo=function(t,e){return v(this,new W(t,e))},O.decimalPlaces=O.dp=function(t,e){var n,r,i,o=this;if(null!=t)return b(t,0,g),null==e?e=U:b(e,0,8),X(new W(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-y(this.e/d))*d,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},O.dividedBy=O.div=function(t,e){return n(this,new W(t,e),B,U)},O.dividedToIntegerBy=O.idiv=function(t,e){return n(this,new W(t,e),0,1)},O.exponentiatedBy=O.pow=function(t,e){var n,r,i,o,s,u,h,f,p=this;if((t=new W(t)).c&&!t.isInteger())throw Error(l+"Exponent not an integer: "+Y(t));if(null!=e&&(e=new W(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return f=new W(Math.pow(+Y(p),s?t.s*(2-E(t)):+Y(t))),e?f.mod(e):f;if(u=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new W(NaN);(r=!u&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&E(t)?-0:0,p.e>-1&&(o=1/o),new W(u?1/o:o);V&&(o=a(V/d+2))}for(s?(n=new W(.5),u&&(t.s=1),h=E(t)):h=(i=Math.abs(+Y(t)))%2,f=new W(I);;){if(h){if(!(f=f.times(p)).c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(e))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(X(t=t.times(n),t.e+1,1),t.e>14)h=E(t);else{if(0===(i=+Y(t)))break;h=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(e))}return r?f:(u&&(f=I.div(f)),e?f.mod(e):o?X(f,V,U,undefined):f)},O.integerValue=function(t){var e=new W(this);return null==t?t=U:b(t,0,8),X(e,e.e+1,t)},O.isEqualTo=O.eq=function(t,e){return 0===v(this,new W(t,e))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(t,e){return v(this,new W(t,e))>0},O.isGreaterThanOrEqualTo=O.gte=function(t,e){return 1===(e=v(this,new W(t,e)))||0===e},O.isInteger=function(){return!!this.c&&y(this.e/d)>this.c.length-2},O.isLessThan=O.lt=function(t,e){return v(this,new W(t,e))<0},O.isLessThanOrEqualTo=O.lte=function(t,e){return-1===(e=v(this,new W(t,e)))||0===e},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.minus=function(t,e){var n,r,i,o,s=this,a=s.s;if(e=(t=new W(t,e)).s,!a||!e)return new W(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/d,l=t.e/d,u=s.c,f=t.c;if(!c||!l){if(!u||!f)return u?(t.s=-e,t):new W(f?s:NaN);if(!u[0]||!f[0])return f[0]?(t.s=-e,t):new W(u[0]?s:3==U?-0:0)}if(c=y(c),l=y(l),u=u.slice(),a=c-l){for((o=a<0)?(a=-a,i=u):(l=c,i=f),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=u.length)<(e=f.length))?a:e,a=e=0;e<r;e++)if(u[e]!=f[e]){o=u[e]<f[e];break}if(o&&(i=u,u=f,f=i,t.s=-t.s),(e=(r=f.length)-(n=u.length))>0)for(;e--;u[n++]=0);for(e=h-1;r>a;){if(u[--r]<f[r]){for(n=r;n&&!u[--n];u[n]=e);--u[n],u[r]+=h}u[r]-=f[r]}for(;0==u[0];u.splice(0,1),--l);return u[0]?Z(t,u,l):(t.s=3==U?-1:1,t.c=[t.e=0],t)},O.modulo=O.mod=function(t,e){var r,i,o=this;return t=new W(t,e),!o.c||!t.s||t.c&&!t.c[0]?new W(NaN):!t.c||o.c&&!o.c[0]?new W(o):(9==M?(i=t.s,t.s=1,r=n(o,t,0,3),t.s=i,r.s*=i):r=n(o,t,0,M),(t=o.minus(r.times(t))).c[0]||1!=M||(t.s=o.s),t)},O.multipliedBy=O.times=function(t,e){var n,r,i,o,s,a,c,l,u,f,p,g,w,v,b,E=this,S=E.c,T=(t=new W(t,e)).c;if(!(S&&T&&S[0]&&T[0]))return!E.s||!t.s||S&&!S[0]&&!T||T&&!T[0]&&!S?t.c=t.e=t.s=null:(t.s*=E.s,S&&T?(t.c=[0],t.e=0):t.c=t.e=null),t;for(r=y(E.e/d)+y(t.e/d),t.s*=E.s,(c=S.length)<(f=T.length)&&(w=S,S=T,T=w,i=c,c=f,f=i),i=c+f,w=[];i--;w.push(0));for(v=h,b=m,i=f;--i>=0;){for(n=0,p=T[i]%b,g=T[i]/b|0,o=i+(s=c);o>i;)n=((l=p*(l=S[--s]%b)+(a=g*l+(u=S[s]/b|0)*p)%b*b+w[o]+n)/v|0)+(a/b|0)+g*u,w[o--]=l%v;w[o]=n}return n?++r:w.splice(0,1),Z(t,w,r)},O.negated=function(){var t=new W(this);return t.s=-t.s||null,t},O.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new W(t,e)).s,!i||!e)return new W(NaN);if(i!=e)return t.s=-e,r.minus(t);var o=r.e/d,s=t.e/d,a=r.c,c=t.c;if(!o||!s){if(!a||!c)return new W(i/0);if(!a[0]||!c[0])return c[0]?t:new W(a[0]?r:0*i)}if(o=y(o),s=y(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=c):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(e=c.length)<0&&(n=c,c=a,a=n,e=i),i=0;e;)i=(a[--e]=a[e]+c[e]+i)/h|0,a[e]=h===a[e]?0:a[e]%h;return i&&(a=[i].concat(a),++s),Z(t,a,s)},O.precision=O.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return b(t,1,g),null==e?e=U:b(e,0,8),X(new W(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*d+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&o.e+1>r&&(r=o.e+1),r},O.shiftedBy=function(t){return b(t,-9007199254740991,f),this.times("1e"+t)},O.squareRoot=O.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,c=s.s,l=s.e,u=B+4,h=new W("0.5");if(1!==c||!a||!a[0])return new W(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Y(s)))||c==1/0?(((e=w(a)).length+l)%2==0&&(e+="0"),c=Math.sqrt(+e),l=y((l+1)/2)-(l<0||l%2),r=new W(e=c==1/0?"5e"+l:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+l)):r=new W(c+""),r.c[0])for((c=(l=r.e)+u)<3&&(c=0);;)if(o=r,r=h.times(o.plus(n(s,o,u,1))),w(o.c).slice(0,c)===(e=w(r.c)).slice(0,c)){if(r.e<l&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(X(r,r.e+B+2,1),t=!r.times(r).eq(s));break}if(!i&&(X(o,o.e+B+2,0),o.times(o).eq(s))){r=o;break}u+=4,c+=4,i=1}return X(r,r.e+B+1,U,t)},O.toExponential=function(t,e){return null!=t&&(b(t,0,g),t++),H(this,t,e,1)},O.toFixed=function(t,e){return null!=t&&(b(t,0,g),t=t+this.e+1),H(this,t,e)},O.toFormat=function(t,e,n){var r,i=this;if(null==n)null!=t&&e&&"object"==typeof e?(n=e,e=null):t&&"object"==typeof t?(n=t,t=e=null):n=F;else if("object"!=typeof n)throw Error(l+"Argument not an object: "+n);if(r=i.toFixed(t,e),i.c){var o,s=r.split("."),a=+n.groupSize,c=+n.secondaryGroupSize,u=n.groupSeparator||"",h=s[0],d=s[1],f=i.s<0,p=f?h.slice(1):h,m=p.length;if(c&&(o=a,a=c,c=o,m-=o),a>0&&m>0){for(o=m%a||a,h=p.substr(0,o);o<m;o+=a)h+=u+p.substr(o,a);c>0&&(h+=u+p.slice(o)),f&&(h="-"+h)}r=d?h+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):h}return(n.prefix||"")+r+(n.suffix||"")},O.toFraction=function(t){var e,r,i,o,s,a,c,u,h,f,m,g,y=this,v=y.c;if(null!=t&&(!(c=new W(t)).isInteger()&&(c.c||1!==c.s)||c.lt(I)))throw Error(l+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!v)return new W(y);for(e=new W(I),h=r=new W(I),i=u=new W(I),g=w(v),s=e.e=g.length-y.e-1,e.c[0]=p[(a=s%d)<0?d+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=j,j=1/0,c=new W(g),u.c[0]=0;f=n(c,e,0,1),1!=(o=r.plus(f.times(i))).comparedTo(t);)r=i,i=o,h=u.plus(f.times(o=h)),u=o,e=c.minus(f.times(o=e)),c=o;return o=n(t.minus(r),i,0,1),u=u.plus(o.times(h)),r=r.plus(o.times(i)),u.s=h.s=y.s,m=n(h,i,s*=2,U).minus(y).abs().comparedTo(n(u,r,s,U).minus(y).abs())<1?[h,i]:[u,r],j=a,m},O.toNumber=function(){return+Y(this)},O.toPrecision=function(t,e){return null!=t&&b(t,1,g),H(this,t,e,2)},O.toString=function(t){var e,n=this,i=n.s,o=n.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=L||o>=N?S(w(n.c),o):T(w(n.c),o,"0"):10===t&&z?e=T(w((n=X(new W(n),B+o+1,U)).c),n.e,"0"):(b(t,2,K.length,"Base"),e=r(T(w(n.c),o,"0"),10,t,i,!0)),i<0&&n.c[0]&&(e="-"+e)),e},O.valueOf=O.toJSON=function(){return Y(this)},O._isBigNumber=!0,null!=e&&W.set(e),W}(),o.default=o.BigNumber=o,void 0===(r=function(){return o}.call(e,n,e,t))||(t.exports=r)}()},764:(t,e,n)=>{"use strict";const r=n(742),i=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.lW=c,e.h2=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return l(t,e,n)}function l(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let r=a(n);const i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return f(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return f(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return c.from(r,e,n);const i=function(t){if(c.isBuffer(t)){const e=0|p(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||G(t.length)?a(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return u(t),a(t<0?0:0|p(t))}function d(t){const e=t.length<0?0:0|p(t.length),n=a(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function f(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,c.prototype),r}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(t).length;default:if(i)return r?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,n);case"utf8":case"utf-8":return k(this,e,n);case"ascii":return P(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function w(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(l(t,o+r)!==l(e,r)){n=!1;break}if(n)return o}return-1}function b(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(G(r))return s;t[n+s]=r}return s}function E(t,e,n,r){return X($(e,t.length-n),t,n,r)}function S(t,e,n,r){return X(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function T(t,e,n,r){return X(Z(e),t,n,r)}function x(t,e,n,r){return X(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function k(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(o=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=R));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(t,e,n){return l(t,e,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(t,e,n){return function(t,e,n){return u(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},c.allocUnsafe=function(t){return h(t)},c.allocUnsafeSlow=function(t){return h(t)},c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=c.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(Y(e,Uint8Array))i+e.length>r.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)y(this,e,e+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},c.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?k(this,0,t):g.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){let t="";const n=e.h2;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(t,e,n,r,i){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),l=this.slice(r,i),u=t.slice(e,n);for(let t=0;t<a;++t)if(l[t]!==u[t]){o=l[t],s=u[t];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return w(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return w(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return S(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function O(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=q[t[r]];return i}function I(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function B(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function U(t,e,n,r,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function L(t,e,n,r,i){K(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function N(t,e,n,r,i){K(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function _(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,o){return e=+e,n>>>=0,o||_(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function D(t,e,n,r,o){return e=+e,n>>>=0,o||_(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=J((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),c.prototype.readBigInt64BE=J((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),c.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){U(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){U(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=J((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(t,e=0){return N(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=J((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(t,e=0){return N(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=c.isBuffer(t)?t:c.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const M={};function V(t,e,n){M[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function F(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function K(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new M.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function z(t,e){if("number"!=typeof t)throw new M.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw z(t,n),new M.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=F(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function $(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=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((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}const q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},470:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===n.call(t)},s=function(t){if(!t||"[object Object]"!==n.call(t))return!1;var r,i=e.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!i&&!o)return!1;for(r in t);return void 0===r||e.call(t,r)},a=function(t,e){r&&"__proto__"===e.name?r(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},c=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(i)return i(t,n).value}return t[n]};t.exports=function t(){var e,n,r,i,l,u,h=arguments[0],d=1,f=arguments.length,p=!1;for("boolean"==typeof h&&(p=h,h=arguments[1]||{},d=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});d<f;++d)if(null!=(e=arguments[d]))for(n in e)r=c(h,n),h!==(i=c(e,n))&&(p&&i&&(s(i)||(l=o(i)))?(l?(l=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},a(h,{name:n,newValue:t(p,u,i)})):void 0!==i&&a(h,{name:n,newValue:i}));return h}},645:(t,e)=>{e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[n+f]=255&s,f+=p,s/=256,l-=8);t[n+f-p]|=128*m}},703:(t,e,n)=>{"use strict";var r=n(414);function i(){}function o(){}o.resetWarningCache=i,t.exports=function(){function t(t,e,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},697:(t,e,n)=>{t.exports=n(703)()},414:t=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},251:(t,e,n)=>{"use strict";var r=n(639),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(t,e,n){var r,o={},l=null,u=null;for(r in void 0!==n&&(l=""+n),void 0!==e.key&&(l=""+e.key),void 0!==e.ref&&(u=e.ref),e)s.call(e,r)&&!c.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===o[r]&&(o[r]=e[r]);return{$$typeof:i,type:t,key:l,ref:u,props:o,_owner:a.current}}e.jsx=l,e.jsxs=l},893:(t,e,n)=>{"use strict";t.exports=n(251)},639:e=>{"use strict";e.exports=t}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={exports:{}};return o[t].call(n.exports,n,n.exports,a),n.exports}a.m=o,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},n=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(t,r){if(1&r&&(t=this(t)),8&r)return t;if("object"==typeof t&&t){if(4&r&&t.__esModule)return t;if(16&r&&"function"==typeof t.then)return t}var i=Object.create(null);a.r(i);var o={};e=e||[null,n({}),n([]),n(n)];for(var s=2&r&&t;"object"==typeof s&&!~e.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,a.d(i,o),i},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce(((e,n)=>(a.f[n](t,e),e)),[])),a.u=t=>t+".onairos.bundle.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r={},i="onairos:",a.l=(t,e,n,o)=>{if(r[t])r[t].push(e);else{var s,c;if(void 0!==n)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var h=l[u];if(h.getAttribute("src")==t||h.getAttribute("data-webpack")==i+n){s=h;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",i+n),s.src=t),r[t]=[e];var d=(e,n)=>{s.onerror=s.onload=null,clearTimeout(f);var i=r[t];if(delete r[t],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((t=>t(n))),e)return e(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),c&&document.head.appendChild(s)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&!t;)t=n[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{var t={179:0};a.f.j=(e,n)=>{var r=a.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise(((n,i)=>r=t[e]=[n,i]));n.push(r[2]=i);var o=a.p+a.u(e),s=new Error;a.l(o,(n=>{if(a.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",s.name="ChunkLoadError",s.type=i,s.request=o,r[1](s)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,i,o=n[0],s=n[1],c=n[2],l=0;if(o.some((e=>0!==t[e]))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(c)c(a)}for(e&&e(n);l<o.length;l++)i=o[l],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},n=this.webpackChunkonairos=this.webpackChunkonairos||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var c={};return(()=>{"use strict";a.r(c),a.d(c,{Onairos:()=>Yh,default:()=>Gh});var t={};a.r(t),a.d(t,{hasBrowserEnv:()=>ee,hasStandardBrowserEnv:()=>ne,hasStandardBrowserWebWorkerEnv:()=>ie});var e=a(639),n=a.n(e),r=a(764);function i(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}"function"==typeof SuppressedError&&SuppressedError;var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==a.g?a.g:"undefined"!=typeof self?self:{};function s(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function l(t,e){return t(e={exports:{}},e.exports),e.exports}var u=l((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){var t=this;this.locked=new Map,this.addToLocked=function(e,n){var r=t.locked.get(e);void 0===r?void 0===n?t.locked.set(e,[]):t.locked.set(e,[n]):void 0!==n&&(r.unshift(n),t.locked.set(e,r))},this.isLocked=function(e){return t.locked.has(e)},this.lock=function(e){return new Promise((function(n,r){t.isLocked(e)?t.addToLocked(e,n):(t.addToLocked(e),n())}))},this.unlock=function(e){var n=t.locked.get(e);if(void 0!==n&&0!==n.length){var r=n.pop();t.locked.set(e,n),void 0!==r&&setTimeout(r,0)}else t.locked.delete(e)}}return t.getInstance=function(){return void 0===t.instance&&(t.instance=new t),t.instance},t}();e.default=function(){return n.getInstance()}}));s(u);var h=s(l((function(t,e){var n=o&&o.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(s,a)}c((r=r.apply(t,e||[])).next())}))},r=o&&o.__generator||function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=o;Object.defineProperty(e,"__esModule",{value:!0});var s="browser-tabs-lock-key",a={key:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},getItem:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},clear:function(){return n(i,void 0,void 0,(function(){return r(this,(function(t){return[2,window.localStorage.clear()]}))}))},removeItem:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},setItem:function(t,e){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},keySync:function(t){return window.localStorage.key(t)},getItemSync:function(t){return window.localStorage.getItem(t)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(t){return window.localStorage.removeItem(t)},setItemSync:function(t,e){return window.localStorage.setItem(t,e)}};function c(t){return new Promise((function(e){return setTimeout(e,t)}))}function l(t){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",n="",r=0;r<t;r++)n+=e[Math.floor(61*Math.random())];return n}var h=function(){function t(e){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+l(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=e,void 0===t.waiters&&(t.waiters=[])}return t.prototype.acquireLock=function(e,i){return void 0===i&&(i=5e3),n(this,void 0,void 0,(function(){var n,o,u,h,d,f,p;return r(this,(function(r){switch(r.label){case 0:n=Date.now()+l(4),o=Date.now()+i,u=s+"-"+e,h=void 0===this.storageHandler?a:this.storageHandler,r.label=1;case 1:return Date.now()<o?[4,c(30)]:[3,8];case 2:return r.sent(),null!==h.getItemSync(u)?[3,5]:(d=this.id+"-"+e+"-"+n,[4,c(Math.floor(25*Math.random()))]);case 3:return r.sent(),h.setItemSync(u,JSON.stringify({id:this.id,iat:n,timeoutKey:d,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,c(30)];case 4:return r.sent(),null!==(f=h.getItemSync(u))&&(p=JSON.parse(f)).id===this.id&&p.iat===n?(this.acquiredIatSet.add(n),this.refreshLockWhileAcquired(u,n),[2,!0]):[3,7];case 5:return t.lockCorrector(void 0===this.storageHandler?a:this.storageHandler),[4,this.waitForSomethingToChange(o)];case 6:r.sent(),r.label=7;case 7:return n=Date.now()+l(4),[3,1];case 8:return[2,!1]}}))}))},t.prototype.refreshLockWhileAcquired=function(t,e){return n(this,void 0,void 0,(function(){var i=this;return r(this,(function(o){return setTimeout((function(){return n(i,void 0,void 0,(function(){var n,i,o;return r(this,(function(r){switch(r.label){case 0:return[4,u.default().lock(e)];case 1:return r.sent(),this.acquiredIatSet.has(e)?(n=void 0===this.storageHandler?a:this.storageHandler,null===(i=n.getItemSync(t))?(u.default().unlock(e),[2]):((o=JSON.parse(i)).timeRefreshed=Date.now(),n.setItemSync(t,JSON.stringify(o)),u.default().unlock(e),this.refreshLockWhileAcquired(t,e),[2])):(u.default().unlock(e),[2])}}))}))}),1e3),[2]}))}))},t.prototype.waitForSomethingToChange=function(e){return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){var r=!1,i=Date.now(),o=!1;function s(){if(o||(window.removeEventListener("storage",s),t.removeFromWaiting(s),clearTimeout(a),o=!0),!r){r=!0;var e=50-(Date.now()-i);e>0?setTimeout(n,e):n(null)}}window.addEventListener("storage",s),t.addToWaiting(s);var a=setTimeout(s,Math.max(0,e-Date.now()))}))];case 1:return n.sent(),[2]}}))}))},t.addToWaiting=function(e){this.removeFromWaiting(e),void 0!==t.waiters&&t.waiters.push(e)},t.removeFromWaiting=function(e){void 0!==t.waiters&&(t.waiters=t.waiters.filter((function(t){return t!==e})))},t.notifyWaiters=function(){void 0!==t.waiters&&t.waiters.slice().forEach((function(t){return t()}))},t.prototype.releaseLock=function(t){return n(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.releaseLock__private__(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.releaseLock__private__=function(e){return n(this,void 0,void 0,(function(){var n,i,o,c;return r(this,(function(r){switch(r.label){case 0:return n=void 0===this.storageHandler?a:this.storageHandler,i=s+"-"+e,null===(o=n.getItemSync(i))?[2]:(c=JSON.parse(o)).id!==this.id?[3,2]:[4,u.default().lock(c.iat)];case 1:r.sent(),this.acquiredIatSet.delete(c.iat),n.removeItemSync(i),u.default().unlock(c.iat),t.notifyWaiters(),r.label=2;case 2:return[2]}}))}))},t.lockCorrector=function(e){for(var n=Date.now()-5e3,r=e,i=[],o=0;;){var a=r.keySync(o);if(null===a)break;i.push(a),o++}for(var c=!1,l=0;l<i.length;l++){var u=i[l];if(u.includes(s)){var h=r.getItemSync(u);if(null!==h){var d=JSON.parse(h);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(r.removeItemSync(u),c=!0)}}}c&&t.notifyWaiters()},t.waiters=void 0,t}();e.default=h})));const d={timeoutInSeconds:60},f={name:"auth0-spa-js",version:"2.1.3"},p=()=>Date.now();class m extends Error{constructor(t,e){super(e),this.error=t,this.error_description=e,Object.setPrototypeOf(this,m.prototype)}static fromPayload({error:t,error_description:e}){return new m(t,e)}}class g extends m{constructor(t,e,n,r=null){super(t,e),this.state=n,this.appState=r,Object.setPrototypeOf(this,g.prototype)}}class y extends m{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,y.prototype)}}class w extends y{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,w.prototype)}}class v extends m{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,v.prototype)}}class b extends m{constructor(t,e,n){super(t,e),this.mfa_token=n,Object.setPrototypeOf(this,b.prototype)}}class E extends m{constructor(t,e){super("missing_refresh_token",`Missing Refresh Token (audience: '${S(t,["default"])}', scope: '${S(e)}')`),this.audience=t,this.scope=e,Object.setPrototypeOf(this,E.prototype)}}function S(t,e=[]){return t&&!e.includes(t)?t:""}const T=()=>window.crypto,x=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(T().getRandomValues(new Uint8Array(43))).forEach((n=>e+=t[n%66])),e},A=t=>btoa(t),k=t=>{var{clientId:e}=t,n=i(t,["clientId"]);return new URLSearchParams((t=>Object.keys(t).filter((e=>void 0!==t[e])).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:t[n]})),{}))(Object.assign({client_id:e},n))).toString()},R=t=>(t=>decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),P=async(t,e)=>{const n=await fetch(t,e);return{ok:n.ok,json:await n.json()}},C=async(t,e,n,r,i,o,s=1e4)=>i?(async(t,e,n,r,i,o,s)=>{return a={auth:{audience:e,scope:n},timeout:i,fetchUrl:t,fetchOptions:r,useFormData:s},c=o,new Promise((function(t,e){const n=new MessageChannel;n.port1.onmessage=function(r){r.data.error?e(new Error(r.data.error)):t(r.data),n.port1.close()},c.postMessage(a,[n.port2])}));var a,c})(t,e,n,r,s,i,o):(async(t,e,n)=>{const r=new AbortController;let i;return e.signal=r.signal,Promise.race([P(t,e),new Promise(((t,e)=>{i=setTimeout((()=>{r.abort(),e(new Error("Timeout when executing 'fetch'"))}),n)}))]).finally((()=>{clearTimeout(i)}))})(t,r,s);async function O(t,e){var{baseUrl:n,timeout:r,audience:o,scope:s,auth0Client:a,useFormData:c}=t,l=i(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const u=c?k(l):JSON.stringify(l);return await async function(t,e,n,r,o,s,a){let c,l=null;for(let i=0;i<3;i++)try{c=await C(t,n,r,o,s,a,e),l=null;break}catch(t){l=t}if(l)throw l;const u=c.json,{error:h,error_description:d}=u,f=i(u,["error","error_description"]),{ok:p}=c;if(!p){const e=d||`HTTP error. Unable to fetch ${t}`;if("mfa_required"===h)throw new b(h,e,f.mfa_token);if("missing_refresh_token"===h)throw new E(n,r);throw new m(h||"request_error",e)}return f}(`${n}/oauth/token`,r,o||"default",s,{method:"POST",body:u,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||f))}},e,c)}const I=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e};class B{constructor(t,e="@@auth0spajs@@",n){this.prefix=e,this.suffix=n,this.clientId=t.clientId,this.scope=t.scope,this.audience=t.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(t){const[e,n,r,i]=t.split("::");return new B({clientId:n,scope:i,audience:r},e)}static fromCacheEntry(t){const{scope:e,audience:n,client_id:r}=t;return new B({scope:e,audience:n,clientId:r})}}class U{set(t,e){localStorage.setItem(t,JSON.stringify(e))}get(t){const e=window.localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(t){return}}remove(t){localStorage.removeItem(t)}allKeys(){return Object.keys(window.localStorage).filter((t=>t.startsWith("@@auth0spajs@@")))}}class L{constructor(){this.enclosedCache=function(){let t={};return{set(e,n){t[e]=n},get(e){const n=t[e];if(n)return n},remove(e){delete t[e]},allKeys:()=>Object.keys(t)}}()}}class N{constructor(t,e,n){this.cache=t,this.keyManifest=e,this.nowProvider=n||p}async setIdToken(t,e,n){var r;const i=this.getIdTokenCacheKey(t);await this.cache.set(i,{id_token:e,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(i))}async getIdToken(t){const e=await this.cache.get(this.getIdTokenCacheKey(t.clientId));if(!e&&t.scope&&t.audience){const e=await this.get(t);if(!e)return;if(!e.id_token||!e.decodedToken)return;return{id_token:e.id_token,decodedToken:e.decodedToken}}if(e)return{id_token:e.id_token,decodedToken:e.decodedToken}}async get(t,e=0){var n;let r=await this.cache.get(t.toKey());if(!r){const e=await this.getCacheKeys();if(!e)return;const n=this.matchExistingCacheKey(t,e);n&&(r=await this.cache.get(n))}if(!r)return;const i=await this.nowProvider(),o=Math.floor(i/1e3);return r.expiresAt-e<o?r.body.refresh_token?(r.body={refresh_token:r.body.refresh_token},await this.cache.set(t.toKey(),r),r.body):(await this.cache.remove(t.toKey()),void await(null===(n=this.keyManifest)||void 0===n?void 0:n.remove(t.toKey()))):r.body}async set(t){var e;const n=new B({clientId:t.client_id,scope:t.scope,audience:t.audience}),r=await this.wrapCacheEntry(t);await this.cache.set(n.toKey(),r),await(null===(e=this.keyManifest)||void 0===e?void 0:e.add(n.toKey()))}async clear(t){var e;const n=await this.getCacheKeys();n&&(await n.filter((e=>!t||e.includes(t))).reduce((async(t,e)=>{await t,await this.cache.remove(e)}),Promise.resolve()),await(null===(e=this.keyManifest)||void 0===e?void 0:e.clear()))}async wrapCacheEntry(t){const e=await this.nowProvider();return{body:t,expiresAt:Math.floor(e/1e3)+t.expires_in}}async getCacheKeys(){var t;return this.keyManifest?null===(t=await this.keyManifest.get())||void 0===t?void 0:t.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(t){return new B({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,e){return e.filter((e=>{var n;const r=B.fromKey(e),i=new Set(r.scope&&r.scope.split(" ")),o=(null===(n=t.scope)||void 0===n?void 0:n.split(" "))||[],s=r.scope&&o.reduce(((t,e)=>t&&i.has(e)),!0);return"@@auth0spajs@@"===r.prefix&&r.clientId===t.clientId&&r.audience===t.audience&&s}))[0]}}class _{constructor(t,e,n){this.storage=t,this.clientId=e,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(t){this.storage.save(this.storageKey,t,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const j=t=>"number"==typeof t,D=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"];var M=l((function(t,e){var n=o&&o.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function r(t,e){if(!e)return"";var n="; "+t;return!0===e?n:n+"="+e}function i(t,e,n){return encodeURIComponent(t).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(e).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(t){if("number"==typeof t.expires){var e=new Date;e.setMilliseconds(e.getMilliseconds()+864e5*t.expires),t.expires=e}return r("Expires",t.expires?t.expires.toUTCString():"")+r("Domain",t.domain)+r("Path",t.path)+r("Secure",t.secure)+r("SameSite",t.sameSite)}(n)}function s(t){for(var e={},n=t?t.split("; "):[],r=/(%[\dA-F]{2})+/gi,i=0;i<n.length;i++){var o=n[i].split("="),s=o.slice(1).join("=");'"'===s.charAt(0)&&(s=s.slice(1,-1));try{e[o[0].replace(r,decodeURIComponent)]=s.replace(r,decodeURIComponent)}catch(t){}}return e}function a(){return s(document.cookie)}function c(t,e,r){document.cookie=i(t,e,n({path:"/"},r))}e.__esModule=!0,e.encode=i,e.parse=s,e.getAll=a,e.get=function(t){return a()[t]},e.set=c,e.remove=function(t,e){c(t,"",n(n({},e),{expires:-1}))}}));s(M),M.encode,M.parse,M.getAll;var V=M.get,F=M.set,K=M.remove;const z={get(t){const e=V(t);if(void 0!==e)return JSON.parse(e)},save(t,e,n){let r={};"https:"===window.location.protocol&&(r={secure:!0,sameSite:"none"}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),F(t,JSON.stringify(e),r)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n)}},W={get:t=>z.get(t)||z.get(`_legacy_${t}`),save(t,e,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),F(`_legacy_${t}`,JSON.stringify(e),r),z.save(t,e,n)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n),z.remove(t,e),z.remove(`_legacy_${t}`,e)}},H={get(t){if("undefined"==typeof sessionStorage)return;const e=sessionStorage.getItem(t);return null!=e?JSON.parse(e):void 0},save(t,e){sessionStorage.setItem(t,JSON.stringify(e))},remove(t){sessionStorage.removeItem(t)}};var $,Z=("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,!1,function(t){return $=$||function(t,e,n){var r=void 0===e?null:e,i=function(t,e){var n=atob(t);if(e){for(var r=new Uint8Array(n.length),i=0,o=n.length;i<o;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(t,void 0!==n&&n),o=i.indexOf("\n",10)+1,s=i.substring(o)+(r?"//# sourceMappingURL="+r:""),a=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(a)}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,false),new Worker($,t)});const X={};class Y{constructor(t,e){this.cache=t,this.clientId=e,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(t){var e;const n=new Set((null===(e=await this.cache.get(this.manifestKey))||void 0===e?void 0:e.keys)||[]);n.add(t),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(t){const e=await this.cache.get(this.manifestKey);if(e){const n=new Set(e.keys);return n.delete(t),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(t){return`@@auth0spajs@@::${t}`}}const G={memory:()=>(new L).enclosedCache,localstorage:()=>new U},q=t=>G[t],J=t=>{const{openUrl:e,onRedirect:n}=t,r=i(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===e||e?e:n})},Q=new h;class tt{constructor(t){let e,n;if(this.userCache=(new L).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await Q.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),t),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),t.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!T())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===T().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),t.cache&&t.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),t.cache)n=t.cache;else{if(e=t.cacheLocation||"memory",!q(e))throw new Error(`Invalid cache location "${e}"`);n=q(e)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===t.legacySameSiteCookie?z:W,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(t=>`auth0.${this.options.clientId}.is.authenticated`)(),this.sessionCheckExpiryDays=t.sessionCheckExpiryDays||1;const r=t.useCookiesForTransactions?this.cookieStorage:H;var i;this.scope=I("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new _(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||p,this.cacheManager=new N(n,n.allKeys?void 0:new Y(n,this.options.clientId),this.nowProvider),this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:`https://${i}`),this.tokenIssuer=((t,e)=>t?t.startsWith("https://")?t:`https://${t}/`:`${e}/`)(this.options.issuer,this.domainUrl),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===e&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Z)}_url(t){const e=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||f)));return`${this.domainUrl}${t}&auth0Client=${e}`}_authorizeUrl(t){return this._url(`/authorize?${k(t)}`)}async _verifyIdToken(t,e,n){const r=await this.nowProvider();return(t=>{if(!t.id_token)throw new Error("ID token is required but missing");const e=(t=>{const e=t.split("."),[n,r,i]=e;if(3!==e.length||!n||!r||!i)throw new Error("ID token could not be decoded");const o=JSON.parse(R(r)),s={__raw:t},a={};return Object.keys(o).forEach((t=>{s[t]=o[t],D.includes(t)||(a[t]=o[t])})),{encoded:{header:n,payload:r,signature:i},header:JSON.parse(R(n)),claims:s,user:a}})(t.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==t.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${t.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==e.header.alg)throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||"string"!=typeof e.claims.aud&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==t.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${t.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==t.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but found "${e.claims.aud}"`);if(t.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==t.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`)}if(t.max_age&&!j(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==e.claims.exp||!j(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!j(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=t.leeway||60,r=new Date(t.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(e.claims.exp+n),r>i)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${i})`);if(null!=e.claims.nbf&&j(e.claims.nbf)){const t=new Date(0);if(t.setUTCSeconds(e.claims.nbf-n),r<t)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${r}) is before ${t}`)}if(null!=e.claims.auth_time&&j(e.claims.auth_time)){const i=new Date(0);if(i.setUTCSeconds(parseInt(e.claims.auth_time)+t.max_age+n),r>i)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${r}) is after last auth at ${i}`)}if(t.organization){const n=t.organization.trim();if(n.startsWith("org_")){const t=n;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(t!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${t}", found "${e.claims.org_id}"`)}else{const t=n.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(t!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${t}", found "${e.claims.org_name}"`)}}return e})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:t,nonce:e,organization:n,leeway:this.options.leeway,max_age:(i=this.options.authorizationParams.max_age,"string"!=typeof i?i:parseInt(i,10)||void 0),now:r});var i}_processOrgHint(t){t?this.cookieStorage.save(this.orgHintCookieName,t,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(t,e,n){const r=A(x()),i=A(x()),o=x(),s=(t=>{const e=new Uint8Array(t);return(t=>{const e={"+":"-","/":"_","=":""};return t.replace(/[+/=]/g,(t=>e[t]))})(window.btoa(String.fromCharCode(...Array.from(e))))})(await(async t=>{const e=T().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(t));return await e})(o)),a=((t,e,n,r,i,o,s,a)=>Object.assign(Object.assign(Object.assign({client_id:t.clientId},t.authorizationParams),n),{scope:I(e,n.scope),response_type:"code",response_mode:a||"query",state:r,nonce:i,redirect_uri:s||t.authorizationParams.redirect_uri,code_challenge:o,code_challenge_method:"S256"}))(this.options,this.scope,t,r,i,s,t.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==e?void 0:e.response_mode),c=this._authorizeUrl(a);return{nonce:i,code_verifier:o,scope:a.scope,audience:a.audience||"default",redirect_uri:a.redirect_uri,state:r,url:c}}async loginWithPopup(t,e){var n;if(t=t||{},!(e=e||{}).popup&&(e.popup=(t=>{const e=window.screenX+(window.innerWidth-400)/2,n=window.screenY+(window.innerHeight-600)/2;return window.open("","auth0:authorize:popup",`left=${e},top=${n},width=400,height=600,resizable,scrollbars=yes,status=1`)})(),!e.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const r=await this._prepareAuthorizeUrl(t.authorizationParams||{},{response_mode:"web_message"},window.location.origin);e.popup.location.href=r.url;const i=await(t=>new Promise(((e,n)=>{let r;const i=setInterval((()=>{t.popup&&t.popup.closed&&(clearInterval(i),clearTimeout(o),window.removeEventListener("message",r,!1),n(new v(t.popup)))}),1e3),o=setTimeout((()=>{clearInterval(i),n(new w(t.popup)),window.removeEventListener("message",r,!1)}),1e3*(t.timeoutInSeconds||60));r=function(s){if(s.data&&"authorization_response"===s.data.type){if(clearTimeout(o),clearInterval(i),window.removeEventListener("message",r,!1),t.popup.close(),s.data.response.error)return n(m.fromPayload(s.data.response));e(s.data.response)}},window.addEventListener("message",r)})))(Object.assign(Object.assign({},e),{timeoutInSeconds:e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==i.state)throw new m("state_mismatch","Invalid state");const o=(null===(n=t.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:o})}async getUser(){var t;const e=await this._getIdTokenFromCache();return null===(t=null==e?void 0:e.decodedToken)||void 0===t?void 0:t.user}async getIdTokenClaims(){var t;const e=await this._getIdTokenFromCache();return null===(t=null==e?void 0:e.decodedToken)||void 0===t?void 0:t.claims}async loginWithRedirect(t={}){var e;const n=J(t),{openUrl:r,fragment:o,appState:s}=n,a=i(n,["openUrl","fragment","appState"]),c=(null===(e=a.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,l=await this._prepareAuthorizeUrl(a.authorizationParams||{}),{url:u}=l,h=i(l,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},h),{appState:s}),c&&{organization:c}));const d=o?`${u}#${o}`:u;r?await r(d):window.location.assign(d)}async handleRedirectCallback(t=window.location.href){const e=t.split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const{state:n,code:r,error:i,error_description:o}=(t=>{t.indexOf("#")>-1&&(t=t.substring(0,t.indexOf("#")));const e=new URLSearchParams(t);return{state:e.get("state"),code:e.get("code")||void 0,error:e.get("error")||void 0,error_description:e.get("error_description")||void 0}})(e.join("")),s=this.transactionManager.get();if(!s)throw new m("missing_transaction","Invalid state");if(this.transactionManager.remove(),i)throw new g(i,o||i,n,s.appState);if(!s.code_verifier||s.state&&s.state!==n)throw new m("state_mismatch","Invalid state");const a=s.organization,c=s.nonce,l=s.redirect_uri;return await this._requestToken(Object.assign({audience:s.audience,scope:s.scope,code_verifier:s.code_verifier,grant_type:"authorization_code",code:r},l?{redirect_uri:l}:{}),{nonceIn:c,organization:a}),{appState:s.appState}}async checkSession(t){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(t)}catch(t){}}async getTokenSilently(t={}){var e;const n=Object.assign(Object.assign({cacheMode:"on"},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:I(this.scope,null===(e=t.authorizationParams)||void 0===e?void 0:e.scope)})}),r=await((t,e)=>{let n=X[e];return n||(n=t().finally((()=>{delete X[e],n=null})),X[e]=n),n})((()=>this._getTokenSilently(n)),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return t.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(t){const{cacheMode:e}=t,n=i(t,["cacheMode"]);if("off"!==e){const t=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(t)return t}if("cache-only"!==e){if(!await(async(t,e=3)=>{for(let n=0;n<e;n++)if(await t())return!0;return!1})((()=>Q.acquireLock("auth0.lock.getTokenSilently",5e3)),10))throw new y;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),"off"!==e){const t=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(t)return t}const t=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,access_token:i,oauthTokenScope:o,expires_in:s}=t;return Object.assign(Object.assign({id_token:r,access_token:i},o?{scope:o}:null),{expires_in:s})}finally{await Q.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(t={},e={}){var n;const r=Object.assign(Object.assign({},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:I(this.scope,null===(n=t.authorizationParams)||void 0===n?void 0:n.scope)})});return e=Object.assign(Object.assign({},d),e),await this.loginWithPopup(r,e),(await this.cacheManager.get(new B({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(t){null!==t.clientId?t.clientId=t.clientId||this.options.clientId:delete t.clientId;const e=t.logoutParams||{},{federated:n}=e,r=i(e,["federated"]),o=n?"&federated":"";return this._url(`/v2/logout?${k(Object.assign({clientId:t.clientId},r))}`)+o}async logout(t={}){const e=J(t),{openUrl:n}=e,r=i(e,["openUrl"]);null===t.clientId?await this.cacheManager.clear():await this.cacheManager.clear(t.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");const o=this._buildLogoutUrl(r);n?await n(o):!1!==n&&window.location.assign(o)}async _getTokenFromIFrame(t){const e=Object.assign(Object.assign({},t.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!e.organization&&(e.organization=n);const{url:r,state:i,nonce:o,code_verifier:s,redirect_uri:a,scope:c,audience:l}=await this._prepareAuthorizeUrl(e,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new m("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const n=t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,u=await((t,e,n=60)=>new Promise(((r,i)=>{const o=window.document.createElement("iframe");o.setAttribute("width","0"),o.setAttribute("height","0"),o.style.display="none";const s=()=>{window.document.body.contains(o)&&(window.document.body.removeChild(o),window.removeEventListener("message",a,!1))};let a;const c=setTimeout((()=>{i(new y),s()}),1e3*n);a=function(t){if(t.origin!=e)return;if(!t.data||"authorization_response"!==t.data.type)return;const n=t.source;n&&n.close(),t.data.response.error?i(m.fromPayload(t.data.response)):r(t.data.response),clearTimeout(c),window.removeEventListener("message",a,!1),setTimeout(s,2e3)},window.addEventListener("message",a,!1),window.document.body.appendChild(o),o.setAttribute("src",t)})))(r,this.domainUrl,n);if(i!==u.state)throw new m("state_mismatch","Invalid state");const h=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:s,code:u.code,grant_type:"authorization_code",redirect_uri:a,timeout:t.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:o,organization:e.organization});return Object.assign(Object.assign({},h),{scope:c,oauthTokenScope:h.scope,audience:l})}catch(t){throw"login_required"===t.error&&this.logout({openUrl:!1}),t}}async _getTokenUsingRefreshToken(t){const e=await this.cacheManager.get(new B({scope:t.authorizationParams.scope,audience:t.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(e&&e.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw new E(t.authorizationParams.audience||"default",t.authorizationParams.scope)}const n=t.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,r="number"==typeof t.timeoutInSeconds?1e3*t.timeoutInSeconds:null;try{const i=await this._requestToken(Object.assign(Object.assign(Object.assign({},t.authorizationParams),{grant_type:"refresh_token",refresh_token:e&&e.refresh_token,redirect_uri:n}),r&&{timeout:r}));return Object.assign(Object.assign({},i),{scope:t.authorizationParams.scope,oauthTokenScope:i.scope,audience:t.authorizationParams.audience||"default"})}catch(e){if((e.message.indexOf("Missing Refresh Token")>-1||e.message&&e.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw e}}async _saveEntryInCache(t){const{id_token:e,decodedToken:n}=t,r=i(t,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:e,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,t.id_token,t.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const t=this.options.authorizationParams.audience||"default",e=await this.cacheManager.getIdToken(new B({clientId:this.options.clientId,audience:t,scope:this.scope})),n=this.userCache.get("@@user@@");return e&&e.id_token===(null==n?void 0:n.id_token)?n:(this.userCache.set("@@user@@",e),e)}async _getEntryFromCache({scope:t,audience:e,clientId:n}){const r=await this.cacheManager.get(new B({scope:t,audience:e,clientId:n}),60);if(r&&r.access_token){const{access_token:t,oauthTokenScope:e,expires_in:n}=r,i=await this._getIdTokenFromCache();return i&&Object.assign(Object.assign({id_token:i.id_token,access_token:t},e?{scope:e}:null),{expires_in:n})}}async _requestToken(t,e){const{nonceIn:n,organization:r}=e||{},i=await O(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},t),this.worker),o=await this._verifyIdToken(i.id_token,n,r);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},i),{decodedToken:o,scope:t.scope,audience:t.audience||"default"}),i.scope?{oauthTokenScope:i.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(r||o.claims.org_id),Object.assign(Object.assign({},i),{decodedToken:o})}}var et=a(470);function nt(t,e){return function(){return t.apply(e,arguments)}}const{toString:rt}=Object.prototype,{getPrototypeOf:it}=Object,ot=(st=Object.create(null),t=>{const e=rt.call(t);return st[e]||(st[e]=e.slice(8,-1).toLowerCase())});var st;const at=t=>(t=t.toLowerCase(),e=>ot(e)===t),ct=t=>e=>typeof e===t,{isArray:lt}=Array,ut=ct("undefined");const ht=at("ArrayBuffer");const dt=ct("string"),ft=ct("function"),pt=ct("number"),mt=t=>null!==t&&"object"==typeof t,gt=t=>{if("object"!==ot(t))return!1;const e=it(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},yt=at("Date"),wt=at("File"),vt=at("Blob"),bt=at("FileList"),Et=at("URLSearchParams");function St(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),lt(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let s;for(r=0;r<o;r++)s=i[r],e.call(null,t[s],s,t)}}function Tt(t,e){e=e.toLowerCase();const n=Object.keys(t);let r,i=n.length;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}const xt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,At=t=>!ut(t)&&t!==xt;const kt=(Rt="undefined"!=typeof Uint8Array&&it(Uint8Array),t=>Rt&&t instanceof Rt);var Rt;const Pt=at("HTMLFormElement"),Ct=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Ot=at("RegExp"),It=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};St(n,((n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)})),Object.defineProperties(t,r)},Bt="abcdefghijklmnopqrstuvwxyz",Ut="0123456789",Lt={DIGIT:Ut,ALPHA:Bt,ALPHA_DIGIT:Bt+Bt.toUpperCase()+Ut};const Nt=at("AsyncFunction"),_t={isArray:lt,isArrayBuffer:ht,isBuffer:function(t){return null!==t&&!ut(t)&&null!==t.constructor&&!ut(t.constructor)&&ft(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||ft(t.append)&&("formdata"===(e=ot(t))||"object"===e&&ft(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&ht(t.buffer),e},isString:dt,isNumber:pt,isBoolean:t=>!0===t||!1===t,isObject:mt,isPlainObject:gt,isUndefined:ut,isDate:yt,isFile:wt,isBlob:vt,isRegExp:Ot,isFunction:ft,isStream:t=>mt(t)&&ft(t.pipe),isURLSearchParams:Et,isTypedArray:kt,isFileList:bt,forEach:St,merge:function t(){const{caseless:e}=At(this)&&this||{},n={},r=(r,i)=>{const o=e&&Tt(n,i)||i;gt(n[o])&&gt(r)?n[o]=t(n[o],r):gt(r)?n[o]=t({},r):lt(r)?n[o]=r.slice():n[o]=r};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&St(arguments[t],r);return n},extend:(t,e,n,{allOwnKeys:r}={})=>(St(e,((e,r)=>{n&&ft(e)?t[r]=nt(e,n):t[r]=e}),{allOwnKeys:r}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],r&&!r(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&it(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:ot,kindOfTest:at,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return-1!==r&&r===n},toArray:t=>{if(!t)return null;if(lt(t))return t;let e=t.length;if(!pt(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const r=[];for(;null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:Pt,hasOwnProperty:Ct,hasOwnProp:Ct,reduceDescriptors:It,freezeMethods:t=>{It(t,((e,n)=>{if(ft(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];ft(r)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(t,e)=>{const n={},r=t=>{t.forEach((t=>{n[t]=!0}))};return lt(t)?r(t):r(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,n){return e.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(t,e)=>(t=+t,Number.isFinite(t)?t:e),findKey:Tt,global:xt,isContextDefined:At,ALPHABET:Lt,generateString:(t=16,e=Lt.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n},isSpecCompliantForm:function(t){return!!(t&&ft(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(mt(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const i=lt(t)?[]:{};return St(t,((t,e)=>{const o=n(t,r+1);!ut(o)&&(i[e]=o)})),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Nt,isThenable:t=>t&&(mt(t)||ft(t))&&ft(t.then)&&ft(t.catch)};function jt(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}_t.inherits(jt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_t.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Dt=jt.prototype,Mt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{Mt[t]={value:t}})),Object.defineProperties(jt,Mt),Object.defineProperty(Dt,"isAxiosError",{value:!0}),jt.from=(t,e,n,r,i,o)=>{const s=Object.create(Dt);return _t.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),jt.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const Vt=jt;function Ft(t){return _t.isPlainObject(t)||_t.isArray(t)}function Kt(t){return _t.endsWith(t,"[]")?t.slice(0,-2):t}function zt(t,e,n){return t?t.concat(e).map((function(t,e){return t=Kt(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const Wt=_t.toFlatObject(_t,{},null,(function(t){return/^is[A-Z]/.test(t)}));const Ht=function(t,e,n){if(!_t.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=_t.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!_t.isUndefined(e[t])}))).metaTokens,i=n.visitor||l,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&_t.isSpecCompliantForm(e);if(!_t.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(_t.isDate(t))return t.toISOString();if(!a&&_t.isBlob(t))throw new Vt("Blob is not supported. Use a Buffer instead.");return _t.isArrayBuffer(t)||_t.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function l(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(_t.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(_t.isArray(t)&&function(t){return _t.isArray(t)&&!t.some(Ft)}(t)||(_t.isFileList(t)||_t.endsWith(n,"[]"))&&(a=_t.toArray(t)))return n=Kt(n),a.forEach((function(t,r){!_t.isUndefined(t)&&null!==t&&e.append(!0===s?zt([n],r,o):null===s?n:n+"[]",c(t))})),!1;return!!Ft(t)||(e.append(zt(i,n,o),c(t)),!1)}const u=[],h=Object.assign(Wt,{defaultVisitor:l,convertValue:c,isVisitable:Ft});if(!_t.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!_t.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),_t.forEach(n,(function(n,o){!0===(!(_t.isUndefined(n)||null===n)&&i.call(e,n,_t.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])})),u.pop()}}(t),e};function $t(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function Zt(t,e){this._pairs=[],t&&Ht(t,this,e)}const Xt=Zt.prototype;Xt.append=function(t,e){this._pairs.push([t,e])},Xt.toString=function(t){const e=t?function(e){return t.call(this,e,$t)}:$t;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const Yt=Zt;function Gt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qt(t,e,n){if(!e)return t;const r=n&&n.encode||Gt,i=n&&n.serialize;let o;if(o=i?i(e,n):_t.isURLSearchParams(e)?e.toString():new Yt(e,n).toString(r),o){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}const Jt=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_t.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},Qt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},te={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Yt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ee="undefined"!=typeof window&&"undefined"!=typeof document,ne=(re="undefined"!=typeof navigator&&navigator.product,ee&&["ReactNative","NativeScript","NS"].indexOf(re)<0);var re;const ie="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,oe={...t,...te};const se=function(t){function e(t,n,r,i){let o=t[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=t.length;if(o=!o&&_t.isArray(r)?r.length:o,a)return _t.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&_t.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&_t.isArray(r[o])&&(r[o]=function(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],e[o]=t[o];return e}(r[o])),!s}if(_t.isFormData(t)&&_t.isFunction(t.entries)){const n={};return _t.forEachEntry(t,((t,r)=>{e(function(t){return _t.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),r,n,0)})),n}return null};const ae={transitional:Qt,adapter:["xhr","http"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=_t.isObject(t);i&&_t.isHTMLForm(t)&&(t=new FormData(t));if(_t.isFormData(t))return r&&r?JSON.stringify(se(t)):t;if(_t.isArrayBuffer(t)||_t.isBuffer(t)||_t.isStream(t)||_t.isFile(t)||_t.isBlob(t))return t;if(_t.isArrayBufferView(t))return t.buffer;if(_t.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Ht(t,new oe.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,r){return oe.isNode&&_t.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=_t.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Ht(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(_t.isString(t))try{return(e||JSON.parse)(t),_t.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||ae.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(t&&_t.isString(t)&&(n&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw Vt.from(t,Vt.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oe.classes.FormData,Blob:oe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_t.forEach(["delete","get","head","post","put","patch"],(t=>{ae.headers[t]={}}));const ce=ae,le=_t.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ue=Symbol("internals");function he(t){return t&&String(t).trim().toLowerCase()}function de(t){return!1===t||null==t?t:_t.isArray(t)?t.map(de):String(t)}function fe(t,e,n,r,i){return _t.isFunction(r)?r.call(this,e,n):(i&&(e=n),_t.isString(e)?_t.isString(r)?-1!==e.indexOf(r):_t.isRegExp(r)?r.test(e):void 0:void 0)}class pe{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=he(e);if(!i)throw new Error("header name must be a non-empty string");const o=_t.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=de(t))}const o=(t,e)=>_t.forEach(t,((t,n)=>i(t,n,e)));return _t.isPlainObject(t)||t instanceof this.constructor?o(t,e):_t.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim())?o((t=>{const e={};let n,r,i;return t&&t.split("\n").forEach((function(t){i=t.indexOf(":"),n=t.substring(0,i).trim().toLowerCase(),r=t.substring(i+1).trim(),!n||e[n]&&le[n]||("set-cookie"===n?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)})),e})(t),e):null!=t&&i(e,t,n),this}get(t,e){if(t=he(t)){const n=_t.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}(t);if(_t.isFunction(e))return e.call(this,t,n);if(_t.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=he(t)){const n=_t.findKey(this,t);return!(!n||void 0===this[n]||e&&!fe(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=he(t)){const i=_t.findKey(n,t);!i||e&&!fe(0,n[i],i,e)||(delete n[i],r=!0)}}return _t.isArray(t)?t.forEach(i):i(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const i=e[n];t&&!fe(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return _t.forEach(this,((r,i)=>{const o=_t.findKey(n,i);if(o)return e[o]=de(r),void delete e[i];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(i):String(i).trim();s!==i&&delete e[i],e[s]=de(r),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return _t.forEach(this,((n,r)=>{null!=n&&!1!==n&&(e[r]=t&&_t.isArray(n)?n.join(", "):n)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach((t=>n.set(t))),n}static accessor(t){const e=(this[ue]=this[ue]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=he(t);e[r]||(!function(t,e){const n=_t.toCamelCase(" "+e);["get","set","has"].forEach((r=>{Object.defineProperty(t,r+n,{value:function(t,n,i){return this[r].call(this,e,t,n,i)},configurable:!0})}))}(n,t),e[r]=!0)}return _t.isArray(t)?t.forEach(r):r(t),this}}pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_t.reduceDescriptors(pe.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),_t.freezeMethods(pe);const me=pe;function ge(t,e){const n=this||ce,r=e||n,i=me.from(r.headers);let o=r.data;return _t.forEach(t,(function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)})),i.normalize(),o}function ye(t){return!(!t||!t.__CANCEL__)}function we(t,e,n){Vt.call(this,null==t?"canceled":t,Vt.ERR_CANCELED,e,n),this.name="CanceledError"}_t.inherits(we,Vt,{__CANCEL__:!0});const ve=we;const be=oe.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];_t.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),_t.isString(r)&&s.push("path="+r),_t.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ee(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Se=oe.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let n;function r(n){let r=n;return t&&(e.setAttribute("href",r),r=e.href),e.setAttribute("href",r),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return n=r(window.location.href),function(t){const e=_t.isString(t)?r(t):t;return e.protocol===n.protocol&&e.host===n.host}}():function(){return!0};const Te=function(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const c=Date.now(),l=r[s];i||(i=c),n[o]=a,r[o]=c;let u=s,h=0;for(;u!==o;)h+=n[u++],u%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-i<e)return;const d=l&&c-l;return d?Math.round(1e3*h/d):void 0}};function xe(t,e){let n=0;const r=Te(50,250);return i=>{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-n,c=r(a);n=o;const l={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:i};l[e?"download":"upload"]=!0,t(l)}}const Ae={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){let r=t.data;const i=me.from(t.headers).normalize();let o,s,{responseType:a,withXSRFToken:c}=t;function l(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}if(_t.isFormData(r))if(oe.hasStandardBrowserEnv||oe.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(s=i.getContentType())){const[t,...e]=s?s.split(";").map((t=>t.trim())).filter(Boolean):[];i.setContentType([t||"multipart/form-data",...e].join("; "))}let u=new XMLHttpRequest;if(t.auth){const e=t.auth.username||"",n=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(e+":"+n))}const h=Ee(t.baseURL,t.url);function d(){if(!u)return;const r=me.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new Vt("Request failed with status code "+n.status,[Vt.ERR_BAD_REQUEST,Vt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}((function(t){e(t),l()}),(function(t){n(t),l()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:t,request:u}),u=null}if(u.open(t.method.toUpperCase(),qt(h,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=d:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=function(){u&&(n(new Vt("Request aborted",Vt.ECONNABORTED,t,u)),u=null)},u.onerror=function(){n(new Vt("Network Error",Vt.ERR_NETWORK,t,u)),u=null},u.ontimeout=function(){let e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const r=t.transitional||Qt;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new Vt(e,r.clarifyTimeoutError?Vt.ETIMEDOUT:Vt.ECONNABORTED,t,u)),u=null},oe.hasStandardBrowserEnv&&(c&&_t.isFunction(c)&&(c=c(t)),c||!1!==c&&Se(h))){const e=t.xsrfHeaderName&&t.xsrfCookieName&&be.read(t.xsrfCookieName);e&&i.set(t.xsrfHeaderName,e)}void 0===r&&i.setContentType(null),"setRequestHeader"in u&&_t.forEach(i.toJSON(),(function(t,e){u.setRequestHeader(e,t)})),_t.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),a&&"json"!==a&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",xe(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",xe(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=e=>{u&&(n(!e||e.type?new ve(null,t,u):e),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const f=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(h);f&&-1===oe.protocols.indexOf(f)?n(new Vt("Unsupported protocol "+f+":",Vt.ERR_BAD_REQUEST,t)):u.send(r||null)}))}};_t.forEach(Ae,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const ke=t=>`- ${t}`,Re=t=>_t.isFunction(t)||null===t||!1===t,Pe=t=>{t=_t.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o<e;o++){let e;if(n=t[o],r=n,!Re(n)&&(r=Ae[(e=String(n)).toLowerCase()],void 0===r))throw new Vt(`Unknown adapter '${e}'`);if(r)break;i[e||"#"+o]=r}if(!r){const t=Object.entries(i).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));let n=e?t.length>1?"since :\n"+t.map(ke).join("\n"):" "+ke(t[0]):"as no adapter specified";throw new Vt("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return r};function Ce(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ve(null,t)}function Oe(t){Ce(t),t.headers=me.from(t.headers),t.data=ge.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Pe(t.adapter||ce.adapter)(t).then((function(e){return Ce(t),e.data=ge.call(t,t.transformResponse,e),e.headers=me.from(e.headers),e}),(function(e){return ye(e)||(Ce(t),e&&e.response&&(e.response.data=ge.call(t,t.transformResponse,e.response),e.response.headers=me.from(e.response.headers))),Promise.reject(e)}))}const Ie=t=>t instanceof me?t.toJSON():t;function Be(t,e){e=e||{};const n={};function r(t,e,n){return _t.isPlainObject(t)&&_t.isPlainObject(e)?_t.merge.call({caseless:n},t,e):_t.isPlainObject(e)?_t.merge({},e):_t.isArray(e)?e.slice():e}function i(t,e,n){return _t.isUndefined(e)?_t.isUndefined(t)?void 0:r(void 0,t,n):r(t,e,n)}function o(t,e){if(!_t.isUndefined(e))return r(void 0,e)}function s(t,e){return _t.isUndefined(e)?_t.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function a(n,i,o){return o in e?r(n,i):o in t?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e)=>i(Ie(t),Ie(e),!0)};return _t.forEach(Object.keys(Object.assign({},t,e)),(function(r){const o=c[r]||i,s=o(t[r],e[r],r);_t.isUndefined(s)&&o!==a||(n[r]=s)})),n}const Ue="1.6.5",Le={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Le[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const Ne={};Le.transitional=function(t,e,n){function r(t,e){return"[Axios v1.6.5] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,i,o)=>{if(!1===t)throw new Vt(r(i," has been removed"+(e?" in "+e:"")),Vt.ERR_DEPRECATED);return e&&!Ne[i]&&(Ne[i]=!0,console.warn(r(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,i,o)}};const _e={assertOptions:function(t,e,n){if("object"!=typeof t)throw new Vt("options must be an object",Vt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const e=t[o],n=void 0===e||s(e,o,t);if(!0!==n)throw new Vt("option "+o+" must be "+n,Vt.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Vt("Unknown option "+o,Vt.ERR_BAD_OPTION)}},validators:Le},je=_e.validators;class De{constructor(t){this.defaults=t,this.interceptors={request:new Jt,response:new Jt}}request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Be(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&_e.assertOptions(n,{silentJSONParsing:je.transitional(je.boolean),forcedJSONParsing:je.transitional(je.boolean),clarifyTimeoutError:je.transitional(je.boolean)},!1),null!=r&&(_t.isFunction(r)?e.paramsSerializer={serialize:r}:_e.assertOptions(r,{encode:je.function,serialize:je.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&_t.merge(i.common,i[e.method]);i&&_t.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=me.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let u,h=0;if(!a){const t=[Oe.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,c),u=t.length,l=Promise.resolve(e);h<u;)l=l.then(t[h++],t[h++]);return l}u=s.length;let d=e;for(h=0;h<u;){const t=s[h++],e=s[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{l=Oe.call(this,d)}catch(t){return Promise.reject(t)}for(h=0,u=c.length;h<u;)l=l.then(c[h++],c[h++]);return l}getUri(t){return qt(Ee((t=Be(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}_t.forEach(["delete","get","head","options"],(function(t){De.prototype[t]=function(e,n){return this.request(Be(n||{},{method:t,url:e,data:(n||{}).data}))}})),_t.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(Be(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}De.prototype[t]=e(),De.prototype[t+"Form"]=e(!0)}));const Me=De;class Ve{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const n=this;this.promise.then((t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null})),this.promise.then=t=>{let e;const r=new Promise((t=>{n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t,r,i){n.reason||(n.reason=new ve(t,r,i),e(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;const e=new Ve((function(e){t=e}));return{token:e,cancel:t}}}const Fe=Ve;const Ke={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ke).forEach((([t,e])=>{Ke[e]=t}));const ze=Ke;const We=function t(e){const n=new Me(e),r=nt(Me.prototype.request,n);return _t.extend(r,Me.prototype,n,{allOwnKeys:!0}),_t.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Be(e,n))},r}(ce);We.Axios=Me,We.CanceledError=ve,We.CancelToken=Fe,We.isCancel=ye,We.VERSION=Ue,We.toFormData=Ht,We.AxiosError=Vt,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=function(t){return function(e){return t.apply(null,e)}},We.isAxiosError=function(t){return _t.isObject(t)&&!0===t.isAxiosError},We.mergeConfig=Be,We.AxiosHeaders=me,We.formToJSON=t=>se(_t.isHTMLForm(t)?new FormData(t):t),We.getAdapter=Pe,We.HttpStatusCode=ze,We.default=We;const He=We;var $e=a(742),Ze=Object.create,Xe=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ge=Object.getOwnPropertyNames,qe=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty,Qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),tn=(t,e,n)=>(n=null!=t?Ze(qe(t)):{},((t,e,n,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of Ge(e))!Je.call(t,i)&&i!==n&&Xe(t,i,{get:()=>e[i],enumerable:!(r=Ye(e,i))||r.enumerable});return t})(!e&&t&&t.__esModule?n:Xe(n,"default",{value:t,enumerable:!0}),t)),en=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var e=t.length,n=e%4;if(!n)return t;var r=e,i=4-n,o=e+i,s=Buffer.alloc(o);for(s.write(t);i--;)s.write("=",r++);return s.toString()}})),nn=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=en();function n(t,e){return void 0===e&&(e="utf8"),Buffer.isBuffer(t)?i(t.toString("base64")):i(Buffer.from(t,e).toString("base64"))}function r(t){return t=t.toString(),e.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function i(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var o=n;o.encode=n,o.decode=function(t,e){return void 0===e&&(e="utf8"),Buffer.from(r(t),"base64").toString(e)},o.toBase64=r,o.fromBase64=i,o.toBuffer=function(t){return Buffer.from(r(t),"base64")},t.default=o})),rn=Qe(((t,e)=>{e.exports=nn().default,e.exports.default=e.exports})),on=Qe((t=>{t.byteLength=function(t){var e=s(t),n=e[0],r=e[1];return 3*(n+r)/4-r},t.toByteArray=function(t){var e,n,o=s(t),a=o[0],c=o[1],l=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,c)),u=0,h=c>0?a-4:a;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[u++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e),l},t.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(c(t,a,a+s>l?l:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};var e,n=[],r=[],i=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(e=0,64;e<64;++e)n[e]=o[e],r[o.charCodeAt(e)]=e;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function a(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function c(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(a(r));return i.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63})),sn=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=on();function n(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function r(t){return(new TextEncoder).encode(t)}function i(t){return new Uint8Array(e.toByteArray(c(t)))}function o(t){return e.fromByteArray(new Uint8Array(t))}function s(t){return a(o(t))}function a(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}function c(t){let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}t.concatBuffers=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;let n=new Uint8Array(e),r=0;n.set(new Uint8Array(t[0]),r),r+=t[0].byteLength;for(let e=1;e<t.length;e++)n.set(new Uint8Array(t[e]),r),r+=t[e].byteLength;return n},t.b64UrlToString=function(t){return n(i(t))},t.bufferToString=n,t.stringToBuffer=r,t.stringToB64Url=function(t){return s(r(t))},t.b64UrlToBuffer=i,t.bufferTob64=o,t.bufferTob64Url=s,t.b64UrlEncode=a,t.b64UrlDecode=c})),an=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=sn();t.default=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let t=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),e=await this.driver.exportKey("jwk",t.privateKey);return{kty:e.kty,e:e.e,n:e.n,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}}async sign(t,e,{saltLength:n}={}){let r=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(t),e);return new Uint8Array(r)}async hash(t,e="SHA-256"){let n=await this.driver.digest(e,t);return new Uint8Array(n)}async verify(t,e,n){let r={kty:"RSA",e:"AQAB",n:t},i=await this.jwkToPublicCryptoKey(r),o=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-o.byteLength-2},i,n,e);return s||a||c}async jwkToCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let t=crypto?.subtle;return void 0!==t&&["generateKey","importKey","exportKey","digest","sign"].every((e=>"function"==typeof t[e]))}async encrypt(t,n,r){let i=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=new Uint8Array(16);crypto.getRandomValues(s);let a=await this.driver.encrypt({name:"AES-CBC",iv:s},o,t);return e.concatBuffers([s,a])}async decrypt(t,n,r){let i=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},o,t.slice(16));return e.concatBuffers([a])}}})),cn=Qe((t=>{t.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)},t.write=function(t,e,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[n+f]=255&s,f+=p,s/=256,l-=8);t[n+f-p]|=128*m}})),ln=Qe((t=>{var e=on(),n=cn(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;var i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if(("string"!=typeof e||""===e)&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=0|f(t,e),r=o(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Z(t,Uint8Array)){let e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return u(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Z(t,ArrayBuffer)||t&&Z(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Z(t,SharedArrayBuffer)||t&&Z(t.buffer,SharedArrayBuffer)))return h(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);let i=function(t){if(s.isBuffer(t)){let e=0|d(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||X(t.length)?o(0):u(t);if("Buffer"===t.type&&Array.isArray(t.data))return u(t.data)}(t);if(i)return i;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return c(t),o(t<0?0:0|d(t))}function u(t){let e=t.length<0?0:0|d(t.length),n=o(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function h(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,s.prototype),r}function d(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function f(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Z(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return x(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return R(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.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:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(l(t,o+r)!==l(e,r)){n=!1;break}if(n)return o}return-1}function w(t,e,n,r){n=Number(n)||0;let i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;let o,s=e.length;for(r>s/2&&(r=s/2),o=0;o<r;++o){let r=parseInt(e.substr(2*o,2),16);if(X(r))return o;t[n+o]=r}return o}function v(t,e,n,r){return $(W(e,t.length-n),t,n,r)}function b(t,e,n,r){return $(function(t){let e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function E(t,e,n,r){return $(H(e),t,n,r)}function S(t,e,n,r){return $(function(t,e){let n,r,i,o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function T(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function x(t,e,n){n=Math.min(t.length,n);let r=[],i=e;for(;i<n;){let e=t[i],o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(o=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){let e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=A));return n}(r)}t.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch{return!1}}(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,n){return a(t,e,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,n){return function(t,e,n){return c(t),t<=0?o(t):void 0!==e?"string"==typeof n?o(t).fill(e,n):o(t).fill(e):o(t)}(t,e,n)},s.allocUnsafe=function(t){return l(t)},s.allocUnsafeSlow=function(t){return l(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Z(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let r=s.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){let e=t[n];if(Z(e,Uint8Array))i+e.length>r.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},s.prototype.swap32=function(){let t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},s.prototype.swap64=function(){let t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},s.prototype.toString=function(){let t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){let e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,i){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),c=Math.min(o,a),l=this.slice(r,i),u=t.slice(e,n);for(let t=0;t<c;++t)if(l[t]!==u[t]){o=l[t],a=u[t];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},s.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},s.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}let i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>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,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function k(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function R(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function P(t,e,n){let r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=Y[t[r]];return i}function C(t,e,n){let r=t.slice(e,n),i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function O(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,n,r,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function B(t,e,n,r,i){V(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function U(t,e,n,r,i){V(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function L(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(t,e,r,i,o){return e=+e,r>>>=0,o||L(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function _(t,e,r,i,o){return e=+e,r>>>=0,o||L(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){let n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);let r=this.subarray(t,e);return Object.setPrototypeOf(r,s.prototype),r},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=G((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=G((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);let n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);let n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=G((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),s.prototype.readBigInt64BE=G((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){I(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){I(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=G((function(t,e=0){return B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=G((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){let r=Math.pow(2,8*n-1);I(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){let r=Math.pow(2,8*n-1);I(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=G((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=G((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return N(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return _(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return _(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!r&&0!==r&&(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n||0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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),t.length-e<r-n&&(r=t.length-e+n);let i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},s.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){let e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{let o=s.isBuffer(t)?t:s.from(t,r),a=o.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%a]}return this};var j={};function D(t,e,n){j[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function M(t){let e="",n=t.length,r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function V(t,e,n,r,i,o){if(t>n||t<e){let r,i="bigint"==typeof e?"n":"";throw r=o>3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${e}${i} and <= ${n}${i}`,new j.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){F(e,"offset"),(void 0===t[e]||void 0===t[e+n])&&K(e,t.length-(n+1))}(r,i,o)}function F(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,n){throw Math.floor(t)!==t?(F(t,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new j.ERR_BUFFER_OUT_OF_BOUNDS:new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=M(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=M(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);var z=/[^+/0-9A-Za-z-_]/g;function W(t,e){e=e||1/0;let n,r=t.length,i=null,o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=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((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function $(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function X(t){return t!=t}var Y=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function G(t){return typeof BigInt>"u"?q:t}function q(){throw new Error("BigInt not supported")}})),un=Qe(((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:ln().Buffer,Crypto:window.crypto}):e.exports={Buffer:ln().Buffer,Crypto:crypto}})),hn={};((t,e)=>{for(var n in e)Xe(t,n,{get:e[n],enumerable:!0})})(hn,{AVSCTap:()=>Cn,ArweaveSigner:()=>xn,DataItem:()=>Mn,MAX_TAG_BYTES:()=>jn,MIN_BINARY_SIZE:()=>Dn,SIG_CONFIG:()=>Tn,SignatureConfig:()=>wn,Signer:()=>dn,createData:()=>Fn,deserializeTags:()=>Bn,indexToType:()=>An,serializeTags:()=>On,tagsExceedLimit:()=>In});var dn=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,n,r){throw new Error("You must implement verify method on child")}},fn=tn(rn(),1),pn=tn(sn(),1);async function mn(t){if(Array.isArray(t)){let e=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("list"),(0,pn.stringToBuffer)(t.length.toString())]);return await gn(t,await Sn().hash(e,"SHA-384"))}let e=t,n=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("blob"),(0,pn.stringToBuffer)(e.byteLength.toString())]),r=(0,pn.concatBuffers)([await Sn().hash(n,"SHA-384"),await Sn().hash(e,"SHA-384")]);return await Sn().hash(r,"SHA-384")}async function gn(t,e){if(t.length<1)return e;let n=(0,pn.concatBuffers)([e,await mn(t[0])]),r=await Sn().hash(n,"SHA-384");return await gn(t.slice(1),r)}var yn,wn,vn=tn(an(),1),bn=vn.default.default?vn.default.default:vn.default,En=class extends bn{getPublicKey(t){throw new Error("Unimplemented")}};function Sn(){return yn??=new En}!function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"}(wn||(wn={}));var Tn={[wn.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[wn.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[wn.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[wn.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[wn.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[wn.MULTIAPTOS]:{sigLength:2052,pubLength:1025,sigName:"multiAptos"},[wn.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},xn=class{signatureType=1;ownerLength=Tn[1].pubLength;signatureLength=Tn[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return fn.default.toBuffer(this.pk)}sign(t){return Sn().sign(this.jwk,t)}static async verify(t,e,n){return await Sn().verify(t,e,n)}},An={1:xn},kn=tn(rn(),1);async function Rn(t){return mn([(0,pn.stringToBuffer)("dataitem"),(0,pn.stringToBuffer)("1"),(0,pn.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function Pn(t,e){let{signature:n,id:r}=await async function(t,e){let n=await Rn(t),r=await e.sign(n),i=await Sn().hash(r);return{signature:Buffer.from(r),id:Buffer.from(i)}}(t,e);return t.getRaw().set(n,2),r}var Cn=class{buf;pos;constructor(t=Buffer.alloc(jn),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e,n=t.length;if(n)for(this.writeLong(n),e=0;e<n;e++){let n=t[e];if(void 0===n?.name||void 0===n?.value)throw new Error(`Invalid tag format for ${n}, expected {name:string, value: string}`);this.writeString(n.name),this.writeString(n.value)}this.writeLong(0)}toBuffer(){let t=Buffer.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e,n,r=this.buf;if(t>=-1073741824&&t<1073741824){n=t>=0?t<<1:~t<<1|1;do{r[this.pos]=127&n,n>>=7}while(n&&(r[this.pos++]|=128))}else{e=t>=0?2*t:2*-t-1;do{r[this.pos]=127&e,e/=128}while(e>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(t){let e=Buffer.byteLength(t),n=this.buf;this.writeLong(e);let r=this.pos;if(this.pos+=e,!(this.pos>n.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,o,s,a;for(i=0,o=e;i<o;i++)s=t.charCodeAt(i),s<128?n[r++]=s:s<2048?(n[r++]=s>>6|192,n[r++]=63&s|128):55296==(64512&s)&&56320==(64512&(a=t.charCodeAt(i+1)))?(s=65536+((1023&s)<<10)+(1023&a),i++,n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}this.buf=n}}readLong(){let t,e,n,r,i=0,o=0,s=this.buf;do{t=s[this.pos++],e=128&t,i|=(127&t)<<o,o+=7}while(e&&o<28);if(e){n=i,r=268435456;do{t=s[this.pos++],n+=(127&t)*r,r*=128}while(128&t);return(n%2?-(n+1):n)/2}return i>>1^-(1&i)}skipLong(){let t=this.buf;for(;128&t[this.pos++];);}readTags(){let t,e=[];for(;t=this.readLong();)for(t<0&&(t=-t,this.skipLong());t--;){let t=this.readString(),n=this.readString();e.push({name:t,value:n})}return e}readString(){let t=this.readLong(),e=this.pos,n=this.buf;if(this.pos+=t,!(this.pos>n.length))return this.buf.slice(e,e+t).toString()}};function On(t){let e=new Cn;return e.writeTags(t),e.toBuffer()}function In(t){let e=new Cn;return e.writeTags(t),e.tagsExceedLimit()}function Bn(t){return new Cn(t).readTags()}function Un(t){let e=0;for(let n=t.length-1;n>=0;n--)e=256*e+t[n];return e}function Ln(t){let e=[0,0,0,0,0,0,0,0];for(let n=0;n<e.length;n++){let r=255&t;e[n]=r,t=(t-r)/256}return Uint8Array.from(e)}var Nn=tn(un(),1),_n=tn(ln(),1),jn=4096,Dn=80,Mn=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return void 0!==t.binary}get signatureType(){let t=Un(this.binary.subarray(0,2));if(void 0!==wn?.[t])return t;throw new Error("Unknown signature type: "+t)}async isValid(){return Mn.verify(this.binary)}get id(){return(async()=>kn.default.encode(await this.rawId))()}set id(t){this._id=kn.default.toBuffer(t)}get rawId(){return(async()=>_n.Buffer.from(await Nn.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return kn.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return Tn[this.signatureType].sigLength}get owner(){return kn.default.encode(this.rawOwner)}get ownerLength(){return Tn[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):_n.Buffer.alloc(0)}get target(){return kn.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):_n.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Un(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(0==Un(this.binary.subarray(t,t+8)))return[];let e=Un(this.binary.subarray(t+8,t+16));return Bn(_n.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map((t=>({name:kn.default.encode(t.name),value:kn.default.encode(t.value)})))}getStartOfData(){let t=this.getTagsStart();return t+16+Un(this.binary.subarray(t+8,t+16))}get rawData(){let t=this.getTagsStart(),e=t+16+Un(this.binary.subarray(t+8,t+16));return this.binary.subarray(e,this.binary.length)}get data(){return kn.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Pn(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=_n.Buffer.from(await Sn().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map((t=>({name:kn.default.encode(t.name),value:kn.default.encode(t.value)}))),data:this.data}}static async verify(t){if(t.byteLength<Dn)return!1;let e=new Mn(t),n=e.signatureType,r=e.getTagsStart(),i=Un(t.subarray(r,r+8)),o=Un(t.subarray(r+8,r+16));if(o>jn)return!1;if(i>0)try{if(Bn(_n.Buffer.from(t.subarray(r+16,r+16+o))).length!==i)return!1}catch{return!1}let s=An[n],a=await Rn(e);return await s.verify(e.rawOwner,a,e.rawSignature)}async getSignatureData(){return Rn(this)}getTagsStart(){let t=this.getTargetStart(),e=t+(1==this.binary[t]?33:1);return e+=1==this.binary[e]?33:1,e}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1;return t+=1==this.binary[this.getTargetStart()]?32:0,t}},Vn=tn(rn(),1);function Fn(t,e,n){let r=e.publicKey,i=n?.target?Vn.default.toBuffer(n.target):null,o=1+(i?.byteLength??0),s=n?.anchor?Buffer.from(n.anchor):null,a=1+(s?.byteLength??0),c=(n?.tags?.length??0)>0?On(n.tags):null,l=16+(c?c.byteLength:0),u=Buffer.from(t),h=u.byteLength,d=2+e.signatureLength+e.ownerLength+o+a+l+h,f=Buffer.alloc(d);if(f.set(function(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let n=0;n<e.length;n++){let r=255&t;e[n]=r,t=(t-r)/256}return Uint8Array.from(e)}(e.signatureType),0),f.set(new Uint8Array(e.signatureLength).fill(0),2),r.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${r.byteLength}`);f.set(r,2+e.signatureLength);let p=2+e.signatureLength+e.ownerLength;if(f[p]=i?1:0,i){if(32!==i.byteLength)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);f.set(i,p+1)}let m=p+o,g=m+1;if(f[m]=s?1:0,s){if(g+=s.byteLength,32!==s.byteLength)throw new Error("Anchor must be 32 bytes");f.set(s,m+1)}f.set(Ln(n?.tags?.length??0),g);let y=Ln(c?.byteLength??0);f.set(y,g+8),c&&f.set(c,g+16);let w=g+l;return f.set(u,w),new Mn(f)}var Kn={...hn};globalThis.arbundles??=Kn;const{Axios:zn,AxiosError:Wn,CanceledError:Hn,isCancel:$n,CancelToken:Zn,VERSION:Xn,all:Yn,Cancel:Gn,isAxiosError:qn,spread:Jn,toFormData:Qn,AxiosHeaders:tr,HttpStatusCode:er,formToJSON:nr,getAdapter:rr,mergeConfig:ir}=He;var or=a(386),sr={debug:!1,inject:!1,auth0Domain:"auth.othent.io",auth0ClientId:"uXkRmJoIa0NfzYgYEDAgj6Rss4wR1tIc",auth0Strategy:"refresh-tokens",auth0Cache:"memory",auth0RefreshTokenExpirationMs:1296e6,auth0LogInMethod:"popup",auth0RedirectURI:null,auth0ReturnToURI:null,serverBaseURL:"https://kms-server.othent.io",autoConnect:"lazy",cookieKey:null,localStorageKey:null,throwErrors:!0,tags:[]},ar={...sr,appName:"",appVersion:"",persistCookie:!1,persistLocalStorage:!1,auth0Cache:"memory"},cr={host:"arweave.net",protocol:"https",port:443},lr="othentUserDetails",ur="Othent KMS",hr="2.0.0-beta.10",dr=[{name:"Client",value:ur},{name:"Client-Version",value:hr}],fr=class{constructor(t){this.listeners=new Set,this.initializedListeners=new Set,this.lastEmittedUpdateId="",this.lastEmittedParams=null,this.options={diffParams:!1,replyOnListen:!1},this.options={...this.options,...t}}getUpdateId(t){const{getUpdateIdTransform:e}=this.options,n=e?e(t):t;return JSON.stringify(n,((t,e)=>e&&"oject"===e&&!Array.isArray(e)?Object.entries(e).sort(((t,e)=>t[0].localeCompare(e[0]))):e))}get hasListeners(){return this.listeners.size>0}add(t){this.listeners.add(t),this.options.replyOnListen&&this.lastEmittedParams&&this.emit(...this.lastEmittedParams)}delete(t){this.listeners.add(t)}emit(...t){const{initializedListeners:e,lastEmittedUpdateId:n}=this,r=this.getUpdateId(t),i=n===r;return this.lastEmittedUpdateId=r,this.lastEmittedParams=t,this.listeners.forEach((n=>{if(!i||!e.has(n)){e.add(n);try{n(...t)}catch(t){}}})),i}};function pr(t,e){return et(!0,{},e,t)}var mr={secure:!0,domain:!0,ttlHours:360},gr=class t{constructor(e=mr){this.secureParam=null,this.domainParam=null,this.ttlMs=1296e6;const{secureParam:n,domainParam:r,ttlMs:i}=this.parseCookieOptions(pr(e,mr));return this.secureParam=n,this.domainParam=r,this.ttlMs=i,new Proxy(this,{get:(t,e)=>e in t||"string"!=typeof e?t[e]:t.getItem(e),ownKeys:e=>document.cookie.split(t.COOKIE_SEPARATOR).map((e=>e.split(t.COOKIE_VALUE_SEPARATOR)[0])),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0})})}parseCookieOptions({secure:t,domain:e,ttlHours:n}={}){return{secureParam:t?"secure":void 0===t?this.secureParam:null,domainParam:e?`domain=${!0===e?location.host:e}`:void 0===e?this.domainParam:null,ttlMs:n?36e5*n:void 0===n?this.ttlMs:0}}getCookieParams(t){const{secureParam:e,domainParam:n,ttlMs:r}=this.parseCookieOptions(t),i=[`expires=${new Date(Date.now()+r).toUTCString()}`,e,n,"path=/"].filter(Boolean).join("; ");return i?` ${i};`:""}get length(){return document.cookie?document.cookie.split(t.COOKIE_SEPARATOR).length:0}key(e){return(document.cookie.split(t.COOKIE_SEPARATOR)[e]||"").split(t.COOKIE_VALUE_SEPARATOR)[0]||null}getItem(e){const n=document.cookie.split(t.COOKIE_SEPARATOR).find((n=>n.split(t.COOKIE_VALUE_SEPARATOR)[0]===e));return n&&n.split(t.COOKIE_VALUE_SEPARATOR)[1]||null}setItem(t,e,n){const r=`${t}=${"string"==typeof e?e:JSON.stringify(e)};${this.getCookieParams(n)}`;return document.cookie=r,r}removeItem(t,e){return this.setItem(t,"",{...e,ttlHours:-1})}clear(){document.cookie.split(t.COOKIE_SEPARATOR).forEach((e=>{this.removeItem(e.split(t.COOKIE_VALUE_SEPARATOR)[0])}))}};gr.COOKIE_SEPARATOR=/\s*;\s*/,gr.COOKIE_VALUE_SEPARATOR=/\s*=\s*/;var yr=gr,wr=null;var vr=class t{constructor({debug:t,domain:e,clientId:n,strategy:r,cache:i,refreshTokenExpirationMs:o,loginMethod:s,redirectURI:a,returnToURI:c,appInfo:l,initialUserDetails:u,cookieKey:h,localStorageKey:d}){this.debug=!1,this.auth0ClientPromise=Promise.resolve(null),this.authEventListenerHandler=new fr({diffParams:!0,replyOnListen:!0}),this.userDetails=null,this.userDetailsExpirationTimeoutID=0,this.cookieKey=null,this.localStorageKey=null,this.refreshTokenExpirationMs=+sr.auth0RefreshTokenExpirationMs,this.appInfo={name:"",version:""},this.isReady=!1,this.isAuthenticated=!1,this.debug=t,this.loginMethod=s,this.redirectURI=a,this.returnToURI=c,this.auth0ClientPromise=async function(t){const e=new tt(t);return await e.checkSession(),e}({domain:e,clientId:n,useRefreshTokens:"refresh-tokens"===r,cacheLocation:"string"==typeof i?i:void 0,cache:"object"==typeof i?i:void 0,authorizationParams:{redirect_uri:this.redirectURI}}).then((t=>(this.isReady=!0,t))),this.cookieKey=h,this.localStorageKey=d,this.refreshTokenExpirationMs=o,this.appInfo=l,this.restoreUserDetails(u||null),this.handleStorage=this.handleStorage.bind(this)}static isIdTokenValidUser(t){return!!(t&&t.sub&&t.owner&&t.walletAddress&&"KMS"===t.authSystem)}static async getUserDetails(e){const{email:n="",walletAddress:r}=e,i=e.sub||"",o=i.split("|")[0];let s=await async function(t){try{const e=(await He.get("https://api.mem.tech/api/state/Tih8T1uESATJNzdwBIY3rpe25kWTzjw8uNiMRYe9I5M",{timeout:2e3})).data.balances.find((e=>e.address===t)),n=e&&(e.primary_domain||e.ownedDomains[0].domain)||null;return n?`${n}.ar`:null}catch(e){return console.warn(`Error resolving ANS domain for ${t} =\n`,e),null}}(r);if(!s){s=`${t.PROVIDER_LABELS[o]||"Unknown Provider"} (${n})`}return{sub:i,name:e.name||"",givenName:e.given_name||"",middleName:e.middle_name||"",familyName:e.family_name||"",nickname:e.nickname||"",preferredUsername:e.preferred_username||"",profile:e.profile||"",picture:e.picture||"",website:e.website||"",locale:e.locale||"",updatedAt:e.updated_at||"",email:n,emailVerified:!!e.email_verified,owner:e.owner,walletAddress:e.walletAddress,walletAddressLabel:s,authSystem:e.authSystem,authProvider:o}}getAuthEventListenerHandler(){return this.authEventListenerHandler}setAppInfo(t){this.appInfo=t}initStorageSyncing(){this.localStorageKey&&window.addEventListener("storage",this.handleStorage)}stopStorageSyncing(){window.removeEventListener("storage",this.handleStorage)}handleStorage(t){t.key===this.localStorageKey&&(t.newValue?this.restoreUserDetails():this.logOut())}persistUserDetails(t){const{cookieKey:e,localStorageKey:n}=this;if(e){const n=function(){if(!wr){const t=!1;wr=new yr({secure:!t&&void 0,domain:!t&&void 0})}return wr}();t?n.setItem(e,JSON.stringify(t)):null!==n.getItem(e)&&n.removeItem(e)}if(n)if(t){const e=new Date,r=JSON.stringify({userDetails:t,createdAt:e.toUTCString(),expiredBy:new Date(e.getTime()+this.refreshTokenExpirationMs).toUTCString()});localStorage.setItem(n,r)}else this.clearStoredUserDetails()}setUserDetails(t,e=!0){window.clearTimeout(this.userDetailsExpirationTimeoutID),t&&(this.userDetailsExpirationTimeoutID=window.setTimeout(this.logOut,this.refreshTokenExpirationMs));return this.authEventListenerHandler.emit(t,e?!!t:this.isAuthenticated)||(this.userDetails=t),e&&(this.isAuthenticated=!!t,this.persistUserDetails(t)),t}restoreUserDetails(t){let e=t||null;if(!e&&this.localStorageKey)try{const t=JSON.parse(localStorage.getItem(this.localStorageKey)||"null");if(t){const n=new Date(t.expiredBy).getTime();!isNaN(n)&&n>Date.now()?e=t.userDetails:this.clearStoredUserDetails()}}catch(t){}this.setUserDetails(e,!1)}clearStoredUserDetails(){Object.keys(localStorage).forEach((t=>{t.startsWith("othent")&&localStorage.removeItem(t)}))}async updateUserDetails(e){const n=e&&t.isIdTokenValidUser(e)?await t.getUserDetails(e):null;return this.setUserDetails(n)}getAuthorizationParams(t={}){const{authorizationParams:e,data:n}=t.hasOwnProperty("keyName")?{authorizationParams:null,data:t}:{authorizationParams:t,data:null},r={othentFunction:"KMS",othentSDKVersion:ur,othentAPIVersion:hr,appName:this.appInfo.name,appVersion:this.appInfo.version};return n&&(r.data=n),{...e,transaction_input:JSON.stringify(r,((t,e)=>{let n=[];if(e instanceof Buffer||e instanceof DataView||ArrayBuffer.isView(e))n=Array.from(new Uint8Array(e.buffer));else{if(!(e instanceof ArrayBuffer))return e;n=Array.from(new Uint8Array(e))}return"data"===t?Object.fromEntries(Object.entries(n)):{type:"Buffer",data:n}}))}}async getTokenSilently(t){const e=await this.auth0ClientPromise;if(!e)throw new Error("Missing Auth0 Client");const n=this.getAuthorizationParams(t);if(this.debug)try{console.log("getTokenSilently() =",{...n,transaction_input:JSON.parse(n.transaction_input)})}catch(t){console.error("Error logging/parsing `authorizationParams`:",t)}try{const t=await e.getTokenSilently({detailedResponse:!0,authorizationParams:n,cacheMode:"off"}),r=await e.getUser();if(!r)throw new Error("Could not get the user's details");const i=await this.updateUserDetails(r);return{...t,idToken:r,userDetails:i}}catch(t){throw t}}async logIn(){const t=await this.auth0ClientPromise;if(!t)throw new Error("Missing Auth0 Client");this.debug&&console.log("logIn()");if(await t.isAuthenticated())throw new Error("Already logged in");const e=this.getAuthorizationParams({redirect_uri:this.redirectURI});if("popup"!==this.loginMethod)throw t.loginWithRedirect({authorizationParams:e}),new Error("Redirecting...");return await t.loginWithPopup({authorizationParams:e},{}),this.getTokenSilently()}async handleRedirectCallback(t){this.debug&&console.log(`handleRedirectCallback(${t})`);const e=await this.auth0ClientPromise;if(!e)throw new Error("Missing Auth0 Client");await e.handleRedirectCallback(t);const n=await e.getUser();if(!n)throw new Error("Could not get the user's details");return this.updateUserDetails(n)}async logOut(){this.setUserDetails(null);const t=await this.auth0ClientPromise;if(!t)throw new Error("Missing Auth0 Client");return t.logout({logoutParams:{returnTo:this.returnToURI}}).catch((t=>{console.warn(t instanceof Error?t.message:t),"undefined"!=typeof location&&location.reload()}))}async encodeToken(t){return(await this.getTokenSilently(t)).id_token}getCachedUserDetails(){return this.userDetails}getCachedUserPublicKey(){var t;return(null==(t=this.userDetails)?void 0:t.owner)||null}getCachedUserSub(){var t;return(null==(t=this.userDetails)?void 0:t.sub)||null}getCachedUserAddress(){var t;return(null==(t=this.userDetails)?void 0:t.walletAddress)||null}getCachedUserAddressLabel(){var t;return(null==(t=this.userDetails)?void 0:t.walletAddressLabel)||null}getCachedUserEmail(){var t;return(null==(t=this.userDetails)?void 0:t.email)||null}};vr.PROVIDER_LABELS={apple:"Apple",auth0:"E-Mail","google-oauth2":"Google","<LinkedIn>":"LinkedIn","<X>":"X","<Meta>":"Meta","<Twitch>":"Twitch",github:"GitHub"};var br=vr;function Er(t){return"string"==typeof t?Sr(t):t}function Sr(t){return(new TextEncoder).encode(t)}function Tr(t){return e=function(t){return $e.fromByteArray(new Uint8Array(t))}(t),e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");var e}async function xr(t,e="SHA-256"){let n=await crypto.subtle.digest(e,t);return new Uint8Array(n)}var Ar=(t=>(t.Unexpected="Unexpected",t.Validation="Validation",t.UserCreation="UserCreation",t.Encryption="Encryption",t.Decryption="Decryption",t.Signing="Signing",t.PublicKey="PublicKey",t))(Ar||{}),kr=class extends Error{constructor(t,e,n,r=!1){super(),this.name=t,this.message=e||"",r?this.stack=`${t} (from server): ${e}\n`:Error.captureStackTrace(this),this.id=t,this.developerMessage=e,n instanceof Error?this.cause=n:"string"!=typeof n&&"number"!=typeof n||(this.cause=new Error(`${n}`))}};function Rr(t){var e;if(qn(t)){const n=null==(e=t.response)?void 0:e.data;if(!function(t){return"object"==typeof t&&!0===t.error&&!!t.id&&!!Ar[t.id]}(n))return t;const{id:r,developerMessage:i,cause:o}=n;let s;return o&&(s=new Error(o.message),s.name=o.name,s.stack=o.stack),new kr(r,i||"",s,!0)}return t instanceof Error?t:new Error("Unknown error")}async function Pr(t,e,n,r){var i;const o=await e.encodeToken({ciphertext:n,keyName:r});let s=null;try{s=null!=(i=(await t.post("/decrypt",{encodedData:o})).data.data)?i:null}catch(t){throw Rr(t)}if(null===s)throw new Error("Error decrypting on server.");return"string"==typeof s?s:(a=new Uint8Array(s.data),(new TextDecoder).decode(a));var a}var Cr=class{constructor(t,e){this.api=He.create({baseURL:t}),this.auth0=e}async createUser(t){return async function(t,e){let n=!1;try{n=(await t.post("/create-user",{encodedData:e})).data.data}catch(t){throw Rr(t)}if(!n)throw new Error("Error creating user on server.");return!0}(this.api,t)}async decrypt(t,e){return Pr(this.api,this.auth0,t,e)}async encrypt(t,e){return async function(t,e,n,r){var i;const o=await e.encodeToken({plaintext:n,keyName:r});let s=null;try{s=null!=(i=(await t.post("/encrypt",{encodedData:o})).data.data)?i:null}catch(t){throw Rr(t)}if(null===s)throw new Error("Error encrypting on server.");return"string"==typeof s?Sr(s):new Uint8Array(s.data)}(this.api,this.auth0,t,e)}async sign(t,e){return async function(t,e,n,r){const i=await e.encodeToken({data:n,keyName:r});let o=null;try{o=(await t.post("/sign",{encodedData:i})).data.data}catch(t){throw Rr(t)}if(null===o)throw new Error("Error signing data on server.");return"string"==typeof o?Sr(o):new Uint8Array(o.data)}(this.api,this.auth0,t,e)}getSignerSignFn(t){return async e=>await this.sign(e,t)}};function Or(t,e="utf8"){return r.lW.isBuffer(t)?Br(t.toString("base64")):Br(r.lW.from(t,e).toString("base64"))}function Ir(t){return function(t){let e=t.length,n=e%4;if(!n)return t;let i=e,o=4-n,s=e+o,a=r.lW.alloc(s);for(a.write(t);o--;)a.write("=",i++);return a.toString()}(t=t.toString()).replace(/\-/g,"+").replace(/_/g,"/")}function Br(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ur(t){return r.lW.from(Ir(t),"base64")}var Lr=Or;function Nr(t){return or.default.init(t)}Lr.encode=Or,Lr.decode=function(t,e="utf8"){return r.lW.from(Ir(t),"base64").toString(e)},Lr.toBase64=Ir,Lr.fromBase64=Br,Lr.toBuffer=Ur;var _r=class t{constructor(t=ar){this.errorEventListenerHandler=new fr,this.tokens=new Set,this.walletName=ur,this.walletVersion=hr,this.config=sr,this.appInfo={name:"",version:""},this.gatewayConfig=cr;let{appName:e,appVersion:n,persistCookie:r,persistLocalStorage:i,auth0Cache:o=sr.auth0Cache,auth0RedirectURI:s,auth0ReturnToURI:a,gatewayConfig:c,initialUserDetails:l,...u}=t;const h="undefined"==typeof location?null:location.origin;this.config={...pr(u,sr),cookieKey:"string"==typeof r?r:r?lr:null,localStorageKey:"string"==typeof i?i:i?lr:null,auth0Cache:"object"==typeof o?"custom":o,auth0RedirectURI:s||h,auth0ReturnToURI:a||h};const{config:d}=this,{cookieKey:f,localStorageKey:p}=d;if("string"==typeof f&&!f.startsWith("othent"))throw new Error('`persistCookie` / `cookieKey` must start with "othent".');if("string"==typeof p&&!p.startsWith("othent"))throw new Error('`persistLocalStorage` / `localStorageKey` must start with "othent".');if(!d.auth0RedirectURI)throw new Error("`auth0RedirectURI` is required.");if(!d.auth0ReturnToURI)throw new Error("`auth0ReturnToURI` is required.");this.appInfo={name:e,version:n},this.gatewayConfig=c||cr;let m=null;if("undefined"!=typeof window)m=window.crypto;else{if("undefined"==typeof global)throw new Error("A Crypto module is needed for Othent to work. If your environment doesn't natively provide one, you should polyfill it.");m=global.crypto}if(this.crypto=m,"eager"===d.autoConnect&&"popup"===d.auth0LogInMethod&&"refresh-tokens"===d.auth0Strategy&&"memory"===o)throw new Error('The browser cannot open the authentication modal automatically before an user interaction. Use `autoConnect = "lazy"` or change any of these other options: `auth0LogInMethod`, `auth0Strategy` or `auth0Cache`.');if(this.auth0=new br({debug:d.debug,domain:d.auth0Domain,clientId:d.auth0ClientId,strategy:d.auth0Strategy,cache:o,refreshTokenExpirationMs:d.auth0RefreshTokenExpirationMs,redirectURI:d.auth0RedirectURI,returnToURI:d.auth0ReturnToURI,loginMethod:d.auth0LogInMethod,appInfo:this.appInfo,initialUserDetails:l,cookieKey:d.cookieKey,localStorageKey:d.localStorageKey}),"eager"===this.config.autoConnect){let t="undefined"==typeof location;if(!t){const e=new URL(location.href),{searchParams:n}=e;n.has("code")||n.has("state")||(t=!0)}t&&this.connect()}if(d.inject&&(window.arweaveWallet=this),!d.throwErrors){["connect","disconnect","getActiveAddress","getActivePublicKey","getAllAddresses","getWalletNames","getUserDetails","getSyncActiveAddress","getSyncActivePublicKey","getSyncAllAddresses","getSyncWalletNames","getSyncUserDetails","sign","dispatch","encrypt","decrypt","signature","signDataItem","signMessage","verifyMessage","privateHash","getArweaveConfig","getPermissions"].forEach((t=>{let e=this[t];"function"==typeof e&&(e=e.bind(this),this[t]=(...t)=>{try{let r=e(...t);return!(n=r)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then||(r=r.catch((t=>(this.onError(t),null)))),r}catch(t){this.onError(t)}var n;return null})}))}this.api=new Cr(this.config.serverBaseURL,this.auth0)}startTabSynching(){return this.config.localStorageKey||console.warn("Calling `Othent.startTabSynching()` is a NOOP unless the `persistLocalStorage` option is used."),this.auth0.initStorageSyncing(),()=>{this.auth0.stopStorageSyncing()}}async completeConnectionAfterRedirect(t){"redirect"!==this.config.auth0LogInMethod&&console.warn('Calling `Othent.completeConnectionAfterRedirect()` is a NOOP unless the `auth0LogInMethod` options is `"redirect"`.');const e=t||("undefined"==typeof location?"":location.href),n=new URL(e.replace(/.+\.auth0:\/\//,"https://")),{searchParams:r}=n;if(!r.has("code")||!r.has("state")||!e)return null;let i=null;try{i=await this.auth0.handleRedirectCallback(e)}finally{"undefined"!=typeof location&&"undefined"!=typeof history&&(r.delete("code"),r.delete("state"),history.replaceState(null,"",n))}return i}get isReady(){return this.auth0.isReady}onError(t){t instanceof Error?this.errorEventListenerHandler.hasListeners?this.errorEventListenerHandler.emit(t):console.warn("Unhandled unthrown error:\n",t,'\nWhen using `throwErrors = false`, you must add at least one error event listener with `othent.addEventListener("error", () => { ... })`'):console.warn("Unknown error type",t)}addEventListener(t,e){let n=null;if("auth"===t)n=this.auth0.getAuthEventListenerHandler();else if("error"===t){if(this.config.throwErrors)throw new Error("You can only listen for `error` events if `throwErrors = false`.");n=this.errorEventListenerHandler}if(!n)throw new Error("Unknown event type");return n.add(e),()=>{n.delete(e)}}removeEventListener(t,e){let n=null;if("auth"===t?n=this.auth0.getAuthEventListenerHandler():"error"===t&&(n=this.errorEventListenerHandler),!n)throw new Error("Unknown event type");n.delete(e)}get isAuthenticated(){return this.auth0.isAuthenticated}requireAuth(){return this.requireUserDataOrThrow().then((()=>{}))}async requireUserDataOrThrow(){"off"===this.config.autoConnect||this.auth0.isAuthenticated||await this.connect(void 0,void 0,this.gatewayConfig);const{sub:t,owner:e}=this.auth0.getCachedUserDetails()||{};if(!t||!e)throw new Error("Missing cached user.");return{sub:t,publicKey:e}}async connect(e,n,r){if(e&&e.toSorted().join("-")!==t.ALL_PERMISSIONS.join("-"))throw new Error("Othent implicitly has access to all available permissions. You should pass `permissions = undefined` or include all of them.");n&&(this.appInfo=n,this.auth0.setAppInfo(n)),this.gatewayConfig=r||cr;let i="",o=null;try{const t=await this.auth0.getTokenSilently();i=t.id_token,o=t.userDetails}catch(t){if(!(t instanceof Error))throw t;if("Login required"!==t.message&&!(t instanceof E))throw t;console.warn(t.message)}if(!i)try{const t=await this.auth0.logIn();i=t.id_token,o=t.userDetails}catch(t){if(!(t instanceof Error))throw t;if("Redirecting..."===t.message&&await new Promise((()=>{})),t.message.startsWith("Unable to open a popup")||t instanceof v||t instanceof w)return t instanceof w&&t.popup.close(),console.warn(t.message),null;throw t}if(i&&!o){await this.api.createUser(i);const t=await this.auth0.getTokenSilently();i=t.id_token,o=t.userDetails}if(i&&o)return o;throw this.auth0.logOut(),new Error("Unexpected authentication error")}async disconnect(){return this.auth0.logOut()}getActiveAddress(){return Promise.resolve(this.getSyncActiveAddress())}getActivePublicKey(){return Promise.resolve(this.getSyncActivePublicKey())}getAllAddresses(){return Promise.resolve(this.getSyncAllAddresses())}getWalletNames(){return Promise.resolve(this.getSyncWalletNames())}getUserDetails(){return Promise.resolve(this.getSyncUserDetails())}getSyncActiveAddress(){return this.auth0.getCachedUserAddress()||""}getSyncActivePublicKey(){return this.auth0.getCachedUserPublicKey()||""}getSyncAllAddresses(){const t=this.auth0.getCachedUserAddress();return t?[t]:[]}getSyncWalletNames(){const t=this.auth0.getCachedUserAddress(),e=this.auth0.getCachedUserAddressLabel();return Promise.resolve(t&&e?{[t]:e}:{})}getSyncUserDetails(){return this.auth0.getCachedUserDetails()}addCommonTags(t=[]){if(Array.isArray(t)){const e=[{name:"App-Name",value:this.appInfo.name},{name:"App-Version",value:this.appInfo.version}];return[...t,...this.config.tags,...e,...dr]}for(const{name:e,value:n}of this.config.tags)t.addTag(e,n);t.addTag("App-Name",this.appInfo.name),t.addTag("App-Version",this.appInfo.version);for(const{name:e,value:n}of dr)t.addTag(e,n)}async sign(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),r=Nr(this.gatewayConfig),i=t.get("tags").map((t=>({name:t.get("name",{decode:!0,string:!0}),value:t.get("value",{decode:!0,string:!0})}))),o=this.addCommonTags(i),s=await r.createTransaction({data:t.data,owner:n,reward:t.reward});o.forEach((t=>{s.addTag(t.name,t.value)}));const a=await s.getSignatureData(),c=await this.api.sign(a,e),l=await xr(c);return s.setSignature({id:Tr(l),owner:n,signature:Tr(c),tags:s.tags,reward:s.reward}),s}async dispatch(t,e){var n;const r=t.get("tags").map((t=>({name:t.get("name",{decode:!0,string:!0}),value:t.get("value",{decode:!0,string:!0})}))),i=await this.signDataItem({data:t.data,tags:r,target:t.target}),o=`${(null==e?void 0:e.node)||"https://turbo.ardrive.io"}/tx`;try{const t=await He.post(o,i,{headers:{"Content-Type":"application/octet-stream"},maxBodyLength:1/0,maxContentLength:1/0,responseType:"json"});if(t.status>=400)throw new Error(`${t.status} - ${JSON.stringify(t.data)}`);return{...t.data,type:"BUNDLED"}}catch(r){console.warn(`Error dispatching transaction to ${o} =\n`,r);const i=await this.sign(t),s=null!=(n=null==e?void 0:e.arweave)?n:Nr(this.gatewayConfig),a=await s.transactions.getUploader(i);for(;!a.isComplete;)await a.uploadChunk();return{id:i.id,signature:i.signature,owner:i.owner,type:"BASE"}}}async encrypt(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.encrypt(t,e)}async decrypt(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.decrypt(t,e)}async signature(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.sign(t,e)}async signDataItem(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),{data:r,tags:i,...o}=t,s={publicKey:Ur(n),signatureType:1,signatureLength:512,ownerLength:512,sign:this.api.getSignerSignFn(e)},a=Fn(r,s,{...o,tags:this.addCommonTags(i)});return await a.sign(s),a.getRaw().buffer}async signMessage(t,e){const{sub:n}=await this.requireUserDataOrThrow(),r=(null==e?void 0:e.hashAlgorithm)||"SHA-256",i=await this.crypto.subtle.digest(r,Er(t));return await this.api.sign(i,n)}async verifyMessage(t,e,n,r={hashAlgorithm:"SHA-256"}){if(!n){const t=await this.requireUserDataOrThrow();n||(n=t.publicKey)}const i=(null==r?void 0:r.hashAlgorithm)||"SHA-256",o=await this.crypto.subtle.digest(i,Er(t)),s={e:"AQAB",ext:!0,kty:"RSA",n},a=await this.crypto.subtle.importKey("jwk",s,{name:"RSA-PSS",hash:r.hashAlgorithm},!1,["verify"]);return await this.crypto.subtle.verify({name:"RSA-PSS",saltLength:32},a,Er(e),o)}async privateHash(t,e){return xr(Er(t),null==e?void 0:e.hashAlgorithm)}getArweaveConfig(){return Promise.resolve(this.gatewayConfig)}getPermissions(){return Promise.resolve(t.ALL_PERMISSIONS)}addToken(t,e,n){return console.warn("Othent doesn't currently support this feature and only tracks added tokens temporarily in memory."),this.tokens.add(t),Promise.resolve()}isTokenAdded(t){return console.warn("Othent doesn't currently support this feature and only tracks added tokens temporarily in memory."),Promise.resolve(this.tokens.has(t))}};_r.walletName=ur,_r.walletVersion=hr,_r.ALL_PERMISSIONS=["ACCESS_ADDRESS","ACCESS_ALL_ADDRESSES","ACCESS_ARWEAVE_CONFIG","ACCESS_PUBLIC_KEY","DECRYPT","DISPATCH","ENCRYPT","SIGN_TRANSACTION","SIGNATURE"];var jr=_r;async function Dr(t,e){try{const n=function(t){const e=t.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=window.atob(e),r=new Uint8Array(n.length);for(let t=0;t<n.length;t++)r[t]=n.charCodeAt(t);return r.buffer}(t),r=await window.crypto.subtle.importKey("spki",n,{name:"RSA-OAEP",hash:{name:"SHA-256"}},!0,["encrypt"]);return function(t){try{let e="";const n=new Uint8Array(t),r=n.byteLength;for(let t=0;t<r;t++)e+=String.fromCharCode(n[t]);return window.btoa(e)}catch(t){console.error("Eror in buffertoBase64 : ",t)}}(await window.crypto.subtle.encrypt({name:"RSA-OAEP"},r,(new TextEncoder).encode(e)))}catch(t){return console.error("rsaEncrypt error:",t),null}}async function Mr(t){const e={Info:{hashedOthentSub:t},request:"PIN"};return await fetch("https://api2.onairos.uk/getAccountInfoFromOthentSub",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then((t=>t.json())).then((t=>t)).catch((t=>console.error(t)))}window.Buffer=r.lW;const Vr=async()=>{if(!window.PublicKeyCredential)throw new Error("WebAuthn not supported");try{if(!await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())throw new Error("Biometric authentication not available");return!!await navigator.credentials.get({publicKey:{challenge:new Uint8Array(32),rpId:window.location.hostname,userVerification:"required"}})}catch(t){return console.error("Biometric authentication failed:",t),!1}};function Fr(t){let{onLoginSuccess:n}=t;const[r,i]=(0,e.useState)(!1);return React.createElement("div",{className:"flex flex-col items-center"},React.createElement("button",{onClick:async()=>{i(!0);try{const t=await(async()=>{const t=localStorage.getItem("onairosCredentials");if(!t)return null;try{const e=JSON.parse(t);return(await fetch("https://api2.onairos.uk/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e.username,token:e.token})})).ok?e:(localStorage.removeItem("onairosCredentials"),null)}catch(t){return console.error("Verification failed:",t),null}})();if(t){if(await Vr())return void await n(t.username)}const e=Date.now(),r=encodeURIComponent(window.location.origin+"/auth/callback"),i="onairos://authenticate?nonce=".concat(e,"&callback=").concat(r,"&appName=google");window.location.href=i,setTimeout((()=>{window.location.href="https://apps.apple.com/app/onairos/id123456789"}),2500)}catch(t){console.error("App login failed:",t)}finally{i(!1)}},disabled:r,className:"w-12 h-12 rounded-full shadow-md hover:shadow-lg transition-shadow duration-200 flex items-center justify-center bg-white"},React.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos",className:"w-10 h-6"})),React.createElement("span",{className:"text-xs mt-2 text-gray-600"},"Login with App"))}function Kr(){const[t,r]=(0,e.useState)(null),[i,o]=(0,e.useState)([]),s=t=>{o((e=>[...e,t]))};return n().createElement("div",{className:"flex flex-col items-center p-4"},n().createElement("button",{onClick:()=>{try{s("Opening external browser...");const t=new URLSearchParams({key:"value"}).toString(),e="https://internship.onairos.uk/auth?".concat(t);window.open(e,"_blank")}catch(t){console.error("Failed to open link:",t),s("Failed to open link: ".concat(t.message)),r("Failed to open link: ".concat(t.message))}},className:"flex flex-col items-center justify-center px-4 py-2 border border-gray-300 rounded-full shadow-sm bg-white hover:bg-gray-50"},n().createElement("div",{className:"relative"},n().createElement("img",{src:"google-icon.png",alt:"Google",className:"w-10 h-10 rounded-full"}),n().createElement("svg",{className:"absolute bottom-0 right-0 w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20"},n().createElement("path",{d:"M10 3a1 1 0 011 1v6h6a1 1 0 110 2h-6v6a1 1 0 11-2 0v-6H3a1 1 0 110-2h6V4a1 1 0 011-1z"}))),n().createElement("span",{className:"text-gray-700 mt-2"},"Google")))}function zr(t){let{onLoginSuccess:n,setOthent:r,setHashedOthentSub:i,setEncryptedPin:o}=t;const[s,a]=(0,e.useState)(!1);(0,e.useEffect)((()=>{c()}),[]);const c=async()=>{const t=localStorage.getItem("onairosCredentials");a(!!t)};return React.createElement("div",{className:"flex flex-row justify-center items-center space-x-4"},React.createElement(Kr,null),React.createElement(Fr,{hasSavedCredentials:s,onSuccess:n}))}var Wr=a(697),Hr=a.n(Wr);function $r(t){let{active:e,title:r,id:i,number:o,descriptions:s,rewards:a,size:c,isChecked:l,onCheckboxChange:u}=t;return n().createElement("div",{className:"bg-white rounded-lg p-4 shadow border border-gray-200"},n().createElement("div",{className:"flex items-center justify-between"},n().createElement("div",{className:"flex items-center space-x-4"},n().createElement("div",{className:"group"},n().createElement("div",null,n().createElement("input",{disabled:!e,type:"checkbox",checked:l,onChange:t=>u(t.target.checked)})))),n().createElement("div",{className:"flex items-center"}),s&&"Avatar"!==r&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Intent: ",s),a&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Rewards: ",a)))}function Zr(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}function Xr(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}$r.propTypes={active:Hr().bool.isRequired,title:Hr().string.isRequired,id:Hr().any.isRequired,number:Hr().number.isRequired,descriptions:Hr().string,rewards:Hr().string,size:Hr().string.isRequired,isChecked:Hr().bool.isRequired,onCheckboxChange:Hr().func.isRequired};const Yr=t=>Array.isArray(t);function Gr(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function qr(t){return"string"==typeof t||Array.isArray(t)}function Jr(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Qr(t,e,n,r){if("function"==typeof e){const[i,o]=Jr(r);e=e(void 0!==n?n:t.custom,i,o)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,o]=Jr(r);e=e(void 0!==n?n:t.custom,i,o)}return e}function ti(t,e,n){const r=t.getProps();return Qr(r,e,void 0!==n?n:r.custom,t)}const ei=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ni=["initial",...ei],ri=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ii=new Set(ri),oi=t=>1e3*t,si=t=>t/1e3,ai={type:"spring",stiffness:500,damping:25,restSpeed:10},ci={type:"keyframes",duration:.8},li={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ui=(t,{keyframes:e})=>e.length>2?ci:ii.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:ai:li;function hi(t,e){return t?t[e]||t.default||t:void 0}const di=!1,fi=!1,pi=!1,mi=t=>null!==t;function gi(t,{repeat:e,repeatType:n="loop"},r){const i=t.filter(mi),o=e&&"loop"!==n&&e%2==1?0:i.length-1;return o&&void 0!==r?r:i[o]}const yi=t=>t;const wi=["read","resolveKeyframes","update","preRender","render","postRender"];function vi(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=wi.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,i=!1;const o=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function a(e){o.has(e)&&(c.schedule(e),t()),e(s)}const c={schedule:(t,i=!1,s=!1)=>{const a=s&&r?e:n;return i&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),o.delete(t)},process:t=>{s=t,r?i=!0:(r=!0,[e,n]=[n,e],e.forEach(a),e.clear(),r=!1,i&&(i=!1,c.process(t)))}};return c}(o),t)),{}),{read:a,resolveKeyframes:c,update:l,preRender:u,render:h,postRender:d}=s,f=()=>{const o=fi?i.timestamp:performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,40),1),i.timestamp=o,i.isProcessing=!0,a.process(i),c.process(i),l.process(i),u.process(i),h.process(i),d.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(f))};return{schedule:wi.reduce(((e,o)=>{const a=s[o];return e[o]=(e,o=!1,s=!1)=>(n||(n=!0,r=!0,i.isProcessing||t(f)),a.schedule(e,o,s)),e}),{}),cancel:t=>{for(let e=0;e<wi.length;e++)s[wi[e]].cancel(t)},state:i,steps:s}}const{schedule:bi,cancel:Ei,state:Si,steps:Ti}=vi("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:yi,!0),xi=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Ai=1e-7,ki=12;function Ri(t,e,n,r){if(t===e&&n===r)return yi;const i=e=>function(t,e,n,r,i){let o,s,a=0;do{s=e+(n-e)/2,o=xi(s,r,i)-t,o>0?n=s:e=s}while(Math.abs(o)>Ai&&++a<ki);return s}(e,0,1,t,n);return t=>0===t||1===t?t:xi(i(t),e,r)}const Pi=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Ci=t=>e=>1-t(1-e),Oi=Ri(.33,1.53,.69,.99),Ii=Ci(Oi),Bi=Pi(Ii),Ui=t=>(t*=2)<1?.5*Ii(t):.5*(2-Math.pow(2,-10*(t-1))),Li=t=>1-Math.sin(Math.acos(t)),Ni=Ci(Li),_i=Pi(Li),ji=t=>/^0[^.\s]+$/u.test(t);let Di=yi,Mi=yi;const Vi=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Fi=t=>e=>"string"==typeof e&&e.startsWith(t),Ki=Fi("--"),zi=Fi("var(--"),Wi=t=>!!zi(t)&&Hi.test(t.split("/*")[0].trim()),Hi=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,$i=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Zi(t,e,n=1){Mi(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,i]=function(t){const e=$i.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${null!=n?n:r}`,i]}(t);if(!r)return;const o=window.getComputedStyle(e).getPropertyValue(r);if(o){const t=o.trim();return Vi(t)?parseFloat(t):t}return Wi(i)?Zi(i,e,n+1):i}const Xi=(t,e,n)=>n>e?e:n<t?t:n,Yi={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Gi={...Yi,transform:t=>Xi(0,1,t)},qi={...Yi,default:1},Ji=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Qi=Ji("deg"),to=Ji("%"),eo=Ji("px"),no=Ji("vh"),ro=Ji("vw"),io={...to,parse:t=>to.parse(t)/100,transform:t=>to.transform(100*t)},oo=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),so=t=>t===Yi||t===eo,ao=(t,e)=>parseFloat(t.split(", ")[e]),co=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return ao(i[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?ao(e[1],t):0}},lo=new Set(["x","y","z"]),uo=ri.filter((t=>!lo.has(t)));const ho={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:co(4,13),y:co(5,14)};ho.translateX=ho.x,ho.translateY=ho.y;const fo=t=>e=>e.test(t),po=[Yi,eo,to,Qi,ro,no,{test:t=>"auto"===t,parse:t=>t}],mo=t=>po.find(fo(t)),go=new Set;let yo=!1,wo=!1;function vo(){if(wo){const t=Array.from(go).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return uo.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}wo=!1,yo=!1,go.forEach((t=>t.complete())),go.clear()}function bo(){go.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(wo=!0)}))}class Eo{constructor(t,e,n,r,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(go.add(this),yo||(yo=!0,bi.read(bo),bi.resolveKeyframes(vo))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let i=0;i<t.length;i++)if(null===t[i])if(0===i){const i=null==r?void 0:r.get(),o=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const r=n.readValue(e,o);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=o),r&&void 0===i&&r.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),go.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,go.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const So=t=>Math.round(1e5*t)/1e5,To=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const xo=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ao=(t,e)=>n=>Boolean("string"==typeof n&&xo.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),ko=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[i,o,s,a]=r.match(To);return{[t]:parseFloat(i),[e]:parseFloat(o),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},Ro={...Yi,transform:t=>Math.round((t=>Xi(0,255,t))(t))},Po={test:Ao("rgb","red"),parse:ko("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Ro.transform(t)+", "+Ro.transform(e)+", "+Ro.transform(n)+", "+So(Gi.transform(r))+")"};const Co={test:Ao("#"),parse:function(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}},transform:Po.transform},Oo={test:Ao("hsl","hue"),parse:ko("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+to.transform(So(e))+", "+to.transform(So(n))+", "+So(Gi.transform(r))+")"},Io={test:t=>Po.test(t)||Co.test(t)||Oo.test(t),parse:t=>Po.test(t)?Po.parse(t):Oo.test(t)?Oo.parse(t):Co.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Po.transform(t):Oo.transform(t)},Bo=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Uo="number",Lo="color",No="var",_o="var(",jo="${}",Do=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Mo(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const s=e.replace(Do,(t=>(Io.test(t)?(r.color.push(o),i.push(Lo),n.push(Io.parse(t))):t.startsWith(_o)?(r.var.push(o),i.push(No),n.push(t)):(r.number.push(o),i.push(Uo),n.push(parseFloat(t))),++o,jo))).split(jo);return{values:n,split:s,indexes:r,types:i}}function Vo(t){return Mo(t).values}function Fo(t){const{split:e,types:n}=Mo(t),r=e.length;return t=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],void 0!==t[o]){const e=n[o];i+=e===Uo?So(t[o]):e===Lo?Io.transform(t[o]):t[o]}return i}}const Ko=t=>"number"==typeof t?0:t;const zo={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(To))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Bo))||void 0===n?void 0:n.length)||0)>0},parse:Vo,createTransformer:Fo,getAnimatableNone:function(t){const e=Vo(t);return Fo(t)(e.map(Ko))}},Wo=new Set(["brightness","contrast","saturate","opacity"]);function Ho(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(To)||[];if(!r)return t;const i=n.replace(r,"");let o=Wo.has(e)?1:0;return r!==n&&(o*=100),e+"("+o+i+")"}const $o=/\b([a-z-]*)\(.*?\)/gu,Zo={...zo,getAnimatableNone:t=>{const e=t.match($o);return e?e.map(Ho).join(" "):t}},Xo={borderWidth:eo,borderTopWidth:eo,borderRightWidth:eo,borderBottomWidth:eo,borderLeftWidth:eo,borderRadius:eo,radius:eo,borderTopLeftRadius:eo,borderTopRightRadius:eo,borderBottomRightRadius:eo,borderBottomLeftRadius:eo,width:eo,maxWidth:eo,height:eo,maxHeight:eo,top:eo,right:eo,bottom:eo,left:eo,padding:eo,paddingTop:eo,paddingRight:eo,paddingBottom:eo,paddingLeft:eo,margin:eo,marginTop:eo,marginRight:eo,marginBottom:eo,marginLeft:eo,backgroundPositionX:eo,backgroundPositionY:eo},Yo={rotate:Qi,rotateX:Qi,rotateY:Qi,rotateZ:Qi,scale:qi,scaleX:qi,scaleY:qi,scaleZ:qi,skew:Qi,skewX:Qi,skewY:Qi,distance:eo,translateX:eo,translateY:eo,translateZ:eo,x:eo,y:eo,z:eo,perspective:eo,transformPerspective:eo,opacity:Gi,originX:io,originY:io,originZ:eo},Go={...Yi,transform:Math.round},qo={...Xo,...Yo,zIndex:Go,size:eo,fillOpacity:Gi,strokeOpacity:Gi,numOctaves:Go},Jo={...qo,color:Io,backgroundColor:Io,outlineColor:Io,fill:Io,stroke:Io,borderColor:Io,borderTopColor:Io,borderRightColor:Io,borderBottomColor:Io,borderLeftColor:Io,filter:Zo,WebkitFilter:Zo},Qo=t=>Jo[t];function ts(t,e){let n=Qo(t);return n!==Zo&&(n=zo),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const es=new Set(["auto","none","0"]);class ns extends Eo{constructor(t,e,n,r,i){super(t,e,n,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),Wi(r))){const i=Zi(r,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!oo.has(n)||2!==t.length)return;const[r,i]=t,o=mo(r),s=mo(i);if(o!==s)if(so(o)&&so(s))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||ji(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,i=0;for(;i<t.length&&!r;){const e=t[i];"string"==typeof e&&!es.has(e)&&Mo(e).values.length&&(r=t[i]),i++}if(r&&n)for(const i of e)t[i]=ts(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ho[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const o=r.length-1,s=r[o];r[o]=ho[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}function rs(t){return"function"==typeof t}let is;function os(){is=void 0}const ss={now:()=>(void 0===is&&ss.set(Si.isProcessing||fi?Si.timestamp:performance.now()),is),set:t=>{is=t,queueMicrotask(os)}},as=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!zo.test(t)&&"0"!==t||t.startsWith("url(")));function cs(t,e,n,r){const i=t[0];if(null===i)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],s=as(i,e),a=as(o,e);return Di(s===a,`You are trying to animate ${e} from "${i}" to "${o}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${o} via the \`style\` property.`),!(!s||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||rs(n))&&r)}class ls{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",...s}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=ss.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:i,repeatType:o,...s},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(bo(),vo()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=ss.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:i,delay:o,onComplete:s,onUpdate:a,isGenerator:c}=this.options;if(!c&&!cs(t,n,r,i)){if(pi||!o)return null==a||a(gi(t,this.options,e)),null==s||s(),void this.resolveFinishedPromise();this.options.duration=0}const l=this.initPlayback(t,e);!1!==l&&(this._resolved={keyframes:t,finalKeyframe:e,...l},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}const us=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},hs=(t,e,n=10)=>{let r="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)r+=t(us(0,i-1,e))+", ";return`linear(${r.substring(0,r.length-2)})`};function ds(t,e){return e?t*(1e3/e):0}const fs=5;function ps(t,e,n){const r=Math.max(e-fs,0);return ds(n-t(r),e-r)}const ms={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},gs=.001;function ys({duration:t=ms.duration,bounce:e=ms.bounce,velocity:n=ms.velocity,mass:r=ms.mass}){let i,o;Di(t<=oi(ms.maxDuration),"Spring duration must be 10 seconds or less");let s=1-e;s=Xi(ms.minDamping,ms.maxDamping,s),t=Xi(ms.minDuration,ms.maxDuration,si(t)),s<1?(i=e=>{const r=e*s,i=r*t,o=r-n,a=vs(e,s),c=Math.exp(-i);return gs-o/a*c},o=e=>{const r=e*s*t,o=r*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,c=Math.exp(-r),l=vs(Math.pow(e,2),s);return(-i(e)+gs>0?-1:1)*((o-a)*c)/l}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-gs,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let r=n;for(let n=1;n<ws;n++)r-=t(r)/e(r);return r}(i,o,5/t);if(t=oi(t),isNaN(a))return{stiffness:ms.stiffness,damping:ms.damping,duration:t};{const e=Math.pow(a,2)*r;return{stiffness:e,damping:2*s*Math.sqrt(r*e),duration:t}}}const ws=12;function vs(t,e){return t*Math.sqrt(1-e*e)}const bs=2e4;function Es(t){let e=0;let n=t.next(e);for(;!n.done&&e<bs;)e+=50,n=t.next(e);return e>=bs?1/0:e}const Ss=["duration","bounce"],Ts=["stiffness","damping","mass"];function xs(t,e){return e.some((e=>void 0!==t[e]))}function As(t=ms.visualDuration,e=ms.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:c,damping:l,mass:u,duration:h,velocity:d,isResolvedFromDuration:f}=function(t){let e={velocity:ms.velocity,stiffness:ms.stiffness,damping:ms.damping,mass:ms.mass,isResolvedFromDuration:!1,...t};if(!xs(t,Ts)&&xs(t,Ss))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(1.2*n),i=r*r,o=2*Xi(.05,1,1-t.bounce)*Math.sqrt(i);e={...e,mass:ms.mass,stiffness:i,damping:o}}else{const n=ys(t);e={...e,...n,mass:ms.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-si(n.velocity||0)}),p=d||0,m=l/(2*Math.sqrt(c*u)),g=s-o,y=si(Math.sqrt(c/u)),w=Math.abs(g)<5;let v;if(r||(r=w?ms.restSpeed.granular:ms.restSpeed.default),i||(i=w?ms.restDelta.granular:ms.restDelta.default),m<1){const t=vs(y,m);v=e=>{const n=Math.exp(-m*y*e);return s-n*((p+m*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===m)v=t=>s-Math.exp(-y*t)*(g+(p+y*g)*t);else{const t=y*Math.sqrt(m*m-1);v=e=>{const n=Math.exp(-m*y*e),r=Math.min(t*e,300);return s-n*((p+m*y*g)*Math.sinh(r)+t*g*Math.cosh(r))/t}}const b={calculatedDuration:f&&h||null,next:t=>{const e=v(t);if(f)a.done=t>=h;else{let n=0;m<1&&(n=0===t?oi(p):ps(v,t,e));const o=Math.abs(n)<=r,c=Math.abs(s-e)<=i;a.done=o&&c}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(Es(b),bs),e=hs((e=>b.next(t*e).value),t,30);return t+"ms "+e}};return b}function ks({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:c,restDelta:l=.5,restSpeed:u}){const h=t[0],d={done:!1,value:h},f=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let p=n*e;const m=h+p,g=void 0===s?m:s(m);g!==m&&(p=g-h);const y=t=>-p*Math.exp(-t/r),w=t=>g+y(t),v=t=>{const e=y(t),n=w(t);d.done=Math.abs(e)<=l,d.value=d.done?g:n};let b,E;const S=t=>{(t=>void 0!==a&&t<a||void 0!==c&&t>c)(d.value)&&(b=t,E=As({keyframes:[d.value,f(d.value)],velocity:ps(w,t,d.value),damping:i,stiffness:o,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return E||void 0!==b||(e=!0,v(t),S(t)),void 0!==b&&t>=b?E.next(t-b):(!e&&v(t),d)}}}const Rs=Ri(.42,0,1,1),Ps=Ri(0,0,.58,1),Cs=Ri(.42,0,.58,1),Os=t=>Array.isArray(t)&&"number"==typeof t[0],Is={linear:yi,easeIn:Rs,easeInOut:Cs,easeOut:Ps,circIn:Li,circInOut:_i,circOut:Ni,backIn:Ii,backInOut:Bi,backOut:Oi,anticipate:Ui},Bs=t=>{if(Os(t)){Mi(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,i]=t;return Ri(e,n,r,i)}return"string"==typeof t?(Mi(void 0!==Is[t],`Invalid easing type '${t}'`),Is[t]):t},Us=(t,e)=>n=>e(t(n)),Ls=(...t)=>t.reduce(Us),Ns=(t,e,n)=>t+(e-t)*n;function _s(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function js(t,e){return n=>n>0?e:t}const Ds=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},Ms=[Co,Po,Oo];function Vs(t){const e=(t=>Ms.find((e=>e.test(t))))(t);if(Di(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let n=e.parse(t);return e===Oo&&(n=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let i=0,o=0,s=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r;i=_s(a,r,t+1/3),o=_s(a,r,t),s=_s(a,r,t-1/3)}else i=o=s=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*s),alpha:r}}(n)),n}const Fs=(t,e)=>{const n=Vs(t),r=Vs(e);if(!n||!r)return js(t,e);const i={...n};return t=>(i.red=Ds(n.red,r.red,t),i.green=Ds(n.green,r.green,t),i.blue=Ds(n.blue,r.blue,t),i.alpha=Ns(n.alpha,r.alpha,t),Po.transform(i))},Ks=new Set(["none","hidden"]);function zs(t,e){return n=>Ns(t,e,n)}function Ws(t){return"number"==typeof t?zs:"string"==typeof t?Wi(t)?js:Io.test(t)?Fs:Zs:Array.isArray(t)?Hs:"object"==typeof t?Io.test(t)?Fs:$s:js}function Hs(t,e){const n=[...t],r=n.length,i=t.map(((t,n)=>Ws(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=i[e](t);return n}}function $s(t,e){const n={...t,...e},r={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(r[i]=Ws(t[i])(t[i],e[i]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Zs=(t,e)=>{const n=zo.createTransformer(e),r=Mo(t),i=Mo(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Ks.has(t)&&!i.values.length||Ks.has(e)&&!r.values.length?function(t,e){return Ks.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Ls(Hs(function(t,e){var n;const r=[],i={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const s=e.types[o],a=t.indexes[s][i[s]],c=null!==(n=t.values[a])&&void 0!==n?n:0;r[o]=c,i[s]++}return r}(r,i),i.values),n):(Di(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),js(t,e))};function Xs(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Ns(t,e,n);return Ws(t)(t,e)}function Ys(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const o=t.length;if(Mi(o===e.length,"Both input and output ranges must be the same length"),1===o)return()=>e[0];if(2===o&&t[0]===t[1])return()=>e[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const s=function(t,e,n){const r=[],i=n||Xs,o=t.length-1;for(let n=0;n<o;n++){let o=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||yi:e;o=Ls(t,o)}r.push(o)}return r}(e,r,i),a=s.length,c=e=>{let n=0;if(a>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=us(t[n],t[n+1],e);return s[n](r)};return n?e=>c(Xi(t[0],t[o-1],e)):c}function Gs(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=us(0,e,r);t.push(Ns(n,1,i))}}(e,t.length-1),e}function qs({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(r)?r.map(Bs):Bs(r),o={done:!1,value:e[0]},s=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Gs(e),t),a=Ys(s,e,{ease:Array.isArray(i)?i:(c=e,l=i,c.map((()=>l||Cs)).splice(0,c.length-1))});var c,l;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}const Js=t=>{const e=({timestamp:e})=>t(e);return{start:()=>bi.update(e,!0),stop:()=>Ei(e),now:()=>Si.isProcessing?Si.timestamp:ss.now()}},Qs={decay:ks,inertia:ks,tween:qs,keyframes:qs,spring:As},ta=t=>t/100;class ea extends ls{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:i}=this.options,o=(null==r?void 0:r.KeyframeResolver)||Eo;this.resolver=new o(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=this.options,s=rs(e)?e:Qs[e]||qs;let a,c;s!==qs&&"number"!=typeof t[0]&&(a=Ls(ta,Xs(t[0],t[1])),t=[0,100]);const l=s({...this.options,keyframes:t});"mirror"===i&&(c=s({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=Es(l));const{calculatedDuration:u}=l,h=u+r;return{generator:l,mirroredGenerator:c,mapPercentToKeyframes:a,calculatedDuration:u,resolvedDuration:h,totalDuration:h*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:i,mirroredGenerator:o,mapPercentToKeyframes:s,keyframes:a,calculatedDuration:c,totalDuration:l,resolvedDuration:u}=n;if(null===this.startTime)return i.next(0);const{delay:h,repeat:d,repeatType:f,repeatDelay:p,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-l/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>l;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=l);let w=this.currentTime,v=i;if(d){const t=Math.min(this.currentTime,l)/u;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===f?(n=1-n,p&&(n-=p/u)):"mirror"===f&&(v=o)),w=Xi(0,1,n)*u}const b=y?{done:!1,value:a[0]}:v.next(w);s&&(b.value=s(b.value));let{done:E}=b;y||null===c||(E=this.speed>=0?this.currentTime>=l:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&E);return S&&void 0!==r&&(b.value=gi(a,this.options,r)),m&&m(b.value),S&&this.finish(),b}get duration(){const{resolved:t}=this;return t?si(t.calculatedDuration):0}get time(){return si(this.currentTime)}set time(t){t=oi(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=si(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Js,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const na=new Set(["opacity","clipPath","filter","transform"]);function ra(t){let e;return()=>(void 0===e&&(e=t()),e)}const ia={linearEasing:void 0};function oa(t,e){const n=ra(t);return()=>{var t;return null!==(t=ia[e])&&void 0!==t?t:n()}}const sa=oa((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function aa(t){return Boolean("function"==typeof t&&sa()||!t||"string"==typeof t&&(t in la||sa())||Os(t)||Array.isArray(t)&&t.every(aa))}const ca=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,la={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ca([0,.65,.55,1]),circOut:ca([.55,0,1,.45]),backIn:ca([.31,.01,.66,-.59]),backOut:ca([.33,1.53,.69,.99])};function ua(t,e){return t?"function"==typeof t&&sa()?hs(t,e):Os(t)?ca(t):Array.isArray(t)?t.map((t=>ua(t,e)||la.easeOut)):la[t]:void 0}function ha(t,e,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeInOut",times:c}={}){const l={[e]:n};c&&(l.offset=c);const u=ua(a,i);return Array.isArray(u)&&(l.easing=u),t.animate(l,{delay:r,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"})}function da(t,e){t.timeline=e,t.onfinish=null}const fa=ra((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const pa={anticipate:Ui,backInOut:Bi,circInOut:_i};class ma extends ls{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new ns(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:i,ease:o,type:s,motionValue:a,name:c,startTime:l}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;var u;if("string"==typeof o&&sa()&&o in pa&&(o=pa[o]),rs((u=this.options).type)||"spring"===u.type||!aa(u.ease)){const{onComplete:e,onUpdate:n,motionValue:a,element:c,...l}=this.options,u=function(t,e){const n=new ea({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const i=[];let o=0;for(;!r.done&&o<2e4;)r=n.sample(o),i.push(r.value),o+=10;return{times:void 0,keyframes:i,duration:o-10,ease:"linear"}}(t,l);1===(t=u.keyframes).length&&(t[1]=t[0]),r=u.duration,i=u.times,o=u.ease,s="keyframes"}const h=ha(a.owner.current,c,t,{...this.options,duration:r,times:i,ease:o});return h.startTime=null!=l?l:this.calcStartTime(),this.pendingTimeline?(da(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;a.set(gi(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:r,times:i,type:s,ease:o,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return si(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return si(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=oi(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return yi;const{animation:n}=e;da(n,t)}else this.pendingTimeline=t;return yi}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:i,ease:o,times:s}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:c,...l}=this.options,u=new ea({...l,keyframes:n,duration:r,type:i,ease:o,times:s,isGenerator:!0}),h=oi(this.time);t.setWithVelocity(u.sample(h-10).value,u.sample(h).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:i,damping:o,type:s}=t;return fa()&&n&&na.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==i&&0!==o&&"inertia"!==s}}const ga=ra((()=>void 0!==window.ScrollTimeline));class ya{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>ga()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const wa=(t,e,n,r={},i,o)=>s=>{const a=hi(r,t)||{},c=a.delay||r.delay||0;let{elapsed:l=0}=r;l-=oi(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:i};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:o,repeatType:s,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length})(a)||(u={...u,...ui(t,u)}),u.duration&&(u.duration=oi(u.duration)),u.repeatDelay&&(u.repeatDelay=oi(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let h=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(u.duration=0,0===u.delay&&(h=!0)),(pi||di)&&(h=!0,u.duration=0,u.delay=0),h&&!o&&void 0!==e.get()){const t=gi(u.keyframes,a);if(void 0!==t)return bi.update((()=>{u.onUpdate(t),u.onComplete()})),new ya([])}return!o&&ma.supports(u)?new ma(u):new ea(u)},va=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),ba=t=>Yr(t)?t[t.length-1]||0:t;function Ea(t,e){-1===t.indexOf(e)&&t.push(e)}function Sa(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Ta{constructor(){this.subscriptions=[]}add(t){return Ea(this.subscriptions,t),()=>Sa(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let i=0;i<r;i++){const r=this.subscriptions[i];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const xa={current:void 0};class Aa{constructor(t,e={}){this.version="11.15.0",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=ss.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=ss.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Ta);const n=this.events[t].add(e);return"change"===t?()=>{n(),bi.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return xa.current&&xa.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=ss.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return ds(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ka(t,e){return new Aa(t,e)}function Ra(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ka(n))}const Pa=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ca="data-"+Pa("framerAppearId");function Oa(t){return t.props[Ca]}const Ia=t=>Boolean(t&&t.getVelocity);function Ba(t,e){const n=t.getValue("willChange");if(r=n,Boolean(Ia(r)&&r.add))return n.add(e);var r}function Ua({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function La(t,e,{delay:n=0,transitionOverride:r,type:i}={}){var o;let{transition:s=t.getDefaultTransition(),transitionEnd:a,...c}=e;r&&(s=r);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const e in c){const r=t.getValue(e,null!==(o=t.latestValues[e])&&void 0!==o?o:null),i=c[e];if(void 0===i||u&&Ua(u,e))continue;const a={delay:n,...hi(s||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Oa(t);if(n){const t=window.MotionHandoffAnimation(n,e,bi);null!==t&&(a.startTime=t,h=!0)}}Ba(t,e),r.start(wa(e,r,i,t.shouldReduceMotion&&ii.has(e)?{type:!1}:a,t,h));const d=r.animation;d&&l.push(d)}return a&&Promise.all(l).then((()=>{bi.update((()=>{a&&function(t,e){const n=ti(t,e);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const e in o)Ra(t,e,ba(o[e]))}(t,a)}))})),l}function Na(t,e,n={}){var r;const i=ti(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(o=n.transitionOverride);const s=i?()=>Promise.all(La(t,i,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:i=0,staggerChildren:s,staggerDirection:a}=o;return function(t,e,n=0,r=0,i=1,o){const s=[],a=(t.variantChildren.size-1)*r,c=1===i?(t=0)=>t*r:(t=0)=>a-t*r;return Array.from(t.variantChildren).sort(_a).forEach(((t,r)=>{t.notify("AnimationStart",e),s.push(Na(t,e,{...o,delay:n+c(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(s)}(t,e,i+r,s,a,n)}:()=>Promise.resolve(),{when:c}=o;if(c){const[t,e]="beforeChildren"===c?[s,a]:[a,s];return t().then((()=>e()))}return Promise.all([s(),a(n.delay)])}function _a(t,e){return t.sortNodePosition(e)}const ja=ni.length;function Da(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Da(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<ja;n++){const r=ni[n],i=t.props[r];(qr(i)||!1===i)&&(e[r]=i)}return e}const Ma=[...ei].reverse(),Va=ei.length;function Fa(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const i=e.map((e=>Na(t,e,n)));r=Promise.all(i)}else if("string"==typeof e)r=Na(t,e,n);else{const i="function"==typeof e?ti(t,e,n.custom):e;r=Promise.all(La(t,i,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Ka(t){let e=Fa(t),n=Ha(),r=!0;const i=e=>(n,r)=>{var i;const o=ti(t,r,"exit"===e?null===(i=t.presenceContext)||void 0===i?void 0:i.custom:void 0);if(o){const{transition:t,transitionEnd:e,...r}=o;n={...n,...r,...e}}return n};function o(o){const{props:s}=t,a=Da(t.parent)||{},c=[],l=new Set;let u={},h=1/0;for(let e=0;e<Va;e++){const d=Ma[e],f=n[d],p=void 0!==s[d]?s[d]:a[d],m=qr(p),g=d===o?f.isActive:null;!1===g&&(h=e);let y=p===a[d]&&p!==s[d]&&m;if(y&&r&&t.manuallyAnimateOnMount&&(y=!1),f.protectedKeys={...u},!f.isActive&&null===g||!p&&!f.prevProp||Xr(p)||"boolean"==typeof p)continue;const w=za(f.prevProp,p);let v=w||d===o&&f.isActive&&!y&&m||e>h&&m,b=!1;const E=Array.isArray(p)?p:[p];let S=E.reduce(i(d),{});!1===g&&(S={});const{prevResolvedValues:T={}}=f,x={...T,...S},A=e=>{v=!0,l.has(e)&&(b=!0,l.delete(e)),f.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=S[t],n=T[t];if(u.hasOwnProperty(t))continue;let r=!1;r=Yr(e)&&Yr(n)?!Gr(e,n):e!==n,r?null!=e?A(t):l.add(t):void 0!==e&&l.has(t)?A(t):f.protectedKeys[t]=!0}f.prevProp=p,f.prevResolvedValues=S,f.isActive&&(u={...u,...S}),r&&t.blockInitialAnimation&&(v=!1);v&&(!(y&&w)||b)&&c.push(...E.map((t=>({animation:t,options:{type:d}}))))}if(l.size){const e={};l.forEach((n=>{const r=t.getBaseTarget(n),i=t.getValue(n);i&&(i.liveStyle=!0),e[n]=null!=r?r:null})),c.push({animation:e})}let d=Boolean(c.length);return!r||!1!==s.initial&&s.initial!==s.animate||t.manuallyAnimateOnMount||(d=!1),r=!1,d?e(c):Promise.resolve()}return{animateChanges:o,setActive:function(e,r){var i;if(n[e].isActive===r)return Promise.resolve();null===(i=t.variantChildren)||void 0===i||i.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const s=o(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Ha(),r=!0}}}function za(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Gr(e,t)}function Wa(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ha(){return{animate:Wa(!0),whileInView:Wa(),whileHover:Wa(),whileTap:Wa(),whileDrag:Wa(),whileFocus:Wa(),exit:Wa()}}class $a{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Za=0;const Xa={animation:{Feature:class extends $a{constructor(t){super(t),t.animationState||(t.animationState=Ka(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Xr(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends $a{constructor(){super(...arguments),this.id=Za++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}},Ya={x:!1,y:!1};function Ga(){return Ya.x||Ya.y}function qa(t,e){const n=function(t,e,n){var r;if(t instanceof Element)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const o=null!==(r=null==n?void 0:n[t])&&void 0!==r?r:i.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}(t),r=new AbortController;return[n,{passive:!0,...e,signal:r.signal},()=>r.abort()]}function Ja(t){return e=>{"touch"===e.pointerType||Ga()||t(e)}}const Qa=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,tc=new WeakSet;function ec(t){return e=>{"Enter"===e.key&&t(e)}}function nc(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const rc=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const ic=(t,e)=>!!e&&(t===e||ic(t,e.parentElement));function oc(t){return Qa(t)&&!Ga()}function sc(t,e,n={}){const[r,i,o]=qa(t,n),s=t=>{const r=t.currentTarget;if(!oc(t)||tc.has(r))return;tc.add(r);const o=e(t),s=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",c),oc(t)&&tc.has(r)&&(tc.delete(r),o&&o(t,{success:e}))},a=t=>{s(t,n.useGlobalTarget||ic(r,t.target))},c=t=>{s(t,!1)};window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",c,i)};return r.forEach((t=>{(function(t){return rc.has(t.tagName)||-1!==t.tabIndex})(t)||(t.tabIndex=0);(n.useGlobalTarget?window:t).addEventListener("pointerdown",s,i),t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const r=ec((()=>{if(tc.has(n))return;nc(n,"down");const t=ec((()=>{nc(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>nc(n,"cancel")),e)}));n.addEventListener("keydown",r,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",r)),e)})(t,i)),i)})),o}function ac(t){return{point:{x:t.pageX,y:t.pageY}}}function cc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function lc(t,e,n,r){return cc(t,e,(t=>e=>Qa(e)&&t(e,ac(e)))(n),r)}const uc=(t,e)=>Math.abs(t-e);class hc{constructor(t,e,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=pc(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=uc(t.x,e.x),r=uc(t.y,e.y);return Math.sqrt(n**2+r**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:r}=t,{timestamp:i}=Si;this.history.push({...r,timestamp:i});const{onStart:o,onMove:s}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),s&&s(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=dc(e,this.transformPagePoint),bi.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if(this.dragSnapToOrigin&&i&&i(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=pc("pointercancel"===t.type?this.lastMoveEventInfo:dc(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,o),r&&r(t,o)},!Qa(t))return;this.dragSnapToOrigin=i,this.handlers=e,this.transformPagePoint=n,this.contextWindow=r||window;const o=dc(ac(t),this.transformPagePoint),{point:s}=o,{timestamp:a}=Si;this.history=[{...s,timestamp:a}];const{onSessionStart:c}=e;c&&c(t,pc(o,this.history)),this.removeListeners=Ls(lc(this.contextWindow,"pointermove",this.handlePointerMove),lc(this.contextWindow,"pointerup",this.handlePointerUp),lc(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ei(this.updatePoint)}}function dc(t,e){return e?{point:e(t.point)}:t}function fc(t,e){return{x:t.x-e.x,y:t.y-e.y}}function pc({point:t},e){return{point:t,delta:fc(t,gc(e)),offset:fc(t,mc(e)),velocity:yc(e,.1)}}function mc(t){return t[0]}function gc(t){return t[t.length-1]}function yc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=gc(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>oi(e)));)n--;if(!r)return{x:0,y:0};const o=si(i.timestamp-r.timestamp);if(0===o)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function wc(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const vc=.9999,bc=1.0001,Ec=-.01,Sc=.01;function Tc(t){return t.max-t.min}function xc(t,e,n,r=.5){t.origin=r,t.originPoint=Ns(e.min,e.max,t.origin),t.scale=Tc(n)/Tc(e),t.translate=Ns(n.min,n.max,t.origin)-t.originPoint,(t.scale>=vc&&t.scale<=bc||isNaN(t.scale))&&(t.scale=1),(t.translate>=Ec&&t.translate<=Sc||isNaN(t.translate))&&(t.translate=0)}function Ac(t,e,n,r){xc(t.x,e.x,n.x,r?r.originX:void 0),xc(t.y,e.y,n.y,r?r.originY:void 0)}function kc(t,e,n){t.min=n.min+e.min,t.max=t.min+Tc(e)}function Rc(t,e,n){t.min=e.min-n.min,t.max=t.min+Tc(e)}function Pc(t,e,n){Rc(t.x,e.x,n.x),Rc(t.y,e.y,n.y)}function Cc(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function Oc(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}const Ic=.35;function Bc(t,e,n){return{min:Uc(t,e),max:Uc(t,n)}}function Uc(t,e){return"number"==typeof t?t:t[e]||0}const Lc=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),Nc=()=>({x:{min:0,max:0},y:{min:0,max:0}});function _c(t){return[t("x"),t("y")]}function jc({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Dc(t){return void 0===t||1===t}function Mc({scale:t,scaleX:e,scaleY:n}){return!Dc(t)||!Dc(e)||!Dc(n)}function Vc(t){return Mc(t)||Fc(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Fc(t){return Kc(t.x)||Kc(t.y)}function Kc(t){return t&&"0%"!==t}function zc(t,e,n){return n+e*(t-n)}function Wc(t,e,n,r,i){return void 0!==i&&(t=zc(t,i,r)),zc(t,n,r)+e}function Hc(t,e=0,n=1,r,i){t.min=Wc(t.min,e,n,r,i),t.max=Wc(t.max,e,n,r,i)}function $c(t,{x:e,y:n}){Hc(t.x,e.translate,e.scale,e.originPoint),Hc(t.y,n.translate,n.scale,n.originPoint)}const Zc=.999999999999,Xc=1.0000000000001;function Yc(t,e){t.min=t.min+e,t.max=t.max+e}function Gc(t,e,n,r,i=.5){Hc(t,e,n,Ns(t.min,t.max,i),r)}function qc(t,e){Gc(t.x,e.x,e.scaleX,e.scale,e.originX),Gc(t.y,e.y,e.scaleY,e.scale,e.originY)}function Jc(t,e){return jc(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}const Qc=({current:t})=>t?t.ownerDocument.defaultView:null,tl=new WeakMap;class el{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Nc(),this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:r}=this.getProps();this.panSession=new hc(t,{onSessionStart:t=>{const{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(ac(t).point)},onStart:(t,e)=>{const{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=n)||"y"===o?Ya[o]?null:(Ya[o]=!0,()=>{Ya[o]=!1}):Ya.x||Ya.y?null:(Ya.x=Ya.y=!0,()=>{Ya.x=Ya.y=!1}),!this.openDragLock))return;var o;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),_c((t=>{let e=this.getAxisMotionValue(t).get()||0;if(to.test(e)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[t];if(r){e=Tc(r)*(parseFloat(e)/100)}}}this.originPoint[t]=e})),i&&bi.postRender((()=>i(t,e))),Ba(this.visualElement,"transform");const{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:o}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:s}=e;if(r&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(s),void(null!==this.currentDirection&&i&&i(this.currentDirection));this.updateAxis("x",e.point,s),this.updateAxis("y",e.point,s),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>this.stop(t,e),resumeAnimation:()=>_c((t=>{var e;return"paused"===this.getAnimationState(t)&&(null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.play())}))},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:r,contextWindow:Qc(this.visualElement)})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:r}=e;this.startAnimation(r);const{onDragEnd:i}=this.getProps();i&&bi.postRender((()=>i(t,e)))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(t,e,n){const{drag:r}=this.getProps();if(!n||!nl(t,r,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:n},r){return void 0!==e&&t<e?t=r?Ns(e,t,r.min):Math.max(t,e):void 0!==n&&t>n&&(t=r?Ns(n,t,r.max):Math.min(t,n)),t}(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(t=this.visualElement.projection)||void 0===t?void 0:t.layout,i=this.constraints;e&&wc(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(t,{top:e,left:n,bottom:r,right:i}){return{x:Cc(t.x,n,i),y:Cc(t.y,e,r)}}(r.layoutBox,e),this.elastic=function(t=Ic){return!1===t?t=0:!0===t&&(t=Ic),{x:Bc(t,"left","right"),y:Bc(t,"top","bottom")}}(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&_c((t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(r.layoutBox[t],this.constraints[t]))}))}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!wc(t))return!1;const n=t.current;Mi(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=function(t,e,n){const r=Jc(t,n),{scroll:i}=e;return i&&(Yc(r.x,i.offset.x),Yc(r.y,i.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Oc(t.x,e.x),y:Oc(t.y,e.y)}}(r.layout.layoutBox,i);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=jc(t))}return o}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{},c=_c((s=>{if(!nl(s,e,this.currentDirection))return;let c=a&&a[s]||{};o&&(c={min:0,max:0});const l=r?200:1e6,u=r?40:1e7,h={type:"inertia",velocity:n?t[s]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(s,h)}));return Promise.all(c).then(s)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return Ba(this.visualElement,t),n.start(wa(t,n,0,e,this.visualElement,!1))}stopAnimation(){_c((t=>this.getAxisMotionValue(t).stop()))}pauseAnimation(){_c((t=>{var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.pause()}))}getAnimationState(t){var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),r=n[e];return r||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){_c((e=>{const{drag:n}=this.getProps();if(!nl(e,n,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(e);if(r&&r.layout){const{min:n,max:o}=r.layout.layoutBox[e];i.set(t[e]-Ns(n,o,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:n}=this.visualElement;if(!wc(e)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};_c((t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const n=e.get();r[t]=function(t,e){let n=.5;const r=Tc(t),i=Tc(e);return i>r?n=us(e.min,e.max-r,t.min):r>i&&(n=us(t.min,t.max-i,e.min)),Xi(0,1,n)}({min:n,max:n},this.constraints[t])}}));const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),_c((e=>{if(!nl(e,t,null))return;const n=this.getAxisMotionValue(e),{min:i,max:o}=this.constraints[e];n.set(Ns(i,o,r[e]))}))}addListeners(){if(!this.visualElement.current)return;tl.set(this.visualElement,this);const t=lc(this.visualElement.current,"pointerdown",(t=>{const{drag:e,dragListener:n=!0}=this.getProps();e&&n&&this.start(t)})),e=()=>{const{dragConstraints:t}=this.getProps();wc(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,r=n.addEventListener("measure",e);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),bi.read(e);const i=cc(window,"resize",(()=>this.scalePositionWithinConstraints())),o=n.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(_c((e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))})),this.visualElement.render())}));return()=>{i(),t(),r(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=Ic,dragMomentum:s=!0}=t;return{...t,drag:e,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:s}}}function nl(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}const rl=t=>(e,n)=>{t&&bi.postRender((()=>t(e,n)))};var il=a(893);const ol=(0,e.createContext)(null);const sl=(0,e.createContext)({}),al=(0,e.createContext)({}),cl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ll(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ul={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!eo.test(t))return t;t=parseFloat(t)}return`${ll(t,e.target.x)}% ${ll(t,e.target.y)}%`}},hl={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=zo.parse(t);if(i.length>5)return r;const o=zo.createTransformer(t),s="number"!=typeof i[0]?1:0,a=n.x.scale*e.x,c=n.y.scale*e.y;i[0+s]/=a,i[1+s]/=c;const l=Ns(a,c,.5);return"number"==typeof i[2+s]&&(i[2+s]/=l),"number"==typeof i[3+s]&&(i[3+s]/=l),o(i)}},dl={};const{schedule:fl,cancel:pl}=vi(queueMicrotask,!1);class ml extends e.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=t;var o;o=yl,Object.assign(dl,o),i&&(e.group&&e.group.add(i),n&&n.register&&r&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",(()=>{this.safeToRemove()})),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),cl.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:n,drag:r,isPresent:i}=this.props,o=n.projection;return o?(o.isPresent=i,r||t.layoutDependency!==e||void 0===e?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||bi.postRender((()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()}))),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),fl.postRender((()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()})))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n}=this.props,{projection:r}=t;r&&(r.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function gl(t){const[n,r]=function(){const t=(0,e.useContext)(ol);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,o=(0,e.useId)();(0,e.useEffect)((()=>i(o)),[]);const s=(0,e.useCallback)((()=>r&&r(o)),[o,r]);return!n&&r?[!1,s]:[!0]}(),i=(0,e.useContext)(sl);return(0,il.jsx)(ml,{...t,layoutGroup:i,switchLayoutGroup:(0,e.useContext)(al),isPresent:n,safeToRemove:r})}const yl={borderRadius:{...ul,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ul,borderTopRightRadius:ul,borderBottomLeftRadius:ul,borderBottomRightRadius:ul,boxShadow:hl},wl=["TopLeft","TopRight","BottomLeft","BottomRight"],vl=wl.length,bl=t=>"string"==typeof t?parseFloat(t):t,El=t=>"number"==typeof t||eo.test(t);function Sl(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Tl=Al(0,.5,Ni),xl=Al(.5,.95,yi);function Al(t,e,n){return r=>r<t?0:r>e?1:n(us(t,e,r))}function kl(t,e){t.min=e.min,t.max=e.max}function Rl(t,e){kl(t.x,e.x),kl(t.y,e.y)}function Pl(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Cl(t,e,n,r,i){return t=zc(t-=e,1/n,r),void 0!==i&&(t=zc(t,1/i,r)),t}function Ol(t,e,[n,r,i],o,s){!function(t,e=0,n=1,r=.5,i,o=t,s=t){to.test(e)&&(e=parseFloat(e),e=Ns(s.min,s.max,e/100)-s.min);if("number"!=typeof e)return;let a=Ns(o.min,o.max,r);t===o&&(a-=e),t.min=Cl(t.min,e,n,a,i),t.max=Cl(t.max,e,n,a,i)}(t,e[n],e[r],e[i],e.scale,o,s)}const Il=["x","scaleX","originX"],Bl=["y","scaleY","originY"];function Ul(t,e,n,r){Ol(t.x,e,Il,n?n.x:void 0,r?r.x:void 0),Ol(t.y,e,Bl,n?n.y:void 0,r?r.y:void 0)}function Ll(t){return 0===t.translate&&1===t.scale}function Nl(t){return Ll(t.x)&&Ll(t.y)}function _l(t,e){return t.min===e.min&&t.max===e.max}function jl(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Dl(t,e){return jl(t.x,e.x)&&jl(t.y,e.y)}function Ml(t){return Tc(t.x)/Tc(t.y)}function Vl(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Fl{constructor(){this.members=[]}add(t){Ea(this.members,t),t.scheduleRender()}remove(t){if(Sa(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex((e=>t===e));if(0===e)return!1;let n;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,e&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;!1===r&&n.hide()}}exitAnimationComplete(){this.members.forEach((t=>{const{options:e,resumingFrom:n}=t;e.onExitComplete&&e.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()}))}scheduleRender(){this.members.forEach((t=>{t.instance&&t.scheduleRender(!1)}))}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Kl=(t,e)=>t.depth-e.depth;class zl{constructor(){this.children=[],this.isDirty=!1}add(t){Ea(this.children,t),this.isDirty=!0}remove(t){Sa(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Kl),this.isDirty=!1,this.children.forEach(t)}}function Wl(t){const e=Ia(t)?t.get():t;return va(e)?e.toValue():e}function Hl(t,e){const n=ss.now(),r=({timestamp:i})=>{const o=i-n;o>=e&&(Ei(r),t(o-e))};return bi.read(r,!0),()=>Ei(r)}const $l={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Zl="undefined"!=typeof window&&void 0!==window.MotionDebug,Xl=["","X","Y","Z"],Yl={visibility:"hidden"};let Gl=0;function ql(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Jl(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Oa(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",bi,!(e||r))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Jl(r)}function Ql({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(t={},n=(null==e?void 0:e())){this.id=Gl++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Zl&&($l.totalNodes=$l.resolvedTargetDeltas=$l.recalculatedProjection=0),this.nodes.forEach(nu),this.nodes.forEach(lu),this.nodes.forEach(uu),this.nodes.forEach(ru),Zl&&window.MotionDebug.record($l)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new zl)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new Ta),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const n=this.eventHandlers.get(t);n&&n.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e,n=this.root.hasTreeAnimated){if(this.instance)return;var r;this.isSVG=(r=e)instanceof SVGElement&&"svg"!==r.tagName,this.instance=e;const{layoutId:i,layout:o,visualElement:s}=this.options;if(s&&!s.current&&s.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(o||i)&&(this.isLayoutDirty=!0),t){let n;const r=()=>this.root.updateBlockedByResize=!1;t(e,(()=>{this.root.updateBlockedByResize=!0,n&&n(),n=Hl(r,250),cl.hasAnimatedSinceResize&&(cl.hasAnimatedSinceResize=!1,this.nodes.forEach(cu))}))}i&&this.root.registerSharedNode(i,this),!1!==this.options.animate&&s&&(i||o)&&this.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const i=this.options.transition||s.getDefaultTransition()||gu,{onLayoutAnimationStart:o,onLayoutAnimationComplete:a}=s.getProps(),c=!this.targetLayout||!Dl(this.targetLayout,r)||n,l=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||l||e&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,l);const e={...hi(i,"layout"),onPlay:o,onComplete:a};(s.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||cu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ei(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(hu),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Jl(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:n}=this.options;if(void 0===e&&!n)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(ou);this.isUpdating||this.nodes.forEach(su),this.isUpdating=!1,this.nodes.forEach(au),this.nodes.forEach(tu),this.nodes.forEach(eu),this.clearAllSnapshots();const t=ss.now();Si.delta=Xi(0,1e3/60,t-Si.timestamp),Si.timestamp=t,Si.isProcessing=!0,Ti.update.process(Si),Ti.preRender.process(Si),Ti.render.process(Si),Si.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,fl.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(iu),this.sharedNodes.forEach(du)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,bi.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){bi.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Nc(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(t="measure"){let e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e){const e=r(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!i)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!Nl(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,o=r!==this.prevTransformTemplateValue;t&&(e||Vc(this.latestValues)||o)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let n=this.removeElementScroll(e);var r;return t&&(n=this.removeTransform(n)),vu((r=n).x),vu(r.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){var t;const{visualElement:e}=this.options;if(!e)return Nc();const n=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(Eu))){const{scroll:t}=this.root;t&&(Yc(n.x,t.offset.x),Yc(n.y,t.offset.y))}return n}removeElementScroll(t){var e;const n=Nc();if(Rl(n,t),null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)return n;for(let e=0;e<this.path.length;e++){const r=this.path[e],{scroll:i,options:o}=r;r!==this.root&&i&&o.layoutScroll&&(i.wasRoot&&Rl(n,t),Yc(n.x,i.offset.x),Yc(n.y,i.offset.y))}return n}applyTransform(t,e=!1){const n=Nc();Rl(n,t);for(let t=0;t<this.path.length;t++){const r=this.path[t];!e&&r.options.layoutScroll&&r.scroll&&r!==r.root&&qc(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),Vc(r.latestValues)&&qc(n,r.latestValues)}return Vc(this.latestValues)&&qc(n,this.latestValues),n}removeTransform(t){const e=Nc();Rl(e,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];if(!n.instance)continue;if(!Vc(n.latestValues))continue;Mc(n.latestValues)&&n.updateSnapshot();const r=Nc();Rl(r,n.measurePageBox()),Ul(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return Vc(this.latestValues)&&Ul(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Si.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){var e;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==n;if(!(t||r&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:i,layoutId:o}=this.options;if(this.layout&&(i||o)){if(this.resolvedRelativeTargetAt=Si.timestamp,!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nc(),this.relativeTargetOrigin=Nc(),Pc(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),Rl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var s,a,c;if(this.target||(this.target=Nc(),this.targetWithTransforms=Nc()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),s=this.target,a=this.relativeTarget,c=this.relativeParent.target,kc(s.x,a.x,c.x),kc(s.y,a.y,c.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):Rl(this.target,this.layout.layoutBox),$c(this.target,this.targetDelta)):Rl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const t=this.getClosestProjectingParent();t&&Boolean(t.resumingFrom)===Boolean(this.resumingFrom)&&!t.options.layoutScroll&&t.target&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nc(),this.relativeTargetOrigin=Nc(),Pc(this.relativeTargetOrigin,this.target,t.target),Rl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Zl&&$l.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!Mc(this.parent.latestValues)&&!Fc(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var t;const e=this.getLead(),n=Boolean(this.resumingFrom)||this!==e;let r=!0;if((this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty))&&(r=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===Si.timestamp&&(r=!1),r)return;const{layout:i,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!i&&!o)return;Rl(this.layoutCorrected,this.layout.layoutBox);const s=this.treeScale.x,a=this.treeScale.y;!function(t,e,n,r=!1){const i=n.length;if(!i)return;let o,s;e.x=e.y=1;for(let a=0;a<i;a++){o=n[a],s=o.projectionDelta;const{visualElement:i}=o.options;i&&i.props.style&&"contents"===i.props.style.display||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&qc(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),s&&(e.x*=s.x.scale,e.y*=s.y.scale,$c(t,s)),r&&Vc(o.latestValues)&&qc(t,o.latestValues))}e.x<Xc&&e.x>Zc&&(e.x=1),e.y<Xc&&e.y>Zc&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms=Nc());const{target:c}=e;c?(this.projectionDelta&&this.prevProjectionDelta?(Pl(this.prevProjectionDelta.x,this.projectionDelta.x),Pl(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),Ac(this.projectionDelta,this.layoutCorrected,c,this.latestValues),this.treeScale.x===s&&this.treeScale.y===a&&Vl(this.projectionDelta.x,this.prevProjectionDelta.x)&&Vl(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",c)),Zl&&$l.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){var e;if(null===(e=this.options.visualElement)||void 0===e||e.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Lc(),this.projectionDelta=Lc(),this.projectionDeltaWithTransform=Lc()}setAnimationOrigin(t,e=!1){const n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},o=Lc();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const s=Nc(),a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=Boolean(a&&!l&&!0===this.options.crossfade&&!this.path.some(mu));let h;this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;fu(o.x,t.x,n),fu(o.y,t.y,n),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Pc(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox),function(t,e,n,r){pu(t.x,e.x,n.x,r),pu(t.y,e.y,n.y,r)}(this.relativeTarget,this.relativeTargetOrigin,s,n),h&&function(t,e){return _l(t.x,e.x)&&_l(t.y,e.y)}(this.relativeTarget,h)&&(this.isProjectionDirty=!1),h||(h=Nc()),Rl(h,this.relativeTarget)),a&&(this.animationValues=i,function(t,e,n,r,i,o){i?(t.opacity=Ns(0,void 0!==n.opacity?n.opacity:1,Tl(r)),t.opacityExit=Ns(void 0!==e.opacity?e.opacity:1,0,xl(r))):o&&(t.opacity=Ns(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let i=0;i<vl;i++){const o=`border${wl[i]}Radius`;let s=Sl(e,o),a=Sl(n,o);void 0===s&&void 0===a||(s||(s=0),a||(a=0),0===s||0===a||El(s)===El(a)?(t[o]=Math.max(Ns(bl(s),bl(a),r),0),(to.test(a)||to.test(s))&&(t[o]+="%")):t[o]=a)}(e.rotate||n.rotate)&&(t.rotate=Ns(e.rotate||0,n.rotate||0,r))}(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ei(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=bi.update((()=>{cl.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,n){const r=Ia(t)?t:ka(t);return r.start(wa("",r,e,n)),r.animation}(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:n,layout:r,latestValues:i}=t;if(e&&n&&r){if(this!==t&&this.layout&&r&&bu(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Nc();const e=Tc(this.layout.layoutBox.x);n.x.min=t.target.x.min,n.x.max=n.x.min+e;const r=Tc(this.layout.layoutBox.y);n.y.min=t.target.y.min,n.y.max=n.y.min+r}Rl(e,n),qc(e,i),Ac(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Fl);this.sharedNodes.get(t).add(e);const n=e.options.initialPromotionConfig;e.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){var t;const{layoutId:e}=this.options;return e&&(null===(t=this.getStack())||void 0===t?void 0:t.lead)||this}getPrevLead(){var t;const{layoutId:e}=this.options;return e?null===(t=this.getStack())||void 0===t?void 0:t.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:n}={}){const r=this.getStack();r&&r.promote(this,n),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:n}=t;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(e=!0),!e)return;const r={};n.z&&ql("z",t,r,this.animationValues);for(let e=0;e<Xl.length;e++)ql(`rotate${Xl[e]}`,t,r,this.animationValues),ql(`skew${Xl[e]}`,t,r,this.animationValues);t.render();for(const e in r)t.setStaticValue(e,r[e]),this.animationValues&&(this.animationValues[e]=r[e]);t.scheduleRender()}getProjectionStyles(t){var e,n;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Yl;const r={visibility:""},i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=Wl(null==t?void 0:t.pointerEvents)||"",r.transform=i?i(this.latestValues,""):"none",r;const o=this.getLead();if(!this.projectionDelta||!this.layout||!o.target){const e={};return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=Wl(null==t?void 0:t.pointerEvents)||""),this.hasProjected&&!Vc(this.latestValues)&&(e.transform=i?i({},""):"none",this.hasProjected=!1),e}const s=o.animationValues||o.latestValues;this.applyTransformsToTarget(),r.transform=function(t,e,n){let r="";const i=t.x.translate/e.x,o=t.y.translate/e.y,s=(null==n?void 0:n.z)||0;if((i||o||s)&&(r=`translate3d(${i}px, ${o}px, ${s}px) `),1===e.x&&1===e.y||(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:t,rotate:e,rotateX:i,rotateY:o,skewX:s,skewY:a}=n;t&&(r=`perspective(${t}px) ${r}`),e&&(r+=`rotate(${e}deg) `),i&&(r+=`rotateX(${i}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),a&&(r+=`skewY(${a}deg) `)}const a=t.x.scale*e.x,c=t.y.scale*e.y;return 1===a&&1===c||(r+=`scale(${a}, ${c})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,s),i&&(r.transform=i(s,r.transform));const{x:a,y:c}=this.projectionDelta;r.transformOrigin=`${100*a.origin}% ${100*c.origin}% 0`,o.animationValues?r.opacity=o===this?null!==(n=null!==(e=s.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==n?n:1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:r.opacity=o===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0;for(const t in dl){if(void 0===s[t])continue;const{correct:e,applyTo:n}=dl[t],i="none"===r.transform?s[t]:e(s[t],o);if(n){const t=n.length;for(let e=0;e<t;e++)r[n[e]]=i}else r[t]=i}return this.options.layoutId&&(r.pointerEvents=o===this?Wl(null==t?void 0:t.pointerEvents)||"":"none"),r}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>{var e;return null===(e=t.currentAnimation)||void 0===e?void 0:e.stop()})),this.root.nodes.forEach(ou),this.root.sharedNodes.clear()}}}function tu(t){t.updateLayout()}function eu(t){var e;const n=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:r}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;"size"===i?_c((t=>{const r=o?n.measuredBox[t]:n.layoutBox[t],i=Tc(r);r.min=e[t].min,r.max=r.min+i})):bu(i,n.layoutBox,e)&&_c((r=>{const i=o?n.measuredBox[r]:n.layoutBox[r],s=Tc(e[r]);i.max=i.min+s,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[r].max=t.relativeTarget[r].min+s)}));const s=Lc();Ac(s,e,n.layoutBox);const a=Lc();o?Ac(a,t.applyTransform(r,!0),n.measuredBox):Ac(a,e,n.layoutBox);const c=!Nl(s);let l=!1;if(!t.resumeFrom){const r=t.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:i,layout:o}=r;if(i&&o){const s=Nc();Pc(s,n.layoutBox,i.layoutBox);const a=Nc();Pc(a,e,o.layoutBox),Dl(s,a)||(l=!0),r.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=s,t.relativeParent=r)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:n,delta:a,layoutDelta:s,hasLayoutChanged:c,hasRelativeTargetChanged:l})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function nu(t){Zl&&$l.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ru(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function iu(t){t.clearSnapshot()}function ou(t){t.clearMeasurements()}function su(t){t.isLayoutDirty=!1}function au(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function cu(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function lu(t){t.resolveTargetDelta()}function uu(t){t.calcProjection()}function hu(t){t.resetSkewAndRotation()}function du(t){t.removeLeadSnapshot()}function fu(t,e,n){t.translate=Ns(e.translate,0,n),t.scale=Ns(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function pu(t,e,n,r){t.min=Ns(e.min,n.min,r),t.max=Ns(e.max,n.max,r)}function mu(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const gu={duration:.45,ease:[.4,0,.1,1]},yu=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),wu=yu("applewebkit/")&&!yu("chrome/")?Math.round:yi;function vu(t){t.min=wu(t.min),t.max=wu(t.max)}function bu(t,e,n){return"position"===t||"preserve-aspect"===t&&(r=Ml(e),i=Ml(n),o=.2,!(Math.abs(r-i)<=o));var r,i,o}function Eu(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const Su=Ql({attachResizeListener:(t,e)=>cc(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Tu={current:void 0},xu=Ql({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Tu.current){const t=new Su({});t.mount(window),t.setOptions({layoutScroll:!0}),Tu.current=t}return Tu.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),Au={pan:{Feature:class extends $a{constructor(){super(...arguments),this.removePointerDownListener=yi}onPointerDown(t){this.session=new hc(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Qc(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:rl(t),onStart:rl(e),onMove:n,onEnd:(t,e)=>{delete this.session,r&&bi.postRender((()=>r(t,e)))}}}mount(){this.removePointerDownListener=lc(this.node.current,"pointerdown",(t=>this.onPointerDown(t)))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends $a{constructor(t){super(t),this.removeGroupControls=yi,this.removeListeners=yi,this.controls=new el(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yi}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:xu,MeasureLayout:gl}};function ku(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover","Start"===n);const i=r["onHover"+n];i&&bi.postRender((()=>i(e,ac(e))))}function Ru(t,e,n){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap","Start"===n);const i=r["onTap"+("End"===n?"":n)];i&&bi.postRender((()=>i(e,ac(e))))}const Pu=new WeakMap,Cu=new WeakMap,Ou=t=>{const e=Pu.get(t.target);e&&e(t)},Iu=t=>{t.forEach(Ou)};function Bu(t,e,n){const r=function({root:t,...e}){const n=t||document;Cu.has(n)||Cu.set(n,{});const r=Cu.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(Iu,{root:t,...e})),r[i]}(e);return Pu.set(t,n),r.observe(t),()=>{Pu.delete(t),r.unobserve(t)}}const Uu={some:0,all:1};const Lu={inView:{Feature:class extends $a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:i}=t,o={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:Uu[r]};return Bu(this.node.current,o,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,i&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),o=e?n:r;o&&o(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends $a{mount(){const{current:t}=this.node;t&&(this.unmount=sc(t,(t=>(Ru(this.node,t,"Start"),(t,{success:e})=>Ru(this.node,t,e?"End":"Cancel"))),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends $a{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ls(cc(this.node.current,"focus",(()=>this.onFocus())),cc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends $a{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[r,i,o]=qa(t,n),s=Ja((t=>{const{target:n}=t,r=e(t);if(!r||!n)return;const o=Ja((t=>{r(t),n.removeEventListener("pointerleave",o)}));n.addEventListener("pointerleave",o,i)}));return r.forEach((t=>{t.addEventListener("pointerenter",s,i)})),o}(t,(t=>(ku(this.node,t,"Start"),t=>ku(this.node,t,"End")))))}unmount(){}}}},Nu={layout:{ProjectionNode:xu,MeasureLayout:gl}},_u=(0,e.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),ju=(0,e.createContext)({}),Du="undefined"!=typeof window,Mu=Du?e.useLayoutEffect:e.useEffect,Vu=(0,e.createContext)({strict:!1});function Fu(t,n,r,i,o){var s,a;const{visualElement:c}=(0,e.useContext)(ju),l=(0,e.useContext)(Vu),u=(0,e.useContext)(ol),h=(0,e.useContext)(_u).reducedMotion,d=(0,e.useRef)(null);i=i||l.renderer,!d.current&&i&&(d.current=i(t,{visualState:n,parent:c,props:r,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:h}));const f=d.current,p=(0,e.useContext)(al);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:c,layoutRoot:l}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Ku(t.parent)),t.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:Boolean(s)||a&&wc(a),visualElement:t,animationType:"string"==typeof o?o:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:l})}(d.current,r,o,p);const m=(0,e.useRef)(!1);(0,e.useInsertionEffect)((()=>{f&&m.current&&f.update(r,u)}));const g=r[Ca],y=(0,e.useRef)(Boolean(g)&&!(null===(s=window.MotionHandoffIsComplete)||void 0===s?void 0:s.call(window,g))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,g)));return Mu((()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),fl.render(f.render),y.current&&f.animationState&&f.animationState.animateChanges())})),(0,e.useEffect)((()=>{f&&(!y.current&&f.animationState&&f.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,g)})),y.current=!1))})),f}function Ku(t){if(t)return!1!==t.options.allowProjection?t.projection:Ku(t.parent)}function zu(t,n,r){return(0,e.useCallback)((e=>{e&&t.mount&&t.mount(e),n&&(e?n.mount(e):n.unmount()),r&&("function"==typeof r?r(e):wc(r)&&(r.current=e))}),[n])}function Wu(t){return Xr(t.animate)||ni.some((e=>qr(t[e])))}function Hu(t){return Boolean(Wu(t)||t.variants)}function $u(t){const{initial:n,animate:r}=function(t,e){if(Wu(t)){const{initial:e,animate:n}=t;return{initial:!1===e||qr(e)?e:void 0,animate:qr(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,e.useContext)(ju));return(0,e.useMemo)((()=>({initial:n,animate:r})),[Zu(n),Zu(r)])}function Zu(t){return Array.isArray(t)?t.join(" "):t}const Xu={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Yu={};for(const t in Xu)Yu[t]={isEnabled:e=>Xu[t].some((t=>!!e[t]))};const Gu=Symbol.for("motionComponentSymbol");function qu({preloadedFeatures:t,createVisualElement:n,useRender:r,useVisualState:i,Component:o}){t&&function(t){for(const e in t)Yu[e]={...Yu[e],...t[e]}}(t);const s=(0,e.forwardRef)((function(t,s){let a;const c={...(0,e.useContext)(_u),...t,layoutId:Ju(t)},{isStatic:l}=c,u=$u(t),h=i(t,l);if(!l&&Du){!function(t,n){(0,e.useContext)(Vu).strict;0}();const t=function(t){const{drag:e,layout:n}=Yu;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(c);a=t.MeasureLayout,u.visualElement=Fu(o,h,c,n,t.ProjectionNode)}return(0,il.jsxs)(ju.Provider,{value:u,children:[a&&u.visualElement?(0,il.jsx)(a,{visualElement:u.visualElement,...c}):null,r(o,t,zu(h,u.visualElement,s),h,l,u.visualElement)]})}));return s[Gu]=o,s}function Ju({layoutId:t}){const n=(0,e.useContext)(sl).id;return n&&void 0!==t?n+"-"+t:t}const Qu=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function th(t){return"string"==typeof t&&!t.includes("-")&&!!(Qu.indexOf(t)>-1||/[A-Z]/u.test(t))}function eh(t,{style:e,vars:n},r,i){Object.assign(t.style,e,i&&i.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}const nh=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function rh(t,e,n,r){eh(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(nh.has(n)?n:Pa(n),e.attrs[n])}function ih(t,{layout:e,layoutId:n}){return ii.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!dl[t]||"opacity"===t)}function oh(t,e,n){var r;const{style:i}=t,o={};for(const s in i)(Ia(i[s])||e.style&&Ia(e.style[s])||ih(s,t)||void 0!==(null===(r=null==n?void 0:n.getValue(s))||void 0===r?void 0:r.liveStyle))&&(o[s]=i[s]);return o}function sh(t,e,n){const r=oh(t,e,n);for(const n in t)if(Ia(t[n])||Ia(e[n])){r[-1!==ri.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const ah=t=>(n,r)=>{const i=(0,e.useContext)(ju),o=(0,e.useContext)(ol),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,i,o){const s={latestValues:ch(r,i,o,t),renderState:e()};return n&&(s.mount=t=>n(r,t,s)),s}(t,n,i,o);return r?s():function(t){const n=(0,e.useRef)(null);return null===n.current&&(n.current=t()),n.current}(s)};function ch(t,e,n,r){const i={},o=r(t,{});for(const t in o)i[t]=Wl(o[t]);let{initial:s,animate:a}=t;const c=Wu(t),l=Hu(t);e&&l&&!c&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let u=!!n&&!1===n.initial;u=u||!1===s;const h=u?a:s;if(h&&"boolean"!=typeof h&&!Xr(h)){const e=Array.isArray(h)?h:[h];for(let n=0;n<e.length;n++){const r=Qr(t,e[n]);if(r){const{transitionEnd:t,transition:e,...n}=r;for(const t in n){let e=n[t];if(Array.isArray(e)){e=e[u?e.length-1:0]}null!==e&&(i[t]=e)}for(const e in t)i[e]=t[e]}}}return i}const lh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),uh=()=>({...lh(),attrs:{}}),hh=(t,e)=>e&&"number"==typeof t?e.transform(t):t,dh={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fh=ri.length;function ph(t,e,n){const{style:r,vars:i,transformOrigin:o}=t;let s=!1,a=!1;for(const t in e){const n=e[t];if(ii.has(t))s=!0;else if(Ki(t))i[t]=n;else{const e=hh(n,qo[t]);t.startsWith("origin")?(a=!0,o[t]=e):r[t]=e}}if(e.transform||(s||n?r.transform=function(t,e,n){let r="",i=!0;for(let o=0;o<fh;o++){const s=ri[o],a=t[s];if(void 0===a)continue;let c=!0;if(c="number"==typeof a?a===(s.startsWith("scale")?1:0):0===parseFloat(a),!c||n){const t=hh(a,qo[s]);c||(i=!1,r+=`${dh[s]||s}(${t}) `),n&&(e[s]=t)}}return r=r.trim(),n?r=n(e,i?"":r):i&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),a){const{originX:t="50%",originY:e="50%",originZ:n=0}=o;r.transformOrigin=`${t} ${e} ${n}`}}function mh(t,e,n){return"string"==typeof t?t:eo.transform(e+n*t)}const gh={offset:"stroke-dashoffset",array:"stroke-dasharray"},yh={offset:"strokeDashoffset",array:"strokeDasharray"};function wh(t,{attrX:e,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:c=0,...l},u,h){if(ph(t,l,h),u)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:d,style:f,dimensions:p}=t;d.transform&&(p&&(f.transform=d.transform),delete d.transform),p&&(void 0!==i||void 0!==o||f.transform)&&(f.transformOrigin=function(t,e,n){return`${mh(e,t.x,t.width)} ${mh(n,t.y,t.height)}`}(p,void 0!==i?i:.5,void 0!==o?o:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==s&&function(t,e,n=1,r=0,i=!0){t.pathLength=1;const o=i?gh:yh;t[o.offset]=eo.transform(-r);const s=eo.transform(e),a=eo.transform(n);t[o.array]=`${s} ${a}`}(d,s,a,c,!1)}const vh=t=>"string"==typeof t&&"svg"===t.toLowerCase(),bh={useVisualState:ah({scrapeMotionValuesFromProps:sh,createRenderState:uh,onMount:(t,e,{renderState:n,latestValues:r})=>{bi.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),bi.render((()=>{wh(n,r,vh(e.tagName),t.transformTemplate),rh(e,n)}))}})},Eh={useVisualState:ah({scrapeMotionValuesFromProps:oh,createRenderState:lh})};function Sh(t,e,n){for(const r in e)Ia(e[r])||ih(r,n)||(t[r]=e[r])}function Th(t,n){const r={};return Sh(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},n){return(0,e.useMemo)((()=>{const e=lh();return ph(e,n,t),Object.assign({},e.vars,e.style)}),[n])}(t,n)),r}function xh(t,e){const n={},r=Th(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Ah=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function kh(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Ah.has(t)}let Rh=t=>!kh(t);try{(Ph=require("@emotion/is-prop-valid").default)&&(Rh=t=>t.startsWith("on")?!kh(t):Ph(t))}catch(t){}var Ph;function Ch(t,n,r,i){const o=(0,e.useMemo)((()=>{const e=uh();return wh(e,n,vh(i),t.transformTemplate),{...e.attrs,style:{...e.style}}}),[n]);if(t.style){const e={};Sh(e,t.style,t),o.style={...e,...o.style}}return o}function Oh(t=!1){return(n,r,i,{latestValues:o},s)=>{const a=(th(n)?Ch:xh)(r,o,s,n),c=function(t,e,n){const r={};for(const i in t)"values"===i&&"object"==typeof t.values||(Rh(i)||!0===n&&kh(i)||!e&&!kh(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}(r,"string"==typeof n,t),l=n!==e.Fragment?{...c,...a,ref:i}:{},{children:u}=r,h=(0,e.useMemo)((()=>Ia(u)?u.get():u),[u]);return(0,e.createElement)(n,{...l,children:h})}}function Ih(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return qu({...th(n)?bh:Eh,preloadedFeatures:t,useRender:Oh(r),createVisualElement:e,Component:n})}}const Bh={current:null},Uh={current:!1};const Lh=new WeakMap,Nh=[...po,Io,zo],_h=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class jh{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Eo,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=ss.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,bi.render(this.render,!1,!0))};const{latestValues:a,renderState:c}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=e.initial?{...a}:{},this.renderState=c,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=s,this.blockInitialAnimation=Boolean(i),this.isControllingVariants=Wu(e),this.isVariantNode=Hu(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in u){const e=u[t];void 0!==a[t]&&Ia(e)&&e.set(a[t],!1)}}mount(t){this.current=t,Lh.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),Uh.current||function(){if(Uh.current=!0,Du)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Bh.current=t.matches;t.addListener(e),e()}else Bh.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Bh.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Lh.delete(this.current),this.projection&&this.projection.unmount(),Ei(this.notifyUpdate),Ei(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=ii.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&bi.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),i=e.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),i(),o&&o(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in Yu){const e=Yu[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Nc()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<_h.length;e++){const n=_h[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const i=e[r],o=n[r];if(Ia(i))t.addValue(r,i);else if(Ia(o))t.addValue(r,ka(i,{owner:t}));else if(o!==i)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(r);t.addValue(r,ka(void 0!==e?e:i,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=ka(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];return null!=r&&("string"==typeof r&&(Vi(r)||ji(r))?r=parseFloat(r):!(t=>Nh.find(fo(t)))(r)&&zo.test(e)&&(r=ts(t,e)),this.setBaseTarget(t,Ia(r)?r.get():r)),Ia(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const i=Qr(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);i&&(r=i[t])}if(n&&void 0!==r)return r;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||Ia(i)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new Ta),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Dh extends jh{constructor(){super(...arguments),this.KeyframeResolver=ns}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ia(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class Mh extends Dh{constructor(){super(...arguments),this.type="html",this.renderInstance=eh}readValueFromInstance(t,e){if(ii.has(e)){const t=Qo(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),i=(Ki(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof i?i.trim():i}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Jc(t,e)}build(t,e,n){ph(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return oh(t,e,n)}}class Vh extends Dh{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Nc}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(ii.has(e)){const t=Qo(e);return t&&t.default||0}return e=nh.has(e)?e:Pa(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return sh(t,e,n)}build(t,e,n){wh(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){rh(t,e,0,r)}mount(t){this.isSVGTag=vh(t.tagName),super.mount(t)}}const Fh=Zr(Ih({...Xa,...Lu,...Au,...Nu},((t,n)=>th(t)?new Vh(n):new Mh(n,{allowProjection:t!==e.Fragment}))));function Kh(t){let{onComplete:r}=t;const[i,o]=(0,e.useState)(""),[s,a]=(0,e.useState)(null),[c,l]=(0,e.useState)({length:!1,capital:!1,number:!1,symbol:!1});(0,e.useEffect)((()=>{l({length:i.length>=8,capital:/[A-Z]/.test(i),number:/[0-9]/.test(i),symbol:/[!@#$%^&*(),.?":{}|<>]/.test(i)})}),[i]);const u=Object.values(c).every((t=>t));return n().createElement(Fh.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-col items-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Secure Your Account"),n().createElement("p",{className:"text-gray-600 text-center"},"Choose how you want to secure your data"),s?"pin"===s?n().createElement(Fh.div,{initial:{opacity:0},animate:{opacity:1},className:"w-full max-w-md space-y-4"},n().createElement("input",{type:"password",value:i,onChange:t=>o(t.target.value),placeholder:"Enter your PIN",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"}),n().createElement("div",{className:"space-y-2"},Object.entries(c).map((t=>{let[e,r]=t;return n().createElement("div",{key:e,className:"flex items-center"},n().createElement("span",{className:"material-icons text-sm ".concat(r?"text-green-500":"text-gray-400")},r?"check_circle":"radio_button_unchecked"),n().createElement("span",{className:"ml-2 text-sm ".concat(r?"text-green-600":"text-gray-600")},"length"===e?"At least 8 characters":"capital"===e?"One capital letter":"number"===e?"One number":"One special character"))}))),n().createElement("button",{onClick:async()=>{u&&r({method:"pin",value:i})},disabled:!u,className:"w-full py-3 px-4 rounded-lg font-semibold ".concat(u?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Set PIN")):n().createElement(Fh.div,{initial:{opacity:0},animate:{opacity:1},className:"w-full max-w-md"},n().createElement("button",{onClick:()=>{r({method:"othent"})},className:"w-full py-3 px-4 rounded-lg font-semibold bg-blue-500 text-white hover:bg-blue-600"},"Continue with Othent")):n().createElement("div",{className:"grid grid-cols-1 gap-4 w-full max-w-md"},n().createElement(Fh.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>a("othent"),className:"flex items-center justify-center p-6 rounded-lg border border-gray-300 hover:border-blue-500 bg-white"},n().createElement("img",{src:"https://onairos.sirv.com/Images/othent-icon.png",alt:"Othent",className:"w-8 h-8 mr-3"}),n().createElement("span",{className:"text-gray-700"},"Secure with Google (Othent)")),n().createElement(Fh.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>a("pin"),className:"flex items-center justify-center p-6 rounded-lg border border-gray-300 hover:border-blue-500 bg-white"},n().createElement("span",{className:"material-icons mr-3"},"lock"),n().createElement("span",{className:"text-gray-700"},"Set up PIN"))))}const zh=[{name:"YouTube",icon:"https://onairos.sirv.com/Images/youtube-icon.png",connected:!1},{name:"Reddit",icon:"https://onairos.sirv.com/Images/reddit-icon.png",connected:!1},{name:"Instagram",icon:"https://onairos.sirv.com/Images/instagram-icon.png",connected:!1},{name:"Pinterest",icon:"https://onairos.sirv.com/Images/pinterest-icon.png",connected:!1}];function Wh(t){let{onComplete:r}=t;const[i,o]=(0,e.useState)(zh),[s,a]=(0,e.useState)(!1),[c,l]=(0,e.useState)(0);(0,e.useEffect)((()=>{if(s){const t=setInterval((()=>{l((e=>e>=100?(clearInterval(t),a(!1),r(),100):e+2))}),100);return()=>clearInterval(t)}}),[s,r]);return s?n().createElement(Fh.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Unifying Your Data"),n().createElement("p",{className:"text-gray-600 text-center"},"Please wait while we process your information"),n().createElement("div",{className:"w-full max-w-md"},n().createElement("div",{className:"relative pt-1"},n().createElement("div",{className:"flex mb-2 items-center justify-between"},n().createElement("div",null,n().createElement("span",{className:"text-xs font-semibold inline-block py-1 px-2 uppercase rounded-full text-blue-600 bg-blue-200"},"Progress")),n().createElement("div",{className:"text-right"},n().createElement("span",{className:"text-xs font-semibold inline-block text-blue-600"},c,"%"))),n().createElement(Fh.div,{className:"overflow-hidden h-2 mb-4 text-xs flex rounded bg-blue-200"},n().createElement(Fh.div,{initial:{width:0},animate:{width:"".concat(c,"%")},transition:{duration:.5},className:"shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-blue-500"})))),n().createElement(Fh.div,{animate:{rotate:360},transition:{duration:2,repeat:1/0,ease:"linear"},className:"w-12 h-12"},n().createElement("svg",{className:"w-full h-full text-blue-500",viewBox:"0 0 24 24"},n().createElement("path",{fill:"currentColor",d:"M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"})))):n().createElement("div",{className:"flex flex-col items-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Connect Your Accounts"),n().createElement("p",{className:"text-gray-600 text-center"},"Connect at least one account to create your personality model"),n().createElement("div",{className:"grid grid-cols-2 gap-4 w-full max-w-md"},i.map((t=>n().createElement("button",{key:t.name,onClick:()=>(async t=>{try{(await fetch("https://api2.onairos.uk/connect/".concat(t.toLowerCase()),{method:"POST",headers:{Authorization:"Bearer ".concat(localStorage.getItem("onairosToken")),"Content-Type":"application/json"}})).ok&&o(i.map((e=>e.name===t?{...e,connected:!0}:e)))}catch(e){console.error("Failed to connect to ".concat(t,":"),e)}})(t.name),className:"flex items-center justify-center p-4 rounded-lg border ".concat(t.connected?"bg-green-50 border-green-500":"border-gray-300 hover:border-blue-500")},n().createElement("img",{src:t.icon,alt:t.name,className:"w-8 h-8 mr-2"}),n().createElement("span",{className:t.connected?"text-green-600":"text-gray-700"},t.connected?"Connected":"Connect ".concat(t.name)))))),n().createElement("button",{onClick:async()=>{if(i.some((t=>t.connected))){a(!0);try{(await fetch("https://api2.onairos.uk/unify",{method:"POST",headers:{Authorization:"Bearer ".concat(localStorage.getItem("onairosToken")),"Content-Type":"application/json"}})).ok&&r()}catch(t){console.error("Failed to unify data:",t)}}},disabled:!i.some((t=>t.connected)),className:"w-full max-w-md py-3 px-4 rounded-lg font-semibold ".concat(i.some((t=>t.connected))?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Unify and Create Model"))}(0,e.createContext)(null);function Hh(t){let{onSignUpSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}=t;const[a,c]=(0,e.useState)({email:"",username:"",password:"",confirmPassword:""}),[l,u]=(0,e.useState)(null),h=t=>{c({...a,[t.target.name]:t.target.value})};return n().createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},l&&n().createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},l),n().createElement(zr,{onLoginSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}),n().createElement("div",{className:"w-full flex items-center justify-center space-x-4"},n().createElement("hr",{className:"flex-grow border-gray-300"}),n().createElement("span",{className:"text-gray-500"},"or"),n().createElement("hr",{className:"flex-grow border-gray-300"})),n().createElement("form",{onSubmit:async t=>{if(t.preventDefault(),a.password===a.confirmPassword)try{const t=await fetch("https://api2.onairos.uk/signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a.email,username:a.username,password:a.password})}),e=await t.json();t.ok?(localStorage.setItem("onairosToken",e.token),localStorage.setItem("username",a.username),r(a.username)):u(e.message||"Sign up failed")}catch(t){u("Sign up failed. Please try again.")}else u("Passwords don't match")},className:"w-full space-y-4"},n().createElement("input",{type:"email",name:"email",value:a.email,onChange:h,placeholder:"Email",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"text",name:"username",value:a.username,onChange:h,placeholder:"Username",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"password",name:"password",value:a.password,onChange:h,placeholder:"Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"password",name:"confirmPassword",value:a.confirmPassword,onChange:h,placeholder:"Confirm Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("button",{type:"submit",className:"w-full bg-blue-500 text-white font-semibold py-3 px-4 rounded-lg hover:bg-blue-600 transition-colors"},"Sign Up")))}function $h(t){let{setOthentConnected:n,dataRequester:r,NoAccount:i,NoModel:o,activeModels:s,avatar:a,setAvatar:c,traits:l,setTraits:u,requestData:h,handleConnectionSelection:d,changeGranted:f,granted:p,allowSubmit:m,rejectDataRequest:g,sendDataRequest:y,isAuthenticated:w,onClose:v,onLoginSuccess:b,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T,accountInfo:x}=t;const[A,k]=(0,e.useState)(null),[R,P]=(0,e.useState)(!1),C=(0,e.useRef)(null),[O,I]=(0,e.useState)({}),B=(t,e)=>{console.log(t," is being changed check to:",e),I((n=>({...n,[t]:e}))),f(e?1:-1);const n=h[t];d(r,t,n.index,n.type,n.reward,e),console.log(n," Selection registered"),d(r,t,n.index,n.type,n.reward,!0)},[U,L]=(0,e.useState)((()=>{var t;return w?x&&(null===(t=x.models)||void 0===t?void 0:t.length)>0?"datarequests":"onboarding":"login"})),[N,_]=(0,e.useState)({username:"",password:""}),[j,D]=(0,e.useState)(!1);(0,e.useEffect)((()=>{const t=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty("--vh","".concat(t,"px"))};return t(),window.addEventListener("resize",t),window.addEventListener("orientationchange",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("orientationchange",t)}}),[]);const M=()=>{v()};(0,e.useEffect)((()=>{const t=t=>{C.current&&!C.current.contains(t.target)&&(null==M||M())};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[M]);const V=t=>{_({...N,[t.target.name]:t.target.value})},F=async t=>{t.preventDefault();try{k(null);const t={details:{username:N.username,password:N.password}},e=await fetch("".concat("https://api2.onairos.uk","/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await e.json();if("Accepted"!==n.authentication)throw new Error("Invalid credentials");localStorage.setItem("onairosToken",n.token),localStorage.setItem("username",N.username),await K(N.username)}catch(t){console.error("Login failed:",t),k("Invalid username or password")}},K=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];P(!0);try{await b(t,e);k(null)}catch(t){console.error("Login process failed:",t),k("Failed to complete login process")}finally{P(!1)}},z=()=>{L("security")},W=t=>{"othent"===t.method?E(!0):"pin"===t.method&&T(t.value),L("datarequests")},H=t=>{let{dataRequester:e,granted:n,allowSubmit:r,rejectDataRequest:i,sendDataRequest:o,activeModels:s,requestData:a,handleConnectionSelection:c,changeGranted:l,avatar:u,traits:h}=t;return React.createElement("div",{className:"flex flex-col h-full"},React.createElement("div",{className:"px-6"},React.createElement("h1",{className:"text-lg font-semibold text-gray-900 mb-6"},"Data Requests from ",e),React.createElement("div",{className:"flex items-center justify-between mb-6"},React.createElement("button",{className:"bg-gray-500 hover:bg-gray-600 text-white font-bold py-2 px-8 rounded-full",onClick:i},"Reject All"),React.createElement("button",{disabled:!r||0===n,className:"".concat(r&&n>0?"bg-blue-500 hover:bg-blue-600":"bg-gray-300 cursor-not-allowed"," text-white font-bold py-2 px-8 rounded-full"),onClick:o},"Confirm (",n,")"))),React.createElement("div",{className:"flex-1 overflow-y-auto px-6"},0===s.length?React.createElement("div",{className:"flex flex-col items-center justify-center py-8"},React.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosWhite.png",alt:"Onairos Logo",className:"w-24 h-24 mb-4"}),React.createElement("p",{className:"text-center text-gray-800 font-medium"},"Please connect ",React.createElement("a",{href:"https://onairos.uk/connections",className:"text-blue-500 hover:underline"},"Onairos")," Personality to send ",e," your data")):React.createElement("div",{className:"space-y-4"},Object.keys(a).sort(((t,e)=>{const n=s.includes(a[t].type),r=s.includes(a[e].type);return"Avatar"===a[t].type?1:"Avatar"===a[e].type?-1:"Traits"===a[e].type?1:"Traits"===a[t].type||n&&!r?-1:r&&!n?1:0})).map(((t,e)=>{const n=a[t],r="Personality"===n.type?s.includes(n.type):"Avatar"===n.type?u:"Traits"===n.type&&h;return React.createElement($r,{key:t,active:r,title:n.type,id:n,number:e,descriptions:n.descriptions,rewards:n.reward,size:t,isChecked:!!O[t],onCheckboxChange:e=>B(t,e)})})))))};return(0,e.useEffect)((()=>{var t;w&&x&&((null===(t=x.models)||void 0===t?void 0:t.length)>0?L("datarequests"):L("onboarding"))}),[w,x]),(0,e.useEffect)((()=>()=>{D(!1)}),[]),(0,e.useEffect)((()=>{}),[w,x]),React.createElement(React.Fragment,null,React.createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:M,style:{touchAction:"none"}}),React.createElement("div",{ref:C,className:"fixed bottom-0 left-0 right-0 w-full bg-white rounded-t-3xl shadow-2xl transform transition-transform duration-300 ease-out flex flex-col",style:{maxHeight:"60vh",minHeight:"45vh",height:"auto",touchAction:"none"}},React.createElement("div",{className:"sticky top-0 bg-white z-10 px-6 pt-3 pb-2"},React.createElement("div",{className:"w-12 h-1.5 bg-gray-300 rounded-full mx-auto"})),React.createElement("div",{className:"flex-1 overflow-y-auto px-6 pb-8",style:{touchAction:"pan-y"}},(()=>{switch(U){case"signup":return React.createElement(Hh,{onSignUpSuccess:K,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T});case"onboarding":return React.createElement(Wh,{onComplete:z});case"security":return React.createElement(Kh,{onComplete:W});case"datarequests":return React.createElement(H,{dataRequester:r,granted:p,allowSubmit:m,rejectDataRequest:g,sendDataRequest:y,activeModels:s,requestData:h,handleConnectionSelection:d,changeGranted:f,avatar:a,traits:l});default:return React.createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},A&&React.createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},A),React.createElement(zr,{onLoginSuccess:K,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T}),React.createElement("div",{className:"w-full flex items-center justify-center space-x-4"},React.createElement("hr",{className:"flex-grow border-gray-300"}),React.createElement("span",{className:"text-gray-500"},"or"),React.createElement("hr",{className:"flex-grow border-gray-300"})),React.createElement("form",{onSubmit:F,className:"w-full space-y-4"},React.createElement("input",{type:"text",name:"username",value:N.username,onChange:V,placeholder:"Username",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),React.createElement("input",{type:"password",name:"password",value:N.password,onChange:V,placeholder:"Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),React.createElement("button",{type:"submit",className:"w-full bg-blue-500 text-white font-semibold py-3 px-4 rounded-lg hover:bg-blue-600 transition-colors"},"Sign In")),React.createElement("button",{onClick:()=>L("signup"),className:"w-full text-center text-blue-500 hover:text-blue-600"},"Don't have an account? Sign up"))}})())))}const Zh=async()=>(await a.e(423).then(a.t.bind(a,153,23))).default;function Xh(t){var r,i;let{requestData:o,webpageName:s,inferenceData:a=null,onComplete:c=null,autoFetch:l=!0,proofMode:u=!1,textLayout:h="below",textColor:d="white",login:f=!1,buttonType:p="pill",loginReturn:m=null,loginType:g="signIn",visualType:y="full"}=t;const[w,v]=(0,e.useState)(null),[b,E]=(0,e.useState)(!1),[S,T]=(0,e.useState)([]),[x,A]=(0,e.useState)(0),[k,R]=(0,e.useState)({}),[P,C]=(0,e.useState)(!1),[O,I]=(0,e.useState)(!1),[B,U]=(0,e.useState)(!1),[L,N]=(0,e.useState)(!1),_=(0,e.useRef)(!1),j=(0,e.useRef)(!1),[D,M]=(0,e.useState)(!1),[V,F]=(0,e.useState)(null),[K,z]=(0,e.useState)(!0),[W,H]=(0,e.useState)(null),[$,Z]=(0,e.useState)(null),[X,Y]=(0,e.useState)({show:!1,type:null,data:null}),[G,q]=(0,e.useState)(null),[J,Q]=(0,e.useState)(!1),[tt,et]=(0,e.useState)(!1),nt=(0,e.useRef)(!1),[rt,it]=(0,e.useState)(null),[ot,st]=(0,e.useState)({show:!1,color:null,message:null}),at="https://api2.onairos.uk";(0,e.useEffect)((()=>{const t=new URLSearchParams(window.location.search).get("callbackURL");Y({show:!0,type:"callback",data:{code:t,state:"Completing Redirect back"}}),t&&ct(t);(async()=>{const t=new URL(window.location.href),e=t.searchParams.get("code"),n=t.searchParams.get("state");if(e&&n&&!nt.current&&!tt){nt.current=!0,et(!0);try{await ct(t.toString()),N(!0),window.history.replaceState({},document.title,window.location.pathname)}catch(t){console.error("Auth callback processing failed:",t),it(t.message)}finally{et(!1)}}})()}),[]);const ct=async t=>{try{const e=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!0,auth0LogInMethod:"redirect",auth0RedirectURI:window.location.href,auth0ReturnToURI:window.location.href}),n=await e.completeConnectionAfterRedirect(t);if(!e)throw new Error("Failed to initialize Othent");if(!n||!n.sub)throw new Error("Invalid user details received from Othent");M(!0);const r=(await Zh())(n.sub).toString();H(r);const i=await Mr(r);Z(i.result),F(i.token),await gt(n.email,!0),E(!0),localStorage.setItem("othentToken",JSON.stringify(n)),localStorage.setItem("onairosToken",n.token)}catch(t){throw st({show:!0,color:"red",message:"An error has occured, please try again"}),console.error("Authentication failed:",t),t}};(0,e.useEffect)((()=>{rt&&console.error("Authentication error:",rt)}),[rt]);const lt=()=>{const t=navigator.userAgent||navigator.vendor||window.opera;return/android|iphone|ipad|ipod|windows phone/i.test(t)};(0,e.useEffect)((()=>{if(l&&a&&"function"==typeof c){const t=async t=>{if(t.data&&"content-script"===t.data.source&&"API_URL_RESPONSE"===t.data.type&&"Onairos-Response"===t.data.unique){const{APIurl:e,approved:n,accessToken:r}=t.data,i=(t=>{const e={Small:16,Medium:32,Large:64};let n=null,r=0;return t.forEach((t=>{const i=e[t.data];i>r&&(r=i,n=t)})),r})(n),o={Input:a.slice(0,i)};try{const t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify(o)}),n=await t.json();c(n)}catch(t){console.error(t),c(null,t)}}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}}),[]);const ut=async(t,e,n)=>{const r={Info:{EncryptedUserPin:e,confirmations:t,web3Type:"othent",Domain:window.location.href,proofMode:!1,OthentSub:n}};try{const t=await fetch("https://api2.onairos.uk/getAPIurl",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await t.json();l&&c?c(n):Y({show:!0,type:"apiURL",data:{code:n,state:e}})}catch(t){console.error(t),c&&c(null,t)}},ht=window.location.href;(0,e.useEffect)((()=>{const t=t=>{console.log("Message received in useEffect:",t.data),t.data&&"terminalOpened"===t.data.action&&dt()};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}),[]);const dt=async()=>{try{if(lt())return void await(async()=>{lt()&&E(!0)})();const t=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),e=await t.connect(),n=(await Zh())(e.sub).toString();function r(t){try{const e=window.atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n.buffer}catch(t){console.error("Error converting to Buffer :",t)}}const i=r((await Mr(n)).result);Dr("\n -----BEGIN PUBLIC KEY-----\n MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4wkWvRPaJiY8CwQ5BoJI\n amcGAYV91Bk8NrvWq4PXM+J/RJugfgTNCYKQ/c6g4xa1YES/tJEzFS7nf0Kdoqxm\n 5aav0ru5vS4fc4vCOLTI9W1T7nj02NY91rogsQm2/KMxUQ8DaLeTZKi+0Wjsa9YO\n 6XGGd1wh4azgQkj04MWW5J1EBCcBavKoY+C85oA9jkkklQ8nGWgbugmZs7eXHNQb\n qH8/ZHcB9Kx1CZ6XjQuVd6YE/A+swV+DksbkXANcYjr6SY/2TbB8GfpcOMM3bkyN\n Q8e0A51q5a8abfuAkDZXe67MwKMWu/626abwPZhJrKr5HhRZZDwPtnXlktYHhOK6\n lQIDAQAB\n -----END PUBLIC KEY-----\n ",await t.decrypt(i)).then((t=>{window.postMessage({source:"webpage",type:"GET_API_URL",webpageName:s,domain:ht,requestData:o,proofMode:u,HashedOthentSub:n,EncryptedUserPin:t})})).catch((t=>{console.error("Encryption failed:",t)}))}catch(a){console.error("Error Sending Data to Terminal: ",a)}},ft="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===p?"px-4 py-2":"w-12 h-12"," ").concat(f?"bg-white border border-gray-300":"bg-transparent","\n ").concat(lt()?"":"OnairosConnect","\n "),pt={flexDirection:"below"===h?"column":"row",backgroundColor:f?"#ffffff":"transparent",color:f?"black":d,border:f?"1px solid #ddd":"1px solid transparent"},mt={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"},gt=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=e?{Info:{identifier:t}}:{Info:{userName:t}},r=e?"/getAccountInfo/email":"/getAccountInfo",i=await fetch("".concat(at).concat(r),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("onairosToken"))},body:JSON.stringify(n)});if(!i.ok)throw new Error("Failed to fetch account info");const o=await i.json();return"No Account Found"===o.AccountInfo?(_.current=!0,q(null),null):(q(o.AccountInfo),o.AccountInfo.models?T(o.AccountInfo.models):j.current=!0,o.AccountInfo.avatar&&C(!0),o.AccountInfo.UserTraits&&I(!0),o.AccountInfo.othent&&U(!0),o.AccountInfo)}catch(t){throw console.error("Error fetching account info:",t),t}};(0,e.useEffect)((()=>{lt()&&(async()=>{try{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("token"),n=t||e;if(n){const t=await fetch("https://api2.onairos.uk/verifyToken",{headers:{Authorization:"Bearer ".concat(n)}});if(t.ok)if((await t.json()).valid){F(n),M(!0);const t=localStorage.getItem("username");await gt(t)}else localStorage.removeItem("onairosToken"),localStorage.removeItem("token")}}catch(t){console.error("Token verification failed:",t)}finally{z(!1)}})()}),[]);(0,e.useEffect)((()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username");t&&e&&gt(e,!1)}),[]);return(0,e.useEffect)((()=>{(async()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username"),n=localStorage.getItem("othentToken");if(t)try{if((await fetch("".concat(at,"/verifyToken"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})).ok){if(M(!0),e)await gt(e,!1);else if(n){const t=JSON.parse(n);await gt(t.email,!0)}}else localStorage.removeItem("onairosToken"),localStorage.removeItem("username"),localStorage.removeItem("othentToken")}catch(t){console.error("Token verification failed:",t)}})()}),[]),n().createElement(n().Fragment,null,n().createElement("div",{className:"flex items-center justify-center"},n().createElement("button",{className:ft,onClick:async()=>{console.log("openTerminal clicked"),window.postMessage({source:"webpage",type:"openTerminal",webpageName:s,domain:ht,key:"Key"})},style:pt},("full"===y||"icon"===y)&&n().createElement("img",{src:f?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:mt,className:"".concat("pill"===p?"w-6 h-6":"w-8 h-8"," object-contain")}),("full"===y||"textOnly"===y)&&n().createElement("span",{className:"".concat(f||"black"===d?"text-black":"text-white"," ").concat("icon"===y?"sr-only":""," ").concat("right"===h?"ml-2":"left"===h?"mr-2":"")},(()=>{switch(g){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})()))),ot.show&&n().createElement(Notification,{message:ot.message,color:ot.color}),X.show&&n().createElement("div",{className:"fixed inset-0 z-50 flex items-center justify-center"},n().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>Y({show:!1,type:null,data:null})}),n().createElement("div",{className:"relative bg-white rounded-lg p-6 max-w-lg w-full mx-4 max-h-[80vh] overflow-y-auto"},n().createElement("button",{onClick:()=>Y({show:!1,type:null,data:null}),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600"},n().createElement("span",{className:"sr-only"},"Close"),n().createElement("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},n().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"callback"===X.type?"Callback Details":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"debug"===X.type?"Debug Results":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"apiURL"===X.type?"API Url Returned":"Authentication Result"),n().createElement("div",{className:"bg-gray-50 rounded p-4 overflow-x-auto"},n().createElement("pre",{className:"text-sm"},JSON.stringify(X.data,null,2))),"auth"===X.type&&n().createElement("div",{className:"mt-4 p-3 rounded ".concat(null!==(r=X.data)&&void 0!==r&&r.success?"bg-green-100 text-green-700":"bg-red-100 text-red-700")},null!==(i=X.data)&&void 0!==i&&i.success?"Authentication successful!":"Authentication failed"))),J&&n().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},n().createElement("div",{className:"bg-white p-6 rounded-lg shadow-xl"},n().createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),n().createElement("p",{className:"mt-4 text-gray-600"},"Loading your account..."))),b&&!J&&n().createElement($h,{setOthentConnected:N,dataRequester:s,NoAccount:_,NoModel:j,accountInfo:G,activeModels:S,avatar:P,traits:O,requestData:o,handleConnectionSelection:(t,e,n,r,i,o)=>{R((s=>({...s,["".concat(t,"-").concat(e,"-").concat(n)]:{type:r,reward:i,isSelected:o}})))},changeGranted:t=>{A((e=>Math.max(e+t,0)))},granted:x,allowSubmit:x>0,rejectDataRequest:()=>{E(!1),c&&c("rejected")},sendDataRequest:async()=>{if(!(x<=0))try{const t=Object.values(k).filter((t=>t.isSelected)).map((t=>({type:t.type,reward:t.reward})));if(null==$&&B&&!L){Y({show:!0,type:"debug",data:{code:"Connecting Othent Details",state1:$,state2:L,state3:B}});const e=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),n=await e.connect(),r=(await Zh())(n.sub).toString();H(r);const i=await Mr(n.sub.toString()),o=i.result;Z(o),N(!0),Y({show:!0,type:"callback",data:{code:"Just Before API",state:i.token}}),await ut(t,o,r)}else $&&W?await ut(t,$,W):console.error("Missing required authentication data")}catch(t){console.error("Error in sendDataRequest:",t)}finally{E(!1)}},isAuthenticated:D,onLoginSuccess:async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=await gt(t,e);return M(!0),E(!0),n}catch(t){throw console.error("Login process failed:",t),t}},onClose:()=>{A(0),E(!1)},setOthentUser:U,setHashedOthentSub:H,setEncryptedPin:Z}))}function Yh(t){return n().createElement(n().Fragment,null,n().createElement(Xh,t))}const Gh=Yh})(),c})()));
2
2
  //# sourceMappingURL=onairos.bundle.js.map