onairos 0.1.394 → 0.1.396

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),u=n(825),l=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=l;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=l.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 u.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(l.stringToBuffer(t.data),i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=l.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=l.bufferTob64Url(e)}const o=new u.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,u=t.host||a.host,l=t.port||a.port||i;return new o.default({...t,host:u,protocol:c,port:l})},"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],u=s,l=async()=>{if(c)try{u.data=new TextDecoder(c).decode(await s.arrayBuffer())}catch(t){u.data=await s.text()}else u.data=await s.text()};if("arraybuffer"===o)u.data=await s.arrayBuffer();else if("text"===o)await l();else if("webstream"===o)u.data=n(s.body);else try{let t=await s.clone().json();"object"!=typeof t?await l():u.data=await s.json(),t=null}catch{await l()}return u}};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 g(await Promise.all([g(t),g(m(n))])),dataHash:t,minByteRange:e,maxByteRange:n}))))}async function u(t){return await l(await c(await a(t)))}async function l(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 l(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,m(t.maxByteRange)])};if("branch"==t.type){const r=(0,i.concatBuffers)([e,t.leftChild.id,t.rightChild.id,m(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 g([await g(t.id),await g(e.id),await g(m(t.maxByteRange))]),byteRange:t.maxByteRange,maxByteRange:e.maxByteRange,leftChild:t,rightChild:e}}async function g(t){return Array.isArray(t)&&(t=r.default.utils.concatBuffers(t)),new Uint8Array(await r.default.crypto.hash(t))}function m(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 u(t)).id},e.generateTree=u,e.generateTransactionChunks=async function(t){const e=await a(t),n=await c(e),r=await l(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=l,e.generateProofs=h,e.arrayFlatten=f,e.intToBuffer=m,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),u=await g([await g(t),await g(r)]);return!!(0,e.arrayCompare)(n,u)&&{offset:a-1,leftBound:i,rightBound:a,chunkSize:a-i}}const u=c.slice(0,s),l=c.slice(u.length,u.length+s),h=c.slice(u.length+l.length,u.length+l.length+o),d=y(h),f=c.slice(u.length+l.length+h.length),p=await g([await g(u),await g(l),await g(h)]);return!!(0,e.arrayCompare)(n,p)&&(r<d?await t(u,r,i,Math.min(a,d),f):await t(l,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),u=e.slice(r.length+i.length+a.length),l=await g([await g(r),await g(i),await g(a)]);return t(u,`${n}\n${JSON.stringify(Buffer.from(r))},${JSON.stringify(Buffer.from(i))},${c} => ${JSON.stringify(l)}`)}},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(l(t)))}function a(t){return r.fromByteArray(new Uint8Array(t))}function c(t){return u(a(t))}function u(t){try{return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}catch(t){throw new Error("Failed to encode string",{cause:t})}}function l(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=u,e.b64UrlDecode=l},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],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,c)),l=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)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[l++]=255&e);1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(c(t,a,a+s>u?u: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,u="[BigNumber Error] ",l=u+"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],g=1e7,m=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,u=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==u,!i||!o)return r?0:!i^n?1:-1;if(!r)return c>u^n?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return c==u?0:c>u^n?1:-1}function b(t,e,n,r){if(t<e||t>n||t!==c(t))throw Error(u+(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,A,x,_,k,R,P,C=W.prototype={constructor:W,toString:null,valueOf:null},I=new W(1),O=20,B=4,U=-7,L=21,N=-1e7,D=1e7,j=!1,M=1,V=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function W(t,e){var n,o,a,u,h,p,g,m,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>D?y.c=y.e=null:t.e<N?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(u=0,h=t;h>=10;h/=10,u++);return void(u>D?y.c=y.e=null:(y.e=u,y.c=[t]))}m=String(t)}else{if(!s.test(m=String(t)))return i(y,m,p);y.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(u=m.indexOf("."))>-1&&(m=m.replace(".","")),(h=m.search(/e/i))>0?(u<0&&(u=h),u+=+m.slice(h+1),m=m.substring(0,h)):u<0&&(u=m.length)}else{if(b(e,2,K.length,"Base"),10==e&&$)return q(y=new W(t),O+y.e+1,B);if(m=String(t),p="number"==typeof t){if(0*t!=0)return i(y,m,p,e);if(y.s=1/t<0?(m=m.slice(1),-1):1,W.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(l+t)}else y.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(n=K.slice(0,e),u=h=0,g=m.length;h<g;h++)if(n.indexOf(o=m.charAt(h))<0){if("."==o){if(h>u){u=g;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,h=-1,u=0;continue}return i(y,String(t),p,e)}p=!1,(u=(m=r(m,e,10,y.s)).indexOf("."))>-1?m=m.replace(".",""):u=m.length}for(h=0;48===m.charCodeAt(h);h++);for(g=m.length;48===m.charCodeAt(--g););if(m=m.slice(h,++g)){if(g-=h,p&&W.DEBUG&&g>15&&(t>f||t!==c(t)))throw Error(l+y.s*t);if((u=u-h-1)>D)y.c=y.e=null;else if(u<N)y.c=[y.e=0];else{if(y.e=u,y.c=[],h=(u+1)%d,u<0&&(h+=d),h<g){for(h&&y.c.push(+m.slice(0,h)),g-=d;h<g;)y.c.push(+m.slice(h,h+=d));h=d-(m=m.slice(h)).length}else h-=g;for(;h--;m+="0");y.c.push(+m)}}else y.c=[y.e=0]}function z(t,e,n,r){var i,o,s,a,c;if(null==n?n=B: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<=U||s>=L)?S(c,s):T(c,s,"0");else if(o=(t=q(new W(t),e,n)).e,a=(c=w(t.c)).length,1==r||2==r&&(e<=o||o<=U)){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 H(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)>D?t.c=t.e=null:n<N?t.c=[t.e=0]:(t.e=n,t.c=e),t}function q(t,e,n,r){var i,o,s,u,l,f,g,m=t.c,y=p;if(m){t:{for(i=1,u=m[0];u>=10;u/=10,i++);if((o=e-i)<0)o+=d,s=e,l=m[f=0],g=c(l/y[i-s-1]%10);else if((f=a((o+1)/d))>=m.length){if(!r)break t;for(;m.length<=f;m.push(0));l=g=0,i=1,s=(o%=d)-d+1}else{for(l=u=m[f],i=1;u>=10;u/=10,i++);g=(s=(o%=d)-d+i)<0?0:c(l/y[i-s-1]%10)}if(r=r||e<0||null!=m[f+1]||(s<0?l:l%y[i-s-1]),r=n<4?(g||r)&&(0==n||n==(t.s<0?3:2)):g>5||5==g&&(4==n||r||6==n&&(o>0?s>0?l/y[i-s]:0:m[f-1])%10&1||n==(t.s<0?8:7)),e<1||!m[0])return m.length=0,r?(e-=t.e+1,m[0]=y[(d-e%d)%d],t.e=-e||0):m[0]=t.e=0,t;if(0==o?(m.length=f,u=1,f--):(m.length=f+1,u=y[d-o],m[f]=s>0?c(l/y[i-s]%y[s])*u:0),r)for(;;){if(0==f){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(t.e++,m[0]==h&&(m[0]=1));break}if(m[f]+=u,m[f]!=h)break;m[f--]=0,u=1}for(o=m.length;0===m[--o];m.pop());}t.e>D?t.c=t.e=null:t.e<N&&(t.c=[t.e=0])}return t}function X(t){var e,n=t.e;return null===n?t.toString():(e=w(t.c),e=n<=U||n>=L?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(u+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(b(n=t[e],0,m,e),O=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(b(n=t[e],0,8,e),B=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(b(n[0],-m,0,e),b(n[1],0,m,e),U=n[0],L=n[1]):(b(n,-m,m,e),U=-(L=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)b(n[0],-m,-1,e),b(n[1],1,m,e),N=n[0],D=n[1];else{if(b(n,-m,m,e),!n)throw Error(u+e+" cannot be zero: "+n);N=-(D=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(u+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw j=!n,Error(u+"crypto unavailable");j=n}else j=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,m,e),V=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(u+e+" not an object: "+n);F=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(u+e+" invalid: "+n);$="0123456789"==n.slice(0,10),K=n}}return{DECIMAL_PLACES:O,ROUNDING_MODE:B,EXPONENTIAL_AT:[U,L],RANGE:[N,D],CRYPTO:j,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>=-m&&i<=m&&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(u+"Invalid BigNumber: "+t)},W.maximum=W.max=function(){return H(arguments,-1)},W.minimum=W.min=function(){return H(arguments,1)},W.random=(o=9007199254740992,A=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,l=[],h=new W(I);if(null==t?t=O:b(t,0,m),i=a(t/d),j)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]):(l.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw j=!1,Error(u+"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):(l.push(o%1e14),s+=7);s=i/7}if(!j)for(;s<i;)(o=A())<9e15&&(l[s++]=o%1e14);for(i=l[--s],t%=d,i&&t&&(o=p[d-t],l[s]=c(i/o)*o);0===l[s];l.pop(),s--);if(s<0)l=[r=0];else{for(r=-1;0===l[0];l.splice(0,1),r-=d);for(s=1,o=l[0];o>=10;o/=10,s++);s<d&&(r-=d-s)}return h.e=r,h.c=l,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,u,l,h,d,f,p,g,m=r.indexOf("."),y=O,v=B;for(m>=0&&(h=V,V=0,r=r.replace(".",""),f=(g=new W(i)).pow(r.length-m),V=h,g.c=e(T(w(f.c),f.e,"0"),10,o,t),g.e=g.c.length),l=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(m<0?--l:(f.c=p,f.e=l,f.s=s,p=(f=n(f,g,y,v,o)).c,d=f.r,l=f.e),m=p[u=l+y+1],h=o/2,d=d||u<0||null!=p[u+1],d=v<4?(null!=m||d)&&(0==v||v==(f.s<0?3:2)):m>h||m==h&&(4==v||d||6==v&&1&p[u-1]||v==(f.s<0?8:7)),u<1||!p[0])r=d?T(c.charAt(1),-y,c.charAt(0)):c.charAt(0);else{if(p.length=u,d)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(h=p.length;!p[--h];);for(m=0,r="";m<=h;r+=c.charAt(p[m++]));r=T(r,l,c.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,c=t.length,u=e%g,l=e/g|0;for(t=t.slice();c--;)a=((i=u*(o=t[c]%g)+(r=l*o+(s=t[c]/g|0)*u)%g*g+a)/n|0)+(r/g|0)+l*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 u,l,f,p,g,m,w,v,b,E,S,T,A,x,_,k,R,P=r.s==i.s?1:-1,C=r.c,I=i.c;if(!(C&&C[0]&&I&&I[0]))return new W(r.s&&i.s&&(C?!I||C[0]!=I[0]:I)?C&&0==C[0]||!I?0*P:P/0:NaN);for(b=(v=new W(P)).c=[],P=o+(l=r.e-i.e)+1,a||(a=h,l=y(r.e/d)-y(i.e/d),P=P/d|0),f=0;I[f]==(C[f]||0);f++);if(I[f]>(C[f]||0)&&l--,P<0)b.push(1),p=!0;else{for(x=C.length,k=I.length,f=0,P+=2,(g=c(a/(I[0]+1)))>1&&(I=t(I,g,a),C=t(C,g,a),k=I.length,x=C.length),A=k,S=(E=C.slice(0,k)).length;S<k;E[S++]=0);R=I.slice(),R=[0].concat(R),_=I[0],I[1]>=a/2&&_++;do{if(g=0,(u=e(I,E,k,S))<0){if(T=E[0],k!=S&&(T=T*a+(E[1]||0)),(g=c(T/_))>1)for(g>=a&&(g=a-1),w=(m=t(I,g,a)).length,S=E.length;1==e(m,E,w,S);)g--,n(m,k<w?R:I,w,a),w=m.length,u=1;else 0==g&&(u=g=1),w=(m=I.slice()).length;if(w<S&&(m=[0].concat(m)),n(E,m,S,a),S=E.length,-1==u)for(;e(I,E,k,S)<1;)g++,n(E,k<S?R:I,S,a),S=E.length}else 0===u&&(g++,E=[0]);b[f++]=g,E[0]?E[S++]=C[A]||0:(E=[C[A]],S=1)}while((A++<x||null!=E[0])&&P--);p=null!=E[0],b[0]||b.splice(0,1)}if(a==h){for(f=1,P=b[0];P>=10;P/=10,f++);q(v,o+(v.e=f+l*d-1)+1,s,p)}else v.e=l,v.r=+p;return v}}(),x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,_=/^([^.]+)\.$/,k=/^\.([^.]+)$/,R=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(P,"");if(R.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(x,(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(_,"$1").replace(k,"0.$1")),e!=o))return new W(o,i);if(W.DEBUG)throw Error(u+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},C.absoluteValue=C.abs=function(){var t=new W(this);return t.s<0&&(t.s=1),t},C.comparedTo=function(t,e){return v(this,new W(t,e))},C.decimalPlaces=C.dp=function(t,e){var n,r,i,o=this;if(null!=t)return b(t,0,m),null==e?e=B:b(e,0,8),q(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},C.dividedBy=C.div=function(t,e){return n(this,new W(t,e),O,B)},C.dividedToIntegerBy=C.idiv=function(t,e){return n(this,new W(t,e),0,1)},C.exponentiatedBy=C.pow=function(t,e){var n,r,i,o,s,l,h,f,p=this;if((t=new W(t)).c&&!t.isInteger())throw Error(u+"Exponent not an integer: "+X(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(+X(p),s?t.s*(2-E(t)):+X(t))),e?f.mod(e):f;if(l=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new W(NaN);(r=!l&&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(l?1/o:o);V&&(o=a(V/d+2))}for(s?(n=new W(.5),l&&(t.s=1),h=E(t)):h=(i=Math.abs(+X(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(q(t=t.times(n),t.e+1,1),t.e>14)h=E(t);else{if(0===(i=+X(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:(l&&(f=I.div(f)),e?f.mod(e):o?q(f,V,B,undefined):f)},C.integerValue=function(t){var e=new W(this);return null==t?t=B:b(t,0,8),q(e,e.e+1,t)},C.isEqualTo=C.eq=function(t,e){return 0===v(this,new W(t,e))},C.isFinite=function(){return!!this.c},C.isGreaterThan=C.gt=function(t,e){return v(this,new W(t,e))>0},C.isGreaterThanOrEqualTo=C.gte=function(t,e){return 1===(e=v(this,new W(t,e)))||0===e},C.isInteger=function(){return!!this.c&&y(this.e/d)>this.c.length-2},C.isLessThan=C.lt=function(t,e){return v(this,new W(t,e))<0},C.isLessThanOrEqualTo=C.lte=function(t,e){return-1===(e=v(this,new W(t,e)))||0===e},C.isNaN=function(){return!this.s},C.isNegative=function(){return this.s<0},C.isPositive=function(){return this.s>0},C.isZero=function(){return!!this.c&&0==this.c[0]},C.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,u=t.e/d,l=s.c,f=t.c;if(!c||!u){if(!l||!f)return l?(t.s=-e,t):new W(f?s:NaN);if(!l[0]||!f[0])return f[0]?(t.s=-e,t):new W(l[0]?s:3==B?-0:0)}if(c=y(c),u=y(u),l=l.slice(),a=c-u){for((o=a<0)?(a=-a,i=l):(u=c,i=f),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=l.length)<(e=f.length))?a:e,a=e=0;e<r;e++)if(l[e]!=f[e]){o=l[e]<f[e];break}if(o&&(i=l,l=f,f=i,t.s=-t.s),(e=(r=f.length)-(n=l.length))>0)for(;e--;l[n++]=0);for(e=h-1;r>a;){if(l[--r]<f[r]){for(n=r;n&&!l[--n];l[n]=e);--l[n],l[r]+=h}l[r]-=f[r]}for(;0==l[0];l.splice(0,1),--u);return l[0]?Z(t,l,u):(t.s=3==B?-1:1,t.c=[t.e=0],t)},C.modulo=C.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)},C.multipliedBy=C.times=function(t,e){var n,r,i,o,s,a,c,u,l,f,p,m,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=g,i=f;--i>=0;){for(n=0,p=T[i]%b,m=T[i]/b|0,o=i+(s=c);o>i;)n=((u=p*(u=S[--s]%b)+(a=m*u+(l=S[s]/b|0)*p)%b*b+w[o]+n)/v|0)+(a/b|0)+m*l,w[o--]=u%v;w[o]=n}return n?++r:w.splice(0,1),Z(t,w,r)},C.negated=function(){var t=new W(this);return t.s=-t.s||null,t},C.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)},C.precision=C.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return b(t,1,m),null==e?e=B:b(e,0,8),q(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},C.shiftedBy=function(t){return b(t,-9007199254740991,f),this.times("1e"+t)},C.squareRoot=C.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,c=s.s,u=s.e,l=O+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(+X(s)))||c==1/0?(((e=w(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(+e),u=y((u+1)/2)-(u<0||u%2),r=new W(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new W(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(o=r,r=h.times(o.plus(n(s,o,l,1))),w(o.c).slice(0,c)===(e=w(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(q(r,r.e+O+2,1),t=!r.times(r).eq(s));break}if(!i&&(q(o,o.e+O+2,0),o.times(o).eq(s))){r=o;break}l+=4,c+=4,i=1}return q(r,r.e+O+1,B,t)},C.toExponential=function(t,e){return null!=t&&(b(t,0,m),t++),z(this,t,e,1)},C.toFixed=function(t,e){return null!=t&&(b(t,0,m),t=t+this.e+1),z(this,t,e)},C.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(u+"Argument not an object: "+n);if(r=i.toFixed(t,e),i.c){var o,s=r.split("."),a=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||"",h=s[0],d=s[1],f=i.s<0,p=f?h.slice(1):h,g=p.length;if(c&&(o=a,a=c,c=o,g-=o),a>0&&g>0){for(o=g%a||a,h=p.substr(0,o);o<g;o+=a)h+=l+p.substr(o,a);c>0&&(h+=l+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||"")},C.toFraction=function(t){var e,r,i,o,s,a,c,l,h,f,g,m,y=this,v=y.c;if(null!=t&&(!(c=new W(t)).isInteger()&&(c.c||1!==c.s)||c.lt(I)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+X(c));if(!v)return new W(y);for(e=new W(I),h=r=new W(I),i=l=new W(I),m=w(v),s=e.e=m.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=D,D=1/0,c=new W(m),l.c[0]=0;f=n(c,e,0,1),1!=(o=r.plus(f.times(i))).comparedTo(t);)r=i,i=o,h=l.plus(f.times(o=h)),l=o,e=c.minus(f.times(o=e)),c=o;return o=n(t.minus(r),i,0,1),l=l.plus(o.times(h)),r=r.plus(o.times(i)),l.s=h.s=y.s,g=n(h,i,s*=2,B).minus(y).abs().comparedTo(n(l,r,s,B).minus(y).abs())<1?[h,i]:[l,r],D=a,g},C.toNumber=function(){return+X(this)},C.toPrecision=function(t,e){return null!=t&&b(t,1,m),z(this,t,e,2)},C.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<=U||o>=L?S(w(n.c),o):T(w(n.c),o,"0"):10===t&&$?e=T(w((n=q(new W(n),O+o+1,B)).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},C.valueOf=C.toJSON=function(){return X(this)},C._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 u(t,e,n)}function u(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|g(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(X(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(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return f(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(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 l(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 l(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 g(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(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 H(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:H(t).length;e=(""+e).toLowerCase(),i=!0}}function m(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 C(this,e,n);case"utf8":case"utf-8":return _(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return P(this,e,n);case"base64":return x(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 u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(u(t,o)===u(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(u(t,o+r)!==u(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 q(H(e,t.length-n),t,n,r)}function S(t,e,n,r){return q(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 q(Z(e),t,n,r)}function A(t,e,n,r){return q(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 x(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function _(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<=k)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=k));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 u(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 l(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(X(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),X(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(X(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=g,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?_(this,0,t):m.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(X(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),u=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<a;++t)if(u[t]!==l[t]){o=u[t],s=l[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 A(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 k=4096;function R(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 P(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 C(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+=Y[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 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 B(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 U(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 L(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 N(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 D(t,e,n,r,o){return e=+e,n>>>=0,o||N(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function j(t,e,n,r,o){return e=+e,n>>>=0,o||N(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||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},c.prototype.readUintBE=c.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},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.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]},c.prototype.readUint32BE=c.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])},c.prototype.readBigUInt64LE=J((function(t){$(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){$(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||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},c.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},c.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||O(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||O(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||O(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||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=J((function(t){$(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){$(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||O(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(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){B(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){B(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||B(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||B(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||B(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||B(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||B(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 U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(t,e=0){return L(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);B(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);B(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||B(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||B(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||B(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||B(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||B(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 U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return D(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return D(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return j(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){$(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function $(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 $(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 z=/[^+/0-9A-Za-z-_]/g;function H(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(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(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 X(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 Y=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,u,l,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)||(u=o(i)))?(u?(u=!1,l=r&&o(r)?r:[]):l=r&&s(r)?r:{},a(h,{name:n,newValue:t(p,l,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,u=c>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=u}return(f?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,g=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=l):(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>=l?(a=0,s=l):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,u+=i;u>0;t[n+f]=255&s,f+=p,s/=256,u-=8);t[n+f-p]|=128*g}},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 u(t,e,n){var r,o={},u=null,l=null;for(r in void 0!==n&&(u=""+n),void 0!==e.key&&(u=""+e.key),void 0!==e.ref&&(l=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:u,ref:l,props:o,_owner:a.current}}e.jsx=u,e.jsxs=u},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 u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var h=u[l];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],u=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);u<o.length;u++)i=o[u],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:()=>Ev,default:()=>Sv});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 u(t,e){return t(e={exports:{}},e.exports),e.exports}var l=u((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(l);var h=s(u((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 u(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()+u(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,l,h,d,f,p;return r(this,(function(r){switch(r.label){case 0:n=Date.now()+u(4),o=Date.now()+i,l=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(l)?[3,5]:(d=this.id+"-"+e+"-"+n,[4,c(Math.floor(25*Math.random()))]);case 3:return r.sent(),h.setItemSync(l,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(l))&&(p=JSON.parse(f)).id===this.id&&p.iat===n?(this.acquiredIatSet.add(n),this.refreshLockWhileAcquired(l,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()+u(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,l.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))?(l.default().unlock(e),[2]):((o=JSON.parse(i)).timeRefreshed=Date.now(),n.setItemSync(t,JSON.stringify(o)),l.default().unlock(e),this.refreshLockWhileAcquired(t,e),[2])):(l.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,l.default().lock(c.iat)];case 1:r.sent(),this.acquiredIatSet.delete(c.iat),n.removeItemSync(i),l.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,u=0;u<i.length;u++){var l=i[u];if(l.includes(s)){var h=r.getItemSync(l);if(null!==h){var d=JSON.parse(h);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(r.removeItemSync(l),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 g extends Error{constructor(t,e){super(e),this.error=t,this.error_description=e,Object.setPrototypeOf(this,g.prototype)}static fromPayload({error:t,error_description:e}){return new g(t,e)}}class m extends g{constructor(t,e,n,r=null){super(t,e),this.state=n,this.appState=r,Object.setPrototypeOf(this,m.prototype)}}class y extends g{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 g{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,v.prototype)}}class b extends g{constructor(t,e,n){super(t,e),this.mfa_token=n,Object.setPrototypeOf(this,b.prototype)}}class E extends g{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,A=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(T().getRandomValues(new Uint8Array(43))).forEach((n=>e+=t[n%66])),e},x=t=>btoa(t),_=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()},k=t=>(t=>decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),R=async(t,e)=>{const n=await fetch(t,e);return{ok:n.ok,json:await n.json()}},P=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([R(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 C(t,e){var{baseUrl:n,timeout:r,audience:o,scope:s,auth0Client:a,useFormData:c}=t,u=i(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const l=c?_(u):JSON.stringify(u);return await async function(t,e,n,r,o,s,a){let c,u=null;for(let i=0;i<3;i++)try{c=await P(t,n,r,o,s,a,e),u=null;break}catch(t){u=t}if(u)throw u;const l=c.json,{error:h,error_description:d}=l,f=i(l,["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 g(h||"request_error",e)}return f}(`${n}/oauth/token`,r,o||"default",s,{method:"POST",body:l,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 O{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 O({clientId:n,scope:i,audience:r},e)}static fromCacheEntry(t){const{scope:e,audience:n,client_id:r}=t;return new O({scope:e,audience:n,clientId:r})}}class B{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 U{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 L{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 O({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 O({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,e){return e.filter((e=>{var n;const r=O.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 N{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 D=t=>"number"==typeof t,j=["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=u((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 $={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=>$.get(t)||$.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),$.save(t,e,n)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n),$.remove(t,e),$.remove(`_legacy_${t}`,e)}},z={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 H,Z=("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,!1,function(t){return H=H||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(H,t)});const q={};class X{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 U).enclosedCache,localstorage:()=>new B},Y=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 U).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",!Y(e))throw new Error(`Invalid cache location "${e}"`);n=Y(e)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===t.legacySameSiteCookie?$: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:z;var i;this.scope=I("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new N(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||p,this.cacheManager=new L(n,n.allKeys?void 0:new X(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?${_(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(k(r)),s={__raw:t},a={};return Object.keys(o).forEach((t=>{s[t]=o[t],j.includes(t)||(a[t]=o[t])})),{encoded:{header:n,payload:r,signature:i},header:JSON.parse(k(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&&!D(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||!D(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!D(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&&D(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&&D(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=x(A()),i=x(A()),o=A(),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(g.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 g("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,u=await this._prepareAuthorizeUrl(a.authorizationParams||{}),{url:l}=u,h=i(u,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},h),{appState:s}),c&&{organization:c}));const d=o?`${l}#${o}`:l;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 g("missing_transaction","Invalid state");if(this.transactionManager.remove(),i)throw new m(i,o||i,n,s.appState);if(!s.code_verifier||s.state&&s.state!==n)throw new g("state_mismatch","Invalid state");const a=s.organization,c=s.nonce,u=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},u?{redirect_uri:u}:{}),{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=q[e];return n||(n=t().finally((()=>{delete q[e],n=null})),q[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 O({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?${_(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:u}=await this._prepareAuthorizeUrl(e,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new g("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,l=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(g.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!==l.state)throw new g("state_mismatch","Invalid state");const h=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:s,code:l.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:u})}catch(t){throw"login_required"===t.error&&this.logout({openUrl:!1}),t}}async _getTokenUsingRefreshToken(t){const e=await this.cacheManager.get(new O({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 O({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 O({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 C(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:ut}=Array,lt=ct("undefined");const ht=at("ArrayBuffer");const dt=ct("string"),ft=ct("function"),pt=ct("number"),gt=t=>null!==t&&"object"==typeof t,mt=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]),ut(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 At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,xt=t=>!lt(t)&&t!==At;const _t=(kt="undefined"!=typeof Uint8Array&&it(Uint8Array),t=>kt&&t instanceof kt);var kt;const Rt=at("HTMLFormElement"),Pt=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Ct=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)},Ot="abcdefghijklmnopqrstuvwxyz",Bt="0123456789",Ut={DIGIT:Bt,ALPHA:Ot,ALPHA_DIGIT:Ot+Ot.toUpperCase()+Bt};const Lt=at("AsyncFunction"),Nt={isArray:ut,isArrayBuffer:ht,isBuffer:function(t){return null!==t&&!lt(t)&&null!==t.constructor&&!lt(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:gt,isPlainObject:mt,isUndefined:lt,isDate:yt,isFile:wt,isBlob:vt,isRegExp:Ct,isFunction:ft,isStream:t=>gt(t)&&ft(t.pipe),isURLSearchParams:Et,isTypedArray:_t,isFileList:bt,forEach:St,merge:function t(){const{caseless:e}=xt(this)&&this||{},n={},r=(r,i)=>{const o=e&&Tt(n,i)||i;mt(n[o])&&mt(r)?n[o]=t(n[o],r):mt(r)?n[o]=t({},r):ut(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(ut(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:Rt,hasOwnProperty:Pt,hasOwnProp:Pt,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 ut(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:At,isContextDefined:xt,ALPHABET:Ut,generateString:(t=16,e=Ut.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(gt(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const i=ut(t)?[]:{};return St(t,((t,e)=>{const o=n(t,r+1);!lt(o)&&(i[e]=o)})),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Lt,isThenable:t=>t&&(gt(t)||ft(t))&&ft(t.then)&&ft(t.catch)};function Dt(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)}Nt.inherits(Dt,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:Nt.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const jt=Dt.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(Dt,Mt),Object.defineProperty(jt,"isAxiosError",{value:!0}),Dt.from=(t,e,n,r,i,o)=>{const s=Object.create(jt);return Nt.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),Dt.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const Vt=Dt;function Ft(t){return Nt.isPlainObject(t)||Nt.isArray(t)}function Kt(t){return Nt.endsWith(t,"[]")?t.slice(0,-2):t}function $t(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=Nt.toFlatObject(Nt,{},null,(function(t){return/^is[A-Z]/.test(t)}));const zt=function(t,e,n){if(!Nt.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=Nt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!Nt.isUndefined(e[t])}))).metaTokens,i=n.visitor||u,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Nt.isSpecCompliantForm(e);if(!Nt.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(Nt.isDate(t))return t.toISOString();if(!a&&Nt.isBlob(t))throw new Vt("Blob is not supported. Use a Buffer instead.");return Nt.isArrayBuffer(t)||Nt.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function u(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(Nt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(Nt.isArray(t)&&function(t){return Nt.isArray(t)&&!t.some(Ft)}(t)||(Nt.isFileList(t)||Nt.endsWith(n,"[]"))&&(a=Nt.toArray(t)))return n=Kt(n),a.forEach((function(t,r){!Nt.isUndefined(t)&&null!==t&&e.append(!0===s?$t([n],r,o):null===s?n:n+"[]",c(t))})),!1;return!!Ft(t)||(e.append($t(i,n,o),c(t)),!1)}const l=[],h=Object.assign(Wt,{defaultVisitor:u,convertValue:c,isVisitable:Ft});if(!Nt.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!Nt.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Nt.forEach(n,(function(n,o){!0===(!(Nt.isUndefined(n)||null===n)&&i.call(e,n,Nt.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])})),l.pop()}}(t),e};function Ht(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&&zt(t,this,e)}const qt=Zt.prototype;qt.append=function(t,e){this._pairs.push([t,e])},qt.toString=function(t){const e=t?function(e){return t.call(this,e,Ht)}:Ht;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const Xt=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 Yt(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):Nt.isURLSearchParams(e)?e.toString():new Xt(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){Nt.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:Xt,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&&Nt.isArray(r)?r.length:o,a)return Nt.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Nt.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&Nt.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(Nt.isFormData(t)&&Nt.isFunction(t.entries)){const n={};return Nt.forEachEntry(t,((t,r)=>{e(function(t){return Nt.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=Nt.isObject(t);i&&Nt.isHTMLForm(t)&&(t=new FormData(t));if(Nt.isFormData(t))return r&&r?JSON.stringify(se(t)):t;if(Nt.isArrayBuffer(t)||Nt.isBuffer(t)||Nt.isStream(t)||Nt.isFile(t)||Nt.isBlob(t))return t;if(Nt.isArrayBufferView(t))return t.buffer;if(Nt.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 zt(t,new oe.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,r){return oe.isNode&&Nt.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=Nt.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return zt(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(Nt.isString(t))try{return(e||JSON.parse)(t),Nt.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&&Nt.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}}};Nt.forEach(["delete","get","head","post","put","patch"],(t=>{ae.headers[t]={}}));const ce=ae,ue=Nt.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"]),le=Symbol("internals");function he(t){return t&&String(t).trim().toLowerCase()}function de(t){return!1===t||null==t?t:Nt.isArray(t)?t.map(de):String(t)}function fe(t,e,n,r,i){return Nt.isFunction(r)?r.call(this,e,n):(i&&(e=n),Nt.isString(e)?Nt.isString(r)?-1!==e.indexOf(r):Nt.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=Nt.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)=>Nt.forEach(t,((t,n)=>i(t,n,e)));return Nt.isPlainObject(t)||t instanceof this.constructor?o(t,e):Nt.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]&&ue[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=Nt.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(Nt.isFunction(e))return e.call(this,t,n);if(Nt.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=he(t)){const n=Nt.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=Nt.findKey(n,t);!i||e&&!fe(0,n[i],i,e)||(delete n[i],r=!0)}}return Nt.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 Nt.forEach(this,((r,i)=>{const o=Nt.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 Nt.forEach(this,((n,r)=>{null!=n&&!1!==n&&(e[r]=t&&Nt.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[le]=this[le]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=he(t);e[r]||(!function(t,e){const n=Nt.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 Nt.isArray(t)?t.forEach(r):r(t),this}}pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Nt.reduceDescriptors(pe.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),Nt.freezeMethods(pe);const ge=pe;function me(t,e){const n=this||ce,r=e||n,i=ge.from(r.headers);let o=r.data;return Nt.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"}Nt.inherits(we,Vt,{__CANCEL__:!0});const ve=we;const be=oe.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];Nt.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),Nt.isString(r)&&s.push("path="+r),Nt.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=Nt.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(),u=r[s];i||(i=c),n[o]=a,r[o]=c;let l=s,h=0;for(;l!==o;)h+=n[l++],l%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-i<e)return;const d=u&&c-u;return d?Math.round(1e3*h/d):void 0}};function Ae(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 u={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};u[e?"download":"upload"]=!0,t(u)}}const xe={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){let r=t.data;const i=ge.from(t.headers).normalize();let o,s,{responseType:a,withXSRFToken:c}=t;function u(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}if(Nt.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 l=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(!l)return;const r=ge.from("getAllResponseHeaders"in l&&l.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),u()}),(function(t){n(t),u()}),{data:a&&"text"!==a&&"json"!==a?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:t,request:l}),l=null}if(l.open(t.method.toUpperCase(),Yt(h,t.params,t.paramsSerializer),!0),l.timeout=t.timeout,"onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(d)},l.onabort=function(){l&&(n(new Vt("Request aborted",Vt.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new Vt("Network Error",Vt.ERR_NETWORK,t,l)),l=null},l.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,l)),l=null},oe.hasStandardBrowserEnv&&(c&&Nt.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 l&&Nt.forEach(i.toJSON(),(function(t,e){l.setRequestHeader(e,t)})),Nt.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&"json"!==a&&(l.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&l.addEventListener("progress",Ae(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",Ae(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=e=>{l&&(n(!e||e.type?new ve(null,t,l):e),l.abort(),l=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)):l.send(r||null)}))}};Nt.forEach(xe,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const _e=t=>`- ${t}`,ke=t=>Nt.isFunction(t)||null===t||!1===t,Re=t=>{t=Nt.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,!ke(n)&&(r=xe[(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(_e).join("\n"):" "+_e(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 Pe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ve(null,t)}function Ce(t){Pe(t),t.headers=ge.from(t.headers),t.data=me.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Re(t.adapter||ce.adapter)(t).then((function(e){return Pe(t),e.data=me.call(t,t.transformResponse,e),e.headers=ge.from(e.headers),e}),(function(e){return ye(e)||(Pe(t),e&&e.response&&(e.response.data=me.call(t,t.transformResponse,e.response),e.response.headers=ge.from(e.response.headers))),Promise.reject(e)}))}const Ie=t=>t instanceof ge?t.toJSON():t;function Oe(t,e){e=e||{};const n={};function r(t,e,n){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge.call({caseless:n},t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function i(t,e,n){return Nt.isUndefined(e)?Nt.isUndefined(t)?void 0:r(void 0,t,n):r(t,e,n)}function o(t,e){if(!Nt.isUndefined(e))return r(void 0,e)}function s(t,e){return Nt.isUndefined(e)?Nt.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 Nt.forEach(Object.keys(Object.assign({},t,e)),(function(r){const o=c[r]||i,s=o(t[r],e[r],r);Nt.isUndefined(s)&&o!==a||(n[r]=s)})),n}const Be="1.6.5",Ue={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Ue[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const Le={};Ue.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&&!Le[i]&&(Le[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 Ne={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:Ue},De=Ne.validators;class je{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=Oe(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&Ne.assertOptions(n,{silentJSONParsing:De.transitional(De.boolean),forcedJSONParsing:De.transitional(De.boolean),clarifyTimeoutError:De.transitional(De.boolean)},!1),null!=r&&(Nt.isFunction(r)?e.paramsSerializer={serialize:r}:Ne.assertOptions(r,{encode:De.function,serialize:De.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&Nt.merge(i.common,i[e.method]);i&&Nt.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=ge.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 u;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let l,h=0;if(!a){const t=[Ce.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,c),l=t.length,u=Promise.resolve(e);h<l;)u=u.then(t[h++],t[h++]);return u}l=s.length;let d=e;for(h=0;h<l;){const t=s[h++],e=s[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{u=Ce.call(this,d)}catch(t){return Promise.reject(t)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(t){return Yt(Ee((t=Oe(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}Nt.forEach(["delete","get","head","options"],(function(t){je.prototype[t]=function(e,n){return this.request(Oe(n||{},{method:t,url:e,data:(n||{}).data}))}})),Nt.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(Oe(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}je.prototype[t]=e(),je.prototype[t+"Form"]=e(!0)}));const Me=je;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 $e=Ke;const We=function t(e){const n=new Me(e),r=nt(Me.prototype.request,n);return Nt.extend(r,Me.prototype,n,{allOwnKeys:!0}),Nt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Oe(e,n))},r}(ce);We.Axios=Me,We.CanceledError=ve,We.CancelToken=Fe,We.isCancel=ye,We.VERSION=Be,We.toFormData=zt,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 Nt.isObject(t)&&!0===t.isAxiosError},We.mergeConfig=Oe,We.AxiosHeaders=ge,We.formToJSON=t=>se(Nt.isHTMLForm(t)?new FormData(t):t),We.getAdapter=Re,We.HttpStatusCode=$e,We.default=We;const ze=We;var He=a(742),Ze=Object.create,qe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ge=Object.getOwnPropertyNames,Ye=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(Ye(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&&qe(t,i,{get:()=>e[i],enumerable:!(r=Xe(e,i))||r.enumerable});return t})(!e&&t&&t.__esModule?n:qe(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],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,c)),l=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)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[l++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u},t.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(c(t,a,a+s>u?u: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,u=c>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=u}return(f?-1:1)*s*Math.pow(2,o-r)},t.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,g=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=l):(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>=l?(a=0,s=l):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,u+=i;u>0;t[n+f]=255&s,f+=p,s/=256,u-=8);t[n+f-p]|=128*g}})),un=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 u(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 l(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||q(t.length)?o(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(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 u(t){return c(t),o(t<0?0:0|d(t))}function l(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 z(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 R(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return _(this,e,n);case"latin1":case"binary":return k(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function g(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function m(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),q(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 u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(u(t,o)===u(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(u(t,o+r)!==u(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(q(r))return o;t[n+o]=r}return o}function v(t,e,n,r){return H(W(e,t.length-n),t,n,r)}function b(t,e,n,r){return H(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(z(e),t,n,r)}function S(t,e,n,r){return H(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 A(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<=x)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=x));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 u(t)},s.allocUnsafeSlow=function(t){return u(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)g(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)g(this,e,e+3),g(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)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},s.prototype.toString=function(){let t=this.length;return 0===t?"":0===arguments.length?A(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),u=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<c;++t)if(u[t]!==l[t]){o=u[t],a=l[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 m(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return m(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 x=4096;function _(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 k(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 R(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+=X[t[r]];return i}function P(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 C(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 O(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 B(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 U(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 L(t,e,r,i,o){return e=+e,r>>>=0,o||U(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function N(t,e,r,i,o){return e=+e,r>>>=0,o||U(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||C(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||C(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||C(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(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||C(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||C(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||C(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||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||C(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||C(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||C(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||C(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||C(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(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 O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=G((function(t,e=0){return B(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 O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=G((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return N(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 D={};function j(t,e,n){D[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 D.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 D.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,n){throw Math.floor(t)!==t?(F(t,n),new D.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),j("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 $=/[^+/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 z(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace($,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(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 q(t){return t!=t}var X=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"?Y:t}function Y(){throw new Error("BigInt not supported")}})),ln=Qe(((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:un().Buffer,Crypto:window.crypto}):e.exports={Buffer:un().Buffer,Crypto:crypto}})),hn={};((t,e)=>{for(var n in e)qe(t,n,{get:e[n],enumerable:!0})})(hn,{AVSCTap:()=>Pn,ArweaveSigner:()=>An,DataItem:()=>Mn,MAX_TAG_BYTES:()=>Dn,MIN_BINARY_SIZE:()=>jn,SIG_CONFIG:()=>Tn,SignatureConfig:()=>wn,Signer:()=>dn,createData:()=>Fn,deserializeTags:()=>On,indexToType:()=>xn,serializeTags:()=>Cn,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 gn(t){if(Array.isArray(t)){let e=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("list"),(0,pn.stringToBuffer)(t.length.toString())]);return await mn(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 mn(t,e){if(t.length<1)return e;let n=(0,pn.concatBuffers)([e,await gn(t[0])]),r=await Sn().hash(n,"SHA-384");return await mn(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"}},An=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)}},xn={1:An},_n=tn(rn(),1);async function kn(t){return gn([(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 Rn(t,e){let{signature:n,id:r}=await async function(t,e){let n=await kn(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 Pn=class{buf;pos;constructor(t=Buffer.alloc(Dn),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 Cn(t){let e=new Pn;return e.writeTags(t),e.toBuffer()}function In(t){let e=new Pn;return e.writeTags(t),e.tagsExceedLimit()}function On(t){return new Pn(t).readTags()}function Bn(t){let e=0;for(let n=t.length-1;n>=0;n--)e=256*e+t[n];return e}function Un(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 Ln=tn(ln(),1),Nn=tn(un(),1),Dn=4096,jn=80,Mn=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return void 0!==t.binary}get signatureType(){let t=Bn(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()=>_n.default.encode(await this.rawId))()}set id(t){this._id=_n.default.toBuffer(t)}get rawId(){return(async()=>Nn.Buffer.from(await Ln.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 _n.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 _n.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):Nn.Buffer.alloc(0)}get target(){return _n.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):Nn.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Bn(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(0==Bn(this.binary.subarray(t,t+8)))return[];let e=Bn(this.binary.subarray(t+8,t+16));return On(Nn.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map((t=>({name:_n.default.encode(t.name),value:_n.default.encode(t.value)})))}getStartOfData(){let t=this.getTagsStart();return t+16+Bn(this.binary.subarray(t+8,t+16))}get rawData(){let t=this.getTagsStart(),e=t+16+Bn(this.binary.subarray(t+8,t+16));return this.binary.subarray(e,this.binary.length)}get data(){return _n.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Rn(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=Nn.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:_n.default.encode(t.name),value:_n.default.encode(t.value)}))),data:this.data}}static async verify(t){if(t.byteLength<jn)return!1;let e=new Mn(t),n=e.signatureType,r=e.getTagsStart(),i=Bn(t.subarray(r,r+8)),o=Bn(t.subarray(r+8,r+16));if(o>Dn)return!1;if(i>0)try{if(On(Nn.Buffer.from(t.subarray(r+16,r+16+o))).length!==i)return!1}catch{return!1}let s=xn[n],a=await kn(e);return await s.verify(e.rawOwner,a,e.rawSignature)}async getSignatureData(){return kn(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?Cn(n.tags):null,u=16+(c?c.byteLength:0),l=Buffer.from(t),h=l.byteLength,d=2+e.signatureLength+e.ownerLength+o+a+u+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 g=p+o,m=g+1;if(f[g]=s?1:0,s){if(m+=s.byteLength,32!==s.byteLength)throw new Error("Anchor must be 32 bytes");f.set(s,g+1)}f.set(Un(n?.tags?.length??0),m);let y=Un(c?.byteLength??0);f.set(y,m+8),c&&f.set(c,m+16);let w=m+u;return f.set(l,w),new Mn(f)}var Kn={...hn};globalThis.arbundles??=Kn;const{Axios:$n,AxiosError:Wn,CanceledError:zn,isCancel:Hn,CancelToken:Zn,VERSION:qn,all:Xn,Cancel:Gn,isAxiosError:Yn,spread:Jn,toFormData:Qn,AxiosHeaders:tr,HttpStatusCode:er,formToJSON:nr,getAdapter:rr,mergeConfig:ir}=ze;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},ur="othentUserDetails",lr="Othent KMS",hr="2.0.0-beta.10",dr=[{name:"Client",value:lr},{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 gr={secure:!0,domain:!0,ttlHours:360},mr=class t{constructor(e=gr){this.secureParam=null,this.domainParam=null,this.ttlMs=1296e6;const{secureParam:n,domainParam:r,ttlMs:i}=this.parseCookieOptions(pr(e,gr));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])}))}};mr.COOKIE_SEPARATOR=/\s*;\s*/,mr.COOKIE_VALUE_SEPARATOR=/\s*=\s*/;var yr=mr,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:u,initialUserDetails:l,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=u,this.restoreUserDetails(l||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 ze.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:lr,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 He.fromByteArray(new Uint8Array(t))}(t),e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");var e}async function Ar(t,e="SHA-256"){let n=await crypto.subtle.digest(e,t);return new Uint8Array(n)}var xr=(t=>(t.Unexpected="Unexpected",t.Validation="Validation",t.UserCreation="UserCreation",t.Encryption="Encryption",t.Decryption="Decryption",t.Signing="Signing",t.PublicKey="PublicKey",t))(xr||{}),_r=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 kr(t){var e;if(Yn(t)){const n=null==(e=t.response)?void 0:e.data;if(!function(t){return"object"==typeof t&&!0===t.error&&!!t.id&&!!xr[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 _r(r,i||"",s,!0)}return t instanceof Error?t:new Error("Unknown error")}async function Rr(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 kr(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 Pr=class{constructor(t,e){this.api=ze.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 kr(t)}if(!n)throw new Error("Error creating user on server.");return!0}(this.api,t)}async decrypt(t,e){return Rr(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 kr(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 kr(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 Cr(t,e="utf8"){return r.lW.isBuffer(t)?Or(t.toString("base64")):Or(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 Or(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Br(t){return r.lW.from(Ir(t),"base64")}var Ur=Cr;function Lr(t){return or.default.init(t)}Ur.encode=Cr,Ur.decode=function(t,e="utf8"){return r.lW.from(Ir(t),"base64").toString(e)},Ur.toBase64=Ir,Ur.fromBase64=Or,Ur.toBuffer=Br;var Nr=class t{constructor(t=ar){this.errorEventListenerHandler=new fr,this.tokens=new Set,this.walletName=lr,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:u,...l}=t;const h="undefined"==typeof location?null:location.origin;this.config={...pr(l,sr),cookieKey:"string"==typeof r?r:r?ur:null,localStorageKey:"string"==typeof i?i:i?ur: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 g=null;if("undefined"!=typeof window)g=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.");g=global.crypto}if(this.crypto=g,"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:u,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 Pr(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=Lr(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),u=await Ar(c);return s.setSignature({id:Tr(u),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 ze.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:Lr(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:Br(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 Ar(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))}};Nr.walletName=lr,Nr.walletVersion=hr,Nr.ALL_PERMISSIONS=["ACCESS_ADDRESS","ACCESS_ALL_ADDRESSES","ACCESS_ARWEAVE_CONFIG","ACCESS_PUBLIC_KEY","DECRYPT","DISPATCH","ENCRYPT","SIGN_TRANSACTION","SIGNATURE"];var Dr=Nr;async function jr(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 $r(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),zr=a.n(Wr);function Hr(t){let{active:e,title:r,id:i,number:o,descriptions:s,rewards:a,size:c,isChecked:u,onCheckboxChange:l}=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:u,onChange:t=>l(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 qr(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}Hr.propTypes={active:zr().bool.isRequired,title:zr().string.isRequired,id:zr().any.isRequired,number:zr().number.isRequired,descriptions:zr().string,rewards:zr().string,size:zr().string.isRequired,isChecked:zr().bool.isRequired,onCheckboxChange:zr().func.isRequired};const Xr=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 Yr(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},ui={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},li=(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:ui;function hi(t,e){return t?t[e]||t.default||t:void 0}const di=!1,fi=!1,pi=!1,gi=t=>null!==t;function mi(t,{repeat:e,repeatType:n="loop"},r){const i=t.filter(gi),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:u,preRender:l,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),u.process(i),l.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),Ai=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,xi=1e-7,_i=12;function ki(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=Ai(s,r,i)-t,o>0?n=s:e=s}while(Math.abs(o)>xi&&++a<_i);return s}(e,0,1,t,n);return t=>0===t||1===t?t:Ai(i(t),e,r)}const Ri=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Pi=t=>e=>1-t(1-e),Ci=ki(.33,1.53,.69,.99),Ii=Pi(Ci),Oi=Ri(Ii),Bi=t=>(t*=2)<1?.5*Ii(t):.5*(2-Math.pow(2,-10*(t-1))),Ui=t=>1-Math.sin(Math.acos(t)),Li=Pi(Ui),Ni=Ri(Ui),Di=t=>/^0[^.\s]+$/u.test(t);let ji=yi,Mi=yi;const Vi=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Fi=t=>e=>"string"==typeof e&&e.startsWith(t),Ki=Fi("--"),$i=Fi("var(--"),Wi=t=>!!$i(t)&&zi.test(t.split("/*")[0].trim()),zi=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Hi=/^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=Hi.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 qi=(t,e,n)=>n>e?e:n<t?t:n,Xi={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Gi={...Xi,transform:t=>qi(0,1,t)},Yi={...Xi,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===Xi||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}},uo=new Set(["x","y","z"]),lo=ri.filter((t=>!uo.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=[Xi,eo,to,Qi,ro,no,{test:t=>"auto"===t,parse:t=>t}],go=t=>po.find(fo(t)),mo=new Set;let yo=!1,wo=!1;function vo(){if(wo){const t=Array.from(mo).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 lo.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,mo.forEach((t=>t.complete())),mo.clear()}function bo(){mo.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?(mo.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),mo.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,mo.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const So=t=>Math.round(1e5*t)/1e5,To=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Ao=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,xo=(t,e)=>n=>Boolean("string"==typeof n&&Ao.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),_o=(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}},ko={...Xi,transform:t=>Math.round((t=>qi(0,255,t))(t))},Ro={test:xo("rgb","red"),parse:_o("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+ko.transform(t)+", "+ko.transform(e)+", "+ko.transform(n)+", "+So(Gi.transform(r))+")"};const Po={test:xo("#"),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:Ro.transform},Co={test:xo("hsl","hue"),parse:_o("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=>Ro.test(t)||Po.test(t)||Co.test(t),parse:t=>Ro.test(t)?Ro.parse(t):Co.test(t)?Co.parse(t):Po.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Ro.transform(t):Co.transform(t)},Oo=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Bo="number",Uo="color",Lo="var",No="var(",Do="${}",jo=/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(jo,(t=>(Io.test(t)?(r.color.push(o),i.push(Uo),n.push(Io.parse(t))):t.startsWith(No)?(r.var.push(o),i.push(Lo),n.push(t)):(r.number.push(o),i.push(Bo),n.push(parseFloat(t))),++o,Do))).split(Do);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===Bo?So(t[o]):e===Uo?Io.transform(t[o]):t[o]}return i}}const Ko=t=>"number"==typeof t?0:t;const $o={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(Oo))||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 zo(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 Ho=/\b([a-z-]*)\(.*?\)/gu,Zo={...$o,getAnimatableNone:t=>{const e=t.match(Ho);return e?e.map(zo).join(" "):t}},qo={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},Xo={rotate:Qi,rotateX:Qi,rotateY:Qi,rotateZ:Qi,scale:Yi,scaleX:Yi,scaleY:Yi,scaleZ:Yi,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={...Xi,transform:Math.round},Yo={...qo,...Xo,zIndex:Go,size:eo,fillOpacity:Gi,strokeOpacity:Gi,numOctaves:Go},Jo={...Yo,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=$o),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=go(r),s=go(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||Di(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||!$o.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 ji(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 us{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(mi(t,this.options,e)),null==s||s(),void this.resolveFinishedPromise();this.options.duration=0}const u=this.initPlayback(t,e);!1!==u&&(this._resolved={keyframes:t,finalKeyframe:e,...u},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 ls=(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(ls(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 gs={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},ms=.001;function ys({duration:t=gs.duration,bounce:e=gs.bounce,velocity:n=gs.velocity,mass:r=gs.mass}){let i,o;ji(t<=oi(gs.maxDuration),"Spring duration must be 10 seconds or less");let s=1-e;s=qi(gs.minDamping,gs.maxDamping,s),t=qi(gs.minDuration,gs.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 ms-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),u=vs(Math.pow(e,2),s);return(-i(e)+ms>0?-1:1)*((o-a)*c)/u}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-ms,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:gs.stiffness,damping:gs.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 As(t,e){return e.some((e=>void 0!==t[e]))}function xs(t=gs.visualDuration,e=gs.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:u,mass:l,duration:h,velocity:d,isResolvedFromDuration:f}=function(t){let e={velocity:gs.velocity,stiffness:gs.stiffness,damping:gs.damping,mass:gs.mass,isResolvedFromDuration:!1,...t};if(!As(t,Ts)&&As(t,Ss))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(1.2*n),i=r*r,o=2*qi(.05,1,1-t.bounce)*Math.sqrt(i);e={...e,mass:gs.mass,stiffness:i,damping:o}}else{const n=ys(t);e={...e,...n,mass:gs.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-si(n.velocity||0)}),p=d||0,g=u/(2*Math.sqrt(c*l)),m=s-o,y=si(Math.sqrt(c/l)),w=Math.abs(m)<5;let v;if(r||(r=w?gs.restSpeed.granular:gs.restSpeed.default),i||(i=w?gs.restDelta.granular:gs.restDelta.default),g<1){const t=vs(y,g);v=e=>{const n=Math.exp(-g*y*e);return s-n*((p+g*y*m)/t*Math.sin(t*e)+m*Math.cos(t*e))}}else if(1===g)v=t=>s-Math.exp(-y*t)*(m+(p+y*m)*t);else{const t=y*Math.sqrt(g*g-1);v=e=>{const n=Math.exp(-g*y*e),r=Math.min(t*e,300);return s-n*((p+g*y*m)*Math.sinh(r)+t*m*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;g<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 _s({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:c,restDelta:u=.5,restSpeed:l}){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 g=h+p,m=void 0===s?g:s(g);m!==g&&(p=m-h);const y=t=>-p*Math.exp(-t/r),w=t=>m+y(t),v=t=>{const e=y(t),n=w(t);d.done=Math.abs(e)<=u,d.value=d.done?m:n};let b,E;const S=t=>{(t=>void 0!==a&&t<a||void 0!==c&&t>c)(d.value)&&(b=t,E=xs({keyframes:[d.value,f(d.value)],velocity:ps(w,t,d.value),damping:i,stiffness:o,restDelta:u,restSpeed:l}))};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 ks=ki(.42,0,1,1),Rs=ki(0,0,.58,1),Ps=ki(.42,0,.58,1),Cs=t=>Array.isArray(t)&&"number"==typeof t[0],Is={linear:yi,easeIn:ks,easeInOut:Ps,easeOut:Rs,circIn:Ui,circInOut:Ni,circOut:Li,backIn:Ii,backInOut:Oi,backOut:Ci,anticipate:Bi},Os=t=>{if(Cs(t)){Mi(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,i]=t;return ki(e,n,r,i)}return"string"==typeof t?(Mi(void 0!==Is[t],`Invalid easing type '${t}'`),Is[t]):t},Bs=(t,e)=>n=>e(t(n)),Us=(...t)=>t.reduce(Bs),Ls=(t,e,n)=>t+(e-t)*n;function Ns(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 Ds(t,e){return n=>n>0?e:t}const js=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},Ms=[Po,Ro,Co];function Vs(t){const e=(t=>Ms.find((e=>e.test(t))))(t);if(ji(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===Co&&(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=Ns(a,r,t+1/3),o=Ns(a,r,t),s=Ns(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 Ds(t,e);const i={...n};return t=>(i.red=js(n.red,r.red,t),i.green=js(n.green,r.green,t),i.blue=js(n.blue,r.blue,t),i.alpha=Ls(n.alpha,r.alpha,t),Ro.transform(i))},Ks=new Set(["none","hidden"]);function $s(t,e){return n=>Ls(t,e,n)}function Ws(t){return"number"==typeof t?$s:"string"==typeof t?Wi(t)?Ds:Io.test(t)?Fs:Zs:Array.isArray(t)?zs:"object"==typeof t?Io.test(t)?Fs:Hs:Ds}function zs(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 Hs(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=$o.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):Us(zs(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):(ji(!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.`),Ds(t,e))};function qs(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Ls(t,e,n);return Ws(t)(t,e)}function Xs(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||qs,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=Us(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=ls(t[n],t[n+1],e);return s[n](r)};return n?e=>c(qi(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=ls(0,e,r);t.push(Ls(n,1,i))}}(e,t.length-1),e}function Ys({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(r)?r.map(Os):Os(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=Xs(s,e,{ease:Array.isArray(i)?i:(c=e,u=i,c.map((()=>u||Ps)).splice(0,c.length-1))});var c,u;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:_s,inertia:_s,tween:Ys,keyframes:Ys,spring:xs},ta=t=>t/100;class ea extends us{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]||Ys;let a,c;s!==Ys&&"number"!=typeof t[0]&&(a=Us(ta,qs(t[0],t[1])),t=[0,100]);const u=s({...this.options,keyframes:t});"mirror"===i&&(c=s({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===u.calculatedDuration&&(u.calculatedDuration=Es(u));const{calculatedDuration:l}=u,h=l+r;return{generator:u,mirroredGenerator:c,mapPercentToKeyframes:a,calculatedDuration:l,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:u,resolvedDuration:l}=n;if(null===this.startTime)return i.next(0);const{delay:h,repeat:d,repeatType:f,repeatDelay:p,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/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 m=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?m<0:m>u;this.currentTime=Math.max(m,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let w=this.currentTime,v=i;if(d){const t=Math.min(this.currentTime,u)/l;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/l)):"mirror"===f&&(v=o)),w=qi(0,1,n)*l}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>=u:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&E);return S&&void 0!==r&&(b.value=mi(a,this.options,r)),g&&g(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 ua||sa())||Cs(t)||Array.isArray(t)&&t.every(aa))}const ca=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,ua={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 la(t,e){return t?"function"==typeof t&&sa()?hs(t,e):Cs(t)?ca(t):Array.isArray(t)?t.map((t=>la(t,e)||ua.easeOut)):ua[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 u={[e]:n};c&&(u.offset=c);const l=la(a,i);return Array.isArray(l)&&(u.easing=l),t.animate(u,{delay:r,duration:i,easing:Array.isArray(l)?"linear":l,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:Bi,backInOut:Oi,circInOut:Ni};class ga extends us{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:u}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;var l;if("string"==typeof o&&sa()&&o in pa&&(o=pa[o]),rs((l=this.options).type)||"spring"===l.type||!aa(l.ease)){const{onComplete:e,onUpdate:n,motionValue:a,element:c,...u}=this.options,l=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,u);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,i=l.times,o=l.ease,s="keyframes"}const h=ha(a.owner.current,c,t,{...this.options,duration:r,times:i,ease:o});return h.startTime=null!=u?u:this.calcStartTime(),this.pendingTimeline?(da(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;a.set(mi(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,...u}=this.options,l=new ea({...u,keyframes:n,duration:r,type:i,ease:o,times:s,isGenerator:!0}),h=oi(this.time);t.setWithVelocity(l.sample(h-10).value,l.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 ma=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=>ma()&&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:u=0}=r;u-=oi(c);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,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:u,...l}){return!!Object.keys(l).length})(a)||(l={...l,...li(t,l)}),l.duration&&(l.duration=oi(l.duration)),l.repeatDelay&&(l.repeatDelay=oi(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let h=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(h=!0)),(pi||di)&&(h=!0,l.duration=0,l.delay=0),h&&!o&&void 0!==e.get()){const t=mi(l.keyframes,a);if(void 0!==t)return bi.update((()=>{l.onUpdate(t),l.onComplete()})),new ya([])}return!o&&ga.supports(l)?new ga(l):new ea(l)},va=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),ba=t=>Xr(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 Aa={current:void 0};class xa{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 Aa.current&&Aa.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 _a(t,e){return new xa(t,e)}function ka(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,_a(n))}const Ra=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Pa="data-"+Ra("framerAppearId");function Ca(t){return t.props[Pa]}const Ia=t=>Boolean(t&&t.getVelocity);function Oa(t,e){const n=t.getValue("willChange");if(r=n,Boolean(Ia(r)&&r.add))return n.add(e);var r}function Ba({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Ua(t,e,{delay:n=0,transitionOverride:r,type:i}={}){var o;let{transition:s=t.getDefaultTransition(),transitionEnd:a,...c}=e;r&&(s=r);const u=[],l=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||l&&Ba(l,e))continue;const a={delay:n,...hi(s||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Ca(t);if(n){const t=window.MotionHandoffAnimation(n,e,bi);null!==t&&(a.startTime=t,h=!0)}}Oa(t,e),r.start(wa(e,r,i,t.shouldReduceMotion&&ii.has(e)?{type:!1}:a,t,h));const d=r.animation;d&&u.push(d)}return a&&Promise.all(u).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)ka(t,e,ba(o[e]))}(t,a)}))})),u}function La(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(Ua(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(Na).forEach(((t,r)=>{t.notify("AnimationStart",e),s.push(La(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 Na(t,e){return t.sortNodePosition(e)}const Da=ni.length;function ja(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&ja(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Da;n++){const r=ni[n],i=t.props[r];(Yr(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=>La(t,e,n)));r=Promise.all(i)}else if("string"==typeof e)r=La(t,e,n);else{const i="function"==typeof e?ti(t,e,n.custom):e;r=Promise.all(Ua(t,i,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Ka(t){let e=Fa(t),n=za(),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=ja(t.parent)||{},c=[],u=new Set;let l={},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],g=Yr(p),m=d===o?f.isActive:null;!1===m&&(h=e);let y=p===a[d]&&p!==s[d]&&g;if(y&&r&&t.manuallyAnimateOnMount&&(y=!1),f.protectedKeys={...l},!f.isActive&&null===m||!p&&!f.prevProp||qr(p)||"boolean"==typeof p)continue;const w=$a(f.prevProp,p);let v=w||d===o&&f.isActive&&!y&&g||e>h&&g,b=!1;const E=Array.isArray(p)?p:[p];let S=E.reduce(i(d),{});!1===m&&(S={});const{prevResolvedValues:T={}}=f,A={...T,...S},x=e=>{v=!0,u.has(e)&&(b=!0,u.delete(e)),f.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in A){const e=S[t],n=T[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Xr(e)&&Xr(n)?!Gr(e,n):e!==n,r?null!=e?x(t):u.add(t):void 0!==e&&u.has(t)?x(t):f.protectedKeys[t]=!0}f.prevProp=p,f.prevResolvedValues=S,f.isActive&&(l={...l,...S}),r&&t.blockInitialAnimation&&(v=!1);v&&(!(y&&w)||b)&&c.push(...E.map((t=>({animation:t,options:{type:d}}))))}if(u.size){const e={};u.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=za(),r=!0}}}function $a(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 za(){return{animate:Wa(!0),whileInView:Wa(),whileHover:Wa(),whileTap:Wa(),whileDrag:Wa(),whileFocus:Wa(),exit:Wa()}}class Ha{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Za=0;const qa={animation:{Feature:class extends Ha{constructor(t){super(t),t.animationState||(t.animationState=Ka(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();qr(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 Ha{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(){}}}},Xa={x:!1,y:!1};function Ga(){return Xa.x||Xa.y}function Ya(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]=Ya(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 uc(t,e,n,r){return cc(t,e,(t=>e=>Qa(e)&&t(e,ac(e)))(n),r)}const lc=(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=lc(t.x,e.x),r=lc(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=Us(uc(this.contextWindow,"pointermove",this.handlePointerMove),uc(this.contextWindow,"pointerup",this.handlePointerUp),uc(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,mc(e)),offset:fc(t,gc(e)),velocity:yc(e,.1)}}function gc(t){return t[0]}function mc(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=mc(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 Ac(t,e,n,r=.5){t.origin=r,t.originPoint=Ls(e.min,e.max,t.origin),t.scale=Tc(n)/Tc(e),t.translate=Ls(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 xc(t,e,n,r){Ac(t.x,e.x,n.x,r?r.originX:void 0),Ac(t.y,e.y,n.y,r?r.originY:void 0)}function _c(t,e,n){t.min=n.min+e.min,t.max=t.min+Tc(e)}function kc(t,e,n){t.min=e.min-n.min,t.max=t.min+Tc(e)}function Rc(t,e,n){kc(t.x,e.x,n.x),kc(t.y,e.y,n.y)}function Pc(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 Cc(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 Oc(t,e,n){return{min:Bc(t,e),max:Bc(t,n)}}function Bc(t,e){return"number"==typeof t?t:t[e]||0}const Uc=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),Lc=()=>({x:{min:0,max:0},y:{min:0,max:0}});function Nc(t){return[t("x"),t("y")]}function Dc({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function jc(t){return void 0===t||1===t}function Mc({scale:t,scaleX:e,scaleY:n}){return!jc(t)||!jc(e)||!jc(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 $c(t,e,n){return n+e*(t-n)}function Wc(t,e,n,r,i){return void 0!==i&&(t=$c(t,i,r)),$c(t,n,r)+e}function zc(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 Hc(t,{x:e,y:n}){zc(t.x,e.translate,e.scale,e.originPoint),zc(t.y,n.translate,n.scale,n.originPoint)}const Zc=.999999999999,qc=1.0000000000001;function Xc(t,e){t.min=t.min+e,t.max=t.max+e}function Gc(t,e,n,r,i=.5){zc(t,e,n,Ls(t.min,t.max,i),r)}function Yc(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 Dc(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,tu=new WeakMap;class eu{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=Lc(),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?Xa[o]?null:(Xa[o]=!0,()=>{Xa[o]=!1}):Xa.x||Xa.y?null:(Xa.x=Xa.y=!0,()=>{Xa.x=Xa.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),Nc((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))),Oa(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:()=>Nc((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||!nu(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?Ls(e,t,r.min):Math.max(t,e):void 0!==n&&t>n&&(t=r?Ls(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:Pc(t.x,n,i),y:Pc(t.y,e,r)}}(r.layoutBox,e),this.elastic=function(t=Ic){return!1===t?t=0:!0===t&&(t=Ic),{x:Oc(t,"left","right"),y:Oc(t,"top","bottom")}}(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Nc((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&&(Xc(r.x,i.offset.x),Xc(r.y,i.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Cc(t.x,e.x),y:Cc(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=Dc(t))}return o}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{},c=Nc((s=>{if(!nu(s,e,this.currentDirection))return;let c=a&&a[s]||{};o&&(c={min:0,max:0});const u=r?200:1e6,l=r?40:1e7,h={type:"inertia",velocity:n?t[s]:0,bounceStiffness:u,bounceDamping:l,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 Oa(this.visualElement,t),n.start(wa(t,n,0,e,this.visualElement,!1))}stopAnimation(){Nc((t=>this.getAxisMotionValue(t).stop()))}pauseAnimation(){Nc((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){Nc((e=>{const{drag:n}=this.getProps();if(!nu(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]-Ls(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};Nc((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=ls(e.min,e.max-r,t.min):r>i&&(n=ls(t.min,t.max-i,e.min)),qi(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(),Nc((e=>{if(!nu(e,t,null))return;const n=this.getAxisMotionValue(e),{min:i,max:o}=this.constraints[e];n.set(Ls(i,o,r[e]))}))}addListeners(){if(!this.visualElement.current)return;tu.set(this.visualElement,this);const t=uc(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&&(Nc((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 nu(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}const ru=t=>(e,n)=>{t&&bi.postRender((()=>t(e,n)))};var iu=a(893);const ou=(0,e.createContext)(null);const su=(0,e.createContext)({}),au=(0,e.createContext)({}),cu={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function uu(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const lu={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!eo.test(t))return t;t=parseFloat(t)}return`${uu(t,e.target.x)}% ${uu(t,e.target.y)}%`}},hu={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=$o.parse(t);if(i.length>5)return r;const o=$o.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 u=Ls(a,c,.5);return"number"==typeof i[2+s]&&(i[2+s]/=u),"number"==typeof i[3+s]&&(i[3+s]/=u),o(i)}},du={};const{schedule:fu,cancel:pu}=vi(queueMicrotask,!1);class gu extends e.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=t;var o;o=yu,Object.assign(du,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()})),cu.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(),fu.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 mu(t){const[n,r]=function(){const t=(0,e.useContext)(ou);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)(su);return(0,iu.jsx)(gu,{...t,layoutGroup:i,switchLayoutGroup:(0,e.useContext)(au),isPresent:n,safeToRemove:r})}const yu={borderRadius:{...lu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:lu,borderTopRightRadius:lu,borderBottomLeftRadius:lu,borderBottomRightRadius:lu,boxShadow:hu},wu=["TopLeft","TopRight","BottomLeft","BottomRight"],vu=wu.length,bu=t=>"string"==typeof t?parseFloat(t):t,Eu=t=>"number"==typeof t||eo.test(t);function Su(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Tu=xu(0,.5,Li),Au=xu(.5,.95,yi);function xu(t,e,n){return r=>r<t?0:r>e?1:n(ls(t,e,r))}function _u(t,e){t.min=e.min,t.max=e.max}function ku(t,e){_u(t.x,e.x),_u(t.y,e.y)}function Ru(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Pu(t,e,n,r,i){return t=$c(t-=e,1/n,r),void 0!==i&&(t=$c(t,1/i,r)),t}function Cu(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=Ls(s.min,s.max,e/100)-s.min);if("number"!=typeof e)return;let a=Ls(o.min,o.max,r);t===o&&(a-=e),t.min=Pu(t.min,e,n,a,i),t.max=Pu(t.max,e,n,a,i)}(t,e[n],e[r],e[i],e.scale,o,s)}const Iu=["x","scaleX","originX"],Ou=["y","scaleY","originY"];function Bu(t,e,n,r){Cu(t.x,e,Iu,n?n.x:void 0,r?r.x:void 0),Cu(t.y,e,Ou,n?n.y:void 0,r?r.y:void 0)}function Uu(t){return 0===t.translate&&1===t.scale}function Lu(t){return Uu(t.x)&&Uu(t.y)}function Nu(t,e){return t.min===e.min&&t.max===e.max}function Du(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function ju(t,e){return Du(t.x,e.x)&&Du(t.y,e.y)}function Mu(t){return Tc(t.x)/Tc(t.y)}function Vu(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Fu{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 Ku=(t,e)=>t.depth-e.depth;class $u{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(Ku),this.isDirty=!1,this.children.forEach(t)}}function Wu(t){const e=Ia(t)?t.get():t;return va(e)?e.toValue():e}function zu(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 Hu={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Zu="undefined"!=typeof window&&void 0!==window.MotionDebug,qu=["","X","Y","Z"],Xu={visibility:"hidden"};let Gu=0;function Yu(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Ju(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Ca(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&&Ju(r)}function Qu({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(t={},n=(null==e?void 0:e())){this.id=Gu++,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,Zu&&(Hu.totalNodes=Hu.resolvedTargetDeltas=Hu.recalculatedProjection=0),this.nodes.forEach(nl),this.nodes.forEach(ul),this.nodes.forEach(ll),this.nodes.forEach(rl),Zu&&window.MotionDebug.record(Hu)},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 $u)}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=zu(r,250),cu.hasAnimatedSinceResize&&(cu.hasAnimatedSinceResize=!1,this.nodes.forEach(cl))}))}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()||ml,{onLayoutAnimationStart:o,onLayoutAnimationComplete:a}=s.getProps(),c=!this.targetLayout||!ju(this.targetLayout,r)||n,u=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||u||e&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,u);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||cl(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(hl),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&&Ju(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(ol);this.isUpdating||this.nodes.forEach(sl),this.isUpdating=!1,this.nodes.forEach(al),this.nodes.forEach(tl),this.nodes.forEach(el),this.clearAllSnapshots();const t=ss.now();Si.delta=qi(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,fu.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(il),this.sharedNodes.forEach(dl)}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=Lc(),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&&!Lu(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)),vl((r=n).x),vl(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 Lc();const n=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(El))){const{scroll:t}=this.root;t&&(Xc(n.x,t.offset.x),Xc(n.y,t.offset.y))}return n}removeElementScroll(t){var e;const n=Lc();if(ku(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&&ku(n,t),Xc(n.x,i.offset.x),Xc(n.y,i.offset.y))}return n}applyTransform(t,e=!1){const n=Lc();ku(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&&Yc(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),Vc(r.latestValues)&&Yc(n,r.latestValues)}return Vc(this.latestValues)&&Yc(n,this.latestValues),n}removeTransform(t){const e=Lc();ku(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=Lc();ku(r,n.measurePageBox()),Bu(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return Vc(this.latestValues)&&Bu(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=Lc(),this.relativeTargetOrigin=Lc(),Rc(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),ku(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var s,a,c;if(this.target||(this.target=Lc(),this.targetWithTransforms=Lc()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),s=this.target,a=this.relativeTarget,c=this.relativeParent.target,_c(s.x,a.x,c.x),_c(s.y,a.y,c.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):ku(this.target,this.layout.layoutBox),Hc(this.target,this.targetDelta)):ku(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=Lc(),this.relativeTargetOrigin=Lc(),Rc(this.relativeTargetOrigin,this.target,t.target),ku(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Zu&&Hu.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;ku(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&&Yc(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),s&&(e.x*=s.x.scale,e.y*=s.y.scale,Hc(t,s)),r&&Vc(o.latestValues)&&Yc(t,o.latestValues))}e.x<qc&&e.x>Zc&&(e.x=1),e.y<qc&&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=Lc());const{target:c}=e;c?(this.projectionDelta&&this.prevProjectionDelta?(Ru(this.prevProjectionDelta.x,this.projectionDelta.x),Ru(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),xc(this.projectionDelta,this.layoutCorrected,c,this.latestValues),this.treeScale.x===s&&this.treeScale.y===a&&Vu(this.projectionDelta.x,this.prevProjectionDelta.x)&&Vu(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",c)),Zu&&Hu.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=Uc(),this.projectionDelta=Uc(),this.projectionDeltaWithTransform=Uc()}setAnimationOrigin(t,e=!1){const n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},o=Uc();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const s=Lc(),a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,l=Boolean(a&&!u&&!0===this.options.crossfade&&!this.path.some(gl));let h;this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;fl(o.x,t.x,n),fl(o.y,t.y,n),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Rc(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox),function(t,e,n,r){pl(t.x,e.x,n.x,r),pl(t.y,e.y,n.y,r)}(this.relativeTarget,this.relativeTargetOrigin,s,n),h&&function(t,e){return Nu(t.x,e.x)&&Nu(t.y,e.y)}(this.relativeTarget,h)&&(this.isProjectionDirty=!1),h||(h=Lc()),ku(h,this.relativeTarget)),a&&(this.animationValues=i,function(t,e,n,r,i,o){i?(t.opacity=Ls(0,void 0!==n.opacity?n.opacity:1,Tu(r)),t.opacityExit=Ls(void 0!==e.opacity?e.opacity:1,0,Au(r))):o&&(t.opacity=Ls(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let i=0;i<vu;i++){const o=`border${wu[i]}Radius`;let s=Su(e,o),a=Su(n,o);void 0===s&&void 0===a||(s||(s=0),a||(a=0),0===s||0===a||Eu(s)===Eu(a)?(t[o]=Math.max(Ls(bu(s),bu(a),r),0),(to.test(a)||to.test(s))&&(t[o]+="%")):t[o]=a)}(e.rotate||n.rotate)&&(t.rotate=Ls(e.rotate||0,n.rotate||0,r))}(i,r,this.latestValues,n,l,u)),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((()=>{cu.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,n){const r=Ia(t)?t:_a(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&&bl(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Lc();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}ku(e,n),Yc(e,i),xc(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Fu);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&&Yu("z",t,r,this.animationValues);for(let e=0;e<qu.length;e++)Yu(`rotate${qu[e]}`,t,r,this.animationValues),Yu(`skew${qu[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 Xu;const r={visibility:""},i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=Wu(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=Wu(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 du){if(void 0===s[t])continue;const{correct:e,applyTo:n}=du[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?Wu(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(ol),this.root.sharedNodes.clear()}}}function tl(t){t.updateLayout()}function el(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?Nc((t=>{const r=o?n.measuredBox[t]:n.layoutBox[t],i=Tc(r);r.min=e[t].min,r.max=r.min+i})):bl(i,n.layoutBox,e)&&Nc((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=Uc();xc(s,e,n.layoutBox);const a=Uc();o?xc(a,t.applyTransform(r,!0),n.measuredBox):xc(a,e,n.layoutBox);const c=!Lu(s);let u=!1;if(!t.resumeFrom){const r=t.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:i,layout:o}=r;if(i&&o){const s=Lc();Rc(s,n.layoutBox,i.layoutBox);const a=Lc();Rc(a,e,o.layoutBox),ju(s,a)||(u=!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:u})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function nl(t){Zu&&Hu.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 rl(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function il(t){t.clearSnapshot()}function ol(t){t.clearMeasurements()}function sl(t){t.isLayoutDirty=!1}function al(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function cl(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function ul(t){t.resolveTargetDelta()}function ll(t){t.calcProjection()}function hl(t){t.resetSkewAndRotation()}function dl(t){t.removeLeadSnapshot()}function fl(t,e,n){t.translate=Ls(e.translate,0,n),t.scale=Ls(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function pl(t,e,n,r){t.min=Ls(e.min,n.min,r),t.max=Ls(e.max,n.max,r)}function gl(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const ml={duration:.45,ease:[.4,0,.1,1]},yl=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),wl=yl("applewebkit/")&&!yl("chrome/")?Math.round:yi;function vl(t){t.min=wl(t.min),t.max=wl(t.max)}function bl(t,e,n){return"position"===t||"preserve-aspect"===t&&(r=Mu(e),i=Mu(n),o=.2,!(Math.abs(r-i)<=o));var r,i,o}function El(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const Sl=Qu({attachResizeListener:(t,e)=>cc(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Tl={current:void 0},Al=Qu({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Tl.current){const t=new Sl({});t.mount(window),t.setOptions({layoutScroll:!0}),Tl.current=t}return Tl.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),xl={pan:{Feature:class extends Ha{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:ru(t),onStart:ru(e),onMove:n,onEnd:(t,e)=>{delete this.session,r&&bi.postRender((()=>r(t,e)))}}}mount(){this.removePointerDownListener=uc(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 Ha{constructor(t){super(t),this.removeGroupControls=yi,this.removeListeners=yi,this.controls=new eu(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:Al,MeasureLayout:mu}};function _l(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 kl(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 Rl=new WeakMap,Pl=new WeakMap,Cl=t=>{const e=Rl.get(t.target);e&&e(t)},Il=t=>{t.forEach(Cl)};function Ol(t,e,n){const r=function({root:t,...e}){const n=t||document;Pl.has(n)||Pl.set(n,{});const r=Pl.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(Il,{root:t,...e})),r[i]}(e);return Rl.set(t,n),r.observe(t),()=>{Rl.delete(t),r.unobserve(t)}}const Bl={some:0,all:1};const Ul={inView:{Feature:class extends Ha{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:Bl[r]};return Ol(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 Ha{mount(){const{current:t}=this.node;t&&(this.unmount=sc(t,(t=>(kl(this.node,t,"Start"),(t,{success:e})=>kl(this.node,t,e?"End":"Cancel"))),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends Ha{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=Us(cc(this.node.current,"focus",(()=>this.onFocus())),cc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Ha{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[r,i,o]=Ya(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=>(_l(this.node,t,"Start"),t=>_l(this.node,t,"End")))))}unmount(){}}}},Ll={layout:{ProjectionNode:Al,MeasureLayout:mu}},Nl=(0,e.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Dl=(0,e.createContext)({}),jl="undefined"!=typeof window,Ml=jl?e.useLayoutEffect:e.useEffect,Vl=(0,e.createContext)({strict:!1});function Fl(t,n,r,i,o){var s,a;const{visualElement:c}=(0,e.useContext)(Dl),u=(0,e.useContext)(Vl),l=(0,e.useContext)(ou),h=(0,e.useContext)(Nl).reducedMotion,d=(0,e.useRef)(null);i=i||u.renderer,!d.current&&i&&(d.current=i(t,{visualState:n,parent:c,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:h}));const f=d.current,p=(0,e.useContext)(au);!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:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Kl(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:u})}(d.current,r,o,p);const g=(0,e.useRef)(!1);(0,e.useInsertionEffect)((()=>{f&&g.current&&f.update(r,l)}));const m=r[Pa],y=(0,e.useRef)(Boolean(m)&&!(null===(s=window.MotionHandoffIsComplete)||void 0===s?void 0:s.call(window,m))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,m)));return Ml((()=>{f&&(g.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),fu.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,m)})),y.current=!1))})),f}function Kl(t){if(t)return!1!==t.options.allowProjection?t.projection:Kl(t.parent)}function $l(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 Wl(t){return qr(t.animate)||ni.some((e=>Yr(t[e])))}function zl(t){return Boolean(Wl(t)||t.variants)}function Hl(t){const{initial:n,animate:r}=function(t,e){if(Wl(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Yr(e)?e:void 0,animate:Yr(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,e.useContext)(Dl));return(0,e.useMemo)((()=>({initial:n,animate:r})),[Zl(n),Zl(r)])}function Zl(t){return Array.isArray(t)?t.join(" "):t}const ql={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"]},Xl={};for(const t in ql)Xl[t]={isEnabled:e=>ql[t].some((t=>!!e[t]))};const Gl=Symbol.for("motionComponentSymbol");function Yl({preloadedFeatures:t,createVisualElement:n,useRender:r,useVisualState:i,Component:o}){t&&function(t){for(const e in t)Xl[e]={...Xl[e],...t[e]}}(t);const s=(0,e.forwardRef)((function(t,s){let a;const c={...(0,e.useContext)(Nl),...t,layoutId:Jl(t)},{isStatic:u}=c,l=Hl(t),h=i(t,u);if(!u&&jl){!function(t,n){(0,e.useContext)(Vl).strict;0}();const t=function(t){const{drag:e,layout:n}=Xl;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,l.visualElement=Fl(o,h,c,n,t.ProjectionNode)}return(0,iu.jsxs)(Dl.Provider,{value:l,children:[a&&l.visualElement?(0,iu.jsx)(a,{visualElement:l.visualElement,...c}):null,r(o,t,$l(h,l.visualElement,s),h,u,l.visualElement)]})}));return s[Gl]=o,s}function Jl({layoutId:t}){const n=(0,e.useContext)(su).id;return n&&void 0!==t?n+"-"+t:t}const Ql=["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("-")&&!!(Ql.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:Ra(n),e.attrs[n])}function ih(t,{layout:e,layoutId:n}){return ii.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!du[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)(Dl),o=(0,e.useContext)(ou),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]=Wu(o[t]);let{initial:s,animate:a}=t;const c=Wl(t),u=zl(t);e&&u&&!c&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let l=!!n&&!1===n.initial;l=l||!1===s;const h=l?a:s;if(h&&"boolean"!=typeof h&&!qr(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[l?e.length-1:0]}null!==e&&(i[t]=e)}for(const e in t)i[e]=t[e]}}}return i}const uh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),lh=()=>({...uh(),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,Yo[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,Yo[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 gh(t,e,n){return"string"==typeof t?t:eo.transform(e+n*t)}const mh={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,...u},l,h){if(ph(t,u,h),l)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`${gh(e,t.x,t.width)} ${gh(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?mh: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:lh,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:uh})};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=uh();return ph(e,n,t),Object.assign({},e.vars,e.style)}),[n])}(t,n)),r}function Ah(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 xh=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 _h(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||xh.has(t)}let kh=t=>!_h(t);try{(Rh=require("@emotion/is-prop-valid").default)&&(kh=t=>t.startsWith("on")?!_h(t):Rh(t))}catch(Yp){}var Rh;function Ph(t,n,r,i){const o=(0,e.useMemo)((()=>{const e=lh();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 Ch(t=!1){return(n,r,i,{latestValues:o},s)=>{const a=(th(n)?Ph:Ah)(r,o,s,n),c=function(t,e,n){const r={};for(const i in t)"values"===i&&"object"==typeof t.values||(kh(i)||!0===n&&_h(i)||!e&&!_h(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}(r,"string"==typeof n,t),u=n!==e.Fragment?{...c,...a,ref:i}:{},{children:l}=r,h=(0,e.useMemo)((()=>Ia(l)?l.get():l),[l]);return(0,e.createElement)(n,{...u,children:h})}}function Ih(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Yl({...th(n)?bh:Eh,preloadedFeatures:t,useRender:Ch(r),createVisualElement:e,Component:n})}}const Oh={current:null},Bh={current:!1};const Uh=new WeakMap,Lh=[...po,Io,$o],Nh=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Dh{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=Wl(e),this.isVariantNode=zl(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:u,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==a[t]&&Ia(e)&&e.set(a[t],!1)}}mount(t){this.current=t,Uh.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))),Bh.current||function(){if(Bh.current=!0,jl)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Oh.current=t.matches;t.addListener(e),e()}else Oh.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Oh.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Uh.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 Xl){const e=Xl[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):Lc()}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<Nh.length;e++){const n=Nh[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,_a(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,_a(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=_a(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)||Di(r))?r=parseFloat(r):!(t=>Lh.find(fo(t)))(r)&&$o.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 jh extends Dh{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 jh{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 jh{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Lc}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:Ra(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({...qa,...Ul,...xl,...Ll},((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,u]=(0,e.useState)({length:!1,capital:!1,number:!1,symbol:!1});(0,e.useEffect)((()=>{u({length:i.length>=8,capital:/[A-Z]/.test(i),number:/[0-9]/.test(i),symbol:/[!@#$%^&*(),.?":{}|<>]/.test(i)})}),[i]);const l=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()=>{l&&r({method:"pin",value:i})},disabled:!l,className:"w-full py-3 px-4 rounded-lg font-semibold ".concat(l?"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 $h=[{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)($h),[s,a]=(0,e.useState)(!1),[c,u]=(0,e.useState)(0);(0,e.useEffect)((()=>{if(s){const t=setInterval((()=>{u((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 zh(t){let{onSignUpSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}=t;const[a,c]=(0,e.useState)({email:"",username:"",password:"",confirmPassword:""}),[u,l]=(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"},u&&n().createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},u),n().createElement($r,{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)):l(e.message||"Sign up failed")}catch(t){l("Sign up failed. Please try again.")}else l("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 Hh(t){let{setOthentConnected:n,dataRequester:r,NoAccount:i,NoModel:o,activeModels:s,avatar:a,setAvatar:c,traits:u,setTraits:l,requestData:h,handleConnectionSelection:d,changeGranted:f,granted:p,allowSubmit:g,rejectDataRequest:m,sendDataRequest:y,isAuthenticated:w,onClose:v,onLoginSuccess:b,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T,accountInfo:A}=t;const[x,_]=(0,e.useState)(null),[k,R]=(0,e.useState)(!1),P=(0,e.useRef)(null),[C,I]=(0,e.useState)({}),O=(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)},[B,U]=(0,e.useState)((()=>{var t;return w?A&&(null===(t=A.models)||void 0===t?void 0:t.length)>0?"datarequests":"onboarding":"login"})),[L,N]=(0,e.useState)({username:"",password:""}),[D,j]=(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=>{P.current&&!P.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({...L,[t.target.name]:t.target.value})},F=async t=>{t.preventDefault();try{_(null);const t={details:{username:L.username,password:L.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",L.username),await K(L.username)}catch(t){console.error("Login failed:",t),_("Invalid username or password")}},K=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];R(!0);try{await b(t,e);_(null)}catch(t){console.error("Login process failed:",t),_("Failed to complete login process")}finally{R(!1)}},$=()=>{U("security")},W=t=>{"othent"===t.method?E(!0):"pin"===t.method&&T(t.value),U("datarequests")},z=t=>{let{dataRequester:e,granted:n,allowSubmit:r,rejectDataRequest:i,sendDataRequest:o,activeModels:s,requestData:a,handleConnectionSelection:c,changeGranted:u,avatar:l,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?l:"Traits"===n.type&&h;return React.createElement(Hr,{key:t,active:r,title:n.type,id:n,number:e,descriptions:n.descriptions,rewards:n.reward,size:t,isChecked:!!C[t],onCheckboxChange:e=>O(t,e)})})))))};return(0,e.useEffect)((()=>{var t;w&&A&&((null===(t=A.models)||void 0===t?void 0:t.length)>0?U("datarequests"):U("onboarding"))}),[w,A]),(0,e.useEffect)((()=>()=>{j(!1)}),[]),(0,e.useEffect)((()=>{}),[w,A]),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:P,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(B){case"signup":return React.createElement(zh,{onSignUpSuccess:K,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T});case"onboarding":return React.createElement(Wh,{onComplete:$});case"security":return React.createElement(Kh,{onComplete:W});case"datarequests":return React.createElement(z,{dataRequester:r,granted:p,allowSubmit:g,rejectDataRequest:m,sendDataRequest:y,activeModels:s,requestData:h,handleConnectionSelection:d,changeGranted:f,avatar:a,traits:u});default:return React.createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},x&&React.createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},x),React.createElement($r,{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:L.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:L.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:()=>U("signup"),className:"w-full text-center text-blue-500 hover:text-blue-600"},"Don't have an account? Sign up"))}})())))}class Zh extends Error{constructor(t,e,n){super("object"==typeof e?e.message:e||t,{cause:"object"==typeof e?e.cause:n}),this.type=t,this.name="TypedError",Object.setPrototypeOf(this,Zh.prototype)}}const qh="ERR_INVALID_VALUE",Xh="ERR_UNEXPECTED_VALUE",Gh="ERR_UNEXPECTED_TYPE",Yh="ERR_PARSE";function Jh(t,e){const n={};for(const r in t){const i=t[r];if(!i)continue;let o,s;"function"==typeof i?(o=r,s=i):[o,s]=i;try{const t=s(e(o));void 0!==t&&(n[r]=t)}catch(t){throw new Zh(Yh,`Parser for "${r}" property failed${o===r?"":`. Source field: "${o}"`}`,t)}}return n}function Qh(t){let e=t;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){throw new Zh(qh,{cause:t})}if("object"!=typeof e||!e||Array.isArray(e))throw new Zh(Xh);return e}function td(t,e){return n=>{const r=r=>{if(!n||void 0!==r)try{return e(r)}catch(e){throw new Zh(Yh,{message:`"${t}" transformer failed to parse the value`,cause:e})}};return Object.assign(r,{isValid(t){try{return r(t),!0}catch{return!1}}})}}function ed(t,e){return td(e||"object",(e=>{const n=Qh(e);return Jh(t,(t=>n[t]))}))}function nd(t){throw new Zh(Gh,`Unexpected value received: ${JSON.stringify(t)}`)}td("boolean",(t=>{if("boolean"==typeof t)return t;const e=String(t);return"1"===e||"true"===e||"0"!==e&&"false"!==e&&void nd(t)}));const rd=td("string",(t=>{if("string"==typeof t||"number"==typeof t)return t.toString();nd(t)})),id=td("number",(t=>{if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);if(!Number.isNaN(e))return e}nd(t)}));td("date",(t=>t instanceof Date?t:new Date(1e3*id()(t))));function od(t){return/^#[\da-f]{6}$/i.test(t)}function sd(t){const e=t.replace(/\s/g,"").toLowerCase();if(od(e))return e;if(function(t){return/^#[\da-f]{3}$/i.test(t)}(e)){let t="#";for(let n=0;n<3;n+=1)t+=e[1+n].repeat(2);return t}const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${t}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((t,e)=>{const n=parseInt(e,10).toString(16);return t+(1===n.length?"0":"")+n}),"#")}const ad=td("rgb",(t=>sd(rd()(t)))),cd=td("themeParams",(t=>{const e=ad(!0);return Object.entries(Qh(t)).reduce(((t,[n,r])=>(t[function(t){return t.replace(/_[a-z]/g,(t=>t[1].toUpperCase()))}(n)]=e(r),t)),{})}));class ud extends Error{constructor(t,e,n){super("object"==typeof e?e.message:e||t,{cause:"object"==typeof e?e.cause:n}),this.type=t,this.name="TypedError",Object.setPrototypeOf(this,ud.prototype)}}function ld(t){return t.replace(/[A-Z]/g,(t=>`_${t.toLowerCase()}`))}const hd="ERR_INVALID_VALUE",dd="ERR_UNEXPECTED_VALUE",fd="ERR_UNEXPECTED_TYPE",pd="ERR_PARSE";function gd(t,e){const n={};for(const r in t){const i=t[r];if(!i)continue;let o,s;"function"==typeof i?(o=r,s=i):[o,s]=i;try{const t=s(e(o));void 0!==t&&(n[r]=t)}catch(t){throw new ud(pd,`Parser for "${r}" property failed${o===r?"":`. Source field: "${o}"`}`,t)}}return n}function md(t){let e=t;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){throw new ud(hd,{cause:t})}if("object"!=typeof e||!e||Array.isArray(e))throw new ud(dd);return e}function yd(t,e){return n=>{const r=r=>{if(!n||void 0!==r)try{return e(r)}catch(e){throw new ud(pd,{message:`"${t}" transformer failed to parse the value`,cause:e})}};return Object.assign(r,{isValid(t){try{return r(t),!0}catch{return!1}}})}}function wd(t,e){return yd(e||"object",(e=>{const n=md(e);return gd(t,(t=>n[t]))}))}function vd(t){throw new ud(fd,`Unexpected value received: ${JSON.stringify(t)}`)}const bd=yd("boolean",(t=>{if("boolean"==typeof t)return t;const e=String(t);return"1"===e||"true"===e||"0"!==e&&"false"!==e&&void vd(t)})),Ed=yd("string",(t=>{if("string"==typeof t||"number"==typeof t)return t.toString();vd(t)})),Sd=yd("number",(t=>{if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);if(!Number.isNaN(e))return e}vd(t)})),Td=yd("date",(t=>t instanceof Date?t:new Date(1e3*Sd()(t))));function Ad(t,e){return yd(e||"searchParams",(e=>{"string"!=typeof e&&!(e instanceof URLSearchParams)&&vd(e);const n="string"==typeof e?new URLSearchParams(e):e;return gd(t,(t=>{const e=n.get(t);return null===e?void 0:e}))}))}function xd(t){for(const e in t)t[e]=[ld(e),t[e]];return t}const _d=t=>{const e=Sd(),n=Sd(!0),r=Ed(),i=Ed(!0),o=bd(!0),s=wd(xd({addedToAttachmentMenu:o,allowsWriteToPm:o,firstName:r,id:e,isBot:o,isPremium:o,languageCode:i,lastName:i,photoUrl:i,username:i}),"User")(!0);return Ad(xd({authDate:Td(),canSendAfter:n,chat:wd(xd({id:e,type:r,title:r,photoUrl:i,username:i}),"Chat")(!0),chatInstance:i,chatType:i,hash:r,queryId:i,receiver:s,startParam:i,signature:r,user:s}),"initData")(t)};const kd=yd("rgb",(t=>function(t){const e=t.replace(/\s/g,"").toLowerCase();if(function(t){return/^#[\da-f]{6}$/i.test(t)}(e))return e;if(function(t){return/^#[\da-f]{3}$/i.test(t)}(e)){let t="#";for(let n=0;n<3;n+=1)t+=e[1+n].repeat(2);return t}const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${t}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((t,e)=>{const n=parseInt(e,10).toString(16);return t+(1===n.length?"0":"")+n}),"#")}(Ed()(t)))),Rd=yd("themeParams",(t=>{const e=kd(!0);return Object.entries(md(t)).reduce(((t,[n,r])=>(t[function(t){return t.replace(/_[a-z]/g,(t=>t[1].toUpperCase()))}(n)]=e(r),t)),{})}));function Pd(t){return JSON.stringify(Object.fromEntries(Object.entries(t).map((([t,e])=>[ld(t),e]))))}const Cd=t=>{const e=Ed(),n=Ed(!0),r=bd(!0);return Ad({botInline:["tgWebAppBotInline",r],defaultColors:["tgWebAppDefaultColors",Rd(!0)],fullscreen:["tgWebAppFullscreen",r],initData:["tgWebAppData",_d(!0)],initDataRaw:["tgWebAppData",n],platform:["tgWebAppPlatform",e],showSettings:["tgWebAppShowSettings",r],startParam:["tgWebAppStartParam",n],themeParams:["tgWebAppThemeParams",Rd()],version:["tgWebAppVersion",e]},"launchParams")(t)};function Id(t){const{initDataRaw:e,startParam:n,showSettings:r,botInline:i,fullscreen:o,defaultColors:s}=t,a=new URLSearchParams;return a.set("tgWebAppPlatform",t.platform),a.set("tgWebAppThemeParams",Pd(t.themeParams)),a.set("tgWebAppVersion",t.version),e&&a.set("tgWebAppData",e),n&&a.set("tgWebAppStartParam",n),"boolean"==typeof r&&a.set("tgWebAppShowSettings",r?"1":"0"),"boolean"==typeof i&&a.set("tgWebAppBotInline",i?"1":"0"),"boolean"==typeof o&&a.set("tgWebAppFullscreen",o?"1":"0"),s&&a.set("tgWebAppDefaultColors",Pd(s)),a.toString()}const Od=wd({eventType:Ed(),eventData:t=>t},"miniAppsMessage"),Bd=yd("fn",(t=>{if("function"==typeof t)return t;vd(t)}));const Ud=wd({TelegramWebviewProxy:wd({postEvent:Bd()})()});function Ld(t){return Ud().isValid(t)}var Nd=Object.defineProperty,Dd=(t,e,n)=>((t,e,n)=>e in t?Nd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);let jd=class t extends Error{constructor(e,n,r){super("object"==typeof n?n.message:n||e,{cause:"object"==typeof n?n.cause:r}),this.type=e,this.name="TypedError",Object.setPrototypeOf(this,t.prototype)}};function Md(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function Vd(...t){const e=t.flat(1);return[e.push.bind(e),()=>{e.forEach((t=>{t()}))}]}function Fd(t){return e=>function(t,e){return t instanceof jd&&t.type===e}(e,t)}const Kd="ERR_ABORTED",$d="ERR_CANCELED",Wd="ERR_TIMED_OUT";function zd(t){return new jd(Kd,{cause:t})}Fd(Wd),Fd(Kd),Fd($d);function Hd(t,e){return t.reject=e.reject,t}class Zd extends Promise{constructor(t,e){let n,r,i,o;"function"==typeof t?(n=t,r=e):r=t,super(((t,e)=>{r||(r={});const{abortSignal:s}=r;if(s&&s.aborted)return e(zd(s.reason));const[a,c]=Vd(),u=t=>(...e)=>(c(),t(...e)),l=new AbortController,{signal:h}=l;o=u((t=>{l.abort(t),e(t)})),i=u(t),s&&a(Md(s,"abort",(()=>{o(zd(s.reason))})));const{timeout:d}=r;if(d){const t=setTimeout((()=>{o(new jd(Wd,`Timeout reached: ${d}ms`))}),d);a((()=>{clearTimeout(t)}))}n&&n(i,o,h)})),Dd(this,"reject"),this.reject=o}static withFn(t,e){return new Zd(((e,n,r)=>{try{const i=t(r);return i instanceof Promise?i.then(e,n):e(i)}catch(t){n(t)}}),e)}static resolve(t){return new Zd((e=>{e(t)}))}static reject(t){return new Zd(((e,n)=>{n(t)}))}cancel(){this.reject(new jd($d))}catch(t){return this.then(void 0,t)}finally(t){return Hd(super.finally(t),this)}then(t,e){return Hd(super.then(t,e),this)}}function qd(t,e){return t.resolve=e.resolve,t}let Xd=class t extends Zd{constructor(t,e){let n,r,i;"function"==typeof t?(n=t,r=e):r=t,super(((t,e,r)=>{i=t,n&&n(t,e,r)}),r),Dd(this,"resolve"),this.resolve=i}static withFn(e,n){return new t(((t,n,r)=>Zd.withFn(e,{abortSignal:r}).then(t,n)),n)}static resolve(e){return new t((t=>{t(e)}))}static reject(e){return new t(((t,n)=>{n(e)}))}catch(t){return this.then(void 0,t)}finally(t){return qd(super.finally(t),this)}then(t,e){return qd(super.then(t,e),this)}};function Gd(t){return`tapps/${t}`}function Yd(t,e){sessionStorage.setItem(Gd(t),JSON.stringify(e))}function Jd(t){const e=sessionStorage.getItem(Gd(t));try{return e?JSON.parse(e):void 0}catch{}}function Qd(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}function tf(t,e){e||(e={});const{textColor:n,bgColor:r,shouldLog:i=!0}=e;function o(e,...o){if(!i||"function"==typeof i&&!i())return;const s="font-weight:bold;padding:0 5px;border-radius:5px";console[e](`%c${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c / %c${t}`,`${s};background-color: lightblue;color:black`,"",`${s};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...o)}return[function(...t){o("log",...t)},function(...t){o("error",...t)}]}function ef(t,e){document.documentElement.style.setProperty(t,e)}function nf(t){document.documentElement.style.removeProperty(t)}function rf(t,e){e||(e={});const n=e.equals||Object.is;let r=[],i=t;const o=t=>{if(!n(i,t)){const e=i;i=t,function(t,e){e()}(0,(()=>{[...r].forEach((([n,r])=>{n(t,e),r&&a(n,!0)}))}))}};function s(t){const e="object"!=typeof t?{once:t}:t;return{once:e.once||!1,signal:e.signal||!1}}const a=(t,e)=>{const n=s(e),i=r.findIndex((([e,r])=>e===t&&r.once===n.once&&r.signal===n.signal));i>=0&&r.splice(i,1)},c=Object.assign((function(){return function(t){of.length&&of[of.length-1].add(t)}(c),i}),{destroy(){r=[]},set:o,reset(){o(t)},sub:(t,e)=>(r.push([t,s(e)]),()=>a(t,e)),unsub:a,unsubAll(){r=r.filter((t=>t[1].signal))}});return c}const of=[];const sf=rf(!1),[af,cf]=tf("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:sf}),uf={clipboard_text_received:wd({req_id:Ed(),data:t=>null===t?t:Ed(!0)(t)},"clipboard_text_received"),custom_method_invoked:wd({req_id:Ed(),result:t=>t,error:Ed(!0)},"custom_method_invoked"),popup_closed:yd("popup_closed",(t=>t?wd({button_id:t=>null==t?void 0:Ed()(t)})()(t):{})),viewport_changed:wd({height:Sd(),width:t=>null==t?window.innerWidth:Sd()(t),is_state_stable:bd(),is_expanded:bd()},"viewport_changed")};const lf=rf(),hf=rf();function df(){return hf()||hf.set(function(t){const e=window,[,n]=Vd(Md(e,"message",(n=>{if(n.source!==e.parent)return;let r;try{r=Od()(n.data)}catch{return}const{eventType:i,eventData:o}=r,s=uf[i];try{const e=s?s()(o):o;af("Event received:",e?{eventType:i,eventData:e}:{eventType:i}),t([i,e])}catch(t){cf([`An error occurred processing the "${i}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/telegram-apps/issues/new/choose"].join("\n"),r,t)}})));return n}(lf.set)),lf}const ff=rf({});function pf(t){let e=ff()[t];return e||(e=rf(void 0,{equals:()=>!1}),df().sub((n=>{n&&n[0]===t&&e.set(n[1])})),ff.set({...ff(),[t]:e})),e}function gf(t,e,n){return pf(t).sub(e,n)}const mf="ERR_RETRIEVE_LP_FAILED",yf="ERR_UNKNOWN_ENV",wf="ERR_INVOKE_CUSTOM_METHOD_RESPONSE",vf=rf("https://web.telegram.org");function bf(t,e){af("Posting event:",e?{eventType:t,eventData:e}:{eventType:t});const n=window;if(Ld(n))return void n.TelegramWebviewProxy.postEvent(t,JSON.stringify(e));const r=JSON.stringify({eventType:t,eventData:e});if(function(){try{return window.self!==window.top}catch{return!0}}())return n.parent.postMessage(r,vf());const{external:i}=n;if(!wd({notify:Bd()})().isValid(i))throw new jd(yf);i.notify(r)}function Ef(t,e,n){n||(n={});const{capture:r}=n,[i,o]=Vd();return new Zd((o=>{(Array.isArray(e)?e:[e]).forEach((t=>{i(gf(t,(n=>{(!r||(Array.isArray(e)?r({event:t,payload:n}):r(n)))&&o(n)})))})),(n.postEvent||bf)(t,n.params)}),n).finally(o)}function Sf(t){return Cd()(t)}function Tf(t){return Sf(t.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&"))}function Af(){return Tf(window.location.href)}function xf(){const t=performance.getEntriesByType("navigation")[0];if(!t)throw new Error("Unable to get first navigation entry.");return Tf(t.name)}const _f="launchParams";function kf(){return Sf(Jd(_f)||"")}function Rf(t){Yd("launchParams",Id(t))}function Pf(t){return t instanceof Error?t.message+(t.cause?`\n ${Pf(t.cause)}`:""):JSON.stringify(t)}function Cf(){const t=[];for(const e of[Af,xf,kf])try{const t=e();return Rf(t),t}catch(e){t.push(e)}throw new jd(mf,["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/telegram-apps-bridge/environment","Collected errors:",...t.map((t=>`— ${Pf(t)}`))].join("\n"))}function If(t){if("simple"===t)try{return Cf(),!0}catch{return!1}return Zd.withFn((async()=>{if(Ld(window))return!0;try{return await Ef("web_app_request_theme","theme_changed",{timeout:100}),!0}catch{return!1}}),t)}function Of(t,e,n){pf(t).unsub(e,n)}function Bf(t){return({req_id:e})=>e===t}function Uf(t){return t.split(".").map(Number)}function Lf(t,e){return function(t,e){const n=Uf(t),r=Uf(e),i=Math.max(n.length,r.length);for(let t=0;t<i;t+=1){const e=n[t]||0,i=r[t]||0;if(e!==i)return e>i?1:-1}return 0}(t,e)<=0}function Nf(t,e,n){if("string"==typeof n){if("web_app_open_link"===t){if("try_instant_view"===e)return Lf("6.4",n);if("try_browser"===e)return Lf("7.6",n)}if("web_app_set_header_color"===t&&"color"===e)return Lf("6.9",n);if("web_app_close"===t&&"return_back"===e)return Lf("7.6",n);if("web_app_setup_main_button"===t&&"has_shine_effect"===e)return Lf("7.10",n)}switch(t){case"web_app_open_tg_link":case"web_app_open_invoice":case"web_app_setup_back_button":case"web_app_set_background_color":case"web_app_set_header_color":case"web_app_trigger_haptic_feedback":return Lf("6.1",e);case"web_app_open_popup":return Lf("6.2",e);case"web_app_close_scan_qr_popup":case"web_app_open_scan_qr_popup":case"web_app_read_text_from_clipboard":return Lf("6.4",e);case"web_app_switch_inline_query":return Lf("6.7",e);case"web_app_invoke_custom_method":case"web_app_request_write_access":case"web_app_request_phone":return Lf("6.9",e);case"web_app_setup_settings_button":return Lf("6.10",e);case"web_app_biometry_get_info":case"web_app_biometry_open_settings":case"web_app_biometry_request_access":case"web_app_biometry_request_auth":case"web_app_biometry_update_token":return Lf("7.2",e);case"web_app_setup_swipe_behavior":return Lf("7.7",e);case"web_app_share_to_story":return Lf("7.8",e);case"web_app_setup_secondary_button":case"web_app_set_bottom_bar_color":return Lf("7.10",e);case"web_app_request_safe_area":case"web_app_request_content_safe_area":case"web_app_request_fullscreen":case"web_app_exit_fullscreen":case"web_app_set_emoji_status":case"web_app_add_to_home_screen":case"web_app_check_home_screen":case"web_app_request_emoji_status_access":return Lf("8.0",e);default:return["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"].includes(t)}}function Df(){const t=performance.getEntriesByType("navigation")[0];return!!t&&"reload"===t.type}let jf;function Mf(t){if(jf)return t();jf=new Map;try{t()}finally{jf.forEach((t=>t())),jf=void 0}}function Vf(t,e){e||(e={});const n=e.equals||Object.is;let r=[],i=t;const o=t=>{if(!n(i,t)){const e=i;i=t,function(t,e){jf&&jf.set(t,e)||e()}(c,(()=>{[...r].forEach((([n,r])=>{n(t,e),r&&a(n,!0)}))}))}};function s(t){const e="object"!=typeof t?{once:t}:t;return{once:e.once||!1,signal:e.signal||!1}}const a=(t,e)=>{const n=s(e),i=r.findIndex((([e,r])=>e===t&&r.once===n.once&&r.signal===n.signal));i>=0&&r.splice(i,1)},c=Object.assign((function(){return function(t){Ff.length&&Ff[Ff.length-1].add(t)}(c),i}),{destroy(){r=[]},set:o,reset(){o(t)},sub:(t,e)=>(r.push([t,s(e)]),()=>a(t,e)),unsub:a,unsubAll(){r=r.filter((t=>t[1].signal))}});return c}const Ff=[];function Kf(t,e){let n,r=new Set;function i(){return n||(n=Vf(s(),e))}function o(){i().set(s())}function s(){r.forEach((t=>{t.unsub(o,{signal:!0})}));const e=new Set;let n;Ff.push(e);try{n=t()}finally{Ff.pop()}return e.forEach((t=>{t.sub(o,{signal:!0})})),r=e,n}return Object.assign((function(){return i()()}),{destroy(){i().destroy()},sub:(...t)=>i().sub(...t),unsub(...t){i().unsub(...t)},unsubAll(...t){i().unsubAll(...t)}})}const $f=Vf((()=>{let t=0;return()=>(t+=1).toString()})()),Wf=Vf(bf),zf=Vf("0.0");function Hf(){return $f()()}function Zf(t,e,n){return function(t,e,n,r){return Ef("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:t,params:e,req_id:n},capture:Bf(n)}).then((({result:t,error:e})=>{if(e)throw new jd(wf,e);return t}))}(t,e,Hf(),{...n||{},postEvent:Xf})}const qf=(t,e,n)=>(n||(n={}),n.postEvent||(n.postEvent=Xf),Ef(t,e,n)),Xf=(t,e)=>Wf()(t,e);function Gf(t){return Kf((()=>Nf(t,zf())))}const Yf="ERR_POPUP_INVALID_PARAMS",Jf="ERR_INVALID_URL",Qf="ERR_ALREADY_REQUESTING",tp="ERR_ALREADY_OPENED",ep="ERR_NOT_INITIALIZED",np="ERR_NOT_SUPPORTED",rp="ERR_NOT_MOUNTED";function ip(){return typeof window>"u"}function op(t,e,{isSupported:n,isMounted:r,component:i,supports:o}={}){const s=`${i?`${i}.`:""}${t}()`;function a(t){if(o){const e=o[t];return Nf(e[0],e[1],zf())}return!0}n=n?Array.isArray(n)||"object"==typeof n&&"any"in n?n:[n]:void 0;const c=()=>{if(!n)return;const t=`it is unsupported in Mini Apps version ${zf()}`;function e(e){return"string"==typeof e?Nf(e,zf())?void 0:t:e.fn()?void 0:e.error}if(Array.isArray(n)){for(const t of n){const n=e(t);if(n)return n}return}let r;for(const t of n.any)if(r=e(t),!r)return;return t},u=Kf((()=>!c())),l=Kf((()=>"0.0"!==zf())),h=Kf((()=>!r||r())),d=Kf((()=>If("simple")&&!ip()&&l()&&u()&&h()));let f;if(o){f={};for(const t in o)f[t]=Kf((()=>a(t)))}return Object.assign(((...t)=>{const n=`Unable to call the ${s} ${i?"method":"function"}:`;if(ip()||!If("simple"))throw new jd(yf,`${n} it can't be called outside Mini Apps`);if(!l())throw new jd(ep,`${n} the SDK was not initialized. Use the SDK init() function`);const r=c();if(r)throw new jd(np,`${n} ${r}`);const u=((...t)=>{if(o)for(const e in o)if(o[e][2](...t)&&!a(e))return`option ${e} is not supported in Mini Apps version ${zf()}`})(...t);if(u)throw new jd(np,`${n} ${u}`);if(!h())throw new jd(rp,`${n} the component is not mounted. Use the ${i}.mount() method`);return e(...t)}),e,{isAvailable:d,ifAvailable:(...t)=>d()?e(...t):void 0},n?{isSupported:u}:{},f?{supports:f}:{})}function sp(t,e){return e||(e={}),(n,r,i,o)=>op(n,r,{...e,isSupported:i||e.isSupported,supports:o,component:t})}function ap(t,e,n){return sp(t,{isSupported:n,isMounted:e})}function cp(t,e){return sp(t,{isSupported:e})}const up="web_app_setup_back_button",lp="back_button_pressed",hp="backButton",dp=Vf(!1),fp=Vf(!1),pp=Gf(up),gp=ap(hp,fp,up),mp=cp(hp,up),yp=gp("hide",(()=>{vp(!1)})),wp=mp("mount",(()=>{fp()||(vp(Df()&&Jd(hp)||!1),fp.set(!0))}));function vp(t){t!==dp()&&(Xf(up,{is_visible:t}),Yd(hp,t),dp.set(t))}const bp=mp("onClick",(t=>gf(lp,t))),Ep=mp("offClick",(t=>{Of(lp,t)})),Sp=gp("show",(()=>{vp(!0)}));Symbol.toStringTag;function Tp(t,e,n,r,i){const o=void 0===i||i?Zd:Promise;return Object.assign(((...i)=>o.resolve().then((async()=>{if(n()){const t=e();throw r.set(t),t}let s;Mf((()=>{n.set(o.resolve(t(...i))),r.set(void 0)}));try{s=[!0,await n()]}catch(t){s=[!1,t]}if(Mf((()=>{n.set(void 0),r.set(s[0]?void 0:s[1])})),!s[0])throw s[1];return s[1]}))),t)}function Ap(t,e,n,r,i,o){const s=Tp(e,(()=>new jd("ERR_ALREADY_MOUNTING",`The ${t} component is already mounting`)),i,o);return t=>Zd.resolve().then((async()=>{if(!r()){const e=await s(t);Mf((()=>{r.set(!0),n(e)}))}}))}const xp=sp,_p=Vf({available:!1}),kp=Vf(!1),Rp=Vf(!1),Pp=Vf(!1),Cp=Kf((()=>!!Op())),Ip=Vf(),Op=Vf(),Bp=Kf((()=>{const t=_p();return t&&t.available}));function Up(t){return t.available?{available:!0,tokenSaved:t.token_saved,deviceId:t.device_id,accessRequested:t.access_requested,type:t.type,accessGranted:t.access_granted}:{available:!1}}const Lp="web_app_biometry_get_info",Np=op("requestBiometry",(t=>qf(Lp,"biometry_info_received",t).then(Up)),{isSupported:Lp}),Dp="web_app_biometry_request_auth",jp="biometry_info_received",Mp="biometry",Vp=Gf(Dp),Fp=xp(Mp),Kp=cp(Mp,Dp),$p=ap(Mp,Pp,Dp);function Wp(){throw new jd("ERR_NOT_AVAILABLE","Biometry is not available")}const zp=$p("authenticate",(t=>Zd.withFn((async e=>{if(kp())throw new jd(Qf,"Authentication is already in progress");const n=_p();(!n||!n.available)&&Wp(),kp.set(!0);try{const r=await qf(Dp,"biometry_auth_requested",{abortSignal:e,params:{reason:((t||{}).reason||"").trim()}}),{token:i}=r;return"string"==typeof i&&Gp({...n,token:i}),r}finally{kp.set(!1)}}),t))),Hp=Kp("openSettings",(()=>{Xf("web_app_biometry_open_settings")})),Zp=$p("requestAccess",(t=>Zd.withFn((async e=>{if(Rp())throw new jd(Qf,"Access request is already in progress");Rp.set(!0);try{const n=await qf("web_app_biometry_request_access",jp,{abortSignal:e,params:{reason:(t||{}).reason||""}}).then(Up);return n.available||Wp(),Gp(n),n.accessGranted}finally{Rp.set(!1)}}),t))),qp=Fp("mount",Ap(Mp,(t=>Df()&&Jd(Mp)||Np(t)),(t=>{gf(jp,Xp),Gp(t)}),Pp,Op,Ip)),Xp=t=>{Gp(Up(t))};function Gp(t){_p.set(t),Yd(Mp,t)}const Yp=$p("updateToken",(t=>(t||(t={}),qf("web_app_biometry_update_token","biometry_token_updated",{...t,params:{token:t.token||"",reason:t.reason}}).then((t=>t.status)))));Symbol.toStringTag;function Jp(t,e){return sp(t,{isMounted:e})}const Qp="closingBehavior",tg=Vf(!1),eg=Vf(!1),ng=Jp(Qp,eg),rg=xp(Qp),ig=ng("disableConfirmation",(()=>{ag(!1)})),og=ng("enableConfirmation",(()=>{ag(!0)})),sg=rg("mount",(()=>{eg()||(ag(Df()&&Jd(Qp)||!1),eg.set(!0))}));function ag(t){t!==tg()&&(Xf("web_app_setup_closing_behavior",{need_confirmation:t}),Yd(Qp,t),tg.set(t))}Symbol.toStringTag;const cg="web_app_invoke_custom_method",ug=cp("cloudStorage",cg),lg=Gf(cg),hg=ug("deleteItem",((t,e)=>{const n=Array.isArray(t)?t:[t];return n.length?Zf("deleteStorageValues",{keys:n},e).then():Zd.resolve()}));const dg=ug("getItem",(function(t,e){const n=Array.isArray(t)?t:[t];return n.length?Zf("getStorageValues",{keys:n},e).then((e=>{const r=ed(Object.fromEntries(n.map((t=>[t,rd()]))))()(e);return Array.isArray(t)?r:r[t]})):Zd.resolve("string"==typeof t?"":{})})),fg=ug("getKeys",(t=>Zf("getStorageKeys",{},t).then(function(t,e){return td("array",(e=>{let n;if(Array.isArray(e))n=e;else if("string"==typeof e)try{const t=JSON.parse(e);Array.isArray(t)&&(n=t)}catch{}return n||nd(e),n.map(t)}))}(rd())()))),pg=ug("setItem",((t,e,n)=>Zf("saveStorageValue",{key:t,value:e},n).then())),gg=(Symbol.toStringTag,"web_app_trigger_haptic_feedback"),mg=cp("hapticFeedback",gg),yg=Gf(gg),wg=mg("impactOccurred",(t=>{Xf(gg,{type:"impact",impact_style:t})})),vg=mg("notificationOccurred",(t=>{Xf(gg,{type:"notification",notification_type:t})})),bg=mg("selectionChanged",(()=>{Xf(gg,{type:"selection_change"})})),Eg=(Symbol.toStringTag,Vf(void 0));function Sg(t){return Kf((()=>{const e=Eg();return e?e[t]:void 0}))}const Tg=Sg("authDate"),Ag=Sg("canSendAfter"),xg=Kf((()=>{const t=Tg(),e=Ag();return e&&t?new Date(t.getTime()+1e3*e):void 0})),_g=Sg("chat"),kg=Sg("chatType"),Rg=Sg("chatInstance"),Pg=Sg("hash"),Cg=Sg("queryId"),Ig=Vf(),Og=Sg("receiver");const Bg=Sg("startParam"),Ug=Sg("user");Symbol.toStringTag;const Lg="web_app_open_invoice",Ng=cp("invoice",Lg),Dg=Vf(!1),jg=Gf(Lg);async function Mg(t,e,n){if(Dg())throw new jd(tp,"An invoice is already opened");let r;if("url"===e){const{hostname:e,pathname:n}=new URL(t,window.location.href);if("t.me"!==e)throw new jd(Jf,`Link has unexpected hostname: ${e}`);const i=n.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);if(!i)throw new jd("ERR_INVALID_SLUG",'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"');[,,r]=i}else r=t,n=e;return Dg.set(!0),qf(Lg,"invoice_closed",{...n,params:{slug:r},capture:t=>r===t.slug}).then((t=>t.status)).finally((()=>{Dg.set(!1)}))}const Vg=Ng("open",Mg);Symbol.toStringTag;function Fg(t){return Object.fromEntries(Object.entries(t).filter((t=>void 0!==t[1])))}function Kg(t){const e=sd(t);return Math.sqrt([.299,.587,.114].reduce(((t,n,r)=>{const i=parseInt(e.slice(1+2*r,1+2*(r+1)),16);return t+i*i*n}),0))<120}const $g=Vf(!1),Wg=Vf(!1),zg=Vf({});function Hg(t){return Kf((()=>zg()[t]))}const Zg=Hg("accentTextColor"),qg=Hg("bgColor"),Xg=Hg("buttonColor"),Gg=Hg("buttonTextColor"),Yg=Hg("bottomBarBgColor"),Jg=Hg("destructiveTextColor"),Qg=Hg("headerBgColor"),tm=Hg("hintColor"),em=Kf((()=>{const{bgColor:t}=zg();return!t||Kg(t)})),nm=Hg("linkColor"),rm=Hg("secondaryBgColor"),im=Hg("sectionBgColor"),om=Hg("sectionHeaderTextColor"),sm=Hg("sectionSeparatorColor"),am=Hg("subtitleTextColor"),cm=Hg("textColor");function um(t){return Kf((()=>hm()[t]))}const lm=Vf({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"}),hm=Kf((()=>{const t=lm();return{...t,backgroundColor:t.backgroundColor||Xg()||"#2481cc",textColor:t.textColor||Gg()||"#ffffff"}})),dm=Vf(!1),fm=um("backgroundColor"),pm=um("hasShineEffect"),gm=um("isEnabled"),mm=um("isLoaderVisible"),ym=um("isVisible"),wm=um("text"),vm=um("textColor"),bm="main_button_pressed",Em="mainButton",Sm=xp(Em),Tm=Jp(Em,dm),Am=Sm("mount",(()=>{if(!dm()){const t=Df()&&Jd(Em);t&&lm.set(t),dm.set(!0)}})),xm=Sm("onClick",(t=>gf(bm,t))),_m=Sm("offClick",(t=>{Of(bm,t)})),km=Tm("setParams",(t=>{lm.set({...lm(),...Fg(t)}),Yd(Em,lm());const e=hm();e.text&&Xf("web_app_setup_main_button",{color:e.backgroundColor,has_shine_effect:e.hasShineEffect,is_active:e.isEnabled,is_progress_visible:e.isLoaderVisible,is_visible:e.isVisible,text:e.text,text_color:e.textColor})}));Symbol.toStringTag;function Rm(){throw new jd("ERR_VARS_ALREADY_BOUND","CSS variables are already bound")}const Pm="themeParams",Cm="theme_changed",Im=xp(Pm),Om=Jp(Pm,$g)("bindCssVars",(t=>{function e(t){Object.entries(zg()).forEach((([e,n])=>{n&&t(e,n)}))}function n(){e(((e,n)=>{ef(t(e),n)}))}return Wg()&&Rm(),t||(t=t=>`--tg-theme-${Qd(t)}`),n(),zg.sub(n),Wg.set(!0),()=>{e(nf),zg.unsub(n),Wg.set(!1)}})),Bm=Im("mount",(()=>{$g()||(gf(Cm,Um),zg.set(Df()&&Jd(Pm)||Cf().themeParams),$g.set(!0))})),Um=t=>{const e=function(t){return cd()(t)}(t.theme_params);zg.set(e),Yd(Pm,e)};function Lm(t){return Kf((()=>{const e=t();return od(e)?e:"bg_color"===e?qg():rm()}))}const Nm=Vf("bg_color"),Dm=Lm(Nm),jm=Vf("bottom_bar_bg_color"),Mm=Kf((()=>{const t=jm();return od(t)?t:"bottom_bar_bg_color"===t?Yg()||rm():"secondary_bg_color"===t?rm():qg()})),Vm=Vf("bg_color"),Fm=Lm(Vm),Km=Vf(!1),$m=Vf(!1),Wm=Kf((()=>{const t=Dm();return!!t&&Kg(t)})),zm=Vf(!0),Hm=Kf((()=>({backgroundColor:Nm(),bottomBarColor:jm(),headerColor:Vm(),isActive:zm()}))),Zm="web_app_set_background_color",qm="web_app_set_bottom_bar_color",Xm="web_app_set_header_color",Gm="visibility_changed",Ym="miniApp",Jm={any:[Zm,qm,Xm]},Qm=Kf((()=>Jm.any.some((t=>Nf(t,zf()))))),ty=xp(Ym),ey=cp(Ym,Jm),ny=ap(Ym,Km,Jm),ry=ny("bindCssVars",(t=>{$m()&&Rm();const[e,n]=Vd();function r(t,n){function r(){ef(t,n()||null)}r(),e(n.sub(r),nf.bind(null,t))}return t||(t=t=>`--tg-${Qd(t)}`),r(t("bgColor"),Dm),r(t("bottomBarColor"),Mm),r(t("headerColor"),Fm),e((()=>{$m.set(!1)})),$m.set(!0),n})),iy=ty("close",(t=>{Xf("web_app_close",{return_back:t})})),oy=t=>{zm.set(t.is_visible),cy()},sy=ey("mount",(()=>{if(!Km()){const t=Df()&&Jd(Ym);Bm(),uy.ifAvailable(t?t.backgroundColor:"bg_color"),ly.ifAvailable(t?t.bottomBarColor:"bottom_bar_bg_color"),hy.ifAvailable(t?t.headerColor:"bg_color"),zm.set(!t||t.isActive),gf(Gm,oy),Km.set(!0)}})),ay=ty("ready",(()=>{Xf("web_app_ready")}));function cy(){Yd(Ym,Hm())}const uy=ny("setBackgroundColor",(t=>{t!==Nm()&&(Xf(Zm,{color:t}),Nm.set(t),cy())}),Zm),ly=ny("setBottomBarColor",(t=>{t!==jm()&&(Xf(qm,{color:t}),jm.set(t),cy())}),qm),hy=ny("setHeaderColor",(t=>{t!==Vm()&&(Xf(Xm,od(t)?{color:t}:{color_key:t}),Vm.set(t),cy())}),Xm,{rgb:[Xm,"color",od]});Symbol.toStringTag;function dy(t){const e=t.message.trim(),n=(t.title||"").trim(),r=t.buttons||[];if(n.length>64)throw new jd(Yf,`Invalid title: ${n}`);if(!e||e.length>256)throw new jd(Yf,`Invalid message: ${e}`);if(r.length>3)throw new jd(Yf,`Invalid buttons count: ${r.length}`);return{title:n,message:e,buttons:r.length?r.map(((t,e)=>{const n=t.id||"";if(n.length>64)throw new jd(Yf,`Button with index ${e} has invalid id: ${n}`);if(!t.type||"default"===t.type||"destructive"===t.type){const r=t.text.trim();if(!r||r.length>64)throw new jd(Yf,`Button with index ${e} has invalid text: ${r}`);return{type:t.type,text:r,id:n}}return{type:t.type,id:n}})):[{type:"close",id:""}]}}const fy="web_app_open_popup",py=cp("popup",fy),gy=Vf(!1),my=Gf(fy),yy=py("open",(async t=>{if(gy())throw new jd(tp,"A popup is already opened");gy.set(!0);try{const{button_id:e=null}=await qf(fy,"popup_closed",{...t,params:dy(t)});return e}finally{gy.set(!1)}})),wy=(Symbol.toStringTag,"web_app_open_scan_qr_popup"),vy=cp("qrScanner",wy),by=vy("close",(()=>{Ey.set(!1),Xf("web_app_close_scan_qr_popup")})),Ey=Vf(!1),Sy=Gf(wy);const Ty=vy("open",(function(t){return Zd.withFn((e=>{if(Ey())throw new jd(tp,"The QR Scanner is already opened");Ey.set(!0),t||(t={});const{onCaptured:n,text:r,capture:i}=t,[,o]=Vd(Ey.sub((()=>{s.resolve()})),gf("scan_qr_popup_closed",(()=>{Ey.set(!1)})),gf("qr_text_received",(t=>{n?n(t.data):(!i||i(t.data))&&(s.resolve(t.data),by())}))),s=new Xd({abortSignal:e}).catch(by).finally(o);return(t.postEvent||Xf)(wy,{text:r}),s}),t)}));Symbol.toStringTag;function Ay(t){return Kf((()=>_y()[t]))}const xy=Vf({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,position:"left",text:"Cancel"}),_y=Kf((()=>{const t=xy();return{...t,backgroundColor:t.backgroundColor||Mm()||"#000000",textColor:t.textColor||Xg()||"#2481cc"}})),ky=Vf(!1),Ry=Ay("backgroundColor"),Py=Ay("hasShineEffect"),Cy=Ay("isEnabled"),Iy=Ay("isLoaderVisible"),Oy=Ay("isVisible"),By=Ay("position"),Uy=Ay("text"),Ly=Ay("textColor"),Ny="web_app_setup_secondary_button",Dy="secondary_button_pressed",jy="secondaryButton",My=cp(jy,Ny),Vy=ap(jy,ky,Ny),Fy=Gf(Ny),Ky=My("mount",(()=>{if(!ky()){const t=Df()&&Jd(jy);t&&xy.set(t),ky.set(!0)}})),$y=My("onClick",(t=>gf(Dy,t))),Wy=My("offClick",(t=>{Of(Dy,t)})),zy=Vy("setParams",(t=>{xy.set({...xy(),...Object.fromEntries(Object.entries(t).filter((([,t])=>void 0!==t)))}),Yd(jy,xy());const e=_y();e.text&&Xf(Ny,{color:e.backgroundColor,has_shine_effect:e.hasShineEffect,is_active:e.isEnabled,is_progress_visible:e.isLoaderVisible,is_visible:e.isVisible,position:e.position,text:e.text,text_color:e.textColor})}));Symbol.toStringTag;const Hy="web_app_setup_settings_button",Zy="settings_button_pressed",qy="settingsButton",Xy=Vf(!1),Gy=Vf(!1),Yy=Gf(Hy),Jy=cp(qy,Hy),Qy=ap(qy,Gy,Hy),tw=Qy("hide",(()=>{nw(!1)})),ew=Jy("mount",(()=>{Gy()||(nw(Df()&&Jd(qy)||!1),Gy.set(!0))}));function nw(t){t!==Xy()&&(Xf(Hy,{is_visible:t}),Yd(qy,t),Xy.set(t))}const rw=Jy("onClick",(t=>gf(Zy,t))),iw=Jy("offClick",(t=>{Of(Zy,t)})),ow=Qy("show",(()=>{nw(!0)}));Symbol.toStringTag;const sw="web_app_setup_swipe_behavior",aw="swipeBehavior",cw=Vf(!1),uw=Gf(sw),lw=Vf(!0),hw=cp(aw,sw),dw=ap(aw,cw,sw),fw=dw("disableVertical",(()=>{mw(!1)})),pw=dw("enableVertical",(()=>{mw(!0)})),gw=hw("mount",(()=>{cw()||(mw(Df()&&Jd(aw)||!1,!0),cw.set(!0))}));function mw(t,e){(t!==lw()||e)&&(Xf(sw,{allow_vertical_swipe:t}),Yd(aw,t),lw.set(t))}Symbol.toStringTag,Symbol.toStringTag;const yw="viewport",ww="web_app_request_fullscreen",vw="fullscreen_changed",bw="safe_area_changed",Ew="content_safe_area_changed",Sw="viewport_changed",Tw="web_app_request_safe_area",Aw="web_app_request_content_safe_area",xw={left:0,top:0,bottom:0,right:0};function _w(t){return Math.max(t,0)}const kw=Vf({contentSafeAreaInsets:xw,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:xw,stableHeight:0,width:0});function Rw(t){return Kf((()=>kw()[t]))}function Pw(t){const{height:e,stableHeight:n,width:r}=t;kw.set({...kw(),...Fg({...t,height:e?_w(e):void 0,width:r?_w(r):void 0,stableHeight:n?_w(n):void 0})}),Yd(yw,kw())}const Cw=Rw("isFullscreen"),Iw=Vf(),Ow=Kf((()=>!!Iw())),Bw=Vf(),Uw=Vf(!1),Lw=Kf((()=>!!Dw())),Nw=Vf(void 0),Dw=Vf(),jw=ap(yw,Uw,ww);function Mw(t,e){return jw(t,Tp((t=>qf(e,[vw,"fullscreen_failed"],t).then((t=>{if("error"in t){if("ALREADY_FULLSCREEN"===t.error)return!0;throw new jd("ERR_FULLSCREEN_FAILED","Fullscreen request failed",t.error)}return t.is_fullscreen})).then((t=>{t!==Cw()&&Pw({isFullscreen:t})}))),(()=>new jd(Qf,"Fullscreen mode change is already being requested")),Iw,Bw))}const Vw=Mw("requestFullscreen",ww),Fw=Mw("exitFullscreen","web_app_exit_fullscreen"),Kw=xp(yw),$w=Jp(yw,Uw);function Ww(t){return Kf((()=>zw()[t]))}const zw=Rw("safeAreaInsets"),Hw=Ww("bottom"),Zw=Ww("left"),qw=Ww("right"),Xw=Ww("top");function Gw(t){return Kf((()=>Yw()[t]))}const Yw=Rw("contentSafeAreaInsets"),Jw=Gw("bottom"),Qw=Gw("left"),tv=Gw("right"),ev=Gw("top"),nv=op("requestContentSafeAreaInsets",(t=>qf(Aw,"content_safe_area_changed",t)),{isSupported:Aw}),rv=op("requestSafeAreaInsets",(t=>qf(Tw,"safe_area_changed",t)),{isSupported:Tw});const iv=t=>{const{height:e}=t;Pw({isExpanded:t.is_expanded,height:e,width:t.width,stableHeight:t.is_state_stable?e:void 0})},ov=t=>{Pw({isFullscreen:t.is_fullscreen})},sv=t=>{Pw({safeAreaInsets:t})},av=t=>{Pw({contentSafeAreaInsets:t})},cv=Kw("mount",Ap(yw,(t=>Zd.resolve().then((async()=>{const e=Df()&&Jd(yw);if(e)return e;const[n,r]=await Zd.all([rv.ifAvailable(t)||zw(),nv.ifAvailable(t)||Yw()]),i=Cf(),o={contentSafeAreaInsets:r,isFullscreen:!!i.fullscreen,safeAreaInsets:n};if(["macos","tdesktop","unigram","webk","weba","web"].includes(i.platform)){const t=window;return{...o,height:t.innerHeight,isExpanded:!0,stableHeight:t.innerHeight,width:t.innerWidth}}return function(t){return qf("web_app_request_viewport","viewport_changed",t).then((t=>({height:t.height,width:t.width,isExpanded:t.is_expanded,isStable:t.is_state_stable})))}(t).then((t=>({...o,height:t.height,isExpanded:t.isExpanded,stableHeight:t.isStable?t.height:0,width:t.width})))}))),(t=>{gf(Sw,iv),gf(vw,ov),gf(bw,sv),gf(Ew,av),Pw(t)}),Uw,Dw,Nw));const uv=Vf(!1),lv=Rw("height"),hv=Rw("stableHeight"),dv=Rw("width"),fv=$w("bindCssVars",(t=>{uv()&&Rm(),t||(t=t=>`--tg-viewport-${Qd(t)}`);const e=[["height",lv],["stableHeight",hv],["width",dv],["safeAreaInsetTop",Xw],["safeAreaInsetBottom",Hw],["safeAreaInsetLeft",Zw],["safeAreaInsetRight",qw],["contentSafeAreaInsetTop",ev],["contentSafeAreaInsetBottom",Jw],["contentSafeAreaInsetLeft",Qw],["contentSafeAreaInsetRight",tv]].reduce(((e,[n,r])=>{const i=t(n);if(i){const t=()=>{ef(i,`${r()}px`)};e.push([t,r.sub(t),i])}return e}),[]);return e.forEach((t=>{t[0]()})),uv.set(!0),()=>{e.forEach((t=>{t[1](),nf(t[2])})),uv.set(!1)}})),pv=Kw("expand",(()=>{Xf("web_app_expand")})),gv=Rw("isExpanded"),mv=Kf((()=>lv()===hv())),yv=(Symbol.toStringTag,xp()("openLink",((t,e)=>{if("string"==typeof t)try{t=new URL(t)}catch(e){throw new jd(Jf,`"${t.toString()}" is invalid URL`,e)}e||(e={}),Xf("web_app_open_link",{url:t.toString(),try_browser:e.tryBrowser,try_instant_view:e.tryInstantView})})),"web_app_open_tg_link"),wv=xp()("openTelegramLink",(t=>{const e=t.toString();if(!e.match(/^https:\/\/t.me\/.+/))throw new jd(Jf,`"${e}" is invalid URL`);Nf(yv,zf())?(t=new URL(t),Xf(yv,{path_full:t.pathname+t.search})):window.location.href=e}));xp()("shareURL",((t,e)=>{wv("https://t.me/share/url?"+new URLSearchParams({url:t,text:e||""}).toString().replace(/\+/g,"%20"))}));const vv=async()=>(await a.e(423).then(a.t.bind(a,153,23))).default;function bv(t){var r,i;let{requestData:o,webpageName:s,inferenceData:a=null,onComplete:c=null,autoFetch:u=!0,proofMode:l=!1,textLayout:h="below",textColor:d="white",login:f=!1,buttonType:p="pill",loginReturn:g=null,loginType:m="signIn",visualType:y="full"}=t;const w=(()=>{const t=navigator.userAgent||navigator.vendor||window.opera;return void 0!==window.Telegram&&/telegram/i.test(t)&&/mobile/i.test(navigator.userAgent)})()?(0,e.useMemo)(Cf,[]):null,[v,b]=(0,e.useState)(null),[E,S]=(0,e.useState)(!1),[T,A]=(0,e.useState)([]),[x,_]=(0,e.useState)(0),[k,R]=(0,e.useState)({}),[P,C]=(0,e.useState)(!1),[I,O]=(0,e.useState)(!1),[B,U]=(0,e.useState)(!1),[L,N]=(0,e.useState)(!1),D=(0,e.useRef)(!1),j=(0,e.useRef)(!1),[M,V]=(0,e.useState)(!1),[F,K]=(0,e.useState)(null),[$,W]=(0,e.useState)(!0),[z,H]=(0,e.useState)(null),[Z,q]=(0,e.useState)(null),[X,G]=(0,e.useState)({show:!1,type:null,data:null}),[Y,J]=(0,e.useState)(null),[Q,tt]=(0,e.useState)(!1),[et,nt]=(0,e.useState)(!1),rt=(0,e.useRef)(!1),[it,ot]=(0,e.useState)(null),[st,at]=(0,e.useState)({show:!1,color:null,message:null}),[ct,ut]=(0,e.useState)(null),[lt,ht]=(0,e.useState)("Initializing..."),dt="https://api2.onairos.uk";(0,e.useEffect)((async()=>{if(w&&(console.log("Launch Params:",w),w.startParam))try{ht("Received parameters: ".concat(params.join(", "))),G({show:!0,type:"callback",data:{startParam:w.startParam}})}catch(t){console.error("Error parsing launch params:",t)}}),[w]),(0,e.useEffect)((()=>{(()=>{try{var t;if(null===(t=window.Telegram)||void 0===t||!t.WebApp)return;window.Telegram.WebApp.ready()}catch(t){}})()}),[w]),(0,e.useEffect)((()=>{(async()=>{const t=new URL(window.location.href),e=t.searchParams.get("code"),n=t.searchParams.get("state");if(e&&n&&!rt.current&&!et){rt.current=!0,nt(!0);try{await ft(t.toString()),N(!0),window.history.replaceState({},document.title,window.location.pathname)}catch(t){console.error("Auth callback processing failed:",t),ot(t.message)}finally{nt(!1)}}})()}),[]);const ft=async t=>{try{const e={name:"Onairos",version:"1.0.0",env:"production"};G({show:!0,type:"callback",data:{code:t,state:"Completing Callback"}});if(!new Dr({appInfo:e,throwErrors:!0,auth0LogInMethod:"redirect",auth0RedirectURI:window.location.href,auth0ReturnToURI:window.location.href}))throw new Error("Failed to initialize Othent");if(!userDetails||!userDetails.sub)throw new Error("Invalid user details received from Othent");V(!0);const n=(await vv())(userDetails.sub).toString();H(n);const r=await Mr(n);q(r.result),K(r.token),await Et(userDetails.email,!0),S(!0),localStorage.setItem("othentToken",JSON.stringify(userDetails)),localStorage.setItem("onairosToken",userDetails.token)}catch(t){throw at({show:!0,color:"red",message:"An error has occured, please try again"}),console.error("Authentication failed:",t),t}};(0,e.useEffect)((()=>{it&&console.error("Authentication error:",it)}),[it]);const pt=()=>{const t=navigator.userAgent||navigator.vendor||window.opera;return/android|iphone|ipad|ipod|windows phone/i.test(t)};(0,e.useEffect)((()=>{if(u&&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 gt=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();u&&c?c(n):G({show:!0,type:"apiURL",data:{code:n,state:e}})}catch(t){console.error(t),c&&c(null,t)}},mt=window.location.href;(0,e.useEffect)((()=>{const t=t=>{console.log("Message received in useEffect:",t.data),t.data&&"terminalOpened"===t.data.action&&yt()};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}),[]);const yt=async()=>{try{const t=new Dr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),e=await t.connect(),n=(await vv())(e.sub).toString(),r=await Mr(n);function i(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)}}console.log("Got your Pin");const a=i(r.result);console.log("Decrypting your Pin");const c=await t.decrypt(a);console.log("Decrypted Pin"),jr("\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 ",c).then((t=>{window.postMessage({source:"webpage",type:"GET_API_URL",webpageName:s,domain:mt,requestData:o,proofMode:l,HashedOthentSub:n,EncryptedUserPin:t})})).catch((t=>{console.error("Encryption failed:",t)}))}catch(u){console.error("Error Sending Data to Terminal: ",u)}},wt="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(pt()?"":"OnairosConnect","\n "),vt={flexDirection:"below"===h?"column":"row",backgroundColor:f?"#ffffff":"transparent",color:f?"black":d,border:f?"1px solid #ddd":"1px solid transparent"},bt={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"},Et=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(dt).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?(D.current=!0,J(null),null):(J(o.AccountInfo),o.AccountInfo.models?A(o.AccountInfo.models):j.current=!0,o.AccountInfo.avatar&&C(!0),o.AccountInfo.UserTraits&&O(!0),o.AccountInfo.othent&&U(!0),o.AccountInfo)}catch(t){throw console.error("Error fetching account info:",t),t}};(0,e.useEffect)((()=>{pt()&&(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){K(n),V(!0);const t=localStorage.getItem("username");await Et(t)}else localStorage.removeItem("onairosToken"),localStorage.removeItem("token")}}catch(t){console.error("Token verification failed:",t)}finally{W(!1)}})()}),[]);(0,e.useEffect)((()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username");t&&e&&Et(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(dt,"/verifyToken"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})).ok){if(V(!0),e)await Et(e,!1);else if(n){const t=JSON.parse(n);await Et(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:wt,onClick:async()=>{pt()?await(async()=>{pt()&&S(!0)})():(console.log("openTerminal clicked"),window.postMessage({source:"webpage",type:"openTerminal",webpageName:s,domain:mt,key:"Key"}))},style:vt},("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:bt,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(m){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})()))),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:()=>G({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:()=>G({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"))),Q&&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..."))),E&&!Q&&n().createElement(Hh,{setOthentConnected:N,dataRequester:s,NoAccount:D,NoModel:j,accountInfo:Y,activeModels:T,avatar:P,traits:I,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=>{_((e=>Math.max(e+t,0)))},granted:x,allowSubmit:x>0,rejectDataRequest:()=>{S(!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==Z&&B&&!L){G({show:!0,type:"debug",data:{code:"Connecting Othent Details",state1:Z,state2:L,state3:B}});const e=new Dr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),n=await e.connect(),r=(await vv())(n.sub).toString();H(r);const i=await Mr(r),o=i.result;q(o),N(!0),G({show:!0,type:"callback",data:{code:"Just Before API",state:i.token}}),await gt(t,o,r)}else Z&&z?await gt(t,Z,z):console.error("Missing required authentication data")}catch(t){console.error("Error in sendDataRequest:",t)}finally{S(!1)}},isAuthenticated:M,onLoginSuccess:async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=await Et(t,e);return V(!0),S(!0),n}catch(t){throw console.error("Login process failed:",t),t}},onClose:()=>{_(0),S(!1)},setOthentUser:U,setHashedOthentSub:H,setEncryptedPin:q}))}function Ev(t){return n().createElement(n().Fragment,null,n().createElement(bv,t))}const Sv=Ev})(),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),u=n(825),l=n(244),h=n(243),f=n(879),d=n(759);class p{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new o.default;static utils=l;constructor(t){this.api=new i.default(t),this.wallets=new c.default(this.api,p.crypto),this.chunks=new f.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 d.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=l.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 u.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(l.stringToBuffer(t.data),i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=l.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=l.bufferTob64Url(e)}const o=new u.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,u=t.host||a.host,l=t.port||a.port||i;return new o.default({...t,host:u,protocol:c,port:l})},"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],u=s,l=async()=>{if(c)try{u.data=new TextDecoder(c).decode(await s.arrayBuffer())}catch(t){u.data=await s.text()}else u.data=await s.text()};if("arraybuffer"===o)u.data=await s.arrayBuffer();else if("text"===o)await l();else if("webstream"===o)u.data=n(s.body);else try{let t=await s.clone().json();"object"!=typeof t?await l():u.data=await s.json(),t=null}catch{await l()}return u}};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 g(await Promise.all([g(t),g(m(n))])),dataHash:t,minByteRange:e,maxByteRange:n}))))}async function u(t){return await l(await c(await a(t)))}async function l(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 l(n,e+1)}function h(t){const e=f(t);return Array.isArray(e)?d(e):[e]}function f(t,e=new Uint8Array,n=0){if("leaf"==t.type)return{offset:t.maxByteRange-1,proof:(0,i.concatBuffers)([e,t.dataHash,m(t.maxByteRange)])};if("branch"==t.type){const r=(0,i.concatBuffers)([e,t.leftChild.id,t.rightChild.id,m(t.byteRange)]);return[f(t.leftChild,r,n+1),f(t.rightChild,r,n+1)]}throw new Error("Unexpected node type")}function d(t){const e=[];return t.forEach((t=>{Array.isArray(t)?e.push(...d(t)):e.push(t)})),e}async function p(t,e){if(!e)return t;return{type:"branch",id:await g([await g(t.id),await g(e.id),await g(m(t.maxByteRange))]),byteRange:t.maxByteRange,maxByteRange:e.maxByteRange,leftChild:t,rightChild:e}}async function g(t){return Array.isArray(t)&&(t=r.default.utils.concatBuffers(t)),new Uint8Array(await r.default.crypto.hash(t))}function m(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 u(t)).id},e.generateTree=u,e.generateTransactionChunks=async function(t){const e=await a(t),n=await c(e),r=await l(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=l,e.generateProofs=h,e.arrayFlatten=d,e.intToBuffer=m,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),u=await g([await g(t),await g(r)]);return!!(0,e.arrayCompare)(n,u)&&{offset:a-1,leftBound:i,rightBound:a,chunkSize:a-i}}const u=c.slice(0,s),l=c.slice(u.length,u.length+s),h=c.slice(u.length+l.length,u.length+l.length+o),f=y(h),d=c.slice(u.length+l.length+h.length),p=await g([await g(u),await g(l),await g(h)]);return!!(0,e.arrayCompare)(n,p)&&(r<f?await t(u,r,i,Math.min(a,f),d):await t(l,r,Math.max(i,f),a,d))},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),u=e.slice(r.length+i.length+a.length),l=await g([await g(r),await g(i),await g(a)]);return t(u,`${n}\n${JSON.stringify(Buffer.from(r))},${JSON.stringify(Buffer.from(i))},${c} => ${JSON.stringify(l)}`)}},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(l(t)))}function a(t){return r.fromByteArray(new Uint8Array(t))}function c(t){return u(a(t))}function u(t){try{return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}catch(t){throw new Error("Failed to encode string",{cause:t})}}function l(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=u,e.b64UrlDecode=l},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],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,c)),l=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)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[l++]=255&e);1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(c(t,a,a+s>u?u: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,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",h=1e14,f=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,m=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=f-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,u=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==u,!i||!o)return r?0:!i^n?1:-1;if(!r)return c>u^n?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return c==u?0:c>u^n?1:-1}function b(t,e,n,r){if(t<e||t>n||t!==c(t))throw Error(u+(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/f)==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,A,x,_,k,R,P,C=W.prototype={constructor:W,toString:null,valueOf:null},I=new W(1),O=20,B=4,U=-7,L=21,N=-1e7,D=1e7,j=!1,M=1,V=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function W(t,e){var n,o,a,u,h,p,g,m,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>D?y.c=y.e=null:t.e<N?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(u=0,h=t;h>=10;h/=10,u++);return void(u>D?y.c=y.e=null:(y.e=u,y.c=[t]))}m=String(t)}else{if(!s.test(m=String(t)))return i(y,m,p);y.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(u=m.indexOf("."))>-1&&(m=m.replace(".","")),(h=m.search(/e/i))>0?(u<0&&(u=h),u+=+m.slice(h+1),m=m.substring(0,h)):u<0&&(u=m.length)}else{if(b(e,2,K.length,"Base"),10==e&&$)return q(y=new W(t),O+y.e+1,B);if(m=String(t),p="number"==typeof t){if(0*t!=0)return i(y,m,p,e);if(y.s=1/t<0?(m=m.slice(1),-1):1,W.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(l+t)}else y.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(n=K.slice(0,e),u=h=0,g=m.length;h<g;h++)if(n.indexOf(o=m.charAt(h))<0){if("."==o){if(h>u){u=g;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,h=-1,u=0;continue}return i(y,String(t),p,e)}p=!1,(u=(m=r(m,e,10,y.s)).indexOf("."))>-1?m=m.replace(".",""):u=m.length}for(h=0;48===m.charCodeAt(h);h++);for(g=m.length;48===m.charCodeAt(--g););if(m=m.slice(h,++g)){if(g-=h,p&&W.DEBUG&&g>15&&(t>d||t!==c(t)))throw Error(l+y.s*t);if((u=u-h-1)>D)y.c=y.e=null;else if(u<N)y.c=[y.e=0];else{if(y.e=u,y.c=[],h=(u+1)%f,u<0&&(h+=f),h<g){for(h&&y.c.push(+m.slice(0,h)),g-=f;h<g;)y.c.push(+m.slice(h,h+=f));h=f-(m=m.slice(h)).length}else h-=g;for(;h--;m+="0");y.c.push(+m)}}else y.c=[y.e=0]}function z(t,e,n,r){var i,o,s,a,c;if(null==n?n=B: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<=U||s>=L)?S(c,s):T(c,s,"0");else if(o=(t=q(new W(t),e,n)).e,a=(c=w(t.c)).length,1==r||2==r&&(e<=o||o<=U)){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 H(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*f-1)>D?t.c=t.e=null:n<N?t.c=[t.e=0]:(t.e=n,t.c=e),t}function q(t,e,n,r){var i,o,s,u,l,d,g,m=t.c,y=p;if(m){t:{for(i=1,u=m[0];u>=10;u/=10,i++);if((o=e-i)<0)o+=f,s=e,l=m[d=0],g=c(l/y[i-s-1]%10);else if((d=a((o+1)/f))>=m.length){if(!r)break t;for(;m.length<=d;m.push(0));l=g=0,i=1,s=(o%=f)-f+1}else{for(l=u=m[d],i=1;u>=10;u/=10,i++);g=(s=(o%=f)-f+i)<0?0:c(l/y[i-s-1]%10)}if(r=r||e<0||null!=m[d+1]||(s<0?l:l%y[i-s-1]),r=n<4?(g||r)&&(0==n||n==(t.s<0?3:2)):g>5||5==g&&(4==n||r||6==n&&(o>0?s>0?l/y[i-s]:0:m[d-1])%10&1||n==(t.s<0?8:7)),e<1||!m[0])return m.length=0,r?(e-=t.e+1,m[0]=y[(f-e%f)%f],t.e=-e||0):m[0]=t.e=0,t;if(0==o?(m.length=d,u=1,d--):(m.length=d+1,u=y[f-o],m[d]=s>0?c(l/y[i-s]%y[s])*u:0),r)for(;;){if(0==d){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(t.e++,m[0]==h&&(m[0]=1));break}if(m[d]+=u,m[d]!=h)break;m[d--]=0,u=1}for(o=m.length;0===m[--o];m.pop());}t.e>D?t.c=t.e=null:t.e<N&&(t.c=[t.e=0])}return t}function X(t){var e,n=t.e;return null===n?t.toString():(e=w(t.c),e=n<=U||n>=L?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(u+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(b(n=t[e],0,m,e),O=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(b(n=t[e],0,8,e),B=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(b(n[0],-m,0,e),b(n[1],0,m,e),U=n[0],L=n[1]):(b(n,-m,m,e),U=-(L=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)b(n[0],-m,-1,e),b(n[1],1,m,e),N=n[0],D=n[1];else{if(b(n,-m,m,e),!n)throw Error(u+e+" cannot be zero: "+n);N=-(D=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(u+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw j=!n,Error(u+"crypto unavailable");j=n}else j=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,m,e),V=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(u+e+" not an object: "+n);F=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(u+e+" invalid: "+n);$="0123456789"==n.slice(0,10),K=n}}return{DECIMAL_PLACES:O,ROUNDING_MODE:B,EXPONENTIAL_AT:[U,L],RANGE:[N,D],CRYPTO:j,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>=-m&&i<=m&&i===c(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break t}if((e=(i+1)%f)<1&&(e+=f),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(u+"Invalid BigNumber: "+t)},W.maximum=W.max=function(){return H(arguments,-1)},W.minimum=W.min=function(){return H(arguments,1)},W.random=(o=9007199254740992,A=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,l=[],h=new W(I);if(null==t?t=O:b(t,0,m),i=a(t/f),j)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]):(l.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw j=!1,Error(u+"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):(l.push(o%1e14),s+=7);s=i/7}if(!j)for(;s<i;)(o=A())<9e15&&(l[s++]=o%1e14);for(i=l[--s],t%=f,i&&t&&(o=p[f-t],l[s]=c(i/o)*o);0===l[s];l.pop(),s--);if(s<0)l=[r=0];else{for(r=-1;0===l[0];l.splice(0,1),r-=f);for(s=1,o=l[0];o>=10;o/=10,s++);s<f&&(r-=f-s)}return h.e=r,h.c=l,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,u,l,h,f,d,p,g,m=r.indexOf("."),y=O,v=B;for(m>=0&&(h=V,V=0,r=r.replace(".",""),d=(g=new W(i)).pow(r.length-m),V=h,g.c=e(T(w(d.c),d.e,"0"),10,o,t),g.e=g.c.length),l=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(m<0?--l:(d.c=p,d.e=l,d.s=s,p=(d=n(d,g,y,v,o)).c,f=d.r,l=d.e),m=p[u=l+y+1],h=o/2,f=f||u<0||null!=p[u+1],f=v<4?(null!=m||f)&&(0==v||v==(d.s<0?3:2)):m>h||m==h&&(4==v||f||6==v&&1&p[u-1]||v==(d.s<0?8:7)),u<1||!p[0])r=f?T(c.charAt(1),-y,c.charAt(0)):c.charAt(0);else{if(p.length=u,f)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(h=p.length;!p[--h];);for(m=0,r="";m<=h;r+=c.charAt(p[m++]));r=T(r,l,c.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,c=t.length,u=e%g,l=e/g|0;for(t=t.slice();c--;)a=((i=u*(o=t[c]%g)+(r=l*o+(s=t[c]/g|0)*u)%g*g+a)/n|0)+(r/g|0)+l*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 u,l,d,p,g,m,w,v,b,E,S,T,A,x,_,k,R,P=r.s==i.s?1:-1,C=r.c,I=i.c;if(!(C&&C[0]&&I&&I[0]))return new W(r.s&&i.s&&(C?!I||C[0]!=I[0]:I)?C&&0==C[0]||!I?0*P:P/0:NaN);for(b=(v=new W(P)).c=[],P=o+(l=r.e-i.e)+1,a||(a=h,l=y(r.e/f)-y(i.e/f),P=P/f|0),d=0;I[d]==(C[d]||0);d++);if(I[d]>(C[d]||0)&&l--,P<0)b.push(1),p=!0;else{for(x=C.length,k=I.length,d=0,P+=2,(g=c(a/(I[0]+1)))>1&&(I=t(I,g,a),C=t(C,g,a),k=I.length,x=C.length),A=k,S=(E=C.slice(0,k)).length;S<k;E[S++]=0);R=I.slice(),R=[0].concat(R),_=I[0],I[1]>=a/2&&_++;do{if(g=0,(u=e(I,E,k,S))<0){if(T=E[0],k!=S&&(T=T*a+(E[1]||0)),(g=c(T/_))>1)for(g>=a&&(g=a-1),w=(m=t(I,g,a)).length,S=E.length;1==e(m,E,w,S);)g--,n(m,k<w?R:I,w,a),w=m.length,u=1;else 0==g&&(u=g=1),w=(m=I.slice()).length;if(w<S&&(m=[0].concat(m)),n(E,m,S,a),S=E.length,-1==u)for(;e(I,E,k,S)<1;)g++,n(E,k<S?R:I,S,a),S=E.length}else 0===u&&(g++,E=[0]);b[d++]=g,E[0]?E[S++]=C[A]||0:(E=[C[A]],S=1)}while((A++<x||null!=E[0])&&P--);p=null!=E[0],b[0]||b.splice(0,1)}if(a==h){for(d=1,P=b[0];P>=10;P/=10,d++);q(v,o+(v.e=d+l*f-1)+1,s,p)}else v.e=l,v.r=+p;return v}}(),x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,_=/^([^.]+)\.$/,k=/^\.([^.]+)$/,R=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(P,"");if(R.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(x,(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(_,"$1").replace(k,"0.$1")),e!=o))return new W(o,i);if(W.DEBUG)throw Error(u+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},C.absoluteValue=C.abs=function(){var t=new W(this);return t.s<0&&(t.s=1),t},C.comparedTo=function(t,e){return v(this,new W(t,e))},C.decimalPlaces=C.dp=function(t,e){var n,r,i,o=this;if(null!=t)return b(t,0,m),null==e?e=B:b(e,0,8),q(new W(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-y(this.e/f))*f,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},C.dividedBy=C.div=function(t,e){return n(this,new W(t,e),O,B)},C.dividedToIntegerBy=C.idiv=function(t,e){return n(this,new W(t,e),0,1)},C.exponentiatedBy=C.pow=function(t,e){var n,r,i,o,s,l,h,d,p=this;if((t=new W(t)).c&&!t.isInteger())throw Error(u+"Exponent not an integer: "+X(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 d=new W(Math.pow(+X(p),s?t.s*(2-E(t)):+X(t))),e?d.mod(e):d;if(l=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new W(NaN);(r=!l&&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(l?1/o:o);V&&(o=a(V/f+2))}for(s?(n=new W(.5),l&&(t.s=1),h=E(t)):h=(i=Math.abs(+X(t)))%2,d=new W(I);;){if(h){if(!(d=d.times(p)).c)break;o?d.c.length>o&&(d.c.length=o):r&&(d=d.mod(e))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(q(t=t.times(n),t.e+1,1),t.e>14)h=E(t);else{if(0===(i=+X(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?d:(l&&(d=I.div(d)),e?d.mod(e):o?q(d,V,B,undefined):d)},C.integerValue=function(t){var e=new W(this);return null==t?t=B:b(t,0,8),q(e,e.e+1,t)},C.isEqualTo=C.eq=function(t,e){return 0===v(this,new W(t,e))},C.isFinite=function(){return!!this.c},C.isGreaterThan=C.gt=function(t,e){return v(this,new W(t,e))>0},C.isGreaterThanOrEqualTo=C.gte=function(t,e){return 1===(e=v(this,new W(t,e)))||0===e},C.isInteger=function(){return!!this.c&&y(this.e/f)>this.c.length-2},C.isLessThan=C.lt=function(t,e){return v(this,new W(t,e))<0},C.isLessThanOrEqualTo=C.lte=function(t,e){return-1===(e=v(this,new W(t,e)))||0===e},C.isNaN=function(){return!this.s},C.isNegative=function(){return this.s<0},C.isPositive=function(){return this.s>0},C.isZero=function(){return!!this.c&&0==this.c[0]},C.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/f,u=t.e/f,l=s.c,d=t.c;if(!c||!u){if(!l||!d)return l?(t.s=-e,t):new W(d?s:NaN);if(!l[0]||!d[0])return d[0]?(t.s=-e,t):new W(l[0]?s:3==B?-0:0)}if(c=y(c),u=y(u),l=l.slice(),a=c-u){for((o=a<0)?(a=-a,i=l):(u=c,i=d),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=l.length)<(e=d.length))?a:e,a=e=0;e<r;e++)if(l[e]!=d[e]){o=l[e]<d[e];break}if(o&&(i=l,l=d,d=i,t.s=-t.s),(e=(r=d.length)-(n=l.length))>0)for(;e--;l[n++]=0);for(e=h-1;r>a;){if(l[--r]<d[r]){for(n=r;n&&!l[--n];l[n]=e);--l[n],l[r]+=h}l[r]-=d[r]}for(;0==l[0];l.splice(0,1),--u);return l[0]?Z(t,l,u):(t.s=3==B?-1:1,t.c=[t.e=0],t)},C.modulo=C.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)},C.multipliedBy=C.times=function(t,e){var n,r,i,o,s,a,c,u,l,d,p,m,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/f)+y(t.e/f),t.s*=E.s,(c=S.length)<(d=T.length)&&(w=S,S=T,T=w,i=c,c=d,d=i),i=c+d,w=[];i--;w.push(0));for(v=h,b=g,i=d;--i>=0;){for(n=0,p=T[i]%b,m=T[i]/b|0,o=i+(s=c);o>i;)n=((u=p*(u=S[--s]%b)+(a=m*u+(l=S[s]/b|0)*p)%b*b+w[o]+n)/v|0)+(a/b|0)+m*l,w[o--]=u%v;w[o]=n}return n?++r:w.splice(0,1),Z(t,w,r)},C.negated=function(){var t=new W(this);return t.s=-t.s||null,t},C.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/f,s=t.e/f,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)},C.precision=C.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return b(t,1,m),null==e?e=B:b(e,0,8),q(new W(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*f+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},C.shiftedBy=function(t){return b(t,-9007199254740991,d),this.times("1e"+t)},C.squareRoot=C.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,c=s.s,u=s.e,l=O+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(+X(s)))||c==1/0?(((e=w(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(+e),u=y((u+1)/2)-(u<0||u%2),r=new W(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new W(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(o=r,r=h.times(o.plus(n(s,o,l,1))),w(o.c).slice(0,c)===(e=w(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(q(r,r.e+O+2,1),t=!r.times(r).eq(s));break}if(!i&&(q(o,o.e+O+2,0),o.times(o).eq(s))){r=o;break}l+=4,c+=4,i=1}return q(r,r.e+O+1,B,t)},C.toExponential=function(t,e){return null!=t&&(b(t,0,m),t++),z(this,t,e,1)},C.toFixed=function(t,e){return null!=t&&(b(t,0,m),t=t+this.e+1),z(this,t,e)},C.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(u+"Argument not an object: "+n);if(r=i.toFixed(t,e),i.c){var o,s=r.split("."),a=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||"",h=s[0],f=s[1],d=i.s<0,p=d?h.slice(1):h,g=p.length;if(c&&(o=a,a=c,c=o,g-=o),a>0&&g>0){for(o=g%a||a,h=p.substr(0,o);o<g;o+=a)h+=l+p.substr(o,a);c>0&&(h+=l+p.slice(o)),d&&(h="-"+h)}r=f?h+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):h}return(n.prefix||"")+r+(n.suffix||"")},C.toFraction=function(t){var e,r,i,o,s,a,c,l,h,d,g,m,y=this,v=y.c;if(null!=t&&(!(c=new W(t)).isInteger()&&(c.c||1!==c.s)||c.lt(I)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+X(c));if(!v)return new W(y);for(e=new W(I),h=r=new W(I),i=l=new W(I),m=w(v),s=e.e=m.length-y.e-1,e.c[0]=p[(a=s%f)<0?f+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=D,D=1/0,c=new W(m),l.c[0]=0;d=n(c,e,0,1),1!=(o=r.plus(d.times(i))).comparedTo(t);)r=i,i=o,h=l.plus(d.times(o=h)),l=o,e=c.minus(d.times(o=e)),c=o;return o=n(t.minus(r),i,0,1),l=l.plus(o.times(h)),r=r.plus(o.times(i)),l.s=h.s=y.s,g=n(h,i,s*=2,B).minus(y).abs().comparedTo(n(l,r,s,B).minus(y).abs())<1?[h,i]:[l,r],D=a,g},C.toNumber=function(){return+X(this)},C.toPrecision=function(t,e){return null!=t&&b(t,1,m),z(this,t,e,2)},C.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<=U||o>=L?S(w(n.c),o):T(w(n.c),o,"0"):10===t&&$?e=T(w((n=q(new W(n),O+o+1,B)).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},C.valueOf=C.toJSON=function(){return X(this)},C._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 u(t,e,n)}function u(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|g(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(X(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return f(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(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return d(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return d(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):f(t);if("Buffer"===t.type&&Array.isArray(t.data))return f(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 l(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 l(t),a(t<0?0:0|p(t))}function f(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 d(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 g(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(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 H(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:H(t).length;e=(""+e).toLowerCase(),i=!0}}function m(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 C(this,e,n);case"utf8":case"utf-8":return _(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return P(this,e,n);case"base64":return x(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 u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(u(t,o)===u(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(u(t,o+r)!==u(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 q(H(e,t.length-n),t,n,r)}function S(t,e,n,r){return q(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 q(Z(e),t,n,r)}function A(t,e,n,r){return q(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 x(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function _(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<=k)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=k));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 u(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 l(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(X(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),X(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(X(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=g,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?_(this,0,t):m.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(X(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),u=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<a;++t)if(u[t]!==l[t]){o=u[t],s=l[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 A(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 k=4096;function R(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 P(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 C(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+=Y[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 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 B(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 U(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 L(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 N(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 D(t,e,n,r,o){return e=+e,n>>>=0,o||N(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function j(t,e,n,r,o){return e=+e,n>>>=0,o||N(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||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},c.prototype.readUintBE=c.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},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.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]},c.prototype.readUint32BE=c.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])},c.prototype.readBigUInt64LE=J((function(t){$(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){$(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||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},c.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},c.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||O(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||O(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||O(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||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=J((function(t){$(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){$(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||O(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(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){B(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){B(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||B(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||B(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||B(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||B(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||B(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 U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(t,e=0){return L(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);B(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);B(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||B(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||B(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||B(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||B(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||B(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 U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return D(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return D(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return j(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){$(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function $(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 $(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 z=/[^+/0-9A-Za-z-_]/g;function H(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(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(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 X(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 Y=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,u,l,h=arguments[0],f=1,d=arguments.length,p=!1;for("boolean"==typeof h&&(p=h,h=arguments[1]||{},f=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});f<d;++f)if(null!=(e=arguments[f]))for(n in e)r=c(h,n),h!==(i=c(e,n))&&(p&&i&&(s(i)||(u=o(i)))?(u?(u=!1,l=r&&o(r)?r:[]):l=r&&s(r)?r:{},a(h,{name:n,newValue:t(p,l,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,u=c>>1,l=-7,h=n?i-1:0,f=n?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=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=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):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+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+d]=255&s,d+=p,s/=256,u-=8);t[n+d-p]|=128*g}},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 u(t,e,n){var r,o={},u=null,l=null;for(r in void 0!==n&&(u=""+n),void 0!==e.key&&(u=""+e.key),void 0!==e.ref&&(l=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:u,ref:l,props:o,_owner:a.current}}e.jsx=u,e.jsxs=u},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 u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var h=u[l];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 f=(e,n)=>{s.onerror=s.onload=null,clearTimeout(d);var i=r[t];if(delete r[t],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((t=>t(n))),e)return e(n)},d=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.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],u=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);u<o.length;u++)i=o[u],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:()=>Ev,default:()=>Sv});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 u(t,e){return t(e={exports:{}},e.exports),e.exports}var l=u((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(l);var h=s(u((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 u(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()+u(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,l,h,f,d,p;return r(this,(function(r){switch(r.label){case 0:n=Date.now()+u(4),o=Date.now()+i,l=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(l)?[3,5]:(f=this.id+"-"+e+"-"+n,[4,c(Math.floor(25*Math.random()))]);case 3:return r.sent(),h.setItemSync(l,JSON.stringify({id:this.id,iat:n,timeoutKey:f,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,c(30)];case 4:return r.sent(),null!==(d=h.getItemSync(l))&&(p=JSON.parse(d)).id===this.id&&p.iat===n?(this.acquiredIatSet.add(n),this.refreshLockWhileAcquired(l,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()+u(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,l.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))?(l.default().unlock(e),[2]):((o=JSON.parse(i)).timeRefreshed=Date.now(),n.setItemSync(t,JSON.stringify(o)),l.default().unlock(e),this.refreshLockWhileAcquired(t,e),[2])):(l.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,l.default().lock(c.iat)];case 1:r.sent(),this.acquiredIatSet.delete(c.iat),n.removeItemSync(i),l.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,u=0;u<i.length;u++){var l=i[u];if(l.includes(s)){var h=r.getItemSync(l);if(null!==h){var f=JSON.parse(h);(void 0===f.timeRefreshed&&f.timeAcquired<n||void 0!==f.timeRefreshed&&f.timeRefreshed<n)&&(r.removeItemSync(l),c=!0)}}}c&&t.notifyWaiters()},t.waiters=void 0,t}();e.default=h})));const f={timeoutInSeconds:60},d={name:"auth0-spa-js",version:"2.1.3"},p=()=>Date.now();class g extends Error{constructor(t,e){super(e),this.error=t,this.error_description=e,Object.setPrototypeOf(this,g.prototype)}static fromPayload({error:t,error_description:e}){return new g(t,e)}}class m extends g{constructor(t,e,n,r=null){super(t,e),this.state=n,this.appState=r,Object.setPrototypeOf(this,m.prototype)}}class y extends g{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 g{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,v.prototype)}}class b extends g{constructor(t,e,n){super(t,e),this.mfa_token=n,Object.setPrototypeOf(this,b.prototype)}}class E extends g{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,A=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(T().getRandomValues(new Uint8Array(43))).forEach((n=>e+=t[n%66])),e},x=t=>btoa(t),_=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()},k=t=>(t=>decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),R=async(t,e)=>{const n=await fetch(t,e);return{ok:n.ok,json:await n.json()}},P=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([R(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 C(t,e){var{baseUrl:n,timeout:r,audience:o,scope:s,auth0Client:a,useFormData:c}=t,u=i(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const l=c?_(u):JSON.stringify(u);return await async function(t,e,n,r,o,s,a){let c,u=null;for(let i=0;i<3;i++)try{c=await P(t,n,r,o,s,a,e),u=null;break}catch(t){u=t}if(u)throw u;const l=c.json,{error:h,error_description:f}=l,d=i(l,["error","error_description"]),{ok:p}=c;if(!p){const e=f||`HTTP error. Unable to fetch ${t}`;if("mfa_required"===h)throw new b(h,e,d.mfa_token);if("missing_refresh_token"===h)throw new E(n,r);throw new g(h||"request_error",e)}return d}(`${n}/oauth/token`,r,o||"default",s,{method:"POST",body:l,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||d))}},e,c)}const I=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e};class O{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 O({clientId:n,scope:i,audience:r},e)}static fromCacheEntry(t){const{scope:e,audience:n,client_id:r}=t;return new O({scope:e,audience:n,clientId:r})}}class B{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 U{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 L{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 O({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 O({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,e){return e.filter((e=>{var n;const r=O.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 N{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 D=t=>"number"==typeof t,j=["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=u((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 $={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=>$.get(t)||$.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),$.save(t,e,n)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n),$.remove(t,e),$.remove(`_legacy_${t}`,e)}},z={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 H,Z=("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,!1,function(t){return H=H||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(H,t)});const q={};class X{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 U).enclosedCache,localstorage:()=>new B},Y=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 U).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",!Y(e))throw new Error(`Invalid cache location "${e}"`);n=Y(e)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===t.legacySameSiteCookie?$: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:z;var i;this.scope=I("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new N(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||p,this.cacheManager=new L(n,n.allKeys?void 0:new X(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||d)));return`${this.domainUrl}${t}&auth0Client=${e}`}_authorizeUrl(t){return this._url(`/authorize?${_(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(k(r)),s={__raw:t},a={};return Object.keys(o).forEach((t=>{s[t]=o[t],j.includes(t)||(a[t]=o[t])})),{encoded:{header:n,payload:r,signature:i},header:JSON.parse(k(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&&!D(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||!D(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!D(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&&D(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&&D(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=x(A()),i=x(A()),o=A(),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(g.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 g("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,u=await this._prepareAuthorizeUrl(a.authorizationParams||{}),{url:l}=u,h=i(u,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},h),{appState:s}),c&&{organization:c}));const f=o?`${l}#${o}`:l;r?await r(f):window.location.assign(f)}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 g("missing_transaction","Invalid state");if(this.transactionManager.remove(),i)throw new m(i,o||i,n,s.appState);if(!s.code_verifier||s.state&&s.state!==n)throw new g("state_mismatch","Invalid state");const a=s.organization,c=s.nonce,u=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},u?{redirect_uri:u}:{}),{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=q[e];return n||(n=t().finally((()=>{delete q[e],n=null})),q[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({},f),e),await this.loginWithPopup(r,e),(await this.cacheManager.get(new O({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?${_(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:u}=await this._prepareAuthorizeUrl(e,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new g("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,l=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(g.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!==l.state)throw new g("state_mismatch","Invalid state");const h=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:s,code:l.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:u})}catch(t){throw"login_required"===t.error&&this.logout({openUrl:!1}),t}}async _getTokenUsingRefreshToken(t){const e=await this.cacheManager.get(new O({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 O({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 O({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 C(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:ut}=Array,lt=ct("undefined");const ht=at("ArrayBuffer");const ft=ct("string"),dt=ct("function"),pt=ct("number"),gt=t=>null!==t&&"object"==typeof t,mt=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]),ut(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 At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,xt=t=>!lt(t)&&t!==At;const _t=(kt="undefined"!=typeof Uint8Array&&it(Uint8Array),t=>kt&&t instanceof kt);var kt;const Rt=at("HTMLFormElement"),Pt=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Ct=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)},Ot="abcdefghijklmnopqrstuvwxyz",Bt="0123456789",Ut={DIGIT:Bt,ALPHA:Ot,ALPHA_DIGIT:Ot+Ot.toUpperCase()+Bt};const Lt=at("AsyncFunction"),Nt={isArray:ut,isArrayBuffer:ht,isBuffer:function(t){return null!==t&&!lt(t)&&null!==t.constructor&&!lt(t.constructor)&&dt(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||dt(t.append)&&("formdata"===(e=ot(t))||"object"===e&&dt(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:ft,isNumber:pt,isBoolean:t=>!0===t||!1===t,isObject:gt,isPlainObject:mt,isUndefined:lt,isDate:yt,isFile:wt,isBlob:vt,isRegExp:Ct,isFunction:dt,isStream:t=>gt(t)&&dt(t.pipe),isURLSearchParams:Et,isTypedArray:_t,isFileList:bt,forEach:St,merge:function t(){const{caseless:e}=xt(this)&&this||{},n={},r=(r,i)=>{const o=e&&Tt(n,i)||i;mt(n[o])&&mt(r)?n[o]=t(n[o],r):mt(r)?n[o]=t({},r):ut(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&&dt(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(ut(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:Rt,hasOwnProperty:Pt,hasOwnProp:Pt,reduceDescriptors:It,freezeMethods:t=>{It(t,((e,n)=>{if(dt(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];dt(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 ut(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:At,isContextDefined:xt,ALPHABET:Ut,generateString:(t=16,e=Ut.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n},isSpecCompliantForm:function(t){return!!(t&&dt(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(gt(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const i=ut(t)?[]:{};return St(t,((t,e)=>{const o=n(t,r+1);!lt(o)&&(i[e]=o)})),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Lt,isThenable:t=>t&&(gt(t)||dt(t))&&dt(t.then)&&dt(t.catch)};function Dt(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)}Nt.inherits(Dt,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:Nt.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const jt=Dt.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(Dt,Mt),Object.defineProperty(jt,"isAxiosError",{value:!0}),Dt.from=(t,e,n,r,i,o)=>{const s=Object.create(jt);return Nt.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),Dt.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const Vt=Dt;function Ft(t){return Nt.isPlainObject(t)||Nt.isArray(t)}function Kt(t){return Nt.endsWith(t,"[]")?t.slice(0,-2):t}function $t(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=Nt.toFlatObject(Nt,{},null,(function(t){return/^is[A-Z]/.test(t)}));const zt=function(t,e,n){if(!Nt.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=Nt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!Nt.isUndefined(e[t])}))).metaTokens,i=n.visitor||u,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Nt.isSpecCompliantForm(e);if(!Nt.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(Nt.isDate(t))return t.toISOString();if(!a&&Nt.isBlob(t))throw new Vt("Blob is not supported. Use a Buffer instead.");return Nt.isArrayBuffer(t)||Nt.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function u(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(Nt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(Nt.isArray(t)&&function(t){return Nt.isArray(t)&&!t.some(Ft)}(t)||(Nt.isFileList(t)||Nt.endsWith(n,"[]"))&&(a=Nt.toArray(t)))return n=Kt(n),a.forEach((function(t,r){!Nt.isUndefined(t)&&null!==t&&e.append(!0===s?$t([n],r,o):null===s?n:n+"[]",c(t))})),!1;return!!Ft(t)||(e.append($t(i,n,o),c(t)),!1)}const l=[],h=Object.assign(Wt,{defaultVisitor:u,convertValue:c,isVisitable:Ft});if(!Nt.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!Nt.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Nt.forEach(n,(function(n,o){!0===(!(Nt.isUndefined(n)||null===n)&&i.call(e,n,Nt.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])})),l.pop()}}(t),e};function Ht(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&&zt(t,this,e)}const qt=Zt.prototype;qt.append=function(t,e){this._pairs.push([t,e])},qt.toString=function(t){const e=t?function(e){return t.call(this,e,Ht)}:Ht;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const Xt=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 Yt(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):Nt.isURLSearchParams(e)?e.toString():new Xt(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){Nt.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:Xt,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&&Nt.isArray(r)?r.length:o,a)return Nt.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Nt.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&Nt.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(Nt.isFormData(t)&&Nt.isFunction(t.entries)){const n={};return Nt.forEachEntry(t,((t,r)=>{e(function(t){return Nt.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=Nt.isObject(t);i&&Nt.isHTMLForm(t)&&(t=new FormData(t));if(Nt.isFormData(t))return r&&r?JSON.stringify(se(t)):t;if(Nt.isArrayBuffer(t)||Nt.isBuffer(t)||Nt.isStream(t)||Nt.isFile(t)||Nt.isBlob(t))return t;if(Nt.isArrayBufferView(t))return t.buffer;if(Nt.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 zt(t,new oe.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,r){return oe.isNode&&Nt.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=Nt.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return zt(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(Nt.isString(t))try{return(e||JSON.parse)(t),Nt.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&&Nt.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}}};Nt.forEach(["delete","get","head","post","put","patch"],(t=>{ae.headers[t]={}}));const ce=ae,ue=Nt.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"]),le=Symbol("internals");function he(t){return t&&String(t).trim().toLowerCase()}function fe(t){return!1===t||null==t?t:Nt.isArray(t)?t.map(fe):String(t)}function de(t,e,n,r,i){return Nt.isFunction(r)?r.call(this,e,n):(i&&(e=n),Nt.isString(e)?Nt.isString(r)?-1!==e.indexOf(r):Nt.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=Nt.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=fe(t))}const o=(t,e)=>Nt.forEach(t,((t,n)=>i(t,n,e)));return Nt.isPlainObject(t)||t instanceof this.constructor?o(t,e):Nt.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]&&ue[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=Nt.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(Nt.isFunction(e))return e.call(this,t,n);if(Nt.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=he(t)){const n=Nt.findKey(this,t);return!(!n||void 0===this[n]||e&&!de(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=Nt.findKey(n,t);!i||e&&!de(0,n[i],i,e)||(delete n[i],r=!0)}}return Nt.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&&!de(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return Nt.forEach(this,((r,i)=>{const o=Nt.findKey(n,i);if(o)return e[o]=fe(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]=fe(r),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Nt.forEach(this,((n,r)=>{null!=n&&!1!==n&&(e[r]=t&&Nt.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[le]=this[le]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=he(t);e[r]||(!function(t,e){const n=Nt.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 Nt.isArray(t)?t.forEach(r):r(t),this}}pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Nt.reduceDescriptors(pe.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),Nt.freezeMethods(pe);const ge=pe;function me(t,e){const n=this||ce,r=e||n,i=ge.from(r.headers);let o=r.data;return Nt.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"}Nt.inherits(we,Vt,{__CANCEL__:!0});const ve=we;const be=oe.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];Nt.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),Nt.isString(r)&&s.push("path="+r),Nt.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=Nt.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(),u=r[s];i||(i=c),n[o]=a,r[o]=c;let l=s,h=0;for(;l!==o;)h+=n[l++],l%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-i<e)return;const f=u&&c-u;return f?Math.round(1e3*h/f):void 0}};function Ae(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 u={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};u[e?"download":"upload"]=!0,t(u)}}const xe={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){let r=t.data;const i=ge.from(t.headers).normalize();let o,s,{responseType:a,withXSRFToken:c}=t;function u(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}if(Nt.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 l=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 f(){if(!l)return;const r=ge.from("getAllResponseHeaders"in l&&l.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),u()}),(function(t){n(t),u()}),{data:a&&"text"!==a&&"json"!==a?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:t,request:l}),l=null}if(l.open(t.method.toUpperCase(),Yt(h,t.params,t.paramsSerializer),!0),l.timeout=t.timeout,"onloadend"in l?l.onloadend=f:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(f)},l.onabort=function(){l&&(n(new Vt("Request aborted",Vt.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new Vt("Network Error",Vt.ERR_NETWORK,t,l)),l=null},l.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,l)),l=null},oe.hasStandardBrowserEnv&&(c&&Nt.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 l&&Nt.forEach(i.toJSON(),(function(t,e){l.setRequestHeader(e,t)})),Nt.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&"json"!==a&&(l.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&l.addEventListener("progress",Ae(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",Ae(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=e=>{l&&(n(!e||e.type?new ve(null,t,l):e),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const d=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(h);d&&-1===oe.protocols.indexOf(d)?n(new Vt("Unsupported protocol "+d+":",Vt.ERR_BAD_REQUEST,t)):l.send(r||null)}))}};Nt.forEach(xe,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const _e=t=>`- ${t}`,ke=t=>Nt.isFunction(t)||null===t||!1===t,Re=t=>{t=Nt.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,!ke(n)&&(r=xe[(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(_e).join("\n"):" "+_e(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 Pe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ve(null,t)}function Ce(t){Pe(t),t.headers=ge.from(t.headers),t.data=me.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Re(t.adapter||ce.adapter)(t).then((function(e){return Pe(t),e.data=me.call(t,t.transformResponse,e),e.headers=ge.from(e.headers),e}),(function(e){return ye(e)||(Pe(t),e&&e.response&&(e.response.data=me.call(t,t.transformResponse,e.response),e.response.headers=ge.from(e.response.headers))),Promise.reject(e)}))}const Ie=t=>t instanceof ge?t.toJSON():t;function Oe(t,e){e=e||{};const n={};function r(t,e,n){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge.call({caseless:n},t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function i(t,e,n){return Nt.isUndefined(e)?Nt.isUndefined(t)?void 0:r(void 0,t,n):r(t,e,n)}function o(t,e){if(!Nt.isUndefined(e))return r(void 0,e)}function s(t,e){return Nt.isUndefined(e)?Nt.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 Nt.forEach(Object.keys(Object.assign({},t,e)),(function(r){const o=c[r]||i,s=o(t[r],e[r],r);Nt.isUndefined(s)&&o!==a||(n[r]=s)})),n}const Be="1.6.5",Ue={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Ue[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const Le={};Ue.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&&!Le[i]&&(Le[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 Ne={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:Ue},De=Ne.validators;class je{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=Oe(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&Ne.assertOptions(n,{silentJSONParsing:De.transitional(De.boolean),forcedJSONParsing:De.transitional(De.boolean),clarifyTimeoutError:De.transitional(De.boolean)},!1),null!=r&&(Nt.isFunction(r)?e.paramsSerializer={serialize:r}:Ne.assertOptions(r,{encode:De.function,serialize:De.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&Nt.merge(i.common,i[e.method]);i&&Nt.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=ge.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 u;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let l,h=0;if(!a){const t=[Ce.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,c),l=t.length,u=Promise.resolve(e);h<l;)u=u.then(t[h++],t[h++]);return u}l=s.length;let f=e;for(h=0;h<l;){const t=s[h++],e=s[h++];try{f=t(f)}catch(t){e.call(this,t);break}}try{u=Ce.call(this,f)}catch(t){return Promise.reject(t)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(t){return Yt(Ee((t=Oe(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}Nt.forEach(["delete","get","head","options"],(function(t){je.prototype[t]=function(e,n){return this.request(Oe(n||{},{method:t,url:e,data:(n||{}).data}))}})),Nt.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(Oe(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}je.prototype[t]=e(),je.prototype[t+"Form"]=e(!0)}));const Me=je;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 $e=Ke;const We=function t(e){const n=new Me(e),r=nt(Me.prototype.request,n);return Nt.extend(r,Me.prototype,n,{allOwnKeys:!0}),Nt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Oe(e,n))},r}(ce);We.Axios=Me,We.CanceledError=ve,We.CancelToken=Fe,We.isCancel=ye,We.VERSION=Be,We.toFormData=zt,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 Nt.isObject(t)&&!0===t.isAxiosError},We.mergeConfig=Oe,We.AxiosHeaders=ge,We.formToJSON=t=>se(Nt.isHTMLForm(t)?new FormData(t):t),We.getAdapter=Re,We.HttpStatusCode=$e,We.default=We;const ze=We;var He=a(742),Ze=Object.create,qe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ge=Object.getOwnPropertyNames,Ye=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(Ye(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&&qe(t,i,{get:()=>e[i],enumerable:!(r=Xe(e,i))||r.enumerable});return t})(!e&&t&&t.__esModule?n:qe(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],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,c)),l=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)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[l++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u},t.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(c(t,a,a+s>u?u: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,u=c>>1,l=-7,h=n?i-1:0,f=n?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-1:1)*s*Math.pow(2,o-r)},t.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=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=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):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+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+d]=255&s,d+=p,s/=256,u-=8);t[n+d-p]|=128*g}})),un=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 u(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|d(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 l(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|f(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||q(t.length)?o(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(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 u(t){return c(t),o(t<0?0:0|f(t))}function l(t){let e=t.length<0?0:0|f(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 f(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(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 z(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 R(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return _(this,e,n);case"latin1":case"binary":return k(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function g(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function m(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),q(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 u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(u(t,o)===u(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(u(t,o+r)!==u(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(q(r))return o;t[n+o]=r}return o}function v(t,e,n,r){return H(W(e,t.length-n),t,n,r)}function b(t,e,n,r){return H(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(z(e),t,n,r)}function S(t,e,n,r){return H(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 A(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<=x)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=x));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 u(t)},s.allocUnsafeSlow=function(t){return u(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=d,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)g(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)g(this,e,e+3),g(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)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},s.prototype.toString=function(){let t=this.length;return 0===t?"":0===arguments.length?A(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),u=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<c;++t)if(u[t]!==l[t]){o=u[t],a=l[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 m(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return m(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 x=4096;function _(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 k(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 R(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+=X[t[r]];return i}function P(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 C(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 O(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 B(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 U(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 L(t,e,r,i,o){return e=+e,r>>>=0,o||U(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function N(t,e,r,i,o){return e=+e,r>>>=0,o||U(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||C(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||C(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||C(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(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||C(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||C(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||C(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||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||C(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||C(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||C(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||C(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||C(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(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 O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=G((function(t,e=0){return B(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 O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=G((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return N(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 D={};function j(t,e,n){D[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 D.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 D.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,n){throw Math.floor(t)!==t?(F(t,n),new D.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),j("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 $=/[^+/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 z(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace($,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(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 q(t){return t!=t}var X=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"?Y:t}function Y(){throw new Error("BigInt not supported")}})),ln=Qe(((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:un().Buffer,Crypto:window.crypto}):e.exports={Buffer:un().Buffer,Crypto:crypto}})),hn={};((t,e)=>{for(var n in e)qe(t,n,{get:e[n],enumerable:!0})})(hn,{AVSCTap:()=>Pn,ArweaveSigner:()=>An,DataItem:()=>Mn,MAX_TAG_BYTES:()=>Dn,MIN_BINARY_SIZE:()=>jn,SIG_CONFIG:()=>Tn,SignatureConfig:()=>wn,Signer:()=>fn,createData:()=>Fn,deserializeTags:()=>On,indexToType:()=>xn,serializeTags:()=>Cn,tagsExceedLimit:()=>In});var fn=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,n,r){throw new Error("You must implement verify method on child")}},dn=tn(rn(),1),pn=tn(sn(),1);async function gn(t){if(Array.isArray(t)){let e=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("list"),(0,pn.stringToBuffer)(t.length.toString())]);return await mn(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 mn(t,e){if(t.length<1)return e;let n=(0,pn.concatBuffers)([e,await gn(t[0])]),r=await Sn().hash(n,"SHA-384");return await mn(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"}},An=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 dn.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)}},xn={1:An},_n=tn(rn(),1);async function kn(t){return gn([(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 Rn(t,e){let{signature:n,id:r}=await async function(t,e){let n=await kn(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 Pn=class{buf;pos;constructor(t=Buffer.alloc(Dn),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 Cn(t){let e=new Pn;return e.writeTags(t),e.toBuffer()}function In(t){let e=new Pn;return e.writeTags(t),e.tagsExceedLimit()}function On(t){return new Pn(t).readTags()}function Bn(t){let e=0;for(let n=t.length-1;n>=0;n--)e=256*e+t[n];return e}function Un(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 Ln=tn(ln(),1),Nn=tn(un(),1),Dn=4096,jn=80,Mn=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return void 0!==t.binary}get signatureType(){let t=Bn(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()=>_n.default.encode(await this.rawId))()}set id(t){this._id=_n.default.toBuffer(t)}get rawId(){return(async()=>Nn.Buffer.from(await Ln.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 _n.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 _n.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):Nn.Buffer.alloc(0)}get target(){return _n.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):Nn.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Bn(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(0==Bn(this.binary.subarray(t,t+8)))return[];let e=Bn(this.binary.subarray(t+8,t+16));return On(Nn.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map((t=>({name:_n.default.encode(t.name),value:_n.default.encode(t.value)})))}getStartOfData(){let t=this.getTagsStart();return t+16+Bn(this.binary.subarray(t+8,t+16))}get rawData(){let t=this.getTagsStart(),e=t+16+Bn(this.binary.subarray(t+8,t+16));return this.binary.subarray(e,this.binary.length)}get data(){return _n.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Rn(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=Nn.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:_n.default.encode(t.name),value:_n.default.encode(t.value)}))),data:this.data}}static async verify(t){if(t.byteLength<jn)return!1;let e=new Mn(t),n=e.signatureType,r=e.getTagsStart(),i=Bn(t.subarray(r,r+8)),o=Bn(t.subarray(r+8,r+16));if(o>Dn)return!1;if(i>0)try{if(On(Nn.Buffer.from(t.subarray(r+16,r+16+o))).length!==i)return!1}catch{return!1}let s=xn[n],a=await kn(e);return await s.verify(e.rawOwner,a,e.rawSignature)}async getSignatureData(){return kn(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?Cn(n.tags):null,u=16+(c?c.byteLength:0),l=Buffer.from(t),h=l.byteLength,f=2+e.signatureLength+e.ownerLength+o+a+u+h,d=Buffer.alloc(f);if(d.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),d.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}`);d.set(r,2+e.signatureLength);let p=2+e.signatureLength+e.ownerLength;if(d[p]=i?1:0,i){if(32!==i.byteLength)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);d.set(i,p+1)}let g=p+o,m=g+1;if(d[g]=s?1:0,s){if(m+=s.byteLength,32!==s.byteLength)throw new Error("Anchor must be 32 bytes");d.set(s,g+1)}d.set(Un(n?.tags?.length??0),m);let y=Un(c?.byteLength??0);d.set(y,m+8),c&&d.set(c,m+16);let w=m+u;return d.set(l,w),new Mn(d)}var Kn={...hn};globalThis.arbundles??=Kn;const{Axios:$n,AxiosError:Wn,CanceledError:zn,isCancel:Hn,CancelToken:Zn,VERSION:qn,all:Xn,Cancel:Gn,isAxiosError:Yn,spread:Jn,toFormData:Qn,AxiosHeaders:tr,HttpStatusCode:er,formToJSON:nr,getAdapter:rr,mergeConfig:ir}=ze;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},ur="othentUserDetails",lr="Othent KMS",hr="2.0.0-beta.10",fr=[{name:"Client",value:lr},{name:"Client-Version",value:hr}],dr=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 gr={secure:!0,domain:!0,ttlHours:360},mr=class t{constructor(e=gr){this.secureParam=null,this.domainParam=null,this.ttlMs=1296e6;const{secureParam:n,domainParam:r,ttlMs:i}=this.parseCookieOptions(pr(e,gr));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])}))}};mr.COOKIE_SEPARATOR=/\s*;\s*/,mr.COOKIE_VALUE_SEPARATOR=/\s*=\s*/;var yr=mr,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:u,initialUserDetails:l,cookieKey:h,localStorageKey:f}){this.debug=!1,this.auth0ClientPromise=Promise.resolve(null),this.authEventListenerHandler=new dr({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=f,this.refreshTokenExpirationMs=o,this.appInfo=u,this.restoreUserDetails(l||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 ze.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:lr,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 He.fromByteArray(new Uint8Array(t))}(t),e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");var e}async function Ar(t,e="SHA-256"){let n=await crypto.subtle.digest(e,t);return new Uint8Array(n)}var xr=(t=>(t.Unexpected="Unexpected",t.Validation="Validation",t.UserCreation="UserCreation",t.Encryption="Encryption",t.Decryption="Decryption",t.Signing="Signing",t.PublicKey="PublicKey",t))(xr||{}),_r=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 kr(t){var e;if(Yn(t)){const n=null==(e=t.response)?void 0:e.data;if(!function(t){return"object"==typeof t&&!0===t.error&&!!t.id&&!!xr[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 _r(r,i||"",s,!0)}return t instanceof Error?t:new Error("Unknown error")}async function Rr(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 kr(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 Pr=class{constructor(t,e){this.api=ze.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 kr(t)}if(!n)throw new Error("Error creating user on server.");return!0}(this.api,t)}async decrypt(t,e){return Rr(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 kr(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 kr(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 Cr(t,e="utf8"){return r.lW.isBuffer(t)?Or(t.toString("base64")):Or(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 Or(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Br(t){return r.lW.from(Ir(t),"base64")}var Ur=Cr;function Lr(t){return or.default.init(t)}Ur.encode=Cr,Ur.decode=function(t,e="utf8"){return r.lW.from(Ir(t),"base64").toString(e)},Ur.toBase64=Ir,Ur.fromBase64=Or,Ur.toBuffer=Br;var Nr=class t{constructor(t=ar){this.errorEventListenerHandler=new dr,this.tokens=new Set,this.walletName=lr,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:u,...l}=t;const h="undefined"==typeof location?null:location.origin;this.config={...pr(l,sr),cookieKey:"string"==typeof r?r:r?ur:null,localStorageKey:"string"==typeof i?i:i?ur:null,auth0Cache:"object"==typeof o?"custom":o,auth0RedirectURI:s||h,auth0ReturnToURI:a||h};const{config:f}=this,{cookieKey:d,localStorageKey:p}=f;if("string"==typeof d&&!d.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(!f.auth0RedirectURI)throw new Error("`auth0RedirectURI` is required.");if(!f.auth0ReturnToURI)throw new Error("`auth0ReturnToURI` is required.");this.appInfo={name:e,version:n},this.gatewayConfig=c||cr;let g=null;if("undefined"!=typeof window)g=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.");g=global.crypto}if(this.crypto=g,"eager"===f.autoConnect&&"popup"===f.auth0LogInMethod&&"refresh-tokens"===f.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:f.debug,domain:f.auth0Domain,clientId:f.auth0ClientId,strategy:f.auth0Strategy,cache:o,refreshTokenExpirationMs:f.auth0RefreshTokenExpirationMs,redirectURI:f.auth0RedirectURI,returnToURI:f.auth0ReturnToURI,loginMethod:f.auth0LogInMethod,appInfo:this.appInfo,initialUserDetails:u,cookieKey:f.cookieKey,localStorageKey:f.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(f.inject&&(window.arweaveWallet=this),!f.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 Pr(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,...fr]}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 fr)t.addTag(e,n)}async sign(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),r=Lr(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),u=await Ar(c);return s.setSignature({id:Tr(u),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 ze.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:Lr(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:Br(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 Ar(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))}};Nr.walletName=lr,Nr.walletVersion=hr,Nr.ALL_PERMISSIONS=["ACCESS_ADDRESS","ACCESS_ALL_ADDRESSES","ACCESS_ARWEAVE_CONFIG","ACCESS_PUBLIC_KEY","DECRYPT","DISPATCH","ENCRYPT","SIGN_TRANSACTION","SIGNATURE"];var Dr=Nr;async function jr(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 $r(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),zr=a.n(Wr);function Hr(t){let{active:e,title:r,id:i,number:o,descriptions:s,rewards:a,size:c,isChecked:u,onCheckboxChange:l}=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:u,onChange:t=>l(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 qr(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}Hr.propTypes={active:zr().bool.isRequired,title:zr().string.isRequired,id:zr().any.isRequired,number:zr().number.isRequired,descriptions:zr().string,rewards:zr().string,size:zr().string.isRequired,isChecked:zr().bool.isRequired,onCheckboxChange:zr().func.isRequired};const Xr=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 Yr(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},ui={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},li=(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:ui;function hi(t,e){return t?t[e]||t.default||t:void 0}const fi=!1,di=!1,pi=!1,gi=t=>null!==t;function mi(t,{repeat:e,repeatType:n="loop"},r){const i=t.filter(gi),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:u,preRender:l,render:h,postRender:f}=s,d=()=>{const o=di?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),u.process(i),l.process(i),h.process(i),f.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(d))};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(d)),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),Ai=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,xi=1e-7,_i=12;function ki(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=Ai(s,r,i)-t,o>0?n=s:e=s}while(Math.abs(o)>xi&&++a<_i);return s}(e,0,1,t,n);return t=>0===t||1===t?t:Ai(i(t),e,r)}const Ri=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Pi=t=>e=>1-t(1-e),Ci=ki(.33,1.53,.69,.99),Ii=Pi(Ci),Oi=Ri(Ii),Bi=t=>(t*=2)<1?.5*Ii(t):.5*(2-Math.pow(2,-10*(t-1))),Ui=t=>1-Math.sin(Math.acos(t)),Li=Pi(Ui),Ni=Ri(Ui),Di=t=>/^0[^.\s]+$/u.test(t);let ji=yi,Mi=yi;const Vi=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Fi=t=>e=>"string"==typeof e&&e.startsWith(t),Ki=Fi("--"),$i=Fi("var(--"),Wi=t=>!!$i(t)&&zi.test(t.split("/*")[0].trim()),zi=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Hi=/^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=Hi.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 qi=(t,e,n)=>n>e?e:n<t?t:n,Xi={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Gi={...Xi,transform:t=>qi(0,1,t)},Yi={...Xi,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===Xi||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}},uo=new Set(["x","y","z"]),lo=ri.filter((t=>!uo.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=[Xi,eo,to,Qi,ro,no,{test:t=>"auto"===t,parse:t=>t}],go=t=>po.find(fo(t)),mo=new Set;let yo=!1,wo=!1;function vo(){if(wo){const t=Array.from(mo).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 lo.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,mo.forEach((t=>t.complete())),mo.clear()}function bo(){mo.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?(mo.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),mo.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,mo.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const So=t=>Math.round(1e5*t)/1e5,To=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Ao=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,xo=(t,e)=>n=>Boolean("string"==typeof n&&Ao.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),_o=(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}},ko={...Xi,transform:t=>Math.round((t=>qi(0,255,t))(t))},Ro={test:xo("rgb","red"),parse:_o("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+ko.transform(t)+", "+ko.transform(e)+", "+ko.transform(n)+", "+So(Gi.transform(r))+")"};const Po={test:xo("#"),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:Ro.transform},Co={test:xo("hsl","hue"),parse:_o("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=>Ro.test(t)||Po.test(t)||Co.test(t),parse:t=>Ro.test(t)?Ro.parse(t):Co.test(t)?Co.parse(t):Po.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Ro.transform(t):Co.transform(t)},Oo=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Bo="number",Uo="color",Lo="var",No="var(",Do="${}",jo=/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(jo,(t=>(Io.test(t)?(r.color.push(o),i.push(Uo),n.push(Io.parse(t))):t.startsWith(No)?(r.var.push(o),i.push(Lo),n.push(t)):(r.number.push(o),i.push(Bo),n.push(parseFloat(t))),++o,Do))).split(Do);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===Bo?So(t[o]):e===Uo?Io.transform(t[o]):t[o]}return i}}const Ko=t=>"number"==typeof t?0:t;const $o={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(Oo))||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 zo(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 Ho=/\b([a-z-]*)\(.*?\)/gu,Zo={...$o,getAnimatableNone:t=>{const e=t.match(Ho);return e?e.map(zo).join(" "):t}},qo={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},Xo={rotate:Qi,rotateX:Qi,rotateY:Qi,rotateZ:Qi,scale:Yi,scaleX:Yi,scaleY:Yi,scaleZ:Yi,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={...Xi,transform:Math.round},Yo={...qo,...Xo,zIndex:Go,size:eo,fillOpacity:Gi,strokeOpacity:Gi,numOctaves:Go},Jo={...Yo,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=$o),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=go(r),s=go(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||Di(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||di?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||!$o.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 ji(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 us{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(mi(t,this.options,e)),null==s||s(),void this.resolveFinishedPromise();this.options.duration=0}const u=this.initPlayback(t,e);!1!==u&&(this._resolved={keyframes:t,finalKeyframe:e,...u},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 ls=(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(ls(0,i-1,e))+", ";return`linear(${r.substring(0,r.length-2)})`};function fs(t,e){return e?t*(1e3/e):0}const ds=5;function ps(t,e,n){const r=Math.max(e-ds,0);return fs(n-t(r),e-r)}const gs={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},ms=.001;function ys({duration:t=gs.duration,bounce:e=gs.bounce,velocity:n=gs.velocity,mass:r=gs.mass}){let i,o;ji(t<=oi(gs.maxDuration),"Spring duration must be 10 seconds or less");let s=1-e;s=qi(gs.minDamping,gs.maxDamping,s),t=qi(gs.minDuration,gs.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 ms-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),u=vs(Math.pow(e,2),s);return(-i(e)+ms>0?-1:1)*((o-a)*c)/u}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-ms,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:gs.stiffness,damping:gs.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 As(t,e){return e.some((e=>void 0!==t[e]))}function xs(t=gs.visualDuration,e=gs.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:u,mass:l,duration:h,velocity:f,isResolvedFromDuration:d}=function(t){let e={velocity:gs.velocity,stiffness:gs.stiffness,damping:gs.damping,mass:gs.mass,isResolvedFromDuration:!1,...t};if(!As(t,Ts)&&As(t,Ss))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(1.2*n),i=r*r,o=2*qi(.05,1,1-t.bounce)*Math.sqrt(i);e={...e,mass:gs.mass,stiffness:i,damping:o}}else{const n=ys(t);e={...e,...n,mass:gs.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-si(n.velocity||0)}),p=f||0,g=u/(2*Math.sqrt(c*l)),m=s-o,y=si(Math.sqrt(c/l)),w=Math.abs(m)<5;let v;if(r||(r=w?gs.restSpeed.granular:gs.restSpeed.default),i||(i=w?gs.restDelta.granular:gs.restDelta.default),g<1){const t=vs(y,g);v=e=>{const n=Math.exp(-g*y*e);return s-n*((p+g*y*m)/t*Math.sin(t*e)+m*Math.cos(t*e))}}else if(1===g)v=t=>s-Math.exp(-y*t)*(m+(p+y*m)*t);else{const t=y*Math.sqrt(g*g-1);v=e=>{const n=Math.exp(-g*y*e),r=Math.min(t*e,300);return s-n*((p+g*y*m)*Math.sinh(r)+t*m*Math.cosh(r))/t}}const b={calculatedDuration:d&&h||null,next:t=>{const e=v(t);if(d)a.done=t>=h;else{let n=0;g<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 _s({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:c,restDelta:u=.5,restSpeed:l}){const h=t[0],f={done:!1,value:h},d=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let p=n*e;const g=h+p,m=void 0===s?g:s(g);m!==g&&(p=m-h);const y=t=>-p*Math.exp(-t/r),w=t=>m+y(t),v=t=>{const e=y(t),n=w(t);f.done=Math.abs(e)<=u,f.value=f.done?m:n};let b,E;const S=t=>{(t=>void 0!==a&&t<a||void 0!==c&&t>c)(f.value)&&(b=t,E=xs({keyframes:[f.value,d(f.value)],velocity:ps(w,t,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:l}))};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),f)}}}const ks=ki(.42,0,1,1),Rs=ki(0,0,.58,1),Ps=ki(.42,0,.58,1),Cs=t=>Array.isArray(t)&&"number"==typeof t[0],Is={linear:yi,easeIn:ks,easeInOut:Ps,easeOut:Rs,circIn:Ui,circInOut:Ni,circOut:Li,backIn:Ii,backInOut:Oi,backOut:Ci,anticipate:Bi},Os=t=>{if(Cs(t)){Mi(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,i]=t;return ki(e,n,r,i)}return"string"==typeof t?(Mi(void 0!==Is[t],`Invalid easing type '${t}'`),Is[t]):t},Bs=(t,e)=>n=>e(t(n)),Us=(...t)=>t.reduce(Bs),Ls=(t,e,n)=>t+(e-t)*n;function Ns(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 Ds(t,e){return n=>n>0?e:t}const js=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},Ms=[Po,Ro,Co];function Vs(t){const e=(t=>Ms.find((e=>e.test(t))))(t);if(ji(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===Co&&(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=Ns(a,r,t+1/3),o=Ns(a,r,t),s=Ns(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 Ds(t,e);const i={...n};return t=>(i.red=js(n.red,r.red,t),i.green=js(n.green,r.green,t),i.blue=js(n.blue,r.blue,t),i.alpha=Ls(n.alpha,r.alpha,t),Ro.transform(i))},Ks=new Set(["none","hidden"]);function $s(t,e){return n=>Ls(t,e,n)}function Ws(t){return"number"==typeof t?$s:"string"==typeof t?Wi(t)?Ds:Io.test(t)?Fs:Zs:Array.isArray(t)?zs:"object"==typeof t?Io.test(t)?Fs:Hs:Ds}function zs(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 Hs(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=$o.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):Us(zs(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):(ji(!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.`),Ds(t,e))};function qs(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Ls(t,e,n);return Ws(t)(t,e)}function Xs(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||qs,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=Us(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=ls(t[n],t[n+1],e);return s[n](r)};return n?e=>c(qi(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=ls(0,e,r);t.push(Ls(n,1,i))}}(e,t.length-1),e}function Ys({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(r)?r.map(Os):Os(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=Xs(s,e,{ease:Array.isArray(i)?i:(c=e,u=i,c.map((()=>u||Ps)).splice(0,c.length-1))});var c,u;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:_s,inertia:_s,tween:Ys,keyframes:Ys,spring:xs},ta=t=>t/100;class ea extends us{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]||Ys;let a,c;s!==Ys&&"number"!=typeof t[0]&&(a=Us(ta,qs(t[0],t[1])),t=[0,100]);const u=s({...this.options,keyframes:t});"mirror"===i&&(c=s({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===u.calculatedDuration&&(u.calculatedDuration=Es(u));const{calculatedDuration:l}=u,h=l+r;return{generator:u,mirroredGenerator:c,mapPercentToKeyframes:a,calculatedDuration:l,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:u,resolvedDuration:l}=n;if(null===this.startTime)return i.next(0);const{delay:h,repeat:f,repeatType:d,repeatDelay:p,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/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 m=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?m<0:m>u;this.currentTime=Math.max(m,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let w=this.currentTime,v=i;if(f){const t=Math.min(this.currentTime,u)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,f+1);Boolean(e%2)&&("reverse"===d?(n=1-n,p&&(n-=p/l)):"mirror"===d&&(v=o)),w=qi(0,1,n)*l}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>=u:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&E);return S&&void 0!==r&&(b.value=mi(a,this.options,r)),g&&g(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 ua||sa())||Cs(t)||Array.isArray(t)&&t.every(aa))}const ca=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,ua={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 la(t,e){return t?"function"==typeof t&&sa()?hs(t,e):Cs(t)?ca(t):Array.isArray(t)?t.map((t=>la(t,e)||ua.easeOut)):ua[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 u={[e]:n};c&&(u.offset=c);const l=la(a,i);return Array.isArray(l)&&(u.easing=l),t.animate(u,{delay:r,duration:i,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"})}function fa(t,e){t.timeline=e,t.onfinish=null}const da=ra((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const pa={anticipate:Bi,backInOut:Oi,circInOut:Ni};class ga extends us{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:u}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;var l;if("string"==typeof o&&sa()&&o in pa&&(o=pa[o]),rs((l=this.options).type)||"spring"===l.type||!aa(l.ease)){const{onComplete:e,onUpdate:n,motionValue:a,element:c,...u}=this.options,l=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,u);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,i=l.times,o=l.ease,s="keyframes"}const h=ha(a.owner.current,c,t,{...this.options,duration:r,times:i,ease:o});return h.startTime=null!=u?u:this.calcStartTime(),this.pendingTimeline?(fa(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;a.set(mi(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;fa(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,...u}=this.options,l=new ea({...u,keyframes:n,duration:r,type:i,ease:o,times:s,isGenerator:!0}),h=oi(this.time);t.setWithVelocity(l.sample(h-10).value,l.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 da()&&n&&na.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==i&&0!==o&&"inertia"!==s}}const ma=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=>ma()&&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:u=0}=r;u-=oi(c);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,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:u,...l}){return!!Object.keys(l).length})(a)||(l={...l,...li(t,l)}),l.duration&&(l.duration=oi(l.duration)),l.repeatDelay&&(l.repeatDelay=oi(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let h=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(h=!0)),(pi||fi)&&(h=!0,l.duration=0,l.delay=0),h&&!o&&void 0!==e.get()){const t=mi(l.keyframes,a);if(void 0!==t)return bi.update((()=>{l.onUpdate(t),l.onComplete()})),new ya([])}return!o&&ga.supports(l)?new ga(l):new ea(l)},va=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),ba=t=>Xr(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 Aa={current:void 0};class xa{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 Aa.current&&Aa.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 fs(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 _a(t,e){return new xa(t,e)}function ka(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,_a(n))}const Ra=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Pa="data-"+Ra("framerAppearId");function Ca(t){return t.props[Pa]}const Ia=t=>Boolean(t&&t.getVelocity);function Oa(t,e){const n=t.getValue("willChange");if(r=n,Boolean(Ia(r)&&r.add))return n.add(e);var r}function Ba({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Ua(t,e,{delay:n=0,transitionOverride:r,type:i}={}){var o;let{transition:s=t.getDefaultTransition(),transitionEnd:a,...c}=e;r&&(s=r);const u=[],l=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||l&&Ba(l,e))continue;const a={delay:n,...hi(s||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Ca(t);if(n){const t=window.MotionHandoffAnimation(n,e,bi);null!==t&&(a.startTime=t,h=!0)}}Oa(t,e),r.start(wa(e,r,i,t.shouldReduceMotion&&ii.has(e)?{type:!1}:a,t,h));const f=r.animation;f&&u.push(f)}return a&&Promise.all(u).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)ka(t,e,ba(o[e]))}(t,a)}))})),u}function La(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(Ua(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(Na).forEach(((t,r)=>{t.notify("AnimationStart",e),s.push(La(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 Na(t,e){return t.sortNodePosition(e)}const Da=ni.length;function ja(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&ja(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Da;n++){const r=ni[n],i=t.props[r];(Yr(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=>La(t,e,n)));r=Promise.all(i)}else if("string"==typeof e)r=La(t,e,n);else{const i="function"==typeof e?ti(t,e,n.custom):e;r=Promise.all(Ua(t,i,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Ka(t){let e=Fa(t),n=za(),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=ja(t.parent)||{},c=[],u=new Set;let l={},h=1/0;for(let e=0;e<Va;e++){const f=Ma[e],d=n[f],p=void 0!==s[f]?s[f]:a[f],g=Yr(p),m=f===o?d.isActive:null;!1===m&&(h=e);let y=p===a[f]&&p!==s[f]&&g;if(y&&r&&t.manuallyAnimateOnMount&&(y=!1),d.protectedKeys={...l},!d.isActive&&null===m||!p&&!d.prevProp||qr(p)||"boolean"==typeof p)continue;const w=$a(d.prevProp,p);let v=w||f===o&&d.isActive&&!y&&g||e>h&&g,b=!1;const E=Array.isArray(p)?p:[p];let S=E.reduce(i(f),{});!1===m&&(S={});const{prevResolvedValues:T={}}=d,A={...T,...S},x=e=>{v=!0,u.has(e)&&(b=!0,u.delete(e)),d.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in A){const e=S[t],n=T[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Xr(e)&&Xr(n)?!Gr(e,n):e!==n,r?null!=e?x(t):u.add(t):void 0!==e&&u.has(t)?x(t):d.protectedKeys[t]=!0}d.prevProp=p,d.prevResolvedValues=S,d.isActive&&(l={...l,...S}),r&&t.blockInitialAnimation&&(v=!1);v&&(!(y&&w)||b)&&c.push(...E.map((t=>({animation:t,options:{type:f}}))))}if(u.size){const e={};u.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 f=Boolean(c.length);return!r||!1!==s.initial&&s.initial!==s.animate||t.manuallyAnimateOnMount||(f=!1),r=!1,f?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=za(),r=!0}}}function $a(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 za(){return{animate:Wa(!0),whileInView:Wa(),whileHover:Wa(),whileTap:Wa(),whileDrag:Wa(),whileFocus:Wa(),exit:Wa()}}class Ha{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Za=0;const qa={animation:{Feature:class extends Ha{constructor(t){super(t),t.animationState||(t.animationState=Ka(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();qr(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 Ha{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(){}}}},Xa={x:!1,y:!1};function Ga(){return Xa.x||Xa.y}function Ya(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]=Ya(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 uc(t,e,n,r){return cc(t,e,(t=>e=>Qa(e)&&t(e,ac(e)))(n),r)}const lc=(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=lc(t.x,e.x),r=lc(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=fc(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:fc(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=fc(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=Us(uc(this.contextWindow,"pointermove",this.handlePointerMove),uc(this.contextWindow,"pointerup",this.handlePointerUp),uc(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ei(this.updatePoint)}}function fc(t,e){return e?{point:e(t.point)}:t}function dc(t,e){return{x:t.x-e.x,y:t.y-e.y}}function pc({point:t},e){return{point:t,delta:dc(t,mc(e)),offset:dc(t,gc(e)),velocity:yc(e,.1)}}function gc(t){return t[0]}function mc(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=mc(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 Ac(t,e,n,r=.5){t.origin=r,t.originPoint=Ls(e.min,e.max,t.origin),t.scale=Tc(n)/Tc(e),t.translate=Ls(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 xc(t,e,n,r){Ac(t.x,e.x,n.x,r?r.originX:void 0),Ac(t.y,e.y,n.y,r?r.originY:void 0)}function _c(t,e,n){t.min=n.min+e.min,t.max=t.min+Tc(e)}function kc(t,e,n){t.min=e.min-n.min,t.max=t.min+Tc(e)}function Rc(t,e,n){kc(t.x,e.x,n.x),kc(t.y,e.y,n.y)}function Pc(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 Cc(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 Oc(t,e,n){return{min:Bc(t,e),max:Bc(t,n)}}function Bc(t,e){return"number"==typeof t?t:t[e]||0}const Uc=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),Lc=()=>({x:{min:0,max:0},y:{min:0,max:0}});function Nc(t){return[t("x"),t("y")]}function Dc({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function jc(t){return void 0===t||1===t}function Mc({scale:t,scaleX:e,scaleY:n}){return!jc(t)||!jc(e)||!jc(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 $c(t,e,n){return n+e*(t-n)}function Wc(t,e,n,r,i){return void 0!==i&&(t=$c(t,i,r)),$c(t,n,r)+e}function zc(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 Hc(t,{x:e,y:n}){zc(t.x,e.translate,e.scale,e.originPoint),zc(t.y,n.translate,n.scale,n.originPoint)}const Zc=.999999999999,qc=1.0000000000001;function Xc(t,e){t.min=t.min+e,t.max=t.max+e}function Gc(t,e,n,r,i=.5){zc(t,e,n,Ls(t.min,t.max,i),r)}function Yc(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 Dc(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,tu=new WeakMap;class eu{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=Lc(),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?Xa[o]?null:(Xa[o]=!0,()=>{Xa[o]=!1}):Xa.x||Xa.y?null:(Xa.x=Xa.y=!0,()=>{Xa.x=Xa.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),Nc((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))),Oa(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:()=>Nc((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||!nu(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?Ls(e,t,r.min):Math.max(t,e):void 0!==n&&t>n&&(t=r?Ls(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:Pc(t.x,n,i),y:Pc(t.y,e,r)}}(r.layoutBox,e),this.elastic=function(t=Ic){return!1===t?t=0:!0===t&&(t=Ic),{x:Oc(t,"left","right"),y:Oc(t,"top","bottom")}}(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Nc((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&&(Xc(r.x,i.offset.x),Xc(r.y,i.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Cc(t.x,e.x),y:Cc(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=Dc(t))}return o}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{},c=Nc((s=>{if(!nu(s,e,this.currentDirection))return;let c=a&&a[s]||{};o&&(c={min:0,max:0});const u=r?200:1e6,l=r?40:1e7,h={type:"inertia",velocity:n?t[s]:0,bounceStiffness:u,bounceDamping:l,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 Oa(this.visualElement,t),n.start(wa(t,n,0,e,this.visualElement,!1))}stopAnimation(){Nc((t=>this.getAxisMotionValue(t).stop()))}pauseAnimation(){Nc((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){Nc((e=>{const{drag:n}=this.getProps();if(!nu(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]-Ls(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};Nc((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=ls(e.min,e.max-r,t.min):r>i&&(n=ls(t.min,t.max-i,e.min)),qi(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(),Nc((e=>{if(!nu(e,t,null))return;const n=this.getAxisMotionValue(e),{min:i,max:o}=this.constraints[e];n.set(Ls(i,o,r[e]))}))}addListeners(){if(!this.visualElement.current)return;tu.set(this.visualElement,this);const t=uc(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&&(Nc((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 nu(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}const ru=t=>(e,n)=>{t&&bi.postRender((()=>t(e,n)))};var iu=a(893);const ou=(0,e.createContext)(null);const su=(0,e.createContext)({}),au=(0,e.createContext)({}),cu={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function uu(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const lu={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!eo.test(t))return t;t=parseFloat(t)}return`${uu(t,e.target.x)}% ${uu(t,e.target.y)}%`}},hu={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=$o.parse(t);if(i.length>5)return r;const o=$o.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 u=Ls(a,c,.5);return"number"==typeof i[2+s]&&(i[2+s]/=u),"number"==typeof i[3+s]&&(i[3+s]/=u),o(i)}},fu={};const{schedule:du,cancel:pu}=vi(queueMicrotask,!1);class gu extends e.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=t;var o;o=yu,Object.assign(fu,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()})),cu.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(),du.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 mu(t){const[n,r]=function(){const t=(0,e.useContext)(ou);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)(su);return(0,iu.jsx)(gu,{...t,layoutGroup:i,switchLayoutGroup:(0,e.useContext)(au),isPresent:n,safeToRemove:r})}const yu={borderRadius:{...lu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:lu,borderTopRightRadius:lu,borderBottomLeftRadius:lu,borderBottomRightRadius:lu,boxShadow:hu},wu=["TopLeft","TopRight","BottomLeft","BottomRight"],vu=wu.length,bu=t=>"string"==typeof t?parseFloat(t):t,Eu=t=>"number"==typeof t||eo.test(t);function Su(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Tu=xu(0,.5,Li),Au=xu(.5,.95,yi);function xu(t,e,n){return r=>r<t?0:r>e?1:n(ls(t,e,r))}function _u(t,e){t.min=e.min,t.max=e.max}function ku(t,e){_u(t.x,e.x),_u(t.y,e.y)}function Ru(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Pu(t,e,n,r,i){return t=$c(t-=e,1/n,r),void 0!==i&&(t=$c(t,1/i,r)),t}function Cu(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=Ls(s.min,s.max,e/100)-s.min);if("number"!=typeof e)return;let a=Ls(o.min,o.max,r);t===o&&(a-=e),t.min=Pu(t.min,e,n,a,i),t.max=Pu(t.max,e,n,a,i)}(t,e[n],e[r],e[i],e.scale,o,s)}const Iu=["x","scaleX","originX"],Ou=["y","scaleY","originY"];function Bu(t,e,n,r){Cu(t.x,e,Iu,n?n.x:void 0,r?r.x:void 0),Cu(t.y,e,Ou,n?n.y:void 0,r?r.y:void 0)}function Uu(t){return 0===t.translate&&1===t.scale}function Lu(t){return Uu(t.x)&&Uu(t.y)}function Nu(t,e){return t.min===e.min&&t.max===e.max}function Du(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function ju(t,e){return Du(t.x,e.x)&&Du(t.y,e.y)}function Mu(t){return Tc(t.x)/Tc(t.y)}function Vu(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Fu{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 Ku=(t,e)=>t.depth-e.depth;class $u{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(Ku),this.isDirty=!1,this.children.forEach(t)}}function Wu(t){const e=Ia(t)?t.get():t;return va(e)?e.toValue():e}function zu(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 Hu={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Zu="undefined"!=typeof window&&void 0!==window.MotionDebug,qu=["","X","Y","Z"],Xu={visibility:"hidden"};let Gu=0;function Yu(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Ju(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Ca(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&&Ju(r)}function Qu({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(t={},n=(null==e?void 0:e())){this.id=Gu++,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,Zu&&(Hu.totalNodes=Hu.resolvedTargetDeltas=Hu.recalculatedProjection=0),this.nodes.forEach(nl),this.nodes.forEach(ul),this.nodes.forEach(ll),this.nodes.forEach(rl),Zu&&window.MotionDebug.record(Hu)},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 $u)}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=zu(r,250),cu.hasAnimatedSinceResize&&(cu.hasAnimatedSinceResize=!1,this.nodes.forEach(cl))}))}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()||ml,{onLayoutAnimationStart:o,onLayoutAnimationComplete:a}=s.getProps(),c=!this.targetLayout||!ju(this.targetLayout,r)||n,u=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||u||e&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,u);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||cl(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(hl),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&&Ju(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(ol);this.isUpdating||this.nodes.forEach(sl),this.isUpdating=!1,this.nodes.forEach(al),this.nodes.forEach(tl),this.nodes.forEach(el),this.clearAllSnapshots();const t=ss.now();Si.delta=qi(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,du.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(il),this.sharedNodes.forEach(fl)}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=Lc(),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&&!Lu(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)),vl((r=n).x),vl(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 Lc();const n=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(El))){const{scroll:t}=this.root;t&&(Xc(n.x,t.offset.x),Xc(n.y,t.offset.y))}return n}removeElementScroll(t){var e;const n=Lc();if(ku(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&&ku(n,t),Xc(n.x,i.offset.x),Xc(n.y,i.offset.y))}return n}applyTransform(t,e=!1){const n=Lc();ku(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&&Yc(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),Vc(r.latestValues)&&Yc(n,r.latestValues)}return Vc(this.latestValues)&&Yc(n,this.latestValues),n}removeTransform(t){const e=Lc();ku(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=Lc();ku(r,n.measurePageBox()),Bu(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return Vc(this.latestValues)&&Bu(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=Lc(),this.relativeTargetOrigin=Lc(),Rc(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),ku(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var s,a,c;if(this.target||(this.target=Lc(),this.targetWithTransforms=Lc()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),s=this.target,a=this.relativeTarget,c=this.relativeParent.target,_c(s.x,a.x,c.x),_c(s.y,a.y,c.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):ku(this.target,this.layout.layoutBox),Hc(this.target,this.targetDelta)):ku(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=Lc(),this.relativeTargetOrigin=Lc(),Rc(this.relativeTargetOrigin,this.target,t.target),ku(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Zu&&Hu.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;ku(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&&Yc(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),s&&(e.x*=s.x.scale,e.y*=s.y.scale,Hc(t,s)),r&&Vc(o.latestValues)&&Yc(t,o.latestValues))}e.x<qc&&e.x>Zc&&(e.x=1),e.y<qc&&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=Lc());const{target:c}=e;c?(this.projectionDelta&&this.prevProjectionDelta?(Ru(this.prevProjectionDelta.x,this.projectionDelta.x),Ru(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),xc(this.projectionDelta,this.layoutCorrected,c,this.latestValues),this.treeScale.x===s&&this.treeScale.y===a&&Vu(this.projectionDelta.x,this.prevProjectionDelta.x)&&Vu(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",c)),Zu&&Hu.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=Uc(),this.projectionDelta=Uc(),this.projectionDeltaWithTransform=Uc()}setAnimationOrigin(t,e=!1){const n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},o=Uc();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const s=Lc(),a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,l=Boolean(a&&!u&&!0===this.options.crossfade&&!this.path.some(gl));let h;this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;dl(o.x,t.x,n),dl(o.y,t.y,n),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Rc(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox),function(t,e,n,r){pl(t.x,e.x,n.x,r),pl(t.y,e.y,n.y,r)}(this.relativeTarget,this.relativeTargetOrigin,s,n),h&&function(t,e){return Nu(t.x,e.x)&&Nu(t.y,e.y)}(this.relativeTarget,h)&&(this.isProjectionDirty=!1),h||(h=Lc()),ku(h,this.relativeTarget)),a&&(this.animationValues=i,function(t,e,n,r,i,o){i?(t.opacity=Ls(0,void 0!==n.opacity?n.opacity:1,Tu(r)),t.opacityExit=Ls(void 0!==e.opacity?e.opacity:1,0,Au(r))):o&&(t.opacity=Ls(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let i=0;i<vu;i++){const o=`border${wu[i]}Radius`;let s=Su(e,o),a=Su(n,o);void 0===s&&void 0===a||(s||(s=0),a||(a=0),0===s||0===a||Eu(s)===Eu(a)?(t[o]=Math.max(Ls(bu(s),bu(a),r),0),(to.test(a)||to.test(s))&&(t[o]+="%")):t[o]=a)}(e.rotate||n.rotate)&&(t.rotate=Ls(e.rotate||0,n.rotate||0,r))}(i,r,this.latestValues,n,l,u)),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((()=>{cu.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,n){const r=Ia(t)?t:_a(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&&bl(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Lc();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}ku(e,n),Yc(e,i),xc(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Fu);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&&Yu("z",t,r,this.animationValues);for(let e=0;e<qu.length;e++)Yu(`rotate${qu[e]}`,t,r,this.animationValues),Yu(`skew${qu[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 Xu;const r={visibility:""},i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=Wu(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=Wu(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 fu){if(void 0===s[t])continue;const{correct:e,applyTo:n}=fu[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?Wu(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(ol),this.root.sharedNodes.clear()}}}function tl(t){t.updateLayout()}function el(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?Nc((t=>{const r=o?n.measuredBox[t]:n.layoutBox[t],i=Tc(r);r.min=e[t].min,r.max=r.min+i})):bl(i,n.layoutBox,e)&&Nc((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=Uc();xc(s,e,n.layoutBox);const a=Uc();o?xc(a,t.applyTransform(r,!0),n.measuredBox):xc(a,e,n.layoutBox);const c=!Lu(s);let u=!1;if(!t.resumeFrom){const r=t.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:i,layout:o}=r;if(i&&o){const s=Lc();Rc(s,n.layoutBox,i.layoutBox);const a=Lc();Rc(a,e,o.layoutBox),ju(s,a)||(u=!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:u})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function nl(t){Zu&&Hu.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 rl(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function il(t){t.clearSnapshot()}function ol(t){t.clearMeasurements()}function sl(t){t.isLayoutDirty=!1}function al(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function cl(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function ul(t){t.resolveTargetDelta()}function ll(t){t.calcProjection()}function hl(t){t.resetSkewAndRotation()}function fl(t){t.removeLeadSnapshot()}function dl(t,e,n){t.translate=Ls(e.translate,0,n),t.scale=Ls(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function pl(t,e,n,r){t.min=Ls(e.min,n.min,r),t.max=Ls(e.max,n.max,r)}function gl(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const ml={duration:.45,ease:[.4,0,.1,1]},yl=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),wl=yl("applewebkit/")&&!yl("chrome/")?Math.round:yi;function vl(t){t.min=wl(t.min),t.max=wl(t.max)}function bl(t,e,n){return"position"===t||"preserve-aspect"===t&&(r=Mu(e),i=Mu(n),o=.2,!(Math.abs(r-i)<=o));var r,i,o}function El(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const Sl=Qu({attachResizeListener:(t,e)=>cc(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Tl={current:void 0},Al=Qu({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Tl.current){const t=new Sl({});t.mount(window),t.setOptions({layoutScroll:!0}),Tl.current=t}return Tl.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),xl={pan:{Feature:class extends Ha{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:ru(t),onStart:ru(e),onMove:n,onEnd:(t,e)=>{delete this.session,r&&bi.postRender((()=>r(t,e)))}}}mount(){this.removePointerDownListener=uc(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 Ha{constructor(t){super(t),this.removeGroupControls=yi,this.removeListeners=yi,this.controls=new eu(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:Al,MeasureLayout:mu}};function _l(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 kl(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 Rl=new WeakMap,Pl=new WeakMap,Cl=t=>{const e=Rl.get(t.target);e&&e(t)},Il=t=>{t.forEach(Cl)};function Ol(t,e,n){const r=function({root:t,...e}){const n=t||document;Pl.has(n)||Pl.set(n,{});const r=Pl.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(Il,{root:t,...e})),r[i]}(e);return Rl.set(t,n),r.observe(t),()=>{Rl.delete(t),r.unobserve(t)}}const Bl={some:0,all:1};const Ul={inView:{Feature:class extends Ha{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:Bl[r]};return Ol(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 Ha{mount(){const{current:t}=this.node;t&&(this.unmount=sc(t,(t=>(kl(this.node,t,"Start"),(t,{success:e})=>kl(this.node,t,e?"End":"Cancel"))),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends Ha{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=Us(cc(this.node.current,"focus",(()=>this.onFocus())),cc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Ha{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[r,i,o]=Ya(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=>(_l(this.node,t,"Start"),t=>_l(this.node,t,"End")))))}unmount(){}}}},Ll={layout:{ProjectionNode:Al,MeasureLayout:mu}},Nl=(0,e.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Dl=(0,e.createContext)({}),jl="undefined"!=typeof window,Ml=jl?e.useLayoutEffect:e.useEffect,Vl=(0,e.createContext)({strict:!1});function Fl(t,n,r,i,o){var s,a;const{visualElement:c}=(0,e.useContext)(Dl),u=(0,e.useContext)(Vl),l=(0,e.useContext)(ou),h=(0,e.useContext)(Nl).reducedMotion,f=(0,e.useRef)(null);i=i||u.renderer,!f.current&&i&&(f.current=i(t,{visualState:n,parent:c,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:h}));const d=f.current,p=(0,e.useContext)(au);!d||d.projection||!o||"html"!==d.type&&"svg"!==d.type||function(t,e,n,r){const{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:c,layoutRoot:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Kl(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:u})}(f.current,r,o,p);const g=(0,e.useRef)(!1);(0,e.useInsertionEffect)((()=>{d&&g.current&&d.update(r,l)}));const m=r[Pa],y=(0,e.useRef)(Boolean(m)&&!(null===(s=window.MotionHandoffIsComplete)||void 0===s?void 0:s.call(window,m))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,m)));return Ml((()=>{d&&(g.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),du.render(d.render),y.current&&d.animationState&&d.animationState.animateChanges())})),(0,e.useEffect)((()=>{d&&(!y.current&&d.animationState&&d.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,m)})),y.current=!1))})),d}function Kl(t){if(t)return!1!==t.options.allowProjection?t.projection:Kl(t.parent)}function $l(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 Wl(t){return qr(t.animate)||ni.some((e=>Yr(t[e])))}function zl(t){return Boolean(Wl(t)||t.variants)}function Hl(t){const{initial:n,animate:r}=function(t,e){if(Wl(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Yr(e)?e:void 0,animate:Yr(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,e.useContext)(Dl));return(0,e.useMemo)((()=>({initial:n,animate:r})),[Zl(n),Zl(r)])}function Zl(t){return Array.isArray(t)?t.join(" "):t}const ql={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"]},Xl={};for(const t in ql)Xl[t]={isEnabled:e=>ql[t].some((t=>!!e[t]))};const Gl=Symbol.for("motionComponentSymbol");function Yl({preloadedFeatures:t,createVisualElement:n,useRender:r,useVisualState:i,Component:o}){t&&function(t){for(const e in t)Xl[e]={...Xl[e],...t[e]}}(t);const s=(0,e.forwardRef)((function(t,s){let a;const c={...(0,e.useContext)(Nl),...t,layoutId:Jl(t)},{isStatic:u}=c,l=Hl(t),h=i(t,u);if(!u&&jl){!function(t,n){(0,e.useContext)(Vl).strict;0}();const t=function(t){const{drag:e,layout:n}=Xl;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,l.visualElement=Fl(o,h,c,n,t.ProjectionNode)}return(0,iu.jsxs)(Dl.Provider,{value:l,children:[a&&l.visualElement?(0,iu.jsx)(a,{visualElement:l.visualElement,...c}):null,r(o,t,$l(h,l.visualElement,s),h,u,l.visualElement)]})}));return s[Gl]=o,s}function Jl({layoutId:t}){const n=(0,e.useContext)(su).id;return n&&void 0!==t?n+"-"+t:t}const Ql=["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("-")&&!!(Ql.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:Ra(n),e.attrs[n])}function ih(t,{layout:e,layoutId:n}){return ii.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!fu[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)(Dl),o=(0,e.useContext)(ou),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]=Wu(o[t]);let{initial:s,animate:a}=t;const c=Wl(t),u=zl(t);e&&u&&!c&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let l=!!n&&!1===n.initial;l=l||!1===s;const h=l?a:s;if(h&&"boolean"!=typeof h&&!qr(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[l?e.length-1:0]}null!==e&&(i[t]=e)}for(const e in t)i[e]=t[e]}}}return i}const uh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),lh=()=>({...uh(),attrs:{}}),hh=(t,e)=>e&&"number"==typeof t?e.transform(t):t,fh={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},dh=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,Yo[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<dh;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,Yo[s]);c||(i=!1,r+=`${fh[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 gh(t,e,n){return"string"==typeof t?t:eo.transform(e+n*t)}const mh={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,...u},l,h){if(ph(t,u,h),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:f,style:d,dimensions:p}=t;f.transform&&(p&&(d.transform=f.transform),delete f.transform),p&&(void 0!==i||void 0!==o||d.transform)&&(d.transformOrigin=function(t,e,n){return`${gh(e,t.x,t.width)} ${gh(n,t.y,t.height)}`}(p,void 0!==i?i:.5,void 0!==o?o:.5)),void 0!==e&&(f.x=e),void 0!==n&&(f.y=n),void 0!==r&&(f.scale=r),void 0!==s&&function(t,e,n=1,r=0,i=!0){t.pathLength=1;const o=i?mh:yh;t[o.offset]=eo.transform(-r);const s=eo.transform(e),a=eo.transform(n);t[o.array]=`${s} ${a}`}(f,s,a,c,!1)}const vh=t=>"string"==typeof t&&"svg"===t.toLowerCase(),bh={useVisualState:ah({scrapeMotionValuesFromProps:sh,createRenderState:lh,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:uh})};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=uh();return ph(e,n,t),Object.assign({},e.vars,e.style)}),[n])}(t,n)),r}function Ah(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 xh=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 _h(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||xh.has(t)}let kh=t=>!_h(t);try{(Rh=require("@emotion/is-prop-valid").default)&&(kh=t=>t.startsWith("on")?!_h(t):Rh(t))}catch(Yp){}var Rh;function Ph(t,n,r,i){const o=(0,e.useMemo)((()=>{const e=lh();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 Ch(t=!1){return(n,r,i,{latestValues:o},s)=>{const a=(th(n)?Ph:Ah)(r,o,s,n),c=function(t,e,n){const r={};for(const i in t)"values"===i&&"object"==typeof t.values||(kh(i)||!0===n&&_h(i)||!e&&!_h(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}(r,"string"==typeof n,t),u=n!==e.Fragment?{...c,...a,ref:i}:{},{children:l}=r,h=(0,e.useMemo)((()=>Ia(l)?l.get():l),[l]);return(0,e.createElement)(n,{...u,children:h})}}function Ih(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Yl({...th(n)?bh:Eh,preloadedFeatures:t,useRender:Ch(r),createVisualElement:e,Component:n})}}const Oh={current:null},Bh={current:!1};const Uh=new WeakMap,Lh=[...po,Io,$o],Nh=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Dh{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=Wl(e),this.isVariantNode=zl(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:u,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==a[t]&&Ia(e)&&e.set(a[t],!1)}}mount(t){this.current=t,Uh.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))),Bh.current||function(){if(Bh.current=!0,jl)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Oh.current=t.matches;t.addListener(e),e()}else Oh.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Oh.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Uh.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 Xl){const e=Xl[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):Lc()}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<Nh.length;e++){const n=Nh[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,_a(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,_a(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=_a(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)||Di(r))?r=parseFloat(r):!(t=>Lh.find(fo(t)))(r)&&$o.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 jh extends Dh{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 jh{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 jh{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Lc}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:Ra(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({...qa,...Ul,...xl,...Ll},((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,u]=(0,e.useState)({length:!1,capital:!1,number:!1,symbol:!1});(0,e.useEffect)((()=>{u({length:i.length>=8,capital:/[A-Z]/.test(i),number:/[0-9]/.test(i),symbol:/[!@#$%^&*(),.?":{}|<>]/.test(i)})}),[i]);const l=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()=>{l&&r({method:"pin",value:i})},disabled:!l,className:"w-full py-3 px-4 rounded-lg font-semibold ".concat(l?"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 $h=[{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)($h),[s,a]=(0,e.useState)(!1),[c,u]=(0,e.useState)(0);(0,e.useEffect)((()=>{if(s){const t=setInterval((()=>{u((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 zh(t){let{onSignUpSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}=t;const[a,c]=(0,e.useState)({email:"",username:"",password:"",confirmPassword:""}),[u,l]=(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"},u&&n().createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},u),n().createElement($r,{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)):l(e.message||"Sign up failed")}catch(t){l("Sign up failed. Please try again.")}else l("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 Hh(t){let{setOthentConnected:n,dataRequester:r,NoAccount:i,NoModel:o,activeModels:s,avatar:a,setAvatar:c,traits:u,setTraits:l,requestData:h,handleConnectionSelection:f,changeGranted:d,granted:p,allowSubmit:g,rejectDataRequest:m,sendDataRequest:y,isAuthenticated:w,onClose:v,onLoginSuccess:b,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T,accountInfo:A}=t;const[x,_]=(0,e.useState)(null),[k,R]=(0,e.useState)(!1),P=(0,e.useRef)(null),[C,I]=(0,e.useState)({}),O=(t,e)=>{console.log(t," is being changed check to:",e),I((n=>({...n,[t]:e}))),d(e?1:-1);const n=h[t];f(r,t,n.index,n.type,n.reward,e),console.log(n," Selection registered"),f(r,t,n.index,n.type,n.reward,!0)},[B,U]=(0,e.useState)((()=>{var t;return w?A&&(null===(t=A.models)||void 0===t?void 0:t.length)>0?"datarequests":"onboarding":"login"})),[L,N]=(0,e.useState)({username:"",password:""}),[D,j]=(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=>{P.current&&!P.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({...L,[t.target.name]:t.target.value})},F=async t=>{t.preventDefault();try{_(null);const t={details:{username:L.username,password:L.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",L.username),await K(L.username)}catch(t){console.error("Login failed:",t),_("Invalid username or password")}},K=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];R(!0);try{await b(t,e);_(null)}catch(t){console.error("Login process failed:",t),_("Failed to complete login process")}finally{R(!1)}},$=()=>{U("security")},W=t=>{"othent"===t.method?E(!0):"pin"===t.method&&T(t.value),U("datarequests")},z=t=>{let{dataRequester:e,granted:n,allowSubmit:r,rejectDataRequest:i,sendDataRequest:o,activeModels:s,requestData:a,handleConnectionSelection:c,changeGranted:u,avatar:l,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?l:"Traits"===n.type&&h;return React.createElement(Hr,{key:t,active:r,title:n.type,id:n,number:e,descriptions:n.descriptions,rewards:n.reward,size:t,isChecked:!!C[t],onCheckboxChange:e=>O(t,e)})})))))};return(0,e.useEffect)((()=>{var t;w&&A&&((null===(t=A.models)||void 0===t?void 0:t.length)>0?U("datarequests"):U("onboarding"))}),[w,A]),(0,e.useEffect)((()=>()=>{j(!1)}),[]),(0,e.useEffect)((()=>{}),[w,A]),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:P,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(B){case"signup":return React.createElement(zh,{onSignUpSuccess:K,setOthentUser:E,setHashedOthentSub:S,setEncryptedPin:T});case"onboarding":return React.createElement(Wh,{onComplete:$});case"security":return React.createElement(Kh,{onComplete:W});case"datarequests":return React.createElement(z,{dataRequester:r,granted:p,allowSubmit:g,rejectDataRequest:m,sendDataRequest:y,activeModels:s,requestData:h,handleConnectionSelection:f,changeGranted:d,avatar:a,traits:u});default:return React.createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},x&&React.createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},x),React.createElement($r,{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:L.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:L.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:()=>U("signup"),className:"w-full text-center text-blue-500 hover:text-blue-600"},"Don't have an account? Sign up"))}})())))}class Zh extends Error{constructor(t,e,n){super("object"==typeof e?e.message:e||t,{cause:"object"==typeof e?e.cause:n}),this.type=t,this.name="TypedError",Object.setPrototypeOf(this,Zh.prototype)}}const qh="ERR_INVALID_VALUE",Xh="ERR_UNEXPECTED_VALUE",Gh="ERR_UNEXPECTED_TYPE",Yh="ERR_PARSE";function Jh(t,e){const n={};for(const r in t){const i=t[r];if(!i)continue;let o,s;"function"==typeof i?(o=r,s=i):[o,s]=i;try{const t=s(e(o));void 0!==t&&(n[r]=t)}catch(t){throw new Zh(Yh,`Parser for "${r}" property failed${o===r?"":`. Source field: "${o}"`}`,t)}}return n}function Qh(t){let e=t;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){throw new Zh(qh,{cause:t})}if("object"!=typeof e||!e||Array.isArray(e))throw new Zh(Xh);return e}function tf(t,e){return n=>{const r=r=>{if(!n||void 0!==r)try{return e(r)}catch(e){throw new Zh(Yh,{message:`"${t}" transformer failed to parse the value`,cause:e})}};return Object.assign(r,{isValid(t){try{return r(t),!0}catch{return!1}}})}}function ef(t,e){return tf(e||"object",(e=>{const n=Qh(e);return Jh(t,(t=>n[t]))}))}function nf(t){throw new Zh(Gh,`Unexpected value received: ${JSON.stringify(t)}`)}tf("boolean",(t=>{if("boolean"==typeof t)return t;const e=String(t);return"1"===e||"true"===e||"0"!==e&&"false"!==e&&void nf(t)}));const rf=tf("string",(t=>{if("string"==typeof t||"number"==typeof t)return t.toString();nf(t)})),of=tf("number",(t=>{if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);if(!Number.isNaN(e))return e}nf(t)}));tf("date",(t=>t instanceof Date?t:new Date(1e3*of()(t))));function sf(t){return/^#[\da-f]{6}$/i.test(t)}function af(t){const e=t.replace(/\s/g,"").toLowerCase();if(sf(e))return e;if(function(t){return/^#[\da-f]{3}$/i.test(t)}(e)){let t="#";for(let n=0;n<3;n+=1)t+=e[1+n].repeat(2);return t}const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${t}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((t,e)=>{const n=parseInt(e,10).toString(16);return t+(1===n.length?"0":"")+n}),"#")}const cf=tf("rgb",(t=>af(rf()(t)))),uf=tf("themeParams",(t=>{const e=cf(!0);return Object.entries(Qh(t)).reduce(((t,[n,r])=>(t[function(t){return t.replace(/_[a-z]/g,(t=>t[1].toUpperCase()))}(n)]=e(r),t)),{})}));class lf extends Error{constructor(t,e,n){super("object"==typeof e?e.message:e||t,{cause:"object"==typeof e?e.cause:n}),this.type=t,this.name="TypedError",Object.setPrototypeOf(this,lf.prototype)}}function hf(t){return t.replace(/[A-Z]/g,(t=>`_${t.toLowerCase()}`))}const ff="ERR_INVALID_VALUE",df="ERR_UNEXPECTED_VALUE",pf="ERR_UNEXPECTED_TYPE",gf="ERR_PARSE";function mf(t,e){const n={};for(const r in t){const i=t[r];if(!i)continue;let o,s;"function"==typeof i?(o=r,s=i):[o,s]=i;try{const t=s(e(o));void 0!==t&&(n[r]=t)}catch(t){throw new lf(gf,`Parser for "${r}" property failed${o===r?"":`. Source field: "${o}"`}`,t)}}return n}function yf(t){let e=t;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){throw new lf(ff,{cause:t})}if("object"!=typeof e||!e||Array.isArray(e))throw new lf(df);return e}function wf(t,e){return n=>{const r=r=>{if(!n||void 0!==r)try{return e(r)}catch(e){throw new lf(gf,{message:`"${t}" transformer failed to parse the value`,cause:e})}};return Object.assign(r,{isValid(t){try{return r(t),!0}catch{return!1}}})}}function vf(t,e){return wf(e||"object",(e=>{const n=yf(e);return mf(t,(t=>n[t]))}))}function bf(t){throw new lf(pf,`Unexpected value received: ${JSON.stringify(t)}`)}const Ef=wf("boolean",(t=>{if("boolean"==typeof t)return t;const e=String(t);return"1"===e||"true"===e||"0"!==e&&"false"!==e&&void bf(t)})),Sf=wf("string",(t=>{if("string"==typeof t||"number"==typeof t)return t.toString();bf(t)})),Tf=wf("number",(t=>{if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);if(!Number.isNaN(e))return e}bf(t)})),Af=wf("date",(t=>t instanceof Date?t:new Date(1e3*Tf()(t))));function xf(t,e){return wf(e||"searchParams",(e=>{"string"!=typeof e&&!(e instanceof URLSearchParams)&&bf(e);const n="string"==typeof e?new URLSearchParams(e):e;return mf(t,(t=>{const e=n.get(t);return null===e?void 0:e}))}))}function _f(t){for(const e in t)t[e]=[hf(e),t[e]];return t}const kf=t=>{const e=Tf(),n=Tf(!0),r=Sf(),i=Sf(!0),o=Ef(!0),s=vf(_f({addedToAttachmentMenu:o,allowsWriteToPm:o,firstName:r,id:e,isBot:o,isPremium:o,languageCode:i,lastName:i,photoUrl:i,username:i}),"User")(!0);return xf(_f({authDate:Af(),canSendAfter:n,chat:vf(_f({id:e,type:r,title:r,photoUrl:i,username:i}),"Chat")(!0),chatInstance:i,chatType:i,hash:r,queryId:i,receiver:s,startParam:i,signature:r,user:s}),"initData")(t)};const Rf=wf("rgb",(t=>function(t){const e=t.replace(/\s/g,"").toLowerCase();if(function(t){return/^#[\da-f]{6}$/i.test(t)}(e))return e;if(function(t){return/^#[\da-f]{3}$/i.test(t)}(e)){let t="#";for(let n=0;n<3;n+=1)t+=e[1+n].repeat(2);return t}const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${t}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((t,e)=>{const n=parseInt(e,10).toString(16);return t+(1===n.length?"0":"")+n}),"#")}(Sf()(t)))),Pf=wf("themeParams",(t=>{const e=Rf(!0);return Object.entries(yf(t)).reduce(((t,[n,r])=>(t[function(t){return t.replace(/_[a-z]/g,(t=>t[1].toUpperCase()))}(n)]=e(r),t)),{})}));function Cf(t){return JSON.stringify(Object.fromEntries(Object.entries(t).map((([t,e])=>[hf(t),e]))))}const If=t=>{const e=Sf(),n=Sf(!0),r=Ef(!0);return xf({botInline:["tgWebAppBotInline",r],defaultColors:["tgWebAppDefaultColors",Pf(!0)],fullscreen:["tgWebAppFullscreen",r],initData:["tgWebAppData",kf(!0)],initDataRaw:["tgWebAppData",n],platform:["tgWebAppPlatform",e],showSettings:["tgWebAppShowSettings",r],startParam:["tgWebAppStartParam",n],themeParams:["tgWebAppThemeParams",Pf()],version:["tgWebAppVersion",e]},"launchParams")(t)};function Of(t){const{initDataRaw:e,startParam:n,showSettings:r,botInline:i,fullscreen:o,defaultColors:s}=t,a=new URLSearchParams;return a.set("tgWebAppPlatform",t.platform),a.set("tgWebAppThemeParams",Cf(t.themeParams)),a.set("tgWebAppVersion",t.version),e&&a.set("tgWebAppData",e),n&&a.set("tgWebAppStartParam",n),"boolean"==typeof r&&a.set("tgWebAppShowSettings",r?"1":"0"),"boolean"==typeof i&&a.set("tgWebAppBotInline",i?"1":"0"),"boolean"==typeof o&&a.set("tgWebAppFullscreen",o?"1":"0"),s&&a.set("tgWebAppDefaultColors",Cf(s)),a.toString()}const Bf=vf({eventType:Sf(),eventData:t=>t},"miniAppsMessage"),Uf=wf("fn",(t=>{if("function"==typeof t)return t;bf(t)}));const Lf=vf({TelegramWebviewProxy:vf({postEvent:Uf()})()});function Nf(t){return Lf().isValid(t)}var Df=Object.defineProperty,jf=(t,e,n)=>((t,e,n)=>e in t?Df(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);let Mf=class t extends Error{constructor(e,n,r){super("object"==typeof n?n.message:n||e,{cause:"object"==typeof n?n.cause:r}),this.type=e,this.name="TypedError",Object.setPrototypeOf(this,t.prototype)}};function Vf(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function Ff(...t){const e=t.flat(1);return[e.push.bind(e),()=>{e.forEach((t=>{t()}))}]}function Kf(t){return e=>function(t,e){return t instanceof Mf&&t.type===e}(e,t)}const $f="ERR_ABORTED",Wf="ERR_CANCELED",zf="ERR_TIMED_OUT";function Hf(t){return new Mf($f,{cause:t})}Kf(zf),Kf($f),Kf(Wf);function Zf(t,e){return t.reject=e.reject,t}class qf extends Promise{constructor(t,e){let n,r,i,o;"function"==typeof t?(n=t,r=e):r=t,super(((t,e)=>{r||(r={});const{abortSignal:s}=r;if(s&&s.aborted)return e(Hf(s.reason));const[a,c]=Ff(),u=t=>(...e)=>(c(),t(...e)),l=new AbortController,{signal:h}=l;o=u((t=>{l.abort(t),e(t)})),i=u(t),s&&a(Vf(s,"abort",(()=>{o(Hf(s.reason))})));const{timeout:f}=r;if(f){const t=setTimeout((()=>{o(new Mf(zf,`Timeout reached: ${f}ms`))}),f);a((()=>{clearTimeout(t)}))}n&&n(i,o,h)})),jf(this,"reject"),this.reject=o}static withFn(t,e){return new qf(((e,n,r)=>{try{const i=t(r);return i instanceof Promise?i.then(e,n):e(i)}catch(t){n(t)}}),e)}static resolve(t){return new qf((e=>{e(t)}))}static reject(t){return new qf(((e,n)=>{n(t)}))}cancel(){this.reject(new Mf(Wf))}catch(t){return this.then(void 0,t)}finally(t){return Zf(super.finally(t),this)}then(t,e){return Zf(super.then(t,e),this)}}function Xf(t,e){return t.resolve=e.resolve,t}let Gf=class t extends qf{constructor(t,e){let n,r,i;"function"==typeof t?(n=t,r=e):r=t,super(((t,e,r)=>{i=t,n&&n(t,e,r)}),r),jf(this,"resolve"),this.resolve=i}static withFn(e,n){return new t(((t,n,r)=>qf.withFn(e,{abortSignal:r}).then(t,n)),n)}static resolve(e){return new t((t=>{t(e)}))}static reject(e){return new t(((t,n)=>{n(e)}))}catch(t){return this.then(void 0,t)}finally(t){return Xf(super.finally(t),this)}then(t,e){return Xf(super.then(t,e),this)}};function Yf(t){return`tapps/${t}`}function Jf(t,e){sessionStorage.setItem(Yf(t),JSON.stringify(e))}function Qf(t){const e=sessionStorage.getItem(Yf(t));try{return e?JSON.parse(e):void 0}catch{}}function td(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}function ed(t,e){e||(e={});const{textColor:n,bgColor:r,shouldLog:i=!0}=e;function o(e,...o){if(!i||"function"==typeof i&&!i())return;const s="font-weight:bold;padding:0 5px;border-radius:5px";console[e](`%c${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c / %c${t}`,`${s};background-color: lightblue;color:black`,"",`${s};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...o)}return[function(...t){o("log",...t)},function(...t){o("error",...t)}]}function nd(t,e){document.documentElement.style.setProperty(t,e)}function rd(t){document.documentElement.style.removeProperty(t)}function id(t,e){e||(e={});const n=e.equals||Object.is;let r=[],i=t;const o=t=>{if(!n(i,t)){const e=i;i=t,function(t,e){e()}(0,(()=>{[...r].forEach((([n,r])=>{n(t,e),r&&a(n,!0)}))}))}};function s(t){const e="object"!=typeof t?{once:t}:t;return{once:e.once||!1,signal:e.signal||!1}}const a=(t,e)=>{const n=s(e),i=r.findIndex((([e,r])=>e===t&&r.once===n.once&&r.signal===n.signal));i>=0&&r.splice(i,1)},c=Object.assign((function(){return function(t){od.length&&od[od.length-1].add(t)}(c),i}),{destroy(){r=[]},set:o,reset(){o(t)},sub:(t,e)=>(r.push([t,s(e)]),()=>a(t,e)),unsub:a,unsubAll(){r=r.filter((t=>t[1].signal))}});return c}const od=[];const sd=id(!1),[ad,cd]=ed("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:sd}),ud={clipboard_text_received:vf({req_id:Sf(),data:t=>null===t?t:Sf(!0)(t)},"clipboard_text_received"),custom_method_invoked:vf({req_id:Sf(),result:t=>t,error:Sf(!0)},"custom_method_invoked"),popup_closed:wf("popup_closed",(t=>t?vf({button_id:t=>null==t?void 0:Sf()(t)})()(t):{})),viewport_changed:vf({height:Tf(),width:t=>null==t?window.innerWidth:Tf()(t),is_state_stable:Ef(),is_expanded:Ef()},"viewport_changed")};const ld=id(),hd=id();function fd(){return hd()||hd.set(function(t){const e=window,[,n]=Ff(Vf(e,"message",(n=>{if(n.source!==e.parent)return;let r;try{r=Bf()(n.data)}catch{return}const{eventType:i,eventData:o}=r,s=ud[i];try{const e=s?s()(o):o;ad("Event received:",e?{eventType:i,eventData:e}:{eventType:i}),t([i,e])}catch(t){cd([`An error occurred processing the "${i}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/telegram-apps/issues/new/choose"].join("\n"),r,t)}})));return n}(ld.set)),ld}const dd=id({});function pd(t){let e=dd()[t];return e||(e=id(void 0,{equals:()=>!1}),fd().sub((n=>{n&&n[0]===t&&e.set(n[1])})),dd.set({...dd(),[t]:e})),e}function gd(t,e,n){return pd(t).sub(e,n)}const md="ERR_RETRIEVE_LP_FAILED",yd="ERR_UNKNOWN_ENV",wd="ERR_INVOKE_CUSTOM_METHOD_RESPONSE",vd=id("https://web.telegram.org");function bd(t,e){ad("Posting event:",e?{eventType:t,eventData:e}:{eventType:t});const n=window;if(Nf(n))return void n.TelegramWebviewProxy.postEvent(t,JSON.stringify(e));const r=JSON.stringify({eventType:t,eventData:e});if(function(){try{return window.self!==window.top}catch{return!0}}())return n.parent.postMessage(r,vd());const{external:i}=n;if(!vf({notify:Uf()})().isValid(i))throw new Mf(yd);i.notify(r)}function Ed(t,e,n){n||(n={});const{capture:r}=n,[i,o]=Ff();return new qf((o=>{(Array.isArray(e)?e:[e]).forEach((t=>{i(gd(t,(n=>{(!r||(Array.isArray(e)?r({event:t,payload:n}):r(n)))&&o(n)})))})),(n.postEvent||bd)(t,n.params)}),n).finally(o)}function Sd(t){return If()(t)}function Td(t){return Sd(t.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&"))}function Ad(){return Td(window.location.href)}function xd(){const t=performance.getEntriesByType("navigation")[0];if(!t)throw new Error("Unable to get first navigation entry.");return Td(t.name)}const _d="launchParams";function kd(){return Sd(Qf(_d)||"")}function Rd(t){Jf("launchParams",Of(t))}function Pd(t){return t instanceof Error?t.message+(t.cause?`\n ${Pd(t.cause)}`:""):JSON.stringify(t)}function Cd(){const t=[];for(const e of[Ad,xd,kd])try{const t=e();return Rd(t),t}catch(e){t.push(e)}throw new Mf(md,["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/telegram-apps-bridge/environment","Collected errors:",...t.map((t=>`— ${Pd(t)}`))].join("\n"))}function Id(t){if("simple"===t)try{return Cd(),!0}catch{return!1}return qf.withFn((async()=>{if(Nf(window))return!0;try{return await Ed("web_app_request_theme","theme_changed",{timeout:100}),!0}catch{return!1}}),t)}function Od(t,e,n){pd(t).unsub(e,n)}function Bd(t){return({req_id:e})=>e===t}function Ud(t){return t.split(".").map(Number)}function Ld(t,e){return function(t,e){const n=Ud(t),r=Ud(e),i=Math.max(n.length,r.length);for(let t=0;t<i;t+=1){const e=n[t]||0,i=r[t]||0;if(e!==i)return e>i?1:-1}return 0}(t,e)<=0}function Nd(t,e,n){if("string"==typeof n){if("web_app_open_link"===t){if("try_instant_view"===e)return Ld("6.4",n);if("try_browser"===e)return Ld("7.6",n)}if("web_app_set_header_color"===t&&"color"===e)return Ld("6.9",n);if("web_app_close"===t&&"return_back"===e)return Ld("7.6",n);if("web_app_setup_main_button"===t&&"has_shine_effect"===e)return Ld("7.10",n)}switch(t){case"web_app_open_tg_link":case"web_app_open_invoice":case"web_app_setup_back_button":case"web_app_set_background_color":case"web_app_set_header_color":case"web_app_trigger_haptic_feedback":return Ld("6.1",e);case"web_app_open_popup":return Ld("6.2",e);case"web_app_close_scan_qr_popup":case"web_app_open_scan_qr_popup":case"web_app_read_text_from_clipboard":return Ld("6.4",e);case"web_app_switch_inline_query":return Ld("6.7",e);case"web_app_invoke_custom_method":case"web_app_request_write_access":case"web_app_request_phone":return Ld("6.9",e);case"web_app_setup_settings_button":return Ld("6.10",e);case"web_app_biometry_get_info":case"web_app_biometry_open_settings":case"web_app_biometry_request_access":case"web_app_biometry_request_auth":case"web_app_biometry_update_token":return Ld("7.2",e);case"web_app_setup_swipe_behavior":return Ld("7.7",e);case"web_app_share_to_story":return Ld("7.8",e);case"web_app_setup_secondary_button":case"web_app_set_bottom_bar_color":return Ld("7.10",e);case"web_app_request_safe_area":case"web_app_request_content_safe_area":case"web_app_request_fullscreen":case"web_app_exit_fullscreen":case"web_app_set_emoji_status":case"web_app_add_to_home_screen":case"web_app_check_home_screen":case"web_app_request_emoji_status_access":return Ld("8.0",e);default:return["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"].includes(t)}}function Dd(){const t=performance.getEntriesByType("navigation")[0];return!!t&&"reload"===t.type}let jd;function Md(t){if(jd)return t();jd=new Map;try{t()}finally{jd.forEach((t=>t())),jd=void 0}}function Vd(t,e){e||(e={});const n=e.equals||Object.is;let r=[],i=t;const o=t=>{if(!n(i,t)){const e=i;i=t,function(t,e){jd&&jd.set(t,e)||e()}(c,(()=>{[...r].forEach((([n,r])=>{n(t,e),r&&a(n,!0)}))}))}};function s(t){const e="object"!=typeof t?{once:t}:t;return{once:e.once||!1,signal:e.signal||!1}}const a=(t,e)=>{const n=s(e),i=r.findIndex((([e,r])=>e===t&&r.once===n.once&&r.signal===n.signal));i>=0&&r.splice(i,1)},c=Object.assign((function(){return function(t){Fd.length&&Fd[Fd.length-1].add(t)}(c),i}),{destroy(){r=[]},set:o,reset(){o(t)},sub:(t,e)=>(r.push([t,s(e)]),()=>a(t,e)),unsub:a,unsubAll(){r=r.filter((t=>t[1].signal))}});return c}const Fd=[];function Kd(t,e){let n,r=new Set;function i(){return n||(n=Vd(s(),e))}function o(){i().set(s())}function s(){r.forEach((t=>{t.unsub(o,{signal:!0})}));const e=new Set;let n;Fd.push(e);try{n=t()}finally{Fd.pop()}return e.forEach((t=>{t.sub(o,{signal:!0})})),r=e,n}return Object.assign((function(){return i()()}),{destroy(){i().destroy()},sub:(...t)=>i().sub(...t),unsub(...t){i().unsub(...t)},unsubAll(...t){i().unsubAll(...t)}})}const $d=Vd((()=>{let t=0;return()=>(t+=1).toString()})()),Wd=Vd(bd),zd=Vd("0.0");function Hd(){return $d()()}function Zd(t,e,n){return function(t,e,n,r){return Ed("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:t,params:e,req_id:n},capture:Bd(n)}).then((({result:t,error:e})=>{if(e)throw new Mf(wd,e);return t}))}(t,e,Hd(),{...n||{},postEvent:Xd})}const qd=(t,e,n)=>(n||(n={}),n.postEvent||(n.postEvent=Xd),Ed(t,e,n)),Xd=(t,e)=>Wd()(t,e);function Gd(t){return Kd((()=>Nd(t,zd())))}const Yd="ERR_POPUP_INVALID_PARAMS",Jd="ERR_INVALID_URL",Qd="ERR_ALREADY_REQUESTING",tp="ERR_ALREADY_OPENED",ep="ERR_NOT_INITIALIZED",np="ERR_NOT_SUPPORTED",rp="ERR_NOT_MOUNTED";function ip(){return typeof window>"u"}function op(t,e,{isSupported:n,isMounted:r,component:i,supports:o}={}){const s=`${i?`${i}.`:""}${t}()`;function a(t){if(o){const e=o[t];return Nd(e[0],e[1],zd())}return!0}n=n?Array.isArray(n)||"object"==typeof n&&"any"in n?n:[n]:void 0;const c=()=>{if(!n)return;const t=`it is unsupported in Mini Apps version ${zd()}`;function e(e){return"string"==typeof e?Nd(e,zd())?void 0:t:e.fn()?void 0:e.error}if(Array.isArray(n)){for(const t of n){const n=e(t);if(n)return n}return}let r;for(const t of n.any)if(r=e(t),!r)return;return t},u=Kd((()=>!c())),l=Kd((()=>"0.0"!==zd())),h=Kd((()=>!r||r())),f=Kd((()=>Id("simple")&&!ip()&&l()&&u()&&h()));let d;if(o){d={};for(const t in o)d[t]=Kd((()=>a(t)))}return Object.assign(((...t)=>{const n=`Unable to call the ${s} ${i?"method":"function"}:`;if(ip()||!Id("simple"))throw new Mf(yd,`${n} it can't be called outside Mini Apps`);if(!l())throw new Mf(ep,`${n} the SDK was not initialized. Use the SDK init() function`);const r=c();if(r)throw new Mf(np,`${n} ${r}`);const u=((...t)=>{if(o)for(const e in o)if(o[e][2](...t)&&!a(e))return`option ${e} is not supported in Mini Apps version ${zd()}`})(...t);if(u)throw new Mf(np,`${n} ${u}`);if(!h())throw new Mf(rp,`${n} the component is not mounted. Use the ${i}.mount() method`);return e(...t)}),e,{isAvailable:f,ifAvailable:(...t)=>f()?e(...t):void 0},n?{isSupported:u}:{},d?{supports:d}:{})}function sp(t,e){return e||(e={}),(n,r,i,o)=>op(n,r,{...e,isSupported:i||e.isSupported,supports:o,component:t})}function ap(t,e,n){return sp(t,{isSupported:n,isMounted:e})}function cp(t,e){return sp(t,{isSupported:e})}const up="web_app_setup_back_button",lp="back_button_pressed",hp="backButton",fp=Vd(!1),dp=Vd(!1),pp=Gd(up),gp=ap(hp,dp,up),mp=cp(hp,up),yp=gp("hide",(()=>{vp(!1)})),wp=mp("mount",(()=>{dp()||(vp(Dd()&&Qf(hp)||!1),dp.set(!0))}));function vp(t){t!==fp()&&(Xd(up,{is_visible:t}),Jf(hp,t),fp.set(t))}const bp=mp("onClick",(t=>gd(lp,t))),Ep=mp("offClick",(t=>{Od(lp,t)})),Sp=gp("show",(()=>{vp(!0)}));Symbol.toStringTag;function Tp(t,e,n,r,i){const o=void 0===i||i?qf:Promise;return Object.assign(((...i)=>o.resolve().then((async()=>{if(n()){const t=e();throw r.set(t),t}let s;Md((()=>{n.set(o.resolve(t(...i))),r.set(void 0)}));try{s=[!0,await n()]}catch(t){s=[!1,t]}if(Md((()=>{n.set(void 0),r.set(s[0]?void 0:s[1])})),!s[0])throw s[1];return s[1]}))),t)}function Ap(t,e,n,r,i,o){const s=Tp(e,(()=>new Mf("ERR_ALREADY_MOUNTING",`The ${t} component is already mounting`)),i,o);return t=>qf.resolve().then((async()=>{if(!r()){const e=await s(t);Md((()=>{r.set(!0),n(e)}))}}))}const xp=sp,_p=Vd({available:!1}),kp=Vd(!1),Rp=Vd(!1),Pp=Vd(!1),Cp=Kd((()=>!!Op())),Ip=Vd(),Op=Vd(),Bp=Kd((()=>{const t=_p();return t&&t.available}));function Up(t){return t.available?{available:!0,tokenSaved:t.token_saved,deviceId:t.device_id,accessRequested:t.access_requested,type:t.type,accessGranted:t.access_granted}:{available:!1}}const Lp="web_app_biometry_get_info",Np=op("requestBiometry",(t=>qd(Lp,"biometry_info_received",t).then(Up)),{isSupported:Lp}),Dp="web_app_biometry_request_auth",jp="biometry_info_received",Mp="biometry",Vp=Gd(Dp),Fp=xp(Mp),Kp=cp(Mp,Dp),$p=ap(Mp,Pp,Dp);function Wp(){throw new Mf("ERR_NOT_AVAILABLE","Biometry is not available")}const zp=$p("authenticate",(t=>qf.withFn((async e=>{if(kp())throw new Mf(Qd,"Authentication is already in progress");const n=_p();(!n||!n.available)&&Wp(),kp.set(!0);try{const r=await qd(Dp,"biometry_auth_requested",{abortSignal:e,params:{reason:((t||{}).reason||"").trim()}}),{token:i}=r;return"string"==typeof i&&Gp({...n,token:i}),r}finally{kp.set(!1)}}),t))),Hp=Kp("openSettings",(()=>{Xd("web_app_biometry_open_settings")})),Zp=$p("requestAccess",(t=>qf.withFn((async e=>{if(Rp())throw new Mf(Qd,"Access request is already in progress");Rp.set(!0);try{const n=await qd("web_app_biometry_request_access",jp,{abortSignal:e,params:{reason:(t||{}).reason||""}}).then(Up);return n.available||Wp(),Gp(n),n.accessGranted}finally{Rp.set(!1)}}),t))),qp=Fp("mount",Ap(Mp,(t=>Dd()&&Qf(Mp)||Np(t)),(t=>{gd(jp,Xp),Gp(t)}),Pp,Op,Ip)),Xp=t=>{Gp(Up(t))};function Gp(t){_p.set(t),Jf(Mp,t)}const Yp=$p("updateToken",(t=>(t||(t={}),qd("web_app_biometry_update_token","biometry_token_updated",{...t,params:{token:t.token||"",reason:t.reason}}).then((t=>t.status)))));Symbol.toStringTag;function Jp(t,e){return sp(t,{isMounted:e})}const Qp="closingBehavior",tg=Vd(!1),eg=Vd(!1),ng=Jp(Qp,eg),rg=xp(Qp),ig=ng("disableConfirmation",(()=>{ag(!1)})),og=ng("enableConfirmation",(()=>{ag(!0)})),sg=rg("mount",(()=>{eg()||(ag(Dd()&&Qf(Qp)||!1),eg.set(!0))}));function ag(t){t!==tg()&&(Xd("web_app_setup_closing_behavior",{need_confirmation:t}),Jf(Qp,t),tg.set(t))}Symbol.toStringTag;const cg="web_app_invoke_custom_method",ug=cp("cloudStorage",cg),lg=Gd(cg),hg=ug("deleteItem",((t,e)=>{const n=Array.isArray(t)?t:[t];return n.length?Zd("deleteStorageValues",{keys:n},e).then():qf.resolve()}));const fg=ug("getItem",(function(t,e){const n=Array.isArray(t)?t:[t];return n.length?Zd("getStorageValues",{keys:n},e).then((e=>{const r=ef(Object.fromEntries(n.map((t=>[t,rf()]))))()(e);return Array.isArray(t)?r:r[t]})):qf.resolve("string"==typeof t?"":{})})),dg=ug("getKeys",(t=>Zd("getStorageKeys",{},t).then(function(t,e){return tf("array",(e=>{let n;if(Array.isArray(e))n=e;else if("string"==typeof e)try{const t=JSON.parse(e);Array.isArray(t)&&(n=t)}catch{}return n||nf(e),n.map(t)}))}(rf())()))),pg=ug("setItem",((t,e,n)=>Zd("saveStorageValue",{key:t,value:e},n).then())),gg=(Symbol.toStringTag,"web_app_trigger_haptic_feedback"),mg=cp("hapticFeedback",gg),yg=Gd(gg),wg=mg("impactOccurred",(t=>{Xd(gg,{type:"impact",impact_style:t})})),vg=mg("notificationOccurred",(t=>{Xd(gg,{type:"notification",notification_type:t})})),bg=mg("selectionChanged",(()=>{Xd(gg,{type:"selection_change"})})),Eg=(Symbol.toStringTag,Vd(void 0));function Sg(t){return Kd((()=>{const e=Eg();return e?e[t]:void 0}))}const Tg=Sg("authDate"),Ag=Sg("canSendAfter"),xg=Kd((()=>{const t=Tg(),e=Ag();return e&&t?new Date(t.getTime()+1e3*e):void 0})),_g=Sg("chat"),kg=Sg("chatType"),Rg=Sg("chatInstance"),Pg=Sg("hash"),Cg=Sg("queryId"),Ig=Vd(),Og=Sg("receiver");const Bg=Sg("startParam"),Ug=Sg("user");Symbol.toStringTag;const Lg="web_app_open_invoice",Ng=cp("invoice",Lg),Dg=Vd(!1),jg=Gd(Lg);async function Mg(t,e,n){if(Dg())throw new Mf(tp,"An invoice is already opened");let r;if("url"===e){const{hostname:e,pathname:n}=new URL(t,window.location.href);if("t.me"!==e)throw new Mf(Jd,`Link has unexpected hostname: ${e}`);const i=n.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);if(!i)throw new Mf("ERR_INVALID_SLUG",'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"');[,,r]=i}else r=t,n=e;return Dg.set(!0),qd(Lg,"invoice_closed",{...n,params:{slug:r},capture:t=>r===t.slug}).then((t=>t.status)).finally((()=>{Dg.set(!1)}))}const Vg=Ng("open",Mg);Symbol.toStringTag;function Fg(t){return Object.fromEntries(Object.entries(t).filter((t=>void 0!==t[1])))}function Kg(t){const e=af(t);return Math.sqrt([.299,.587,.114].reduce(((t,n,r)=>{const i=parseInt(e.slice(1+2*r,1+2*(r+1)),16);return t+i*i*n}),0))<120}const $g=Vd(!1),Wg=Vd(!1),zg=Vd({});function Hg(t){return Kd((()=>zg()[t]))}const Zg=Hg("accentTextColor"),qg=Hg("bgColor"),Xg=Hg("buttonColor"),Gg=Hg("buttonTextColor"),Yg=Hg("bottomBarBgColor"),Jg=Hg("destructiveTextColor"),Qg=Hg("headerBgColor"),tm=Hg("hintColor"),em=Kd((()=>{const{bgColor:t}=zg();return!t||Kg(t)})),nm=Hg("linkColor"),rm=Hg("secondaryBgColor"),im=Hg("sectionBgColor"),om=Hg("sectionHeaderTextColor"),sm=Hg("sectionSeparatorColor"),am=Hg("subtitleTextColor"),cm=Hg("textColor");function um(t){return Kd((()=>hm()[t]))}const lm=Vd({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"}),hm=Kd((()=>{const t=lm();return{...t,backgroundColor:t.backgroundColor||Xg()||"#2481cc",textColor:t.textColor||Gg()||"#ffffff"}})),fm=Vd(!1),dm=um("backgroundColor"),pm=um("hasShineEffect"),gm=um("isEnabled"),mm=um("isLoaderVisible"),ym=um("isVisible"),wm=um("text"),vm=um("textColor"),bm="main_button_pressed",Em="mainButton",Sm=xp(Em),Tm=Jp(Em,fm),Am=Sm("mount",(()=>{if(!fm()){const t=Dd()&&Qf(Em);t&&lm.set(t),fm.set(!0)}})),xm=Sm("onClick",(t=>gd(bm,t))),_m=Sm("offClick",(t=>{Od(bm,t)})),km=Tm("setParams",(t=>{lm.set({...lm(),...Fg(t)}),Jf(Em,lm());const e=hm();e.text&&Xd("web_app_setup_main_button",{color:e.backgroundColor,has_shine_effect:e.hasShineEffect,is_active:e.isEnabled,is_progress_visible:e.isLoaderVisible,is_visible:e.isVisible,text:e.text,text_color:e.textColor})}));Symbol.toStringTag;function Rm(){throw new Mf("ERR_VARS_ALREADY_BOUND","CSS variables are already bound")}const Pm="themeParams",Cm="theme_changed",Im=xp(Pm),Om=Jp(Pm,$g)("bindCssVars",(t=>{function e(t){Object.entries(zg()).forEach((([e,n])=>{n&&t(e,n)}))}function n(){e(((e,n)=>{nd(t(e),n)}))}return Wg()&&Rm(),t||(t=t=>`--tg-theme-${td(t)}`),n(),zg.sub(n),Wg.set(!0),()=>{e(rd),zg.unsub(n),Wg.set(!1)}})),Bm=Im("mount",(()=>{$g()||(gd(Cm,Um),zg.set(Dd()&&Qf(Pm)||Cd().themeParams),$g.set(!0))})),Um=t=>{const e=function(t){return uf()(t)}(t.theme_params);zg.set(e),Jf(Pm,e)};function Lm(t){return Kd((()=>{const e=t();return sf(e)?e:"bg_color"===e?qg():rm()}))}const Nm=Vd("bg_color"),Dm=Lm(Nm),jm=Vd("bottom_bar_bg_color"),Mm=Kd((()=>{const t=jm();return sf(t)?t:"bottom_bar_bg_color"===t?Yg()||rm():"secondary_bg_color"===t?rm():qg()})),Vm=Vd("bg_color"),Fm=Lm(Vm),Km=Vd(!1),$m=Vd(!1),Wm=Kd((()=>{const t=Dm();return!!t&&Kg(t)})),zm=Vd(!0),Hm=Kd((()=>({backgroundColor:Nm(),bottomBarColor:jm(),headerColor:Vm(),isActive:zm()}))),Zm="web_app_set_background_color",qm="web_app_set_bottom_bar_color",Xm="web_app_set_header_color",Gm="visibility_changed",Ym="miniApp",Jm={any:[Zm,qm,Xm]},Qm=Kd((()=>Jm.any.some((t=>Nd(t,zd()))))),ty=xp(Ym),ey=cp(Ym,Jm),ny=ap(Ym,Km,Jm),ry=ny("bindCssVars",(t=>{$m()&&Rm();const[e,n]=Ff();function r(t,n){function r(){nd(t,n()||null)}r(),e(n.sub(r),rd.bind(null,t))}return t||(t=t=>`--tg-${td(t)}`),r(t("bgColor"),Dm),r(t("bottomBarColor"),Mm),r(t("headerColor"),Fm),e((()=>{$m.set(!1)})),$m.set(!0),n})),iy=ty("close",(t=>{Xd("web_app_close",{return_back:t})})),oy=t=>{zm.set(t.is_visible),cy()},sy=ey("mount",(()=>{if(!Km()){const t=Dd()&&Qf(Ym);Bm(),uy.ifAvailable(t?t.backgroundColor:"bg_color"),ly.ifAvailable(t?t.bottomBarColor:"bottom_bar_bg_color"),hy.ifAvailable(t?t.headerColor:"bg_color"),zm.set(!t||t.isActive),gd(Gm,oy),Km.set(!0)}})),ay=ty("ready",(()=>{Xd("web_app_ready")}));function cy(){Jf(Ym,Hm())}const uy=ny("setBackgroundColor",(t=>{t!==Nm()&&(Xd(Zm,{color:t}),Nm.set(t),cy())}),Zm),ly=ny("setBottomBarColor",(t=>{t!==jm()&&(Xd(qm,{color:t}),jm.set(t),cy())}),qm),hy=ny("setHeaderColor",(t=>{t!==Vm()&&(Xd(Xm,sf(t)?{color:t}:{color_key:t}),Vm.set(t),cy())}),Xm,{rgb:[Xm,"color",sf]});Symbol.toStringTag;function fy(t){const e=t.message.trim(),n=(t.title||"").trim(),r=t.buttons||[];if(n.length>64)throw new Mf(Yd,`Invalid title: ${n}`);if(!e||e.length>256)throw new Mf(Yd,`Invalid message: ${e}`);if(r.length>3)throw new Mf(Yd,`Invalid buttons count: ${r.length}`);return{title:n,message:e,buttons:r.length?r.map(((t,e)=>{const n=t.id||"";if(n.length>64)throw new Mf(Yd,`Button with index ${e} has invalid id: ${n}`);if(!t.type||"default"===t.type||"destructive"===t.type){const r=t.text.trim();if(!r||r.length>64)throw new Mf(Yd,`Button with index ${e} has invalid text: ${r}`);return{type:t.type,text:r,id:n}}return{type:t.type,id:n}})):[{type:"close",id:""}]}}const dy="web_app_open_popup",py=cp("popup",dy),gy=Vd(!1),my=Gd(dy),yy=py("open",(async t=>{if(gy())throw new Mf(tp,"A popup is already opened");gy.set(!0);try{const{button_id:e=null}=await qd(dy,"popup_closed",{...t,params:fy(t)});return e}finally{gy.set(!1)}})),wy=(Symbol.toStringTag,"web_app_open_scan_qr_popup"),vy=cp("qrScanner",wy),by=vy("close",(()=>{Ey.set(!1),Xd("web_app_close_scan_qr_popup")})),Ey=Vd(!1),Sy=Gd(wy);const Ty=vy("open",(function(t){return qf.withFn((e=>{if(Ey())throw new Mf(tp,"The QR Scanner is already opened");Ey.set(!0),t||(t={});const{onCaptured:n,text:r,capture:i}=t,[,o]=Ff(Ey.sub((()=>{s.resolve()})),gd("scan_qr_popup_closed",(()=>{Ey.set(!1)})),gd("qr_text_received",(t=>{n?n(t.data):(!i||i(t.data))&&(s.resolve(t.data),by())}))),s=new Gf({abortSignal:e}).catch(by).finally(o);return(t.postEvent||Xd)(wy,{text:r}),s}),t)}));Symbol.toStringTag;function Ay(t){return Kd((()=>_y()[t]))}const xy=Vd({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,position:"left",text:"Cancel"}),_y=Kd((()=>{const t=xy();return{...t,backgroundColor:t.backgroundColor||Mm()||"#000000",textColor:t.textColor||Xg()||"#2481cc"}})),ky=Vd(!1),Ry=Ay("backgroundColor"),Py=Ay("hasShineEffect"),Cy=Ay("isEnabled"),Iy=Ay("isLoaderVisible"),Oy=Ay("isVisible"),By=Ay("position"),Uy=Ay("text"),Ly=Ay("textColor"),Ny="web_app_setup_secondary_button",Dy="secondary_button_pressed",jy="secondaryButton",My=cp(jy,Ny),Vy=ap(jy,ky,Ny),Fy=Gd(Ny),Ky=My("mount",(()=>{if(!ky()){const t=Dd()&&Qf(jy);t&&xy.set(t),ky.set(!0)}})),$y=My("onClick",(t=>gd(Dy,t))),Wy=My("offClick",(t=>{Od(Dy,t)})),zy=Vy("setParams",(t=>{xy.set({...xy(),...Object.fromEntries(Object.entries(t).filter((([,t])=>void 0!==t)))}),Jf(jy,xy());const e=_y();e.text&&Xd(Ny,{color:e.backgroundColor,has_shine_effect:e.hasShineEffect,is_active:e.isEnabled,is_progress_visible:e.isLoaderVisible,is_visible:e.isVisible,position:e.position,text:e.text,text_color:e.textColor})}));Symbol.toStringTag;const Hy="web_app_setup_settings_button",Zy="settings_button_pressed",qy="settingsButton",Xy=Vd(!1),Gy=Vd(!1),Yy=Gd(Hy),Jy=cp(qy,Hy),Qy=ap(qy,Gy,Hy),tw=Qy("hide",(()=>{nw(!1)})),ew=Jy("mount",(()=>{Gy()||(nw(Dd()&&Qf(qy)||!1),Gy.set(!0))}));function nw(t){t!==Xy()&&(Xd(Hy,{is_visible:t}),Jf(qy,t),Xy.set(t))}const rw=Jy("onClick",(t=>gd(Zy,t))),iw=Jy("offClick",(t=>{Od(Zy,t)})),ow=Qy("show",(()=>{nw(!0)}));Symbol.toStringTag;const sw="web_app_setup_swipe_behavior",aw="swipeBehavior",cw=Vd(!1),uw=Gd(sw),lw=Vd(!0),hw=cp(aw,sw),fw=ap(aw,cw,sw),dw=fw("disableVertical",(()=>{mw(!1)})),pw=fw("enableVertical",(()=>{mw(!0)})),gw=hw("mount",(()=>{cw()||(mw(Dd()&&Qf(aw)||!1,!0),cw.set(!0))}));function mw(t,e){(t!==lw()||e)&&(Xd(sw,{allow_vertical_swipe:t}),Jf(aw,t),lw.set(t))}Symbol.toStringTag,Symbol.toStringTag;const yw="viewport",ww="web_app_request_fullscreen",vw="fullscreen_changed",bw="safe_area_changed",Ew="content_safe_area_changed",Sw="viewport_changed",Tw="web_app_request_safe_area",Aw="web_app_request_content_safe_area",xw={left:0,top:0,bottom:0,right:0};function _w(t){return Math.max(t,0)}const kw=Vd({contentSafeAreaInsets:xw,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:xw,stableHeight:0,width:0});function Rw(t){return Kd((()=>kw()[t]))}function Pw(t){const{height:e,stableHeight:n,width:r}=t;kw.set({...kw(),...Fg({...t,height:e?_w(e):void 0,width:r?_w(r):void 0,stableHeight:n?_w(n):void 0})}),Jf(yw,kw())}const Cw=Rw("isFullscreen"),Iw=Vd(),Ow=Kd((()=>!!Iw())),Bw=Vd(),Uw=Vd(!1),Lw=Kd((()=>!!Dw())),Nw=Vd(void 0),Dw=Vd(),jw=ap(yw,Uw,ww);function Mw(t,e){return jw(t,Tp((t=>qd(e,[vw,"fullscreen_failed"],t).then((t=>{if("error"in t){if("ALREADY_FULLSCREEN"===t.error)return!0;throw new Mf("ERR_FULLSCREEN_FAILED","Fullscreen request failed",t.error)}return t.is_fullscreen})).then((t=>{t!==Cw()&&Pw({isFullscreen:t})}))),(()=>new Mf(Qd,"Fullscreen mode change is already being requested")),Iw,Bw))}const Vw=Mw("requestFullscreen",ww),Fw=Mw("exitFullscreen","web_app_exit_fullscreen"),Kw=xp(yw),$w=Jp(yw,Uw);function Ww(t){return Kd((()=>zw()[t]))}const zw=Rw("safeAreaInsets"),Hw=Ww("bottom"),Zw=Ww("left"),qw=Ww("right"),Xw=Ww("top");function Gw(t){return Kd((()=>Yw()[t]))}const Yw=Rw("contentSafeAreaInsets"),Jw=Gw("bottom"),Qw=Gw("left"),tv=Gw("right"),ev=Gw("top"),nv=op("requestContentSafeAreaInsets",(t=>qd(Aw,"content_safe_area_changed",t)),{isSupported:Aw}),rv=op("requestSafeAreaInsets",(t=>qd(Tw,"safe_area_changed",t)),{isSupported:Tw});const iv=t=>{const{height:e}=t;Pw({isExpanded:t.is_expanded,height:e,width:t.width,stableHeight:t.is_state_stable?e:void 0})},ov=t=>{Pw({isFullscreen:t.is_fullscreen})},sv=t=>{Pw({safeAreaInsets:t})},av=t=>{Pw({contentSafeAreaInsets:t})},cv=Kw("mount",Ap(yw,(t=>qf.resolve().then((async()=>{const e=Dd()&&Qf(yw);if(e)return e;const[n,r]=await qf.all([rv.ifAvailable(t)||zw(),nv.ifAvailable(t)||Yw()]),i=Cd(),o={contentSafeAreaInsets:r,isFullscreen:!!i.fullscreen,safeAreaInsets:n};if(["macos","tdesktop","unigram","webk","weba","web"].includes(i.platform)){const t=window;return{...o,height:t.innerHeight,isExpanded:!0,stableHeight:t.innerHeight,width:t.innerWidth}}return function(t){return qd("web_app_request_viewport","viewport_changed",t).then((t=>({height:t.height,width:t.width,isExpanded:t.is_expanded,isStable:t.is_state_stable})))}(t).then((t=>({...o,height:t.height,isExpanded:t.isExpanded,stableHeight:t.isStable?t.height:0,width:t.width})))}))),(t=>{gd(Sw,iv),gd(vw,ov),gd(bw,sv),gd(Ew,av),Pw(t)}),Uw,Dw,Nw));const uv=Vd(!1),lv=Rw("height"),hv=Rw("stableHeight"),fv=Rw("width"),dv=$w("bindCssVars",(t=>{uv()&&Rm(),t||(t=t=>`--tg-viewport-${td(t)}`);const e=[["height",lv],["stableHeight",hv],["width",fv],["safeAreaInsetTop",Xw],["safeAreaInsetBottom",Hw],["safeAreaInsetLeft",Zw],["safeAreaInsetRight",qw],["contentSafeAreaInsetTop",ev],["contentSafeAreaInsetBottom",Jw],["contentSafeAreaInsetLeft",Qw],["contentSafeAreaInsetRight",tv]].reduce(((e,[n,r])=>{const i=t(n);if(i){const t=()=>{nd(i,`${r()}px`)};e.push([t,r.sub(t),i])}return e}),[]);return e.forEach((t=>{t[0]()})),uv.set(!0),()=>{e.forEach((t=>{t[1](),rd(t[2])})),uv.set(!1)}})),pv=Kw("expand",(()=>{Xd("web_app_expand")})),gv=Rw("isExpanded"),mv=Kd((()=>lv()===hv())),yv=(Symbol.toStringTag,xp()("openLink",((t,e)=>{if("string"==typeof t)try{t=new URL(t)}catch(e){throw new Mf(Jd,`"${t.toString()}" is invalid URL`,e)}e||(e={}),Xd("web_app_open_link",{url:t.toString(),try_browser:e.tryBrowser,try_instant_view:e.tryInstantView})})),"web_app_open_tg_link"),wv=xp()("openTelegramLink",(t=>{const e=t.toString();if(!e.match(/^https:\/\/t.me\/.+/))throw new Mf(Jd,`"${e}" is invalid URL`);Nd(yv,zd())?(t=new URL(t),Xd(yv,{path_full:t.pathname+t.search})):window.location.href=e}));xp()("shareURL",((t,e)=>{wv("https://t.me/share/url?"+new URLSearchParams({url:t,text:e||""}).toString().replace(/\+/g,"%20"))}));const vv=async()=>(await a.e(423).then(a.t.bind(a,153,23))).default;function bv(t){var r,i;let{requestData:o,webpageName:s,inferenceData:a=null,onComplete:c=null,autoFetch:u=!0,proofMode:l=!1,textLayout:h="below",textColor:f="white",login:d=!1,buttonType:p="pill",loginReturn:g=null,loginType:m="signIn",visualType:y="full"}=t;const[w,v]=(0,e.useState)(null);(0,e.useEffect)((()=>{let t=!0;return async function(){if((()=>{const t=navigator.userAgent||navigator.vendor||window.opera;return void 0!==window.Telegram&&/telegram/i.test(t)&&/mobile/i.test(navigator.userAgent)})())try{const n=(0,e.useMemo)(Cd,[]);t&&v(n)}catch(t){console.error("Error fetching launch params:",t)}}(),()=>{t=!1}}),[]);const[b,E]=(0,e.useState)(null),[S,T]=(0,e.useState)(!1),[A,x]=(0,e.useState)([]),[_,k]=(0,e.useState)(0),[R,P]=(0,e.useState)({}),[C,I]=(0,e.useState)(!1),[O,B]=(0,e.useState)(!1),[U,L]=(0,e.useState)(!1),[N,D]=(0,e.useState)(!1),j=(0,e.useRef)(!1),M=(0,e.useRef)(!1),[V,F]=(0,e.useState)(!1),[K,$]=(0,e.useState)(null),[W,z]=(0,e.useState)(!0),[H,Z]=(0,e.useState)(null),[q,X]=(0,e.useState)(null),[G,Y]=(0,e.useState)({show:!1,type:null,data:null}),[J,Q]=(0,e.useState)(null),[tt,et]=(0,e.useState)(!1),[nt,rt]=(0,e.useState)(!1),it=(0,e.useRef)(!1),[ot,st]=(0,e.useState)(null),[at,ct]=(0,e.useState)({show:!1,color:null,message:null}),[ut,lt]=(0,e.useState)(null),[ht,ft]=(0,e.useState)("Initializing..."),dt="https://api2.onairos.uk";(0,e.useEffect)((async()=>{if(w&&(console.log("Launch Params:",w),w.startParam))try{ft("Received parameters: ".concat(params.join(", "))),Y({show:!0,type:"callback",data:{startParam:w.startParam}})}catch(t){console.error("Error parsing launch params:",t)}}),[w]),(0,e.useEffect)((()=>{(()=>{try{var t;if(null===(t=window.Telegram)||void 0===t||!t.WebApp)return;window.Telegram.WebApp.ready()}catch(t){}})()}),[w]),(0,e.useEffect)((()=>{(async()=>{const t=new URL(window.location.href),e=t.searchParams.get("code"),n=t.searchParams.get("state");if(e&&n&&!it.current&&!nt){it.current=!0,rt(!0);try{await pt(t.toString()),D(!0),window.history.replaceState({},document.title,window.location.pathname)}catch(t){console.error("Auth callback processing failed:",t),st(t.message)}finally{rt(!1)}}})()}),[]);const pt=async t=>{try{const e={name:"Onairos",version:"1.0.0",env:"production"};Y({show:!0,type:"callback",data:{code:t,state:"Completing Callback"}});if(!new Dr({appInfo:e,throwErrors:!0,auth0LogInMethod:"redirect",auth0RedirectURI:window.location.href,auth0ReturnToURI:window.location.href}))throw new Error("Failed to initialize Othent");if(!userDetails||!userDetails.sub)throw new Error("Invalid user details received from Othent");F(!0);const n=(await vv())(userDetails.sub).toString();Z(n);const r=await Mr(n);X(r.result),$(r.token),await St(userDetails.email,!0),T(!0),localStorage.setItem("othentToken",JSON.stringify(userDetails)),localStorage.setItem("onairosToken",userDetails.token)}catch(t){throw ct({show:!0,color:"red",message:"An error has occured, please try again"}),console.error("Authentication failed:",t),t}};(0,e.useEffect)((()=>{ot&&console.error("Authentication error:",ot)}),[ot]);const gt=()=>{const t=navigator.userAgent||navigator.vendor||window.opera;return/android|iphone|ipad|ipod|windows phone/i.test(t)};(0,e.useEffect)((()=>{if(u&&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 mt=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();u&&c?c(n):Y({show:!0,type:"apiURL",data:{code:n,state:e}})}catch(t){console.error(t),c&&c(null,t)}},yt=window.location.href;(0,e.useEffect)((()=>{const t=t=>{console.log("Message received in useEffect:",t.data),t.data&&"terminalOpened"===t.data.action&&wt()};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}),[]);const wt=async()=>{try{const t=new Dr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),e=await t.connect(),n=(await vv())(e.sub).toString(),r=await Mr(n);function i(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)}}console.log("Got your Pin");const a=i(r.result);console.log("Decrypting your Pin");const c=await t.decrypt(a);console.log("Decrypted Pin"),jr("\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 ",c).then((t=>{window.postMessage({source:"webpage",type:"GET_API_URL",webpageName:s,domain:yt,requestData:o,proofMode:l,HashedOthentSub:n,EncryptedUserPin:t})})).catch((t=>{console.error("Encryption failed:",t)}))}catch(u){console.error("Error Sending Data to Terminal: ",u)}},vt="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===p?"px-4 py-2":"w-12 h-12"," ").concat(d?"bg-white border border-gray-300":"bg-transparent","\n ").concat(gt()?"":"OnairosConnect","\n "),bt={flexDirection:"below"===h?"column":"row",backgroundColor:d?"#ffffff":"transparent",color:d?"black":f,border:d?"1px solid #ddd":"1px solid transparent"},Et={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"},St=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(dt).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?(j.current=!0,Q(null),null):(Q(o.AccountInfo),o.AccountInfo.models?x(o.AccountInfo.models):M.current=!0,o.AccountInfo.avatar&&I(!0),o.AccountInfo.UserTraits&&B(!0),o.AccountInfo.othent&&L(!0),o.AccountInfo)}catch(t){throw console.error("Error fetching account info:",t),t}};(0,e.useEffect)((()=>{gt()&&(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){$(n),F(!0);const t=localStorage.getItem("username");await St(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&&St(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(dt,"/verifyToken"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})).ok){if(F(!0),e)await St(e,!1);else if(n){const t=JSON.parse(n);await St(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:vt,onClick:async()=>{gt()?await(async()=>{gt()&&T(!0)})():(console.log("openTerminal clicked"),window.postMessage({source:"webpage",type:"openTerminal",webpageName:s,domain:yt,key:"Key"}))},style:bt},("full"===y||"icon"===y)&&n().createElement("img",{src:d?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:Et,className:"".concat("pill"===p?"w-6 h-6":"w-8 h-8"," object-contain")}),("full"===y||"textOnly"===y)&&n().createElement("span",{className:"".concat(d||"black"===f?"text-black":"text-white"," ").concat("icon"===y?"sr-only":""," ").concat("right"===h?"ml-2":"left"===h?"mr-2":"")},(()=>{switch(m){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})()))),G.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"===G.type?"Callback Details":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"debug"===G.type?"Debug Results":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"apiURL"===G.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(G.data,null,2))),"auth"===G.type&&n().createElement("div",{className:"mt-4 p-3 rounded ".concat(null!==(r=G.data)&&void 0!==r&&r.success?"bg-green-100 text-green-700":"bg-red-100 text-red-700")},null!==(i=G.data)&&void 0!==i&&i.success?"Authentication successful!":"Authentication failed"))),tt&&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..."))),S&&!tt&&n().createElement(Hh,{setOthentConnected:D,dataRequester:s,NoAccount:j,NoModel:M,accountInfo:J,activeModels:A,avatar:C,traits:O,requestData:o,handleConnectionSelection:(t,e,n,r,i,o)=>{P((s=>({...s,["".concat(t,"-").concat(e,"-").concat(n)]:{type:r,reward:i,isSelected:o}})))},changeGranted:t=>{k((e=>Math.max(e+t,0)))},granted:_,allowSubmit:_>0,rejectDataRequest:()=>{T(!1),c&&c("rejected")},sendDataRequest:async()=>{if(!(_<=0))try{const t=Object.values(R).filter((t=>t.isSelected)).map((t=>({type:t.type,reward:t.reward})));if(null==q&&U&&!N){Y({show:!0,type:"debug",data:{code:"Connecting Othent Details",state1:q,state2:N,state3:U}});const e=new Dr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),n=await e.connect(),r=(await vv())(n.sub).toString();Z(r);const i=await Mr(r),o=i.result;X(o),D(!0),Y({show:!0,type:"callback",data:{code:"Just Before API",state:i.token}}),await mt(t,o,r)}else q&&H?await mt(t,q,H):console.error("Missing required authentication data")}catch(t){console.error("Error in sendDataRequest:",t)}finally{T(!1)}},isAuthenticated:V,onLoginSuccess:async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=await St(t,e);return F(!0),T(!0),n}catch(t){throw console.error("Login process failed:",t),t}},onClose:()=>{k(0),T(!1)},setOthentUser:L,setHashedOthentSub:Z,setEncryptedPin:X}))}function Ev(t){return n().createElement(n().Fragment,null,n().createElement(bv,t))}const Sv=Ev})(),c})()));
2
2
  //# sourceMappingURL=onairos.bundle.js.map