@ethersphere/bee-js 12.3.1 → 12.3.2-upcoming.116
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.
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/manifest/manifest.js +43 -15
- package/dist/cjs/modules/debug/status.js +5 -8
- package/dist/cjs/version.js +11 -0
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/index.js +1 -1
- package/dist/mjs/manifest/manifest.js +43 -11
- package/dist/mjs/modules/debug/status.js +1 -3
- package/dist/mjs/version.js +8 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/manifest/manifest.d.ts +2 -0
- package/dist/types/modules/debug/status.d.ts +0 -3
- package/dist/types/version.d.ts +6 -0
- package/package.json +7 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BeeJs=t():e.BeeJs=t()}(this,(()=>(()=>{var e={20(e,t){"use strict";var n;async function r(e){return new Promise(((t,n)=>e.then(n,t)))}async function i(e){return new Promise((t=>setTimeout((()=>{t(!0)}),e)))}function o(e,t=Math.random){for(let n=e.length-1;n>0;n--){const r=Math.floor(t()*(n+1)),i=e[n];e[n]=e[r],e[r]=i}return e}function a(e,t,n=Math.random){return o(H(0,e.length-1),n).slice(0,t)}function s(e,t,n=Math.random){return Math.floor(n()*(t-e+1))+e}function c(e,t,n){return t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height}function u(e,t=Math.random){return t()<e}function l(e,t=Math.random){return e[Math.floor(e.length*t())]}function f(e){if(!e.length)throw Error("Received empty array");return e[e.length-1]}function h(e,t,n){return n(t.reduce(((e,t)=>t(e)),e))}function p(e,t){if(null==e)return null;const n=t.split(".");let r=e;for(const i of n){if(null===r[i]||void 0===r[i])return null;r=r[i]}return r}function d(e,t,n){const r=t.split(/\.|\[/);let i=e;for(let o=0;o<r.length;o++){const e=r[o],t=o<r.length-1&&r[o+1].includes("]"),a=e.includes("]")?e.replace(/\[|\]/g,""):e;if(o===r.length-1)return i[a]=n,n;g(i[a])||(i[a]=t?[]:{}),i=i[a]}return n}function m(e,t){return Math.round(e/t)*t}function g(e,t=!0){return!(!e||t&&!b(e._readableState)||t&&e.constructor&&(e.constructor.isBuffer||"AbortController"==e.constructor.name||"AbortSignal"==e.constructor.name||"Uint8Array"==e.constructor.name||"ArrayBuffer"===e.constructor.name||"ReadableStream"===e.constructor.name))&&"object"==typeof e}function y(e){return g(e)&&!Array.isArray(e)}function w(e){return Array.isArray(e)&&0===e.length}function b(e){return void 0===e}function v(e){return"[object Function]"===Object.prototype.toString.call(e)||"[object AsyncFunction]"===Object.prototype.toString.call(e)}function T(e){return"[object String]"===Object.prototype.toString.call(e)}function B(e){return"number"==typeof e&&isFinite(e)}function E(e){return!0===e||!1===e}function z(e){return"[object Date]"===Object.prototype.toString.call(e)}function R(e){return!T(e)||0===e.trim().length}function x(e){return B(e)&&Number.isInteger(e)&&e>=1}function I(e){return T(e)&&null!==e.match(/^-?\d+$/)}function $(e){return T(e)&&null!==e.match(/^(0x)?[0-9a-f]+$/i)}t.DH=t.Or=t.Rb=t.AO=t.FQ=t.iQ=t.DO=t.o8=t.LQ=t.yI=t.O3=t.ie=t.vU=t.pp=t.Xx=void 0;const k="!@#$%^&*()_+-=[]{}|;:<>?,./".split(""),S="abcdefghijklmnopqrstuvwxyz",A=S+"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",O=A+"!@#$%^&*()_+-=[]{}|;:<>?,./",_=["—","\\","東","京","都","𝖆","𝖇","𝖈","👾","🙇","💁","🙅","ᚠ","ᛇ","ᚻ","ᛦ"],D="0123456789abcdef";function V(e,t){if(R(e))throw new TypeError(`Expected string${t?.name?` for ${t.name}`:""}, got: `+e);if(t&&(void 0!==t.min&&e.length<t.min||void 0!==t.max&&e.length>t.max))throw RangeError(`Expected string${t?.name?` for ${t.name}`:""} length in range: ${t.min??"-inf"}..${t.max??"inf"}; got: ${e.length}`);return e}function N(e,t){if(void 0!==t.min&&e<t.min||void 0!==t.max&&e>t.max)throw RangeError(`Expected value${t?.name?` for ${t.name}`:""} in range: ${t.min??"-inf"}..${t.max??"inf"}; got: ${e}`)}function C(e,t){if(B(e))return t&&N(e,t),e;if(!T(e)||!e.match(/^-?\d+(\.\d+)?$/))throw new TypeError(`Expected number${t?.name?` for ${t.name}`:""}, got: `+e);const n=parseFloat(e);return t&&N(n,t),n}function P(e,t){return Math.trunc(C(e,t))}function F(e,t){if(!y(e))throw new TypeError(`Expected object${t?.name?` for ${t.name}`:""}, got: `+e);return e}function M(e){return T(e)&&null!==e.match(/^https?:\/\/.+/)}function U(e){return"bigint"==typeof e}function L(e,t){if(!U(e))throw new TypeError(`Expected bigint${t?.name?` for ${t.name}`:""}, got: `+e);if(void 0!==t?.min&&e<t?.min||void 0!==t?.max&&e>t?.max)throw RangeError(`Expected value${t?.name?` for ${t.name}`:""} in range: ${t.min??"-inf"}..${t.max??"inf"}; got: ${e}`);return e}function j(e,t){for(const[n,r]of Object.entries(t))if(!r(e[n]))throw TypeError(`${n} in value does not exist or match shape`);for(const n of Object.keys(e))if(!t[n])throw TypeError(`${n} exists in value but not in shape`);return!0}function G(e,t){if(y(e)&&y(t))for(const n in t)y(t[n])?(e[n]||(e[n]={}),G(e[n],t[n])):Array.isArray(t[n])?e[n]=[...t[n]]:(null!==t[n]&&void 0!==t[n]||null===e[n]||void 0===e[n])&&(e[n]=t[n]);return e}function Z(e,t){const n={};for(const r of e)for(const e of Object.keys(r))n[e]?n[e]=t(n[e],r[e]):n[e]=r[e];return n}function q(e,t){Array.prototype.push.apply(e,t)}function H(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}function J(e,t=()=>!1){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").split("").map((e=>/[a-z0-9]/.test(e)||t(e)?e:"-")).join("").replace(/-+/g,"-").replace(/^-|-$/g,"")}function W(e,t){if(0===t.length)return 0;const n=e.toLowerCase(),r=t.toLowerCase();return e===t?1e4:n.startsWith(r)?1e4-e.length:n.includes(r)?5e3-e.length:new RegExp(".*"+r.split("").join(".*")+".*").test(n)?1e3-e.length:0}const X={"&":"&",""":'"',"'":"'",">":">","<":"<"};function K(e,t){const n=e.indexOf(t);return-1===n?null:e.slice(0,n)}function Q(e,t){const n=e.indexOf(t);return-1===n?null:e.slice(n+t.length)}function Y(e,t){const n=e.lastIndexOf(t);return-1===n?null:e.slice(0,n)}function ee(e,t){const n=e.lastIndexOf(t);return-1===n?null:e.slice(n+t.length)}function te(e,t,n=!1){const r=n?e.lastIndexOf(t):e.indexOf(t);return-1===r?n?[null,e]:[e,null]:[e.slice(0,r),e.slice(r+t.length)]}function ne(e,t){let n=[e];for(const r of t)n=n.flatMap((e=>e.split(r)));return n.filter((e=>e))}function re(e){const t=f(e.split(/\\|\//g)),n=t.lastIndexOf(".",t.length-1);return n<=0?"":t.slice(n+1)}function ie(e){const t=f(e.split(/\\|\//g)),n=t.lastIndexOf(".",t.length-1);return n<=0?t:t.slice(0,n)}function oe(e){return e.split("\n").map((e=>e.trim().replace(/\s+/g," "))).filter((e=>e.length>0)).join("\n")}function ae(e){return e.charAt(0).toUpperCase()+e.slice(1)}function se(e){return e.charAt(0).toLowerCase()+e.slice(1)}function ce(e){if(!e)return!1;const t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122}function ue(e){if(!e)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}function le(e){return ce(e)||ue(e)}const fe=" \n\t\r.,?!:;\"'`(){}[]~@#$%^&*-+=|<>/\\".split("");function he(e){return fe.includes(e)}function pe(e,t,n=0){const r=t.exec(e.slice(n));return r?{index:r.index,match:r[0]}:null}function de(e,t,n=!0){if(!n)return t.every((t=>t instanceof RegExp?t.test(e):-1!==e.indexOf(t,0)));let r=0;for(const i of t)if(i instanceof RegExp){const t=pe(e,i,r);if(!t)return!1;r=t.index+t.match.length}else{const t=e.indexOf(i,r);if(-1===t)return!1;r=t+i.length}return!0}function me(e,t,n=0){const r=[];let i=e.indexOf(t,n);for(;-1!==i;)r.push(i),i=e.indexOf(t,i+t.length);return r}function ge(e,t,n=0){let r=-1;for(const i of t){const t=e.indexOf(i,n);-1!==t&&(-1===r||t<r)&&(r=t)}return r}function ye(e,t=0){for(let n=t;n<e.length;n++)if(he(e[n]))return n;return-1}function we(e,t=0){for(let n=t;n<e.length;n++)if("#"===e[n]&&le(e[n+1]))return n;return-1}function be(e,t,n=0){return e.slice(0,n).lastIndexOf(t)}function ve(e,t=0,n="{",r="}"){let i=1;for(let o=t;o<e.length;o++)if(e.slice(o,o+r.length)===r){if(0==--i)return o}else e.slice(o,o+n.length)===n&&i++;return-1}function Te(e,t){const n=t.wordBoundary?ge(e,[`${t.opening} `,`${t.opening}\n`],t.start||0):e.indexOf(t.opening,t.start||0);if(-1===n)return null;const r=ve(e,n+t.opening.length,t.opening,t.closing);return-1===r?null:t.exclusive?e.slice(n+t.opening.length,r):e.slice(n,r+t.closing.length)}const Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ee="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function ze(e,t){const n=t.length;let r=0,i=0;const o=[];for(let a=0;a<e.length;a++){const s=e[a];if("="===s)break;const c=t.indexOf(s);if(-1===c)throw new Error(`Invalid character: ${s}`);i=i<<Math.log2(n)|c,r+=Math.log2(n),r>=8&&(r-=8,o.push(i>>r&255))}return new Uint8Array(o)}function Re(e,t){const n=t.length;let r=0,i=0,o="";for(let a=0;a<e.length;a++)for(i=i<<8|e[a],r+=8;r>=Math.log2(n);)r-=Math.log2(n),o+=t[i>>r&n-1];return r>0&&(o+=t[i<<Math.log2(n)-r&n-1]),o.length%4!=0&&(o+="=".repeat(4-o.length%4)),o}function xe(e,t,n){const r=[];for(const i of n)i!==t&&r.push(e.replace(t,i));return r}function Ie(e){const t=e.lastIndexOf(" ");if(-1===t)return{line:e,rest:""};return{line:e.slice(0,t),rest:e.slice(t+1)}}function $e(e){const t=e.reduce(((e,t)=>e.length<t.length?e:t));let n="";for(let r=0;r<t.length;r++){const i=t[r];if(!e.every((e=>e[r]===i)))break;n+=i}return n}function ke(e,t){return new RegExp(`\\b${t}\\b`).test(e)}function Se(e,t,n=[]){let r="";for(;t<e.length&&(le(e[t])||n.includes(e[t]));)r+=e[t++];return r}function Ae(e,t,n,r="$",i=":"){if(""===n)return e;let o=e.indexOf(`${r}${t}`);for(;-1!==o;){if(e[o+t.length+1]===i)if(e[o+t.length+2]===i)e=e.replace(`${r}${t}${i}${i}`,n);else{const a=Se(e,o+t.length+2,["_"]);e=e.replace(`${r}${t}${i}${a}`,n)}else e=e.replace(`${r}${t}`,n);o=e.indexOf(`${r}${t}`,o+n.length)}return e}function Oe(e,t="$",n=":"){let r=e.indexOf(t);for(;-1!==r;){const i=Se(e,r+1);if(e[r+i.length+1]===n)if(e[r+i.length+2]===n)e=e.replace(`${t}${i}${n}${n}`,"");else{const o=Se(e,r+i.length+2);e=e.replace(`${t}${i}${n}${o}`,o)}r=e.indexOf(t,r+1)}return e}function _e(e,t=!0){const n=Object.entries(e).filter((([e,t])=>null!=t)).map((([e,t])=>`${e}=${encodeURIComponent(t)}`)).join("&");return n?(t?"?":"")+n:""}function De(e){return String(Math.floor(e)).padStart(2,"0")}function Ve(e){const t=Math.floor(e/36e5);e%=36e5;const n=Math.floor(e/6e4);e%=6e4;const r=Math.floor(e/1e3);return t?`${De(t)}:${De(n)}:${De(r)}`:`${De(n)}:${De(r)}`}function Ne(e){return Math.floor((z(e)?e.getTime():e)/864e5)}const Ce={today:(e,t)=>De(e)+":"+De(t),yesterday:()=>"Yesterday",monday:()=>"Mon",tuesday:()=>"Tue",wednesday:()=>"Wed",thursday:()=>"Thu",friday:()=>"Fri",saturday:()=>"Sat",sunday:()=>"Sun",weeks:e=>`${e}w`};const Pe={now:()=>"A few seconds",seconds:e=>`${e} seconds`,minutes:e=>`${e} minutes`,hours:e=>`${e} hours`,days:e=>`${e} days`,weeks:e=>`${e} weeks`};function Fe(e,n){const r=n?.now??Date.now(),i=n?.labels||Pe;let o=(r-(t.Or.isDate(e)?e.getTime():e))/1e3;return o<10?i.now():o<120?i.seconds(Math.floor(o)):(o/=60,o<120?i.minutes(Math.floor(o)):(o/=60,o<48?i.hours(Math.floor(o)):(o/=24,o<14?i.days(Math.floor(o)):(o/=7,i.weeks(Math.floor(o))))))}const Me={};const Ue={s:1e3,m:6e4,h:36e5,d:864e5};const Le={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"};function je(e){return{zeroBasedIndex:e,day:Le[e]}}function Ge(e){return je(e.getDay())}const Ze={ms:1,milli:1,millis:1,millisecond:1,milliseconds:1,s:1e3,sec:1e3,second:1e3,seconds:1e3,m:6e4,min:6e4,minute:6e4,minutes:6e4,h:36e5,hour:36e5,hours:36e5,d:864e5,day:864e5,days:864e5,w:6048e5,week:6048e5,weeks:6048e5,month:2592e6,months:2592e6,y:31536e6,year:31536e6,years:31536e6};const qe={b:0,byte:0,bytes:0,kb:1,kilobyte:1,kilobytes:1,mb:2,megabyte:2,megabytes:2,gb:3,gigabyte:3,gigabytes:3,tb:4,terabyte:4,terabytes:4};const He=new Map;function Je(e,t=!1){e=e.filter((e=>e)),t&&T(e[1])&&(e[1]="../"+e[1]);let n="";T(e[0])&&e[0].includes("://")&&(n=K(e[0],"://")??"",e[0]=Q(e[0],"://")??"");const r=e.map((e=>String(e))).flatMap((e=>e.split("/"))),i=[];for(let o=0;o<r.length;o++)"."!==r[o]&&(".."===r[o]?(!n||i.length>1)&&i.pop():i.push(r[o]));return(n?n+"://":"")+i.join("/").replaceAll(/\/{2,}/g,"/")}function We(e){const t=Object.keys(e).sort(((e,t)=>e.localeCompare(t))),n={};for(const r of t)n[r]=Ke(e[r]);return n}function Xe(e){const t=[];return e.sort(((e,t)=>JSON.stringify(Ke(e)).localeCompare(JSON.stringify(Ke(t))))).forEach((e=>t.push(Ke(e)))),t}function Ke(e){return Array.isArray(e)?Xe(e):g(e)?We(e):e}function Qe(e,t){return JSON.stringify(Ke(e))===JSON.stringify(Ke(t))}function Ye(e){const t=Object.keys(e);return t[Math.floor(Math.random()*t.length)]}const et=[1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24,1e27,1e30,1e9,1e16,1e18,1e18,1e18,1e33],tt=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","gwei","bzz","btc","eth","dai","decillion"],nt=["K","M","B","T","Qa","Qi","Sx","Sp","O","N","gwei","bzz","eth","btc","dai","D"];function rt(e){const t=parseFloat(e);if(isNaN(t))throw Error("makeNumber got NaN for input");const n=e.replace(/^-?[0-9.]+/,"").trim(),r=nt.findIndex((e=>e.toLowerCase()===n.toLowerCase()));return-1===r?t:t*et[r]}function it(e,t,n){return e<t?t:e>n?n:e}function ot(e,t,n){return e+(n?"["+t+"]":(e.length?".":"")+t)}function at(e,t,n,r,i){if(!g(t))return t;for(const[o,a]of Object.entries(t)){const t=ot(n,o,r);Array.isArray(a)?i?at(e,a,t,!0,i):e[t]=a.map((e=>at(Array.isArray(e)?[]:{},e,"",!1,i))):g(a)?at(e,a,t,!1,i):e[t]=a}return e}function st(e,t){const n={};for(const r of e){n[t(r)]=r}return n}function ct(e,t){const n=Math.ceil(e.length/t),r=[];for(let i=0;i<e.length;i+=n)r.push(e.slice(i,i+n));return r}function ut(e,t){const n=[],r=Math.ceil(e.length/t);for(let i=0;i<r;i++)n.push(e.slice(i*t,i*t+t));return n}function lt(e,t){return Object.fromEntries(Object.entries(e).sort(t))}function ft(e,t){const n=[];let r=[];return e.forEach(((i,o)=>{(0===o||!t(i,e[o-1]))&&(r=[],n.push(r)),r.push(i)})),n}function ht(e,t,n,r=100){if(e.map.has(t)){const n=e.keys.indexOf(t);e.keys.splice(n,1)}if(e.map.set(t,n),e.keys.push(t),e.keys.length>r){const t=e.keys.shift();t&&e.map.delete(t)}}class pt{constructor(e){this.value=e}static of(e){return new pt(e)}static empty(){return new pt(null)}map(e){return new pt(null!==this.value&&void 0!==this.value?e(this.value):null)}mapAsync(e){return null!==this.value&&void 0!==this.value?e(this.value).then((e=>pt.of(e))):Promise.resolve(pt.empty())}ifPresent(e){return null!==this.value&&void 0!==this.value&&e(this.value),this}ifPresentAsync(e){return null!==this.value&&void 0!==this.value?e(this.value).then((()=>this)):Promise.resolve(this)}ifAbsent(e){return(null===this.value||void 0===this.value)&&e(),this}ifAbsentAsync(e){return null===this.value||void 0===this.value?e().then((()=>this)):Promise.resolve(this)}getOrFallback(e){return this.value??e()}getOrFallbackAsync(e){return null!==this.value&&void 0!==this.value?Promise.resolve(this.value):e()}getOrThrow(){if(null===this.value||void 0===this.value)throw Error("Optional.value is empty");return this.value}}t.Xx=pt;class dt{constructor(e){this.value=e,this.children=[]}}function mt(e,t){if(Math.log2(e.length)%1!=0)throw new Error("Array length must be a power of 2");let n=[...e];for(;n.length>1;){const e=[];for(let r=0;r<n.length;r+=2){const i=n[r+1];e.push(t(n[r],i))}n=e}return n[0]}function gt(...e){const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;return e.forEach((e=>{n.set(e,r),r+=e.length})),n}function yt(e){return 137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]}function wt(e){return 255===e[0]&&216===e[1]}function bt(e){return 87===e[8]&&69===e[9]&&66===e[10]&&80===e[11]}function vt(e,t){const n=new ArrayBuffer(8);return new DataView(n).setBigUint64(0,BigInt(e),"LE"===t),new Uint8Array(n)}function Tt(e,t){const n=new Uint8Array(32);let r=e;if("LE"===t){for(let e=0;e<32;e++)n[e]=Number(0xffn&r),r>>=8n;return n}for(let i=31;i>=0;i--)n[i]=Number(0xffn&r),r>>=8n;return n}function Bt(e,t){let n=0n;if("LE"===t){for(let t=31;t>=0;t--)n=n<<8n|BigInt(e[t]);return n}for(let r=0;r<32;r++)n=n<<8n|BigInt(e[r]);return n}function Et(e,t){const n=[];for(let r=0;r<e.length;r+=t)n.push(e.subarray(r,r+t));return n}const zt=[0,1,0,32898,2147483648,32906,2147483648,2147516416,0,32907,0,2147483649,2147483648,2147516545,2147483648,32777,0,138,0,136,0,2147516425,0,2147483658,0,2147516555,2147483648,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,0,32778,2147483648,2147483658,2147483648,2147516545,2147483648,32896,0,2147483649,2147483648,2147516424];function Rt(e){for(let t=0;t<24;t++){const n=e[0]^e[10]^e[20]^e[30]^e[40],r=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],o=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],s=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],u=e[7]^e[17]^e[27]^e[37]^e[47],l=e[8]^e[18]^e[28]^e[38]^e[48],f=e[9]^e[19]^e[29]^e[39]^e[49],h=l^(i<<1|o>>>31),p=f^(o<<1|i>>>31),d=n^(a<<1|s>>>31),m=r^(s<<1|a>>>31),g=i^(c<<1|u>>>31),y=o^(u<<1|c>>>31),w=a^(l<<1|f>>>31),b=s^(f<<1|l>>>31),v=c^(n<<1|r>>>31),T=u^(r<<1|n>>>31);e[0]^=h,e[1]^=p,e[2]^=d,e[3]^=m,e[4]^=g,e[5]^=y,e[6]^=w,e[7]^=b,e[8]^=v,e[9]^=T,e[10]^=h,e[11]^=p,e[12]^=d,e[13]^=m,e[14]^=g,e[15]^=y,e[16]^=w,e[17]^=b,e[18]^=v,e[19]^=T,e[20]^=h,e[21]^=p,e[22]^=d,e[23]^=m,e[24]^=g,e[25]^=y,e[26]^=w,e[27]^=b,e[28]^=v,e[29]^=T,e[30]^=h,e[31]^=p,e[32]^=d,e[33]^=m,e[34]^=g,e[35]^=y,e[36]^=w,e[37]^=b,e[38]^=v,e[39]^=T,e[40]^=h,e[41]^=p,e[42]^=d,e[43]^=m,e[44]^=g,e[45]^=y,e[46]^=w,e[47]^=b,e[48]^=v,e[49]^=T;const B=e[0],E=e[1],z=e[2]<<1|e[3]>>>31,R=e[3]<<1|e[2]>>>31,x=e[5]<<30|e[4]>>>2,I=e[4]<<30|e[5]>>>2,$=e[6]<<28|e[7]>>>4,k=e[7]<<28|e[6]>>>4,S=e[8]<<27|e[9]>>>5,A=e[9]<<27|e[8]>>>5,O=e[11]<<4|e[10]>>>28,_=e[10]<<4|e[11]>>>28,D=e[13]<<12|e[12]>>>20,V=e[12]<<12|e[13]>>>20,N=e[14]<<6|e[15]>>>26,C=e[15]<<6|e[14]>>>26,P=e[17]<<23|e[16]>>>9,F=e[16]<<23|e[17]>>>9,M=e[18]<<20|e[19]>>>12,U=e[19]<<20|e[18]>>>12,L=e[20]<<3|e[21]>>>29,j=e[21]<<3|e[20]>>>29,G=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,q=e[25]<<11|e[24]>>>21,H=e[24]<<11|e[25]>>>21,J=e[26]<<25|e[27]>>>7,W=e[27]<<25|e[26]>>>7,X=e[29]<<7|e[28]>>>25,K=e[28]<<7|e[29]>>>25,Q=e[31]<<9|e[30]>>>23,Y=e[30]<<9|e[31]>>>23,ee=e[33]<<13|e[32]>>>19,te=e[32]<<13|e[33]>>>19,ne=e[34]<<15|e[35]>>>17,re=e[35]<<15|e[34]>>>17,ie=e[36]<<21|e[37]>>>11,oe=e[37]<<21|e[36]>>>11,ae=e[38]<<8|e[39]>>>24,se=e[39]<<8|e[38]>>>24,ce=e[40]<<18|e[41]>>>14,ue=e[41]<<18|e[40]>>>14,le=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,he=e[45]<<29|e[44]>>>3,pe=e[44]<<29|e[45]>>>3,de=e[47]<<24|e[46]>>>8,me=e[46]<<24|e[47]>>>8,ge=e[48]<<14|e[49]>>>18,ye=e[49]<<14|e[48]>>>18;e[0]=B^~D&q,e[1]=E^~V&H,e[2]=D^~q&ie,e[3]=V^~H&oe,e[4]=q^~ie&ge,e[5]=H^~oe&ye,e[6]=ie^~ge&B,e[7]=oe^~ye&E,e[8]=ge^~B&D,e[9]=ye^~E&V,e[10]=$^~M&L,e[11]=k^~U&j,e[12]=M^~L&ee,e[13]=U^~j&te,e[14]=L^~ee&he,e[15]=j^~te&pe,e[16]=ee^~he&$,e[17]=te^~pe&k,e[18]=he^~$&M,e[19]=pe^~k&U,e[20]=z^~N&J,e[21]=R^~C&W,e[22]=N^~J&ae,e[23]=C^~W&se,e[24]=J^~ae&ce,e[25]=W^~se&ue,e[26]=ae^~ce&z,e[27]=se^~ue&R,e[28]=ce^~z&N,e[29]=ue^~R&C,e[30]=S^~O&G,e[31]=A^~_&Z,e[32]=O^~G&ne,e[33]=_^~Z&re,e[34]=G^~ne&de,e[35]=Z^~re&me,e[36]=ne^~de&S,e[37]=re^~me&A,e[38]=de^~S&O,e[39]=me^~A&_,e[40]=x^~P&X,e[41]=I^~F&K,e[42]=P^~X&Q,e[43]=F^~K&Y,e[44]=X^~Q&le,e[45]=K^~Y&fe,e[46]=Q^~le&x,e[47]=Y^~fe&I,e[48]=le^~x&P,e[49]=fe^~I&F,e[0]^=zt[2*t],e[1]^=zt[2*t+1]}}function xt(e){const t=[];for(let n=0;n<e.length;n+=4)t.push(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24);return t}function It(e,t){if(!e.length){const e=new Uint8Array(136);return e[0]=t,e[135]=128,[xt(e)]}const n=Et(e,136),r=n[n.length-1];if(r.length<136){const e=new Uint8Array(136);e.set(r),e[r.length]=t,e[135]|=128,n[n.length-1]=e}if(136===r.length){const e=new Uint8Array(136);e[0]=t,e[135]=128,n.push(e)}return n.map(xt)}function $t(e,t){for(const n of t){for(let t=0;t<34;t+=2)e[t]^=n[t+1],e[t+1]^=n[t];Rt(e)}return e}function kt(e){return new Uint8Array([e[1],e[1]>>-24,e[1]>>-16,e[1]>>-8,e[0],e[0]>>8,e[0]>>16,e[0]>>24,e[3],e[3]>>-24,e[3]>>-16,e[3]>>-8,e[2],e[2]>>8,e[2]>>16,e[2]>>24,e[5],e[5]>>-24,e[5]>>-16,e[5]>>-8,e[4],e[4]>>8,e[4]>>16,e[4]>>24,e[7],e[7]>>-24,e[7]>>-16,e[7]>>-8,e[6],e[6]>>8,e[6]>>16,e[6]>>24])}function St(e){return kt($t(new Array(50).fill(0),It(e,1)))}function At(e,t,n=0){if(e.length>=t)return e;const r=new Uint8Array(t);return r.fill(n),r.set(e,t-e.length),r}function Ot(e,t,n=0){if(e.length>=t)return e;const r=new Uint8Array(t);return r.fill(n),r.set(e,0),r}function _t(e,t){return(e%t+t)%t}function Dt(e,t){e=_t(e,t);let[n,r]=[0n,1n],[i,o]=[t,e];for(;0n!==o;){const e=i/o;[n,r]=[r,n-e*r],[i,o]=[o,i-e*o]}if(i>1n)throw new Error("a is not invertible");return n<0n&&(n+=t),n}function Vt(e,t){return 0n===_t(e,t)?0n:t%4n===3n?function(e,t,n){let r=1n;for(e=_t(e,n);t>0;)t%2n===1n&&(r=_t(r*e,n)),e=_t(e*e,n),t/=2n;return r}(e,(t+1n)/4n,t):null}const Nt=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,Ct=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,Pt=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Ft=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;function Mt(e,t,n){if(0n===t)return[0n,0n];const r=_t(3n*e*e*Dt(2n*t,n),n),i=_t(r*r-2n*e,n);return[i,_t(r*(e-i)-t,n)]}function Ut(e,t,n,r,i){if(0n===e&&0n===t)return[n,r];if(0n===n&&0n===r)return[e,t];if(e===n&&t===_t(-r,i))return[0n,0n];if(e===n&&t===r)return Mt(e,t,i);const o=_t((r-t)*Dt(n-e,i),i),a=_t(o*o-e-n,i);return[a,_t(o*(e-a)-t,i)]}function Lt(e,t,n,r){let i=[0n,0n],o=[e,t];const a=n.toString(2);for(const s of a)"0"===s?(o=Ut(i[0],i[1],o[0],o[1],r),i=Mt(i[0],i[1],r)):(i=Ut(i[0],i[1],o[0],o[1],r),o=Mt(o[0],o[1],r));return i}function jt(e,t,n){if(t<=0n||t>=Ct)throw new Error("Invalid private key");if(n||(n=_t(Bt(St(gt(St(Tt(t,"BE")),Tt(e,"BE"))),"BE"),Ct)),n<=0n||n>=Ct)throw new Error("Invalid nonce");const r=_t(e,Ct),i=Lt(Pt,Ft,n,Nt),o=_t(i[0],Ct);let a=_t((r+_t(o,Ct)*t)*Dt(n,Ct),Ct);if(0n===o||0n===a)throw new Error("Invalid r or s value");let s=i[1]%2n===0n?27n:28n;return a>Ct/2n&&(a=Ct-a,s=27n===s?28n:27n),[o,a,s]}class Gt{constructor(e){this.cursor=0,this.buffer=e}read(e){const t=this.buffer.subarray(this.cursor,this.cursor+e);return this.cursor+=e,t}max(){return this.buffer.length-this.cursor}}t.pp=Gt;class Zt{constructor(e){this.buffer=e,this.cursor=0}write(e){const t=Math.min(this.max(),e.max());return this.buffer.set(e.read(t),this.cursor),this.cursor+=t,t}max(){return this.buffer.length-this.cursor}}class qt{constructor(e,t=0n){this.span=t,this.writer=new Zt(new Uint8Array(e))}build(){return gt(vt(this.span,"LE"),this.writer.buffer)}hash(){const e=mt(Et(this.writer.buffer,32),((e,t)=>qt.hashFunction(gt(e,t))));return qt.hashFunction(gt(vt(this.span,"LE"),e))}}qt.hashFunction=St;class Ht{constructor(e,t=4096){this.counters=[1],this.capacity=t,this.chunks=[new qt(t)],this.onChunk=e}static async root(e,t=4096){const r=new n(n.NOOP,t);return await r.append(e),r.finalize()}async append(e,t=0,n=0n){const r=new Gt(e);for(;r.max()>0;){0===this.chunks[t].writer.max()&&await this.elevate(t);const e=this.chunks[t].writer.write(r);n?this.chunks[t].span+=n:this.chunks[0].span+=BigInt(e)}}async elevate(e){this.counters[e]=++this.counters[e]%(this.capacity/32),this.chunks[e+1]||(this.chunks.push(new qt(this.capacity)),this.counters.push(1)),await this.append(this.chunks[e].hash(),e+1,this.chunks[e].span),await this.onChunk(this.chunks[e]),this.chunks[e]=new qt(this.capacity)}async finalize(e=0){return this.chunks[e+1]?1===this.counters[e]?(await this.elevate(e+1),this.chunks[e+1]=this.chunks[e],this.finalize(e+1)):(await this.elevate(e),this.finalize(e+1)):(await this.onChunk(this.chunks[e]),this.chunks[e])}}t.vU=Ht,n=Ht,Ht.NOOP=async e=>{};class Jt{constructor(e,t){if(t<0)throw Error("Scale must be non-negative");this.value=BigInt(e),this.scale=t}static cast(e){if(!e)throw Error("Cannot cast falsy value to FixedPointNumber");if(e instanceof Jt)return e;const t=L(e.value),n=C(e.scale);return new Jt(t,n)}static fromDecimalString(e,t){/e\-\d+$/i.test(e)&&(e=parseFloat(e).toFixed(t));let[n,r]=e.split(".");return r=(r||"").padEnd(t,"0").slice(0,t),new Jt(BigInt(n+r),t)}static fromFloat(e,t){return Jt.fromDecimalString(e.toString(),t)}add(e){return this.assertSameScale(e),new Jt(this.value+e.value,this.scale)}subtract(e){return this.assertSameScale(e),new Jt(this.value-e.value,this.scale)}multiply(e){return new Jt(this.value*e,this.scale)}divmod(e){if(0n===e)throw new Error("Division by zero is not allowed");const t=this.value/e,n=this.value%e;return[new Jt(t,this.scale),new Jt(n,this.scale)]}exchange(e,t,n){if("*"===e){const e=this.value*t.value/10n**BigInt(this.scale);return new Jt(e,n)}this.assertSameScale(t);const r=this.value*10n**BigInt(n)/t.value;return new Jt(r,n)}compare(e){return this.assertSameScale(e),this.value>e.value?1:this.value<e.value?-1:0}toDecimalString(){if(0===this.scale)return this.value.toString();const e=this.value.toString();return`${e.slice(0,-this.scale)||"0"}.${e.slice(-this.scale).padStart(this.scale,"0")}`}toString(){return this.value.toString()}toJSON(){return this.toString()}toFloat(){return parseFloat(this.toDecimalString())}assertSameScale(e){if(this.scale!==e.scale)throw new Error(`Scale mismatch: expected ${this.scale}, but got ${e.scale}`)}}function Wt(e,t,n,r){const i=e.findIndex((e=>e===`--${t}`||e.startsWith(`--${t}=`))),o=e[i];if(!o)return(n||{})[r||t||""]||null;if(o.includes("="))return o.split("=")[1];const a=e[i+1];return a&&!a.startsWith("-")?a:(n||{})[r||t||""]||null}function Xt(e,t,n,r){const i=Wt(e,t,n,r);if(!i)throw new Error(`Missing argument ${t}`);return i}function Kt(e,t){const n=e[t];e.splice(t,1),e.unshift(n)}function Qt(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Yt(e,t){return{x:e.x*t,y:e.y*t}}function en(e,t,n){return{x:e.x+Math.cos(t)*n,y:e.y+Math.sin(t)*n}}function tn(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function nn(e,t,n="row-first"){const r=[];if("column-first"===n)for(let i=0;i<e.length;i++)for(let n=0;n<e[0].length;n++)t(i,n)&&r.push({x:i,y:n});else for(let i=0;i<e[0].length;i++)for(let n=0;n<e.length;n++)t(n,i)&&r.push({x:n,y:i});return r}function rn(e,t,n){return!e[t-1]?.[n]}function on(e,t,n){return!e[t+1]?.[n]}function an(e,t,n){return!e[t][n-1]}function sn(e,t,n){return!e[t][n+1]}function cn(e,t,n){const r=[];return e[t][n]?function(e,t,n){return e[t+1]?.[n]&&e[t-1]?.[n]&&!e[t][n-1]&&!e[t][n+1]}(e,t,n)||function(e,t,n){return e[t][n+1]&&e[t][n-1]&&!e[t-1]?.[n]&&!e[t+1]?.[n]}(e,t,n)?[]:(!e[t-1]?.[n-1]&&rn(e,t,n)&&an(e,t,n)&&r.push({x:t,y:n}),!e[t+1]?.[n-1]&&on(e,t,n)&&an(e,t,n)&&r.push({x:t+1,y:n}),!e[t-1]?.[n+1]&&rn(e,t,n)&&sn(e,t,n)&&r.push({x:t,y:n+1}),!e[t+1]?.[n+1]&&on(e,t,n)&&sn(e,t,n)&&r.push({x:t+1,y:n+1}),r):(e[t-1]?.[n]&&e[t][n-1]&&r.push({x:t,y:n}),e[t+1]?.[n]&&e[t][n-1]&&r.push({x:t+1,y:n}),e[t-1]?.[n]&&e[t][n+1]&&r.push({x:t,y:n+1}),e[t+1]?.[n]&&e[t][n+1]&&r.push({x:t+1,y:n+1}),r)}function un(e,t){return t.map((t=>function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}(e,t))).sort(((e,t)=>e-t))}function ln(e,t,n,r){const i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y);if(0===i)return null;let o=e.y-n.y,a=e.x-n.x;const s=(r.x-n.x)*o-(r.y-n.y)*a,c=(t.x-e.x)*o-(t.y-e.y)*a;return o>0&&o<1&&a>0&&a<1?{x:e.x+o*(t.x-e.x),y:e.y+o*(t.y-e.y)}:null}function fn(e,t,n){const r=[],i=en(e,n,1e4);for(const o of t){const t=ln(e,i,o.start,o.end);t&&r.push(t)}return r.length?r.reduce(((t,n)=>tn(e,n)<tn(e,t)?n:t)):null}t.ie=Jt;class hn{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),()=>{this.subscribers=this.subscribers.filter((t=>t!==e))}}publish(e){this.subscribers.forEach((t=>t(e)))}clear(){this.subscribers=[]}getSubscriberCount(){return this.subscribers.length}}t.O3=class{constructor(e,t){this.queue=[],this.running=0,this.onProcessed=new hn,this.onDrained=new hn,this.concurrency=e,this.capacity=t}process(){if(this.running>=this.concurrency)return;const e=this.queue.shift();e&&(this.running++,e().finally((()=>{this.running--,this.process(),this.onProcessed.publish(),0===this.running&&this.onDrained.publish()})))}enqueue(e){if(this.queue.length<this.capacity)return this.queue.push(e),this.process(),Promise.resolve();if(this.onProcessed.getSubscriberCount())throw Error("Queue capacity is full");return new Promise((t=>{this.onProcessed.subscribe((()=>{this.queue.length<this.capacity&&(this.queue.push(e),this.process(),this.onProcessed.clear(),t())}))}))}drain(){if(0===this.running)return Promise.resolve();if(this.onDrained.getSubscriberCount())throw Error("Already draining");return new Promise((e=>{this.onDrained.subscribe((()=>{this.onDrained.clear(),e()}))}))}};class pn{constructor(){this.forks=new Map}insert(e,t){if(0===e.length)return void(this.handler=t);const n=e[0];let r,i=n;if(n.startsWith(":")&&n.slice(1),!this.forks.has(i)){const e=new pn;r&&(e.variableName=r),this.forks.set(i,e)}this.forks.get(i).insert(e.slice(1),t)}async handle(e,t,n,r){if(0===e.length)return!!this.handler&&(await this.handler(t,n,r),!0);const i=e[0],o=this.forks.get(i);if(o)return o.handle(e.slice(1),t,n,r);const a=this.forks.get(":");if(a)return a.variableName&&r.set(a.variableName,decodeURIComponent(i)),a.handle(e.slice(1),t,n,r);const s=this.forks.get("*");return!!s&&(r.set("wildcard",e.join("/")),!!s.handler&&(await s.handler(t,n,r),!0))}}t.yI={hexToUint8Array:function(e){(e.startsWith("0x")||e.startsWith("0X"))&&(e=e.slice(2));const t=e.length/2,n=new Uint8Array(t);for(let r=0;r<t;r++){const t=parseInt(e.slice(2*r,2*r+2),16);n[r]=t}return n},uint8ArrayToHex:function(e){return Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join("")},binaryToUint8Array:function(e){const t=Math.ceil(e.length/8),n=new Uint8Array(t);for(let r=0;r<t;r++){const t=parseInt(e.slice(8*r,8*r+8),2);n[r]=t}return n},uint8ArrayToBinary:function(e){return Array.from(e).map((e=>e.toString(2).padStart(8,"0"))).join("")},base64ToUint8Array:function(e){return ze(e,Be)},uint8ArrayToBase64:function(e){return Re(e,Be)},base32ToUint8Array:function(e){return ze(e,Ee)},uint8ArrayToBase32:function(e){return Re(e,Ee)},log2Reduce:mt,partition:Et,concatBytes:gt,numberToUint8:function(e){return new Uint8Array([e])},uint8ToNumber:function(e){return e[0]},numberToUint16:function(e,t){const n=new ArrayBuffer(2);return new DataView(n).setUint16(0,e,"LE"===t),new Uint8Array(n)},uint16ToNumber:function(e,t){return new DataView(e.buffer).getUint16(e.byteOffset,"LE"===t)},numberToUint32:function(e,t){const n=new ArrayBuffer(4);return new DataView(n).setUint32(0,e,"LE"===t),new Uint8Array(n)},uint32ToNumber:function(e,t){return new DataView(e.buffer).getUint32(e.byteOffset,"LE"===t)},numberToUint64:vt,uint64ToNumber:function(e,t){return new DataView(e.buffer).getBigUint64(e.byteOffset,"LE"===t)},numberToUint256:Tt,uint256ToNumber:Bt,sliceBytes:function(e,t){const n=[];let r=0;for(const i of t)n.push(e.subarray(r,r+i)),r+=i;return n},keccak256:St,sha3_256:function(e){return kt($t(new Array(50).fill(0),It(e,6)))},proximity:function(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=e[r]^t[r];for(let e=0;e<8;e++)if(n>>7-e&1)return 8*r+e}return 8*Math.min(e.length,t.length)},commonPrefix:function(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return e.subarray(0,r);return e.subarray(0,n)},setBit:function(e,t,n,r){const i=Math.floor(t/8),o=t%8;1===n?e[i]|=1<<("BE"===r?7-o:o):e[i]&=~(1<<("BE"===r?7-o:o))},getBit:function(e,t,n){const r=t%8;return e[Math.floor(t/8)]>>("BE"===n?7-r:r)&1},indexOf:function(e,t,n=0){for(let r=n;r<e.length;r++)for(let n=0;n<t.length&&e[r+n]===t[n];n++)if(n===t.length-1)return r;return-1},equals:function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},padStart:At,padStartToMultiple:function(e,t,n=0){const r=e.length%t;return 0===r?e:At(e,e.length+t-r,n)},padEnd:Ot,padEndToMultiple:function(e,t,n=0){const r=e.length%t;return 0===r?e:Ot(e,e.length+t-r,n)},xorCypher:function(e,t){const n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]^t[r%t.length];return n},isUtf8:function(e){for(let t=0;t<e.length;t++){const n=e[t];if(!(n<128))if(192==(224&n)){if(t+1>=e.length||128!=(192&e[t+1]))return!1;t+=1}else if(224==(240&n)){if(t+2>=e.length||128!=(192&e[t+1])||128!=(192&e[t+2]))return!1;t+=2}else{if(240!=(248&n))return!1;if(t+3>=e.length||128!=(192&e[t+1])||128!=(192&e[t+2])||128!=(192&e[t+3]))return!1;t+=3}}return!0}},t.LQ={privateKeyToPublicKey:function(e){if(e<=0n||e>=Ct)throw new Error("Invalid private key");return Lt(Pt,Ft,e,Nt)},compressPublicKey:function(e){const t=e[1]%2n===0n?2:3;return new Uint8Array([t,...Tt(e[0],"BE")])},publicKeyFromCompressed:function(e){if(33!==e.length||2!==e[0]&&3!==e[0])throw new Error("Invalid compressed public key");const t=Bt(e.slice(1),"BE"),n=Vt(_t(t**3n+7n,Nt),Nt);if(!n)throw Error("Invalid x: does not correspond to a valid curve point");const r=_t(-n,Nt),i=n%2n===0n;return[t,2===e[0]?i?n:r:i?r:n]},publicKeyToAddress:function(e){const t=new Uint8Array(20),n=St(gt(Tt(e[0],"BE"),Tt(e[1],"BE")));return t.set(n.subarray(12)),t},signMessage:function(e,t,n){return jt(Bt(St(e),"BE"),t,n)},signHash:jt,verifySignature:function(e,t,n,r){const i=_t(Bt(St(e),"BE"),Ct),o=Dt(r,Ct),a=_t(i*o,Ct),s=_t(n*o,Ct),c=Lt(Pt,Ft,a,Nt),u=Lt(t[0],t[1],s,Nt);return n===_t(Ut(c[0],c[1],u[0],u[1],Nt)[0],Ct)},recoverPublicKey:function(e,t,n,r){const i=Vt(_t(t**3n+7n,Nt),Nt);if(!i)throw new Error("Invalid r: does not correspond to a valid curve point");const o=i%2n===(27n===r?0n:1n)?i:Nt-i,a=_t(Bt(St(e),"BE"),Ct),s=Lt(t,o,n,Nt),c=Lt(Pt,Ft,a,Nt),u=Ut(s[0],s[1],c[0],_t(-c[1],Nt),Nt);return Lt(u[0],u[1],Dt(t,Ct),Nt)},checksumEncode:function(e){const n=t.yI.uint8ArrayToHex(e),r=t.yI.uint8ArrayToHex(t.yI.keccak256(new Uint8Array([...n].map((e=>e.charCodeAt(0))))));let i="0x";for(let t=0;t<n.length;t++)parseInt(r[t],16)>7?i+=n[t].toUpperCase():i+=n[t];return i}},t.o8={intBetween:s,floatBetween:function(e,t,n=Math.random){return n()*(t-e)+e},chance:u,signed:function(){return 2*Math.random()-1},makeSeededRng:function(e){let t=e,n=3405648695,r=3735928559;return function(){return t+=n,n^=t<<7,t*=r,r^=t<<13,t^=n^r,(t>>>0)/4294967296}},point:function(e,t,n,r=Math.random){let i,o;do{i=s(0,e-1,r),o=s(0,t-1,r)}while(n&&c(n,i,o));return[i,o]},procs:function(e,t=Math.random){const n=Math.floor(e);return u(e-n,t)?n+1:n}},t.DO={countUnique:function(e,t,n,r,i){const o=t?e.map(t):e,a={};for(const c of o)a[c]=(a[c]||0)+1;const s=r?lt(a,i?(e,t)=>e[1]-t[1]:(e,t)=>t[1]-e[1]):a;return n?Object.keys(s):s},makeUnique:function(e,t){return Object.values(st(e,t))},splitBySize:function(e,t){const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},splitByCount:ct,index:st,indexCollection:function(e,t){const n={};for(const r of e){const e=t(r);n[e]||(n[e]=[]),n[e].push(r)}return n},onlyOrThrow:function(e){if(1===e.length)return e[0];throw Error(`Expected exactly one element, actual: ${e.length}`)},onlyOrNull:function(e){return 1===e.length?e[0]:null},firstOrThrow:function(e){if(!e.length)throw Error("Received empty array");return e[0]},firstOrNull:function(e){return e.length>0?e[0]:null},shuffle:o,initialize:function(e,t){const n=[];for(let r=0;r<e;r++)n.push(t(r));return n},initialize2D:function(e,t,n){const r=[];for(let i=0;i<e;i++){r.push([]);for(let e=0;e<t;e++)r[i].push(n)}return r},rotate2D:function(e){const t=[];for(let n=0;n<e[0].length;n++){t.push([]);for(let r=0;r<e.length;r++)t[n].push(e[r][n])}return t},containsShape:function(e,t,n,r){if(n<0||r<0||r+t[0].length>e[0].length||n+t.length>e.length)return!1;for(let i=0;i<t.length;i++)for(let o=0;o<t[i].length;o++)if(void 0!==t[i][o]&&e[n+i][r+o]!==t[i][o])return!1;return!0},glue:function(e,t){const n=[];for(let r=0;r<e.length;r++)n.push(e[r]),r<e.length-1&&(v(t)?n.push(t()):n.push(t));return n},pluck:function(e,t){return e.map((e=>e[t]))},pick:l,pickMany:function(e,t,n=Math.random){if(t>e.length)throw new Error(`Count (${t}) is greater than array length (${e.length})`);return a(e,t,n).map((t=>e[t]))},pickManyUnique:function(e,t,n,r=Math.random){if(t>e.length)throw new Error(`Count (${t}) is greater than array length (${e.length})`);const i=[];for(;i.length<t;){const t=l(e,r);i.some((e=>n(e,t)))||i.push(t)}return i},pickWeighted:function(e,t,n){if(void 0===n&&(n=Math.random()),e.length!==t.length)throw new Error("Array length mismatch");let r=t.reduce(((e,t)=>e+t),0);const i=n*r;for(let o=0;o<e.length-1;o++)if(r-=t[o],i>=r)return e[o];return f(e)},pickRandomIndices:a,pickGuaranteed:function(e,n,r,i,a,s=Math.random){const c=e.filter((e=>e!==n&&e!==r)),u=[];for(null!==n&&u.push(n);c.length&&u.length<i;){const e=t.o8.intBetween(0,c.length-1,s);a(c[e],u)&&u.push(c[e]),c.splice(e,1)}return o(u,s),{values:u,indexOfGuaranteed:null!==n?u.indexOf(n):-1}},last:f,pipe:h,makePipe:function(e,t){return n=>h(n,e,t)},sortWeighted:function(e,t,n=Math.random){const r=t.map((e=>n()*e)),i=[];for(let o=0;o<e.length;o++)i.push([e[o],r[o]]);return i.sort(((e,t)=>t[1]-e[1])).map((e=>e[0]))},pushAll:q,unshiftAll:function(e,t){Array.prototype.unshift.apply(e,t)},filterAndRemove:function(e,t){const n=[];for(let r=e.length-1;r>=0;r--)t(e[r])&&n.push(e.splice(r,1)[0]);return n},merge:function(e,t){const n=Object.keys(t);for(const r of n)Array.isArray(t[r])&&Array.isArray(e[r])&&q(e[r],t[r])},empty:function(e){return e.splice(0,e.length),e},pushToBucket:function(e,t,n){e[t]||(e[t]=[]),e[t].push(n)},unshiftAndLimit:function(e,t,n){for(e.unshift(t);e.length>n;)e.pop()},atRolling:function(e,t){let n=t%e.length;return n<0&&(n+=e.length),e[n]},group:ft,createOscillator:function(e){let t=0;return{next:()=>e[t++%e.length]}},organiseWithLimits:function(e,t,n,r,i){const o={};for(const a of Object.keys(t))o[a]=[];o[r]=[],i&&(e=e.sort(i));for(const a of e){const e=a[n],i=t[e]?e:r;o[i].length>=t[i]?o[r].push(a):o[i].push(a)}return o},tickPlaybook:function(e){if(0===e.length)return null;const t=e[0];return t.ttlMax?--t.ttl<=0&&e.shift():t.ttlMax=t.ttl,{progress:(t.ttlMax-t.ttl)/t.ttlMax,data:t.data}},getArgument:Wt,getBooleanArgument:function(e,t,n,r){const i=e.some((e=>e.endsWith("-"+t))),o=Wt(e,t,n,r);if(!o&&i)return!0;if(!o&&!i)return null;if(["true","1","yes","y","on"].includes(o.toLowerCase()))return!0;if(["false","0","no","n","off"].includes(o.toLowerCase()))return!1;throw Error(`Invalid boolean argument ${t}: ${o}`)},getNumberArgument:function(e,t,n,r){const i=Wt(e,t,n,r);if(!i)return null;try{return rt(i)}catch{throw new Error(`Invalid number argument ${t}: ${i}`)}},requireStringArgument:Xt,requireNumberArgument:function(e,t,n,r){const i=Xt(e,t,n,r);try{return rt(i)}catch{throw new Error(`Invalid argument ${t}: ${i}`)}},bringToFront:function(e,t){const n=[...e];return Kt(n,t),n},bringToFrontInPlace:Kt,findInstance:function(e,t){const n=e.find((e=>e instanceof t));return pt.of(n)},filterInstances:function(e,t){return e.filter((e=>e instanceof t))},interleave:function(e,t){const n=[],r=Math.max(e.length,t.length);for(let i=0;i<r;i++)e[i]&&n.push(e[i]),t[i]&&n.push(t[i]);return n},toggle:function(e,t){return e.includes(t)?e.filter((e=>e!==t)):[...e,t]},createHierarchy:function(e,t,n,r,i=!1){const o=new Map,a=[];e.forEach((e=>{const n=new dt(e);o.set(e[t],n)})),e.forEach((e=>{const r=o.get(e[t]);if(!r)return;const i=e[n];if(i){const e=o.get(i);e&&e.children.push(r)}else a.push(r)}));const s=e=>{e.children.sort(((e,t)=>{const n=e.value[r],o=t.value[r];return i?o-n:n-o})),e.children.forEach(s)};return a.forEach(s),a},multicall:function(e){return()=>e.forEach((e=>e()))},maxBy:function(e,t){return e.reduce(((e,n)=>t(e)>t(n)?e:n))},minBy:function(e,t){return e.reduce(((e,n)=>t(e)<t(n)?e:n))},allIndexOf:function(e,t){const n=[];return e.forEach(((e,r)=>{t(e)&&n.push(r)})),n}},t.iQ={sleepMillis:i,forever:async function(e,t,n){for(;;){try{await e()}catch(r){n&&n("Error in forever",r)}await i(t)}},scheduleMany:function(e,t){for(let n=0;n<e.length;n++){const r=e[n],i=t[n],o=Math.max(0,i.getTime()-Date.now());setTimeout(r,o)}},waitFor:async function(e,t){let n=t.requiredConsecutivePasses||1,r=0;for(let o=0;o<t.attempts;o++){try{if(await e()){if(r++,r>=n)return}else r=0}catch{r=0}o<t.attempts-1&&await i(t.waitMillis)}throw Error("Timed out waiting for predicate")},expandError:function(e,t){if(T(e))return e;const n=Object.keys(e);e.message&&!n.includes("message")&&n.push("message");const r=n.map((t=>`${t}: ${e[t]}`)).join("; ");return t&&e.stack?r+"\n"+e.stack:r},runAndSetInterval:function(e,t){e();const n=setInterval((()=>{e()}),t);return()=>clearInterval(n)},whereAmI:function(){const e=globalThis.process;return e?!0===e.browser?"browser":"node":"browser"},withRetries:async function(e,t,n,r,o,a){let s=null;for(let u=0;u<=t;u++)try{return await e()}catch(c){if(s=c,u===t)break;const e=n+u/(t-1)*(r-n);o&&o("Error in withRetries, retrying",{attempt:u+1,allowedFailures:t,delayMillis:e,error:c}),a&&a(),await i(e)}throw s}},t.FQ={make:rt,sum:function(e){return e.reduce(((e,t)=>e+t),0)},average:function(e){return e.reduce(((e,t)=>e+t),0)/e.length},median:function(e){const t=[...e].sort(((e,t)=>e-t)),n=Math.floor(t.length/2);return t.length%2==0?(t[n]+t[n-1])/2:t[n]},getDistanceFromMidpoint:function(e,t){return e-(t-1)/2},clamp:it,range:H,interpolate:function(e,t,n){return e+(t-e)*n},createSequence:function(){let e=0;return{next:()=>e++}},increment:function(e,t,n){const r=e+t;return r>n?n:r},decrement:function(e,t,n){const r=e-t;return r<n?n:r},format:function(e,t){const n=t?.longForm??!1,r=t?.unit?` ${t.unit}`:"",i=n?tt:nt,o=t?.precision??1;if(e<et[0])return`${e}${r}`;for(let a=0;a<et.length-1;a++)if(e<et[a+1])return`${(e/et[a]).toFixed(o)}${n?" ":""}${i[a]}${r}`;return`${(e/et[et.length-1]).toFixed(o)}${n?" ":""}${i[et.length-1]}${r}`},fromDecimals:function(e,t,n){let r=e.length-t;if(r<=0)return"0."+"0".repeat(-r)+e+(n?" "+n:"");let i=e.substring(0,r);return""===i&&(i="0"),i+"."+e.substring(r)+(n?" "+n:"")},makeStorage:function(e,t=1024){const n=parseFloat(e);if(isNaN(n))throw Error("makeStorage got NaN for input");const r=e.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),i=""===r?0:qe[r];if(null==i)throw Error(`Unknown unit: "${r}"`);return Math.ceil(n*t**i)},asMegabytes:function(e){return e/1024/1024},convertBytes:function(e,t=1024){return e>=t*t*t*t?(e/t/t/t/t).toFixed(3)+" TB":e>=t*t*t?(e/t/t/t).toFixed(3)+" GB":e>=t*t?(e/t/t).toFixed(3)+" MB":e>=t?(e/t).toFixed(3)+" KB":e+" B"},hexToRgb:function(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e.toLowerCase());if(!t)throw new Error("Invalid hex color: "+e);return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]},rgbToHex:function(e){return"#"+e.map((e=>e.toString(16).padStart(2,"0"))).join("")},haversineDistanceToMeters:function(e,t,n,r){const i=e*Math.PI/180,o=n*Math.PI/180,a=(n-e)*Math.PI/180,s=(r-t)*Math.PI/180,c=Math.sin(a/2)*Math.sin(a/2)+Math.cos(i)*Math.cos(o)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*6371e3},roundToNearest:m,formatDistance:function(e){return e>1e3?(e/1e3).toFixed(0)+" km":e>=500?m(e,100)+" m":e>=100?m(e,50)+" m":m(e,10)+" m"},triangularNumber:function(e){return e*(e+1)/2},searchFloat:function(e){const t=e.match(/-?\d+(\.\d+)?/);if(!t)throw Error("No float found in "+e);return parseFloat(t[0])},binomialSample:function(e,t,n=Math.random){const r=e*t,i=Math.sqrt(e*t*(1-t)),o=(n()+n()+n()+n()+n()+n()-3)*Math.SQRT2,a=Math.round(r+i*o);return Math.max(0,Math.min(e,a))},toSignificantDigits:function(e,t){if(!e.includes("."))return e;if(0===parseFloat(e))return"0";const[n,r]=e.split("."),i=n.replace("-",""),o=i.length;if(o>=t)return n;if("0"!==i){const e=t-o,i=r.slice(0,e);return/[1-9]/.test(i)?`${n}.${i.replace(/0+$/,"")}`:n}const a=t+(r.match(/^0*/)?.[0].length??0);return`${n}.${r.slice(0,a)}`}},t.AO={getTimestamp:function(e,t){const n=new Date(t?.now||Date.now()),r=t?.labels||Ce,i=z(e)?e:new Date(e);if(Ne(n)===Ne(i))return r.today(i.getUTCHours(),i.getUTCMinutes(),i.getUTCHours()>12);if(Ne(n)-Ne(i)==1)return r.yesterday();const o=Ge(i);return Ne(n)-Ne(i)<7?r[o.day]():r.weeks(Math.round((n.getTime()-i.getTime())/6048e5))},getTimeDelta:Fe,secondsToHumanTime:function(e,t=Pe){return Fe(0,{now:1e3*e,labels:t})},countCycles:function(e,t,n){const r=(n?.now??Date.now())-e;return{cycles:Math.floor(r/t),remaining:t/(n?.precision??1)-Math.ceil(r%t/(n?.precision??1))}},isoDate:function(e){return(e||new Date).toISOString().slice(0,10)},throttle:function(e,t){return(!Me[e]||Date.now()>Me[e])&&(Me[e]=Date.now()+t,!0)},timeSince:function(e,t,n){return t=z(t)?t.getTime():t,((n=n?z(n)?n.getTime():n:Date.now())-t)/Ue[e]},dateTimeSlug:function(e){return(e||new Date).toISOString().slice(0,19).replace(/T|:/g,"-")},unixTimestamp:function(e){return Math.ceil((e||Date.now())/1e3)},fromUtcString:function(e){const t=new Date(e);return new Date(t.getTime()-6e4*t.getTimezoneOffset())},fromMillis:function(e){return new Date(e)},getProgress:function(e,t,n,r){r||(r=Date.now());const i=r-e,o=i/t,a=o*n;return{deltaMs:i,progress:t/n,baseTimeMs:o,totalTimeMs:a,remainingTimeMs:a-i}},humanizeTime:Ve,humanizeProgress:function(e){return`[${Math.floor(100*e.progress)}%] ${Ve(e.deltaMs)} out of ${Ve(e.totalTimeMs)} (${Ve(e.remainingTimeMs)} left) [${Math.round(e.baseTimeMs)} ms each]`},createTimeDigits:De,mapDayNumber:je,getDayInfoFromDate:Ge,getDayInfoFromDateTimeString:function(e){return Ge(new Date(e))},seconds:function(e){return 1e3*e},minutes:function(e){return 6e4*e},hours:function(e){return 36e5*e},days:function(e){return 864e5*e},make:function(e){const t=parseFloat(e);if(isNaN(t))throw Error("makeDate got NaN for input");const n=e.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),r=""===n?1:Ze[n];if(!r)throw Error(`Unknown unit: "${n}"`);return Math.ceil(t*r)},normalizeTime:function(e){let[t,n]=e.split(":");B(parseInt(t,10))||(t="0"),B(parseInt(n,10))||(n="0");let r=it(P(t),0,23),i=it(P(n),0,59);return`${De(r)}:${De(i)}`},absoluteDays:Ne},t.Rb={safeParse:function(e){try{return JSON.parse(e)}catch{return null}},deleteDeep:function(e,t){const n=Y(t,"."),r=ee(t,".");if(!n||!r)return;const i=p(e,n);i&&delete i[r]},getDeep:p,setDeep:d,incrementDeep:function(e,t,n=1){const r=p(e,t)||0;return d(e,t,r+n),r},ensureDeep:function(e,t,n){return p(e,t)||d(e,t,n)},replaceDeep:function(e,t,n){const r=p(e,t);if(!r)throw new Error("Key '"+t+"' does not exist.");return d(e,t,n),r},getFirstDeep:function(e,t,n){for(const r of t){const t=p(e,r);if(t)return t}if(n){const t=Object.values(e);if(t.length)return t[0]}return null},deepMergeInPlace:G,deepMerge2:function(e,t){const n={};return G(n,e),G(n,t),n},deepMerge3:function(e,t,n){const r={};return G(r,e),G(r,t),G(r,n),r},mapAllAsync:async function(e,t){const n=[];for(const r of e)n.push(await t(r));return n},cloneWithJson:function(e){return JSON.parse(JSON.stringify(e))},sortObject:We,sortArray:Xe,sortAny:Ke,deepEquals:Qe,deepEqualsEvery:function(...e){for(let t=1;t<e.length;t++)if(!Qe(e[t-1],e[t]))return!1;return!0},runOn:function(e,t){return t(e),e},ifPresent:function(e,t){e&&t(e)},zip:Z,zipSum:function(e){return Z(e,((e,t)=>e+t))},removeEmptyArrays:function(e){for(const t of Object.keys(e))(w(e[t])||Array.isArray(e[t])&&e[t].every((e=>null==e)))&&delete e[t];return e},removeEmptyValues:function(e){for(const t of Object.entries(e))(null===t[1]||void 0===t[1]||T(t[1])&&R(t[1]))&&delete e[t[0]];return e},flatten:function(e,t=!1,n){return at({},e,n||"",!1,t)},unflatten:function e(t){if(!g(t))return t;const n=Array.isArray(t)?[]:{};for(const[r,i]of Object.entries(t))Array.isArray(i)?d(n,r,i.map((t=>e(t)))):d(n,r,i);return n},match:function(e,t,n){return t[e]?t[e]:n},sort:lt,map:function(e,t){const n={};for(const r of Object.entries(e))n[r[0]]=t(r[1]);return n},mapIterable:function(e,t){const n=[];let r=0;for(const i of e)n.push(t(i,r++));return n},filterKeys:function(e,t){const n={};for(const[r,i]of Object.entries(e))t(r)&&(n[r]=i);return n},filterValues:function(e,t){const n={};for(const[r,i]of Object.entries(e))t(i)&&(n[r]=i);return n},rethrow:async function(e,t){try{return await e()}catch{throw t}},setSomeOnObject:function(e,t,n){null!=n&&(e[t]=n)},setSomeDeep:function(e,t,n,r){const i=p(n,r);null!=i&&d(e,t,i)},flip:function(e){const t={};for(const[n,r]of Object.entries(e))t[r]=n;return t},getAllPermutations:function(e){const t=Object.keys(e),n=t.map((t=>e[t].length)),r=n.reduce(((e,t)=>e*t));let i=1;const o=[1];for(let s=0;s<n.length-1;s++)i*=n[s],o.push(i);const a=[];for(let s=0;s<r;s++){const n={};for(let r=0;r<t.length;r++){const i=e[t[r]],a=Math.floor(s/o[r])%i.length;n[t[r]]=i[a]}a.push(n)}return a},countTruthyValues:function(e){return Object.values(e).filter((e=>e)).length},transformToArray:function(e){const t=[],n=Object.keys(e),r=e[n[0]].length;for(let i=0;i<r;i++){const r={};for(const t of n)r[t]=e[t][i];t.push(r)}return t},setMulti:function(e,t,n){for(const r of e)r[t]=n},incrementMulti:function(e,t,n=1){for(const r of e)r[t]+=n},createBidirectionalMap:function(){return{map:new Map,keys:[]}},createTemporalBidirectionalMap:function(){return{map:new Map,keys:[]}},pushToBidirectionalMap:ht,unshiftToBidirectionalMap:function(e,t,n,r=100){if(e.map.has(t)){const n=e.keys.indexOf(t);e.keys.splice(n,1)}if(e.map.set(t,n),e.keys.unshift(t),e.keys.length>r){const t=e.keys.shift();t&&e.map.delete(t)}},addToTemporalBidirectionalMap:function(e,t,n,r,i=100){ht(e,t,{validUntil:Date.now()+r,data:n},i)},getFromTemporalBidirectionalMap:function(e,t){const n=e.map.get(t);return n&&n.validUntil>Date.now()?n.data:null},createStatefulToggle:function(e){let t;return n=>{const r=n===e&&t!==e;return t=n,r}},diffKeys:function(e,t){const n=Object.keys(e),r=Object.keys(t);return{uniqueToA:n.filter((e=>!r.includes(e))),uniqueToB:r.filter((e=>!n.includes(e)))}},pickRandomKey:Ye,mapRandomKey:function(e,t){const n=Ye(e);return e[n]=t(e[n]),n},fromObjectString:function(e){return e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/\r\n/g,"\n")).replace(/(\w+)\((.+)\)/g,((e,t,n)=>`${t}(${n.replaceAll(",",",")})`))).replace(/(,)(\s+})/g,"$2")).replace(/\.\.\..+?,/g,"")).replace(/({\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',")).replace(/(,\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',")).replace(/:(.+)\?(.+):/g,((e,t,n)=>`: (${t.trim()} && ${n.trim()}) ||`))).replace(/([a-zA-Z0-9]+)( ?: ?{)/g,'"$1"$2')).replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g,((e,t,n,r)=>`"${t}":"${n.trim()}"${r}`))).replace(/("'|'")/g,'"')).replaceAll(",",","),JSON.parse(e)},toQueryString:_e,parseQueryString:function(e){const t={},n=e.split("&");for(const r of n){const[e,n]=r.split("=");e&&n&&(t[e]=decodeURIComponent(n))}return t},hasKey:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},selectMax:function(e,t){let n=null,r=-1/0;for(const[i,o]of Object.entries(e)){const e=t(o);e>r&&(r=e,n=i)}return n?[n,e[n]]:null},reposition:function(e,t,n,r){const i=e.find((e=>e[t]===n)),o=e.find((e=>e[t]===n+r));i&&o?(i[t]=n+r,o[t]=n):i&&(i[t]=n+r),e.sort(((e,n)=>C(e[t])-C(n[t]))),e.forEach(((e,n)=>e[t]=n+1))},unwrapSingleKey:function(e){const t=Object.keys(e);if(1===t.length)return e[t[0]];throw new Error("Expected object to have a single key")},parseKeyValues:function(e,t=":"){return Object.fromEntries(e.map((e=>te(e,t))).map((e=>e[0]&&e[1]?[oe(e[0]),oe(e[1])]:null)).filter((e=>e)))},errorMatches:function(e,t){if(!e)return!1;const n=e.message;return"string"==typeof n&&n.includes(t)}},t.Or={isFunction:v,isObject:g,isStrictlyObject:y,isEmptyArray:w,isEmptyObject:function(e){return y(e)&&0===Object.keys(e).length},isUndefined:b,isString:T,isNumber:B,isBoolean:E,isDate:z,isBlank:R,isId:x,isIntegerString:I,isHexString:$,isUrl:M,isBigint:U,isNullable:function(e,t){return null==t||e(t)},asString:V,asHexString:function(e,t){if(!$(e))throw new TypeError(`Expected hex string${t?.name?` for ${t.name}`:""}, got: `+e);if(t?.strictPrefix&&!e.startsWith("0x")&&!e.startsWith("0X"))throw new TypeError(`Expected hex string with 0x prefix${t?.name?` for ${t.name}`:""}, got: `+e);const n=e.replace(/^0x/i,"");if(n.length%2!=0&&!t?.uneven)throw RangeError(`Expected even number of hex digits${t?.name?` for ${t.name}`:""}; got: `+e);if(t&&t.byteLength&&n.length!==2*t.byteLength)throw RangeError(`Expected hex string${t?.name?` for ${t.name}`:""} of byte length ${t.byteLength}; got: `+n);return`0x${n}`},asSafeString:function(e,t){if(!V(e,t).split("").every((e=>"_"===e||le(e))))throw new TypeError(`Expected safe string${t?.name?` for ${t.name}`:""}, got: `+e);return e},asIntegerString:function(e,t){if(!I(e))throw new TypeError(`Expected integer string${t?.name?` for ${t.name}`:""}, got: `+e);const n=BigInt(e);if(t&&(t.min&&n<t.min||t.max&&n>t.max))throw RangeError(`Expected integer string${t?.name?` for ${t.name}`:""} in range: ${t.min??"-inf"}..${t.max??"inf"}; got: `+n);return e},asNumber:C,asFunction:function(e,t){if(!v(e))throw new TypeError(`Expected function${t?.name?` for ${t.name}`:""}, got: `+e);return e},asInteger:P,asBoolean:function(e,t){if("true"===e)return!0;if("false"===e)return!1;if(!E(e))throw new TypeError(`Expected boolean${t?.name?` for ${t.name}`:""}, got: `+e);return e},asDate:function(e,t){if(!z(e))throw new TypeError(`Expected date${t?.name?` for ${t.name}`:""}, got: `+e);return e},asNullableString:function(e){return R(e)?null:e},asEmptiableString:function(e,t){if(!T(e))throw new TypeError(`Expected string${t?.name?` for ${t.name}`:""}, got: `+e);return e},asId:function(e,t){if(x(e))return e;const n=parseInt(e,10);if(!x(n))throw new TypeError(`Expected id${t?.name?` for ${t.name}`:""}, got: `+e);return n},asTime:function(e,t){if(!T(e))throw new TypeError(`Expected time${t?.name?` for ${t.name}`:""}, got: `+e);const n=e.split(":");if(2!==n.length)throw new TypeError(`Expected time${t?.name?` for ${t.name}`:""}, got: `+e);const r=parseInt(n[0],10),i=parseInt(n[1],10);if(!B(r)||!B(i)||r<0||r>23||i<0||i>59)throw new TypeError(`Expected time, got${t?.name?` for ${t.name}`:""}: `+e);return`${String(r).padStart(2,"0")}:${String(i).padStart(2,"0")}`},asArray:function(e,t){if(!Array.isArray(e))throw new TypeError(`Expected array${t?.name?` for ${t.name}`:""}, got: `+e);return e},asObject:F,asNullableObject:function(e,t){return null===e?null:F(e,t)},asStringMap:function(e,t){const n=F(e,t);for(const r of Object.keys(n))if(!T(n[r]))throw new TypeError(`Expected string map${t?.name?` for ${t.name}`:""}, got: `+e);return n},asNumericDictionary:function(e,t){const n=F(e),r=Object.keys(n),i=Object.values(n);if(!r.every(T)||!i.every(B))throw new TypeError(`Expected numeric dictionary${t?.name?` for ${t.name}`:""}, got: `+e);return n},asUrl:function(e,t){if(!M(e))throw new TypeError(`Expected url${t?.name?` for ${t.name}`:""}, got: `+e);return e},asBigint:L,asEmptiable:function(e,t){return""===t?void 0:e(t)},asNullable:function(e,t){return null==t?null:e(t)},asOptional:function(e,t){return null==t?void 0:e(t)},enforceObjectShape:j,enforceArrayShape:function(e,t){return e.every((e=>j(e,t)))},isPng:yt,isJpg:wt,isWebp:bt,isImage:function(e){return yt(e)||wt(e)||bt(e)}},t.DH={tokenizeByCount:function(e,t){return ut(e,Math.ceil(e.length/t))},tokenizeByLength:ut,searchHex:function(e,t){const n=new RegExp(`[0-9a-f]{${t}}`,"i"),r=e.match(n);return r?r[0]:null},searchSubstring:function(e,t,n=k){const r=ne(e,n);for(const i of r)if(t(i))return i;return null},randomHex:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=D[Math.floor(16*t())];return n},randomLetter:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=S[Math.floor(26*t())];return n},randomAlphanumeric:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=A[Math.floor(62*t())];return n},randomRichAscii:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=O[Math.floor(89*t())];return n},randomUnicode:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=_[Math.floor(t()*_.length)];return n},includesAny:function(e,t){return t.some((t=>e.includes(t)))},slugify:J,normalForm:function(e){return J(e).replaceAll("-","")},enumify:function(e){return J(e).replace(/-/g,"_").toUpperCase()},escapeHtml:function(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},decodeHtmlEntities:function(e){let t=e.replace(/&#(\d+);/g,((e,t)=>String.fromCharCode(t))).replace(/&#x(\d+);/g,((e,t)=>String.fromCharCode(parseInt(t,16))));for(const[n,r]of Object.entries(X))t=t.replaceAll(n,r);return t},after:Q,afterLast:ee,before:K,beforeLast:Y,betweenWide:function(e,t,n){const r=Y(e,n);return r?Q(r,t):null},betweenNarrow:function(e,t,n){const r=Q(e,t);return r?K(r,n):null},getPreLine:function(e){return e.replace(/ +/g," ").replace(/^ /gm,"")},containsWord:ke,containsWords:function(e,t,n){return"any"===n?t.some((t=>ke(e,t))):t.every((t=>ke(e,t)))},joinUrl:Je,getFuzzyMatchScore:W,sortByFuzzyScore:function(e,t){return e.filter((e=>W(e,t))).sort(((e,n)=>W(n,t)-W(e,t)))},splitOnce:te,splitAll:ne,randomize:function(e,t=Math.random){return e.replace(/\{(.+?)\}/g,((e,n)=>l(n.split("|"),t)))},expand:function e(t){const n=t.match(/\{(.+?)\}/);if(!n||!n.index)return[t];const r=n[1].split(","),i=t.slice(0,n.index),o=t.slice(n.index+n[0].length);let a=[];for(const s of r){const t=e(i+s+o);a=a.concat(t)}return a},shrinkTrim:oe,capitalize:ae,decapitalize:se,csvEscape:function(e){return e.match(/"|,/)?`"${e.replace(/"/g,'""')}"`:e},parseCsv:function(e,t=",",n='"'){const r=[];let i="",o=!1;const a=e.split("");for(const s of a)s!==t||o?s!==n||(i||o)&&!o?i+=s:o=!o:(r.push(i),i="");return r.push(i),r},surroundInOut:function(e,t){return t+e.split("").join(t)+t},getExtension:re,getBasename:ie,normalizeEmail:function(e){let[t,n]=e.split("@");t=oe(t.replaceAll(".","").toLowerCase()).replaceAll(" ","");const[r]=t.split("+");if(!r||!n||-1===n.indexOf(".")||n.indexOf(".")===n.length-1)throw new Error("Invalid email");return n=oe(n.toLowerCase()).replaceAll(" ",""),`${r}@${n}`},normalizeFilename:function(e){const t=ie(e),n=re(e);return n?`${t}.${n}`:t},parseFilename:function(e){const t=ie(e),n=re(e);return{basename:t,extension:n,filename:n?`${t}.${n}`:t}},camelToTitle:function(e){return ae(e.replace(/([A-Z])/g," $1"))},slugToTitle:function(e){return e.split("-").map(ae).join(" ")},slugToCamel:function(e){return se(e.split("-").map(ae).join(""))},joinHumanly:function(e,t=", ",n=" and "){return e&&e.length?1===e.length?e[0]:2===e.length?`${e[0]}${n}${e[1]}`:`${e.slice(0,e.length-1).join(t)}${n}${e[e.length-1]}`:""},findWeightedPair:ve,extractBlock:Te,extractAllBlocks:function(e,t){const n=[];let r=t.wordBoundary?ge(e,[`${t.opening} `,`${t.opening}\n`],t.start||0):e.indexOf(t.opening,t.start||0);for(;;){if(-1===r)return n;const i=Te(e,{...t,start:r});if(!i)return n;n.push(i),r=t.wordBoundary?ge(e,[`${t.opening} `,`${t.opening}\n`],r+i.length):e.indexOf(t.opening,r+i.length)}},replaceBlocks:function(e,n,r){let i=0;for(;;){const o=t.DH.extractBlock(e,{...r,start:i});if(!o)return e;const a=n(o);i=e.indexOf(o,i)+a.length,e=e.replace(o,a)}},indexOfEarliest:ge,lastIndexOfBefore:be,parseHtmlAttributes:function(e){const t={},n=e.match(/([a-z\-]+)="([^"]+)"/g);if(n)for(const r of n){const[e,n]=te(r,"=");t[e]=n.slice(1,n.length-1)}return t},readNextWord:Se,readWordsAfterAll:function(e,t,n=[]){const r=me(e,t),i=[];for(const o of r)i.push(Se(e,o+t.length,n));return i},resolveVariables:function(e,t,n="$",r=":"){for(const i in t)e=Ae(e,i,t[i],n,r);return e=Oe(e)},resolveVariableWithDefaultSyntax:Ae,resolveRemainingVariablesWithDefaults:Oe,isLetter:ce,isDigit:ue,isLetterOrDigit:le,isValidObjectPathCharacter:function(e){return le(e)||"."===e||"["===e||"]"===e||"_"===e},insert:function(e,t,n,r,i){return e.slice(0,t)+r+e.slice(t,t+n)+i+e.slice(t+n)},indexOfRegex:pe,allIndexOf:me,lineMatches:de,linesMatchInOrder:function(e,t,n=!0){let r=0;for(const i of t){let t=!1;for(;!t&&r<e.length;)de(e[r],i,n)&&(t=!0),r++;if(!t)return!1}return!0},represent:function e(t,n="json",r=0){if(t&&v(t.represent)){const e=t.represent();if(T(e))return"json"===n&&0===r?JSON.stringify(e):e}if(g(t,!1)){if(r>1)return"[object Object]";if("json"===n){if(Array.isArray(t)){const n=t.map((t=>e(t,"json",r+1)));return 0===r?JSON.stringify(n):n}const n={};t.message&&(n.message=e(t.message,"json",r+1));for(const[i,o]of Object.entries(t))n[i]=e(o,"json",r+1);return 0===r?JSON.stringify(n):n}if("key-value"===n){const n=Object.keys(t);return t.message&&!n.includes("message")&&n.unshift("message"),n.map((n=>`${n}=${JSON.stringify(e(t[n],"json",r+1))}`)).join(" ")}}return b(t)&&(t="undefined"),0===r?JSON.stringify(t):t},resolveMarkdownLinks:function(e,t){let n=e.indexOf("](");for(;-1!==n;){const r=be(e,"[",n),i=e.indexOf(")",n);if(-1!==r&&-1!==i){const[n,o]=e.slice(r+1,i).split("]("),a=t(n,o);e=e.slice(0,r)+a+e.slice(i+1)}n=e.indexOf("](",n+1)}return e},buildUrl:function(e,t,n){return Je([e,t])+_e(n||{})},isChinese:function(e){return/^[\u4E00-\u9FA5]+$/.test(e)},replaceBetweenStrings:function(e,t,n,r,i=!0){const o=e.indexOf(t),a=e.indexOf(n,o+t.length);if(-1===o||-1===a)throw Error("Start or end not found");return i?e.substring(0,o+t.length)+r+e.substring(a):e.substring(0,o)+r+e.substring(a+n.length)},describeMarkdown:function(e){let t="p";return e.startsWith("#")?(t="h1",e=e.slice(1).trim()):e.startsWith("-")&&(t="li",e=e.slice(1).trim()),{type:t,isCapitalized:e[0]===e[0].toUpperCase(),hasPunctuation:/[.?!]$/.test(e),endsWithColon:/:$/.test(e)}},isBalanced:function(e,t="(",n=")"){let r=0,i=0;for(;i<e.length;)if(e.startsWith(t,i)?(r++,i+=t.length):e.startsWith(n,i)?(r--,i+=n.length):i++,r<0)return!1;return t===n?r%2==0:0===r},textToFormat:function(e){let t=(e=e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")).length;for(;(e=e.replace(/(\w+)[\s,']+\w+/g,"$1")).length!==t;)t=e.length;return e=(e=(e=e.replaceAll(/[A-Z][a-zA-Z0-9]*/g,"A")).replaceAll(/[a-z][a-zA-Z0-9]*/g,"a")).replaceAll(/[\u4E00-\u9FA5]+/g,"Z")},splitFormatting:function(e,t){const n=[];let r=0;for(;r<e.length;){const i=e.indexOf(t,r);if(-1===i){n.push({string:e.slice(r),symbol:null});break}const o=e.indexOf(t,i+t.length);if(i>r&&-1!==o&&n.push({string:e.slice(r,i),symbol:null}),-1===o){n.push({string:e.slice(r),symbol:null});break}n.push({string:e.slice(i+t.length,o),symbol:t}),r=o+t.length}return n},splitHashtags:function(e){const t=[];let n=0;for(;n<e.length;){const r=we(e,n);if(-1===r){t.push({string:e.slice(n),symbol:null});break}const i=ye(e,r+1);if(-1===i){t.push({string:e.slice(n,r),symbol:null}),t.push({string:e.slice(r+1),symbol:"#"});break}r>n&&t.push({string:e.slice(n,r),symbol:null}),t.push({string:e.slice(r+1,i),symbol:"#"}),n=i}return t},splitUrls:function(e){const t=[];let n=0;for(;n<e.length;){const r=ge(e,["http://","https://"],n);if(-1===r){t.push({string:e.slice(n),symbol:null});break}const i=ge(e,[" ","\n"],r);if(-1===i){r>n&&t.push({string:e.slice(n,r),symbol:null}),t.push({string:e.slice(r),symbol:"http"});break}r>n&&t.push({string:e.slice(n,r),symbol:null}),t.push({string:e.slice(r,i),symbol:"http"}),n=i}return t},route:function(e,t){const n=e.split("/").filter((e=>e)),r=t.split("/").filter((e=>e));if(n.length!==r.length)return null;const i={};for(let o=0;o<n.length;o++){const e=n[o];if(e.startsWith(":"))i[e.slice(1)]=r[o];else if(e!==r[o])return null}return i},explodeReplace:xe,generateVariants:function(e,n,r,i=Math.random){const o=t.DO.shuffle(n.map((e=>({variants:t.DO.shuffle(e.variants.map((e=>e)),i),avoid:e.avoid}))),i),a=[];for(const t of o){const n=t.variants.filter((e=>e!==t.avoid)),i=n.find((t=>e.includes(t)));if(i&&(q(a,xe(e,i,n)),a.length>=r))break}if(a.length<r)for(const t of o){const n=t.variants.find((t=>e.includes(t)));if(n&&(q(a,xe(e,n,t.variants)),a.length>=r))break}return a.slice(0,r)},replaceWord:function(e,t,n,r=!1){const i=new RegExp(r?`(?<=\\s|^)${t}(?=\\s|$)`:`\\b${t}\\b`,"g");return e.replace(i,n)},replacePascalCaseWords:function(e,t){return e.replace(/\b[A-Z][a-zA-Z0-9]*\b/g,(e=>e.toUpperCase()===e?e:t(e)))},stripHtml:function(e){return e.replace(/<[^>]*>/g,"")},breakLine:Ie,measureTextWidth:function(e,t={}){return[...e].reduce(((e,n)=>e+(t[n]||1)),0)},toLines:function(e,t,n={}){const r=[];let i="",o=0;for(let a=0;a<e.length;a++){const s=e[a];if(i+=s,o+=n[s]||1,o>t){const{line:e,rest:t}=Ie(i);r.push(e),i=t,o=t.split("").map((e=>n[e]||1)).reduce(((e,t)=>e+t),0)}}return i&&r.push(i),r},levenshteinDistance:function(e,t){const n=[];for(let r=0;r<=e.length;r++)n[r]=[r];for(let r=0;r<=t.length;r++)n[0][r]=r;for(let r=1;r<=e.length;r++)for(let i=1;i<=t.length;i++){const o=e[r-1]===t[i-1]?0:1;n[r][i]=Math.min(n[r-1][i]+1,n[r][i-1]+1,n[r-1][i-1]+o)}return n[e.length][t.length]},findCommonPrefix:$e,findCommonDirectory:function(e){const t=$e(e),n=t.lastIndexOf("/");return-1===n?"":t.slice(0,n+1)}}},878(e,t,n){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(n){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(n){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(945)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},945(e,t,n){e.exports=function(e){function t(e){let n,i,o,a=null;function s(...e){if(!s.enabled)return;const r=s,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";a++;const o=t.formatters[i];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=r,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e,t){let n=0,r=0,i=-1,o=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||"*"===t[r]))"*"===t[r]?(i=r,o=n,r++):(n++,r++);else{if(-1===i)return!1;r=i+1,o++,n=o}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const r of n)"-"===r[0]?t.skips.push(r.slice(1)):t.names.push(r)},t.enabled=function(e){for(const n of t.skips)if(i(e,n))return!1;for(const n of t.names)if(i(e,n))return!0;return!1},t.humanize=n(192),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},666(e,t,n){var r=null;"undefined"!=typeof WebSocket?r=WebSocket:"undefined"!=typeof MozWebSocket?r=MozWebSocket:void 0!==n.g?r=n.g.WebSocket||n.g.MozWebSocket:"undefined"!=typeof window?r=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(r=self.WebSocket||self.MozWebSocket),e.exports=r},192(e){var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i,a=365.25*i;function s(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*a;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return s(e,o,i,"day");if(o>=r)return s(e,o,r,"hour");if(o>=n)return s(e,o,n,"minute");if(o>=t)return s(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=r)return Math.round(e/r)+"h";if(o>=n)return Math.round(e/n)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},963(e,t,n){"use strict";const r=n(527),{MAX_LENGTH:i,MAX_SAFE_INTEGER:o}=n(197),{safeRe:a,t:s}=n(423),c=n(676),{compareIdentifiers:u}=n(956);class l{constructor(e,t){if(t=c(t),e instanceof l){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);r("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?a[s.LOOSE]:a[s.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<o)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(r("SemVer.compare",this.version,this.options,e),!(e instanceof l)){if("string"==typeof e&&e===this.version)return 0;e=new l(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof l||(e=new l(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof l||(e=new l(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],i=e.prerelease[t];if(r("prerelease compare",t,n,i),void 0===n&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===n)return-1;if(n!==i)return u(n,i)}while(++t)}compareBuild(e){e instanceof l||(e=new l(e,this.options));let t=0;do{const n=this.build[t],i=e.build[t];if(r("build compare",t,n,i),void 0===n&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===n)return-1;if(n!==i)return u(n,i)}while(++t)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?a[s.PRERELEASELOOSE]:a[s.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];if(!1===n&&(r=[t]),((e,t)=>{const n=t.split(".");if(n.length>e.length)return!1;for(let r=0;r<n.length;r++)if(0!==u(e[r],n[r]))return!1;return!0})(this.prerelease,t)){const e=this.prerelease[t.split(".").length];isNaN(e)&&(this.prerelease=r)}else this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=l},359(e,t,n){"use strict";const r=n(963);e.exports=(e,t)=>new r(e,t).major},197(e){"use strict";const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},527(e){"use strict";const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},956(e){"use strict";const t=/^[0-9]+$/,n=(e,n)=>{if("number"==typeof e&&"number"==typeof n)return e===n?0:e<n?-1:1;const r=t.test(e),i=t.test(n);return r&&i&&(e=+e,n=+n),e===n?0:r&&!i?-1:i&&!r?1:e<n?-1:1};e.exports={compareIdentifiers:n,rcompareIdentifiers:(e,t)=>n(t,e)}},676(e){"use strict";const t=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:n},423(e,t,n){"use strict";const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:o}=n(197),a=n(527),s=(t=e.exports={}).re=[],c=t.safeRe=[],u=t.src=[],l=t.safeSrc=[],f=t.t={};let h=0;const p="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",o],[p,i]],m=(e,t,n)=>{const r=(e=>{for(const[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=h++;a(e,i,t),f[e]=i,u[i]=t,l[i]=r,s[i]=new RegExp(t,n?"g":void 0),c[i]=new RegExp(r,n?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),m("MAINVERSION",`(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${u[f.PRERELEASEIDENTIFIER]}(?:\\.${u[f.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${u[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[f.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${p}+`),m("BUILD",`(?:\\+(${u[f.BUILDIDENTIFIER]}(?:\\.${u[f.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${u[f.MAINVERSION]}${u[f.PRERELEASE]}?${u[f.BUILD]}?`),m("FULL",`^${u[f.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${u[f.MAINVERSIONLOOSE]}${u[f.PRERELEASELOOSE]}?${u[f.BUILD]}?`),m("LOOSE",`^${u[f.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${u[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${u[f.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:${u[f.PRERELEASE]})?${u[f.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:${u[f.PRERELEASELOOSE]})?${u[f.BUILD]}?)?)?`),m("XRANGE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),m("COERCE",`${u[f.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",u[f.COERCEPLAIN]+`(?:${u[f.PRERELEASE]})?`+`(?:${u[f.BUILD]})?(?:$|[^\\d])`),m("COERCERTL",u[f.COERCE],!0),m("COERCERTLFULL",u[f.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${u[f.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${u[f.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${u[f.LONECARET]}${u[f.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${u[f.LONECARET]}${u[f.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${u[f.GTLT]}\\s*(${u[f.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]}|${u[f.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${u[f.XRANGEPLAIN]})\\s+-\\s+(${u[f.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${u[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[f.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},497(){},61(){},320(){}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{BRANCHES:()=>Eo,BZZ:()=>Vo,BatchId:()=>co,Bee:()=>au,BeeArgumentError:()=>mo,BeeError:()=>po,BeeModes:()=>vo,BeeResponseError:()=>go,Bytes:()=>Ji,CHUNK_SIZE:()=>zo,DAI:()=>No,Duration:()=>_o,EthAddress:()=>no,FeedIndex:()=>ho,Identifier:()=>ro,MantarayNode:()=>Wc,MerkleTree:()=>i.vU,NULL_ADDRESS:()=>fu,NULL_IDENTIFIER:()=>hu,NULL_OWNER:()=>pu,NULL_STAMP:()=>uu,NULL_TOPIC:()=>lu,PSS_TARGET_HEX_LENGTH_MAX:()=>Ro,PeerAddress:()=>so,PrivateKey:()=>eo,PublicKey:()=>to,RedundancyLevel:()=>So,RedundancyStrategy:()=>Ao,Reference:()=>io,SECTION_SIZE:()=>Bo,STAMPS_DEPTH_MAX:()=>Io,STAMPS_DEPTH_MIN:()=>xo,SUPPORTED_BEE_VERSION:()=>yc,SUPPORTED_BEE_VERSION_EXACT:()=>gc,SWARM_GATEWAY_URL:()=>cu,Signature:()=>uo,Size:()=>Do,Span:()=>ao,Stamper:()=>su,TAGS_LIMIT_MAX:()=>ko,TAGS_LIMIT_MIN:()=>$o,Topic:()=>lo,TransactionId:()=>oo,Utils:()=>e,capacityBreakpoints:()=>Oo,toBeeMode:()=>To});var e={};n.r(e),n.d(e,{approximateOverheadForRedundancyLevel:()=>Eu,convertEnvelopeToMarshaledStamp:()=>ga,getAmountForDuration:()=>da,getCollectionSize:()=>ss,getDepthForSize:()=>ma,getFolderSize:()=>eu,getRedundancyStat:()=>ku,getRedundancyStats:()=>$u,getStampCost:()=>ha,getStampDuration:()=>pa,getStampEffectiveBytes:()=>la,getStampEffectiveBytesBreakpoints:()=>fa,getStampTheoreticalBytes:()=>ca,getStampUsage:()=>sa,makeCollectionFromFileList:()=>as,makeMaxTarget:()=>du,mapPostageBatch:()=>ya,unmapPostageBatch:()=>wa});var t,i=n(20);function o(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:a,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=a.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class o extends i{}function a(e){var t;const i=n?.Parent?new o:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Symbol("zod_brand");class a extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class s extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(t=globalThis).__zod_globalConfig??(t.__zod_globalConfig={});const c=globalThis.__zod_globalConfig;function u(e){return e&&Object.assign(c,e),c}const l=/^[cC][0-9a-z]{6,}$/,f=/^[0-9a-z]+$/,h=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,p=/^[0-9a-vA-V]{20}$/,d=/^[A-Za-z0-9]{27}$/,m=/^[a-zA-Z0-9_-]{21}$/,g=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,y=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,w=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,b=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const v=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,T=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,B=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,E=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,z=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,R=/^[A-Za-z0-9_-]*$/,x=/^https?$/,I=/^\+[1-9]\d{6,14}$/,$="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",k=new RegExp(`^${$}$`);function S(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const A=/^-?\d+n?$/,O=/^-?\d+$/,_=/^-?\d+(?:\.\d+)?$/,D=/^(?:true|false)$/i,V=/^[^A-Z]*$/,N=/^[^a-z]*$/;function C(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}function P(e,t){return"bigint"==typeof t?t.toString():t}function F(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function M(e){return null==e}function U(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const L=Symbol("evaluating");function j(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==L)return void 0===r&&(r=L,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function G(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Z(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function q(e){return JSON.stringify(e)}const H="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function J(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const W=F((()=>{if(c.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function X(e){if(!1===J(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==J(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function K(e){return X(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Q=new Set(["string","number","symbol"]);function Y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ee(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function te(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const ne={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function re(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function ie(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function oe(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function ae(e){return"string"==typeof e?e:e?.message}function se(e,t,n){const r=e.message?e.message:ae(e.inst?._zod.def?.error?.(e))??ae(t?.error?.(e))??ae(n.customError?.(e))??ae(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:a,...s}=e;return s.path??(s.path=[]),s.message=r,t?.reportInput&&(s.input=a),s}function ce(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ue(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const le=o("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),fe={number:"number",bigint:"bigint",object:"date"},he=o("$ZodCheckLessThan",((e,t)=>{le.init(e,t);const n=fe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),pe=o("$ZodCheckGreaterThan",((e,t)=>{le.init(e,t);const n=fe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),de=o("$ZodCheckMultipleOf",((e,t)=>{le.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),me=o("$ZodCheckNumberFormat",((e,t)=>{le.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=ne[t.format];e._zod.onattach.push((e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=o,n&&(r.pattern=O)})),e._zod.check=a=>{const s=a.value;if(n){if(!Number.isInteger(s))return void a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}})),ge=o("$ZodCheckMaxLength",((e,t)=>{var n;le.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!M(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=ce(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}})),ye=o("$ZodCheckMinLength",((e,t)=>{var n;le.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!M(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=ce(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}})),we=o("$ZodCheckLengthEquals",((e,t)=>{var n;le.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!M(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const o=ce(r),a=i>t.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),be=o("$ZodCheckStringFormat",((e,t)=>{var n,r;le.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})})),ve=o("$ZodCheckRegex",((e,t)=>{be.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),Te=o("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=V),be.init(e,t)})),Be=o("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=N),be.init(e,t)})),Ee=o("$ZodCheckIncludes",((e,t)=>{le.init(e,t);const n=Y(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)})),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}})),ze=o("$ZodCheckStartsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`^${Y(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),Re=o("$ZodCheckEndsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`.*${Y(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}));const xe=o("$ZodCheckOverwrite",((e,t)=>{le.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class Ie{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),r=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const i of r)this.content.push(i)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const $e=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,P,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ke=o("$ZodError",$e),Se=o("$ZodError",$e,{Parent:Error});const Ae=e=>(t,n,r,i)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new a;if(s.issues.length){const t=new(i?.Err??e)(s.issues.map((e=>se(e,o,u()))));throw H(t,i?.callee),t}return s.value},Oe=Ae(Se),_e=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(i?.Err??e)(a.issues.map((e=>se(e,o,u()))));throw H(t,i?.callee),t}return a.value},De=_e(Se),Ve=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new a;return o.issues.length?{success:!1,error:new(e??ke)(o.issues.map((e=>se(e,i,u()))))}:{success:!0,data:o.value}},Ne=Ve(Se),Ce=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map((e=>se(e,i,u()))))}:{success:!0,data:o.value}},Pe=Ce(Se),Fe=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ae(e)(t,n,i)},Me=e=>(t,n,r)=>Ae(e)(t,n,r),Ue=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return _e(e)(t,n,i)},Le=e=>async(t,n,r)=>_e(e)(t,n,r),je=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ve(e)(t,n,i)},Ge=e=>(t,n,r)=>Ve(e)(t,n,r),Ze=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ce(e)(t,n,i)},qe=e=>async(t,n,r)=>Ce(e)(t,n,r),He={major:4,minor:4,patch:3};const Je=o("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=He;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const t of i._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let r,i=re(e);for(const o of t){if(o._zod.def.when){if(ie(e))continue;if(!o._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&!1===n?.async)throw new a;if(r||s instanceof Promise)r=(r??Promise.resolve()).then((async()=>{await s;e.issues.length!==t&&(i||(i=re(e,t)))}));else{if(e.issues.length===t)continue;i||(i=re(e,t))}}return r?r.then((()=>e)):e},n=(n,i,o)=>{if(re(n))return n.aborted=!0,n;const s=t(i,r,o);if(s instanceof Promise){if(!1===o.async)throw new a;return s.then((t=>e._zod.parse(t,o)))}return e._zod.parse(s,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if("backward"===o.direction){const t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then((e=>n(e,i,o))):n(t,i,o)}const s=e._zod.parse(i,o);if(s instanceof Promise){if(!1===o.async)throw new a;return s.then((e=>t(e,r,o)))}return t(s,r,o)}}j(e,"~standard",(()=>({validate:t=>{try{const n=Ne(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Pe(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1})))})),We=o("$ZodString",((e,t)=>{var n;Je.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Xe=o("$ZodStringFormat",((e,t)=>{be.init(e,t),We.init(e,t)})),Ke=o("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=y),Xe.init(e,t)})),Qe=o("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=w(e))}else t.pattern??(t.pattern=w());Xe.init(e,t)})),Ye=o("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=b),Xe.init(e,t)})),et=o("$ZodURL",((e,t)=>{Xe.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===x.source&&!/^https?:\/\//i.test(r))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),tt=o("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Xe.init(e,t)})),nt=o("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=m),Xe.init(e,t)})),rt=o("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=l),Xe.init(e,t)})),it=o("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=f),Xe.init(e,t)})),ot=o("$ZodULID",((e,t)=>{t.pattern??(t.pattern=h),Xe.init(e,t)})),at=o("$ZodXID",((e,t)=>{t.pattern??(t.pattern=p),Xe.init(e,t)})),st=o("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=d),Xe.init(e,t)})),ct=o("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){const t=S({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${$}T(?:${r})$`)}(t)),Xe.init(e,t)})),ut=o("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=k),Xe.init(e,t)})),lt=o("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${S(t)}$`)),Xe.init(e,t)})),ft=o("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=g),Xe.init(e,t)})),ht=o("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=v),Xe.init(e,t),e._zod.bag.format="ipv4"})),pt=o("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=T),Xe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),dt=o("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=B),Xe.init(e,t)})),mt=o("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=E),Xe.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function gt(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const yt=o("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=z),Xe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{gt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}));const wt=o("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=R),Xe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!R.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return gt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),bt=o("$ZodE164",((e,t)=>{t.pattern??(t.pattern=I),Xe.init(e,t)}));const vt=o("$ZodJWT",((e,t)=>{Xe.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),Tt=o("$ZodNumber",((e,t)=>{Je.init(e,t),e._zod.pattern=e._zod.bag.pattern??_,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(a){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}})),Bt=o("$ZodNumberFormat",((e,t)=>{me.init(e,t),Tt.init(e,t)})),Et=o("$ZodBoolean",((e,t)=>{Je.init(e,t),e._zod.pattern=D,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(o){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}})),zt=o("$ZodBigInt",((e,t)=>{Je.init(e,t),e._zod.pattern=A,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(i){}return"bigint"==typeof n.value||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}})),Rt=o("$ZodAny",((e,t)=>{Je.init(e,t),e._zod.parse=e=>e})),xt=o("$ZodUnknown",((e,t)=>{Je.init(e,t),e._zod.parse=e=>e})),It=o("$ZodNever",((e,t)=>{Je.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function $t(e,t,n){e.issues.length&&t.issues.push(...oe(n,e.issues)),t.value[n]=e.value}const kt=o("$ZodArray",((e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const a=i[e],s=t.element._zod.run({value:a,issues:[]},r);s instanceof Promise?o.push(s.then((t=>$t(t,n,e)))):$t(s,n,e)}return o.length?Promise.all(o).then((()=>n)):n}}));function St(e,t,n,r,i,o){const a=n in r;if(e.issues.length){if(i&&o&&!a)return;t.issues.push(...oe(n,e.issues))}a||i?void 0===e.value?a&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function At(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter((e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout)));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ot(e,t,n,r,i,o){const a=[],s=i.keySet,c=i.catchall._zod,u=c.def.type,l="optional"===c.optin,f="optional"===c.optout;for(const h in t){if("__proto__"===h)continue;if(s.has(h))continue;if("never"===u){a.push(h);continue}const i=c.run({value:t[h],issues:[]},r);i instanceof Promise?e.push(i.then((e=>St(e,n,h,t,l,f)))):St(i,n,h,t,l,f)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then((()=>n)):n}const _t=o("$ZodObject",((e,t)=>{Je.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=F((()=>At(t)));j(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n}));const i=J,o=t.catchall;let a;e._zod.parse=(t,n)=>{a??(a=r.value);const s=t.value;if(!i(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],u=a.shape;for(const e of a.keys){const r=u[e],i="optional"===r._zod.optin,o="optional"===r._zod.optout,a=r._zod.run({value:s[e],issues:[]},n);a instanceof Promise?c.push(a.then((n=>St(n,t,e,s,i,o)))):St(a,t,e,s,i,o)}return o?Ot(c,s,t,n,r.value,e):c.length?Promise.all(c).then((()=>t)):t}})),Dt=o("$ZodObjectJIT",((e,t)=>{_t.init(e,t);const n=e._zod.parse,r=F((()=>At(t)));let i;const o=J,a=!c.jitless,s=a&&W.value,u=t.catchall;let l;e._zod.parse=(c,f)=>{l??(l=r.value);const h=c.value;return o(h)?a&&s&&!1===f?.async&&!0!==f.jitless?(i||(i=(e=>{const t=new Ie(["shape","payload","ctx"]),n=r.value,i=e=>{const t=q(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let a=0;for(const r of n.keys)o[r]="key_"+a++;t.write("const newResult = {};");for(const r of n.keys){const n=o[r],a=q(r),s=e[r],c="optional"===s?._zod?.optin,u="optional"===s?._zod?.optout;t.write(`const ${n} = ${i(r)};`),c&&u?t.write(`\n if (${n}.issues.length) {\n if (${a} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${a} in input) {\n newResult[${a}] = undefined;\n }\n } else {\n newResult[${a}] = ${n}.value;\n }\n \n `):c?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${a} in input) {\n newResult[${a}] = undefined;\n }\n } else {\n newResult[${a}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${a} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${a}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${a}] = undefined;\n } else {\n newResult[${a}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)})(t.shape)),c=i(c,f),u?Ot([],h,c,f,l,e):c):n(c,f):(c.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),c)}}));function Vt(e,t,n,r){for(const o of e)if(0===o.issues.length)return t.value=o.value,t;const i=e.filter((e=>!re(e)));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>se(e,r,u())))))}),t)}const Nt=o("$ZodUnion",((e,t)=>{Je.init(e,t),j(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),j(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),j(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),j(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>U(e.source))).join("|")})$`)}}));const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)a.push(t),o=!0;else{if(0===t.issues.length)return t;a.push(t)}}return o?Promise.all(a).then((t=>Vt(t,r,e,i))):Vt(a,r,e,i)}}));const Ct=o("$ZodIntersection",((e,t)=>{Je.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then((([t,n])=>Ft(e,t,n))):Ft(e,i,o)}}));function Pt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(X(e)&&X(t)){const n=Object.keys(t),r=Object.keys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const o of r){const n=Pt(e[o],t[o]);if(!n.valid)return{valid:!1,mergeErrorPath:[o,...n.mergeErrorPath]};i[o]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=Pt(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ft(e,t,n){const r=new Map;let i;for(const s of t.issues)if("unrecognized_keys"===s.code){i??(i=s);for(const e of s.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(s);for(const s of n.issues)if("unrecognized_keys"===s.code)for(const e of s.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(s);const o=[...r].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(o.length&&i&&e.issues.push({...i,keys:o}),re(e))return e;const a=Pt(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Mt=o("$ZodTuple",((e,t)=>{Je.init(e,t);const n=t.items;e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];const a=[],s=Ut(n,"optin"),c=Ut(n,"optout");if(!t.rest){if(o.length<s)return r.issues.push({code:"too_small",minimum:s,inclusive:!0,input:o,inst:e,origin:"array"}),r;o.length>n.length&&r.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:o,inst:e,origin:"array"})}const u=new Array(n.length);for(let e=0;e<n.length;e++){const t=n[e]._zod.run({value:o[e],issues:[]},i);t instanceof Promise?a.push(t.then((t=>{u[e]=t}))):u[e]=t}if(t.rest){let e=n.length-1;const s=o.slice(n.length);for(const n of s){e++;const o=t.rest._zod.run({value:n,issues:[]},i);o instanceof Promise?a.push(o.then((t=>Lt(t,r,e)))):Lt(o,r,e)}}return a.length?Promise.all(a).then((()=>jt(u,r,n,o,c))):jt(u,r,n,o,c)}}));function Ut(e,t){for(let n=e.length-1;n>=0;n--)if("optional"!==e[n]._zod[t])return n+1;return 0}function Lt(e,t,n){e.issues.length&&t.issues.push(...oe(n,e.issues)),t.value[n]=e.value}function jt(e,t,n,r,i){for(let o=0;o<n.length;o++){const n=e[o],a=o<r.length;if(n.issues.length){if(!a&&o>=i){t.value.length=o;break}t.issues.push(...oe(o,n.issues))}t.value[o]=n.value}for(let o=t.value.length-1;o>=r.length&&("optional"===n[o]._zod.optout&&void 0===t.value[o]);o--)t.value.length=o;return t}const Gt=o("$ZodRecord",((e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!X(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const o=[],a=t.keyType._zod.values;if(a){n.value={};const s=new Set;for(const l of a)if("string"==typeof l||"number"==typeof l||"symbol"==typeof l){s.add("number"==typeof l?l.toString():l);const a=t.keyType._zod.run({value:l,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map((e=>se(e,r,u()))),input:l,path:[l],inst:e});continue}const c=a.value,f=t.valueType._zod.run({value:i[l],issues:[]},r);f instanceof Promise?o.push(f.then((e=>{e.issues.length&&n.issues.push(...oe(l,e.issues)),n.value[c]=e.value}))):(f.issues.length&&n.issues.push(...oe(l,f.issues)),n.value[c]=f.value)}let c;for(const e in i)s.has(e)||(c=c??[],c.push(e));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{n.value={};for(const a of Reflect.ownKeys(i)){if("__proto__"===a)continue;if(!Object.prototype.propertyIsEnumerable.call(i,a))continue;let s=t.keyType._zod.run({value:a,issues:[]},r);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof a&&_.test(a)&&s.issues.length){const e=t.keyType._zod.run({value:Number(a),issues:[]},r);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map((e=>se(e,r,u()))),input:a,path:[a],inst:e});continue}const c=t.valueType._zod.run({value:i[a],issues:[]},r);c instanceof Promise?o.push(c.then((e=>{e.issues.length&&n.issues.push(...oe(a,e.issues)),n.value[s.value]=e.value}))):(c.issues.length&&n.issues.push(...oe(a,c.issues)),n.value[s.value]=c.value)}}return o.length?Promise.all(o).then((()=>n)):n}}));const Zt=o("$ZodEnum",((e,t)=>{Je.init(e,t);const n=C(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter((e=>Q.has(typeof e))).map((e=>"string"==typeof e?Y(e):e.toString())).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}})),qt=o("$ZodLiteral",((e,t)=>{if(Je.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?Y(e):e?Y(e.toString()):String(e))).join("|")})$`),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}})),Ht=o("$ZodTransform",((e,t)=>{Je.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new s(e.constructor.name);const i=t.transform(n.value,n);if(r.async){return(i instanceof Promise?i:Promise.resolve(i)).then((e=>(n.value=e,n.fallback=!0,n)))}if(i instanceof Promise)throw new a;return n.value=i,n.fallback=!0,n}}));function Jt(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Wt=o("$ZodOptional",((e,t)=>{Je.init(e,t),e._zod.optin="optional",e._zod.optout="optional",j(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),j(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${U(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((e=>Jt(e,r))):Jt(i,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),Xt=o("$ZodExactOptional",((e,t)=>{Wt.init(e,t),j(e._zod,"values",(()=>t.innerType._zod.values)),j(e._zod,"pattern",(()=>t.innerType._zod.pattern)),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)})),Kt=o("$ZodNullable",((e,t)=>{Je.init(e,t),j(e._zod,"optin",(()=>t.innerType._zod.optin)),j(e._zod,"optout",(()=>t.innerType._zod.optout)),j(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${U(e.source)}|null)$`):void 0})),j(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),Qt=o("$ZodDefault",((e,t)=>{Je.init(e,t),e._zod.optin="optional",j(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then((e=>Yt(e,t))):Yt(r,t)}}));function Yt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const en=o("$ZodPrefault",((e,t)=>{Je.init(e,t),e._zod.optin="optional",j(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),tn=o("$ZodNonOptional",((e,t)=>{Je.init(e,t),j(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then((t=>nn(t,e))):nn(i,e)}}));function nn(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const rn=o("$ZodCatch",((e,t)=>{Je.init(e,t),e._zod.optin="optional",j(e._zod,"optout",(()=>t.innerType._zod.optout)),j(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then((r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map((e=>se(e,n,u())))},input:e.value}),e.issues=[],e.fallback=!0),e))):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map((e=>se(e,n,u())))},input:e.value}),e.issues=[],e.fallback=!0),e)}})),on=o("$ZodPipe",((e,t)=>{Je.init(e,t),j(e._zod,"values",(()=>t.in._zod.values)),j(e._zod,"optin",(()=>t.in._zod.optin)),j(e._zod,"optout",(()=>t.out._zod.optout)),j(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then((e=>an(e,t.in,n))):an(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then((e=>an(e,t.out,n))):an(r,t.out,n)}}));function an(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const sn=o("$ZodReadonly",((e,t)=>{Je.init(e,t),j(e._zod,"propValues",(()=>t.innerType._zod.propValues)),j(e._zod,"values",(()=>t.innerType._zod.values)),j(e._zod,"optin",(()=>t.innerType?._zod?.optin)),j(e._zod,"optout",(()=>t.innerType?._zod?.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(cn):cn(r)}}));function cn(e){return e.value=Object.freeze(e.value),e}const un=o("$ZodFunction",((e,t)=>(Je.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if("function"!=typeof t)throw new Error("implement() must be called with a function");return function(...n){const r=e._def.input?Oe(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?Oe(e._def.output,i):i}},e.implementAsync=t=>{if("function"!=typeof t)throw new Error("implementAsync() must be called with a function");return async function(...n){const r=e._def.input?await De(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await De(e._def.output,i):i}},e._zod.parse=(t,n)=>{if("function"!=typeof t.value)return t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}),t;const r=e._def.output&&"promise"===e._def.output._zod.def.type;return t.value=r?e.implementAsync(t.value):e.implement(t.value),t},e.input=(...t)=>{const n=e.constructor;return Array.isArray(t[0])?new n({type:"function",input:new Mt({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output}):new n({type:"function",input:t[0],output:e._def.output})},e.output=t=>new(0,e.constructor)({type:"function",input:e._def.input,output:t}),e))),ln=o("$ZodCustom",((e,t)=>{le.init(e,t),Je.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then((t=>fn(t,n,r,e)));fn(i,n,r,e)}}));function fn(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ue(e))}}var hn;Symbol("ZodOutput"),Symbol("ZodInput");class pn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(hn=globalThis).__zod_globalRegistry??(hn.__zod_globalRegistry=new pn);const dn=globalThis.__zod_globalRegistry;function mn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...te(t)})}function gn(e,t){return new he({check:"less_than",...te(t),value:e,inclusive:!1})}function yn(e,t){return new he({check:"less_than",...te(t),value:e,inclusive:!0})}function wn(e,t){return new pe({check:"greater_than",...te(t),value:e,inclusive:!1})}function bn(e,t){return new pe({check:"greater_than",...te(t),value:e,inclusive:!0})}function vn(e,t){return new de({check:"multiple_of",...te(t),value:e})}function Tn(e,t){return new ge({check:"max_length",...te(t),maximum:e})}function Bn(e,t){return new ye({check:"min_length",...te(t),minimum:e})}function En(e,t){return new we({check:"length_equals",...te(t),length:e})}function zn(e){return new xe({check:"overwrite",tx:e})}function Rn(e,t){const n=function(e,t){const n=new le({check:"custom",...te(t)});return n._zod.check=e,n}((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(ue(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(ue(r))}},e(t.value,t))),t);return n}function xn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??dn,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function In(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o){o.count++;return n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema}const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,r);else{const n=a.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(a.ref||(a.ref=o),In(o,t,r),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(a.schema,c),"input"===t.io&&Sn(e)&&(delete a.schema.examples,delete a.schema.default),"input"===t.io&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault;return t.seen.get(e).schema}function $n(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const o of e.seen.entries()){const t=e.metadataRegistry.get(o[0])?.id;if(t){const e=r.get(t);if(e&&e!==o[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,o[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);r.def={...r.schema},o&&(r.defId=o);const a=r.schema;for(const e in a)delete a[e];a.$ref=i};if("throw"===e.cycles)for(const o of e.seen.entries()){const e=o[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const o of e.seen.entries()){const n=o[1];if(t===o[0]){i(o);continue}if(e.external){const n=e.external.registry.get(o[0])?.id;if(t!==o[0]&&n){i(o);continue}}const r=e.metadataRegistry.get(o[0])?.id;r?i(o):(n.cycle||n.count>1&&"ref"===e.reused)&&i(o)}}function kn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},a=n.ref;if(n.ref=null,a){r(a);const n=e.seen.get(a),s=n.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,s):(i.allOf=i.allOf??[],i.allOf.push(s)),Object.assign(i,o);if(t._zod.parent===a)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(s.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const s=t._zod.parent;if(s&&s!==a){r(s);const t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(const c of[...e.seen.entries()].reverse())r(c[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const a=e.external?.defs??{};for(const c of e.seen.entries()){const e=c[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&("draft-2020-12"===e.target?i.$defs=a:i.definitions=a);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:An(t,"input",e.processors),output:An(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(s){throw new Error("Error converting schema to JSON.")}}function Sn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return Sn(r.element,n);if("set"===r.type)return Sn(r.valueType,n);if("lazy"===r.type)return Sn(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return Sn(r.innerType,n);if("intersection"===r.type)return Sn(r.left,n)||Sn(r.right,n);if("record"===r.type||"map"===r.type)return Sn(r.keyType,n)||Sn(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||(Sn(r.in,n)||Sn(r.out,n));if("object"===r.type){for(const e in r.shape)if(Sn(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(Sn(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(Sn(e,n))return!0;return!(!r.rest||!Sn(r.rest,n))}return!1}const An=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},a=xn({...i??{},target:o,io:t,processors:n});return In(e,a),$n(a,e),kn(a,e)};const On={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},_n=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:o,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if("number"==typeof o&&(i.minLength=o),"number"==typeof a&&(i.maxLength=a),s&&(i.format=On[s]??s,""===i.format&&delete i.format,"time"===s&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const e=[...c];1===e.length?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map((e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source})))])}},Dn=(e,t,n,r)=>{const i=n,{minimum:o,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;"string"==typeof s&&s.includes("int")?i.type="integer":i.type="number";const f="number"==typeof l&&l>=(o??Number.NEGATIVE_INFINITY),h="number"==typeof u&&u<=(a??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;f?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:"number"==typeof o&&(i.minimum=o),h?p?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u:"number"==typeof a&&(i.maximum=a),"number"==typeof c&&(i.multipleOf=c)},Vn=(e,t,n,r)=>{n.type="boolean"},Nn=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema")},Cn=(e,t,n,r)=>{n.not={}},Pn=(e,t,n,r)=>{const i=C(e._zod.def.entries);i.every((e=>"number"==typeof e))&&(n.type="number"),i.every((e=>"string"==typeof e))&&(n.type="string"),n.enum=i},Fn=(e,t,n,r)=>{const i=e._zod.def,o=[];for(const a of i.values)if(void 0===a){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof a){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(0===o.length);else if(1===o.length){const e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every((e=>"number"==typeof e))&&(n.type="number"),o.every((e=>"string"==typeof e))&&(n.type="string"),o.every((e=>"boolean"==typeof e))&&(n.type="boolean"),o.every((e=>null===e))&&(n.type="null"),n.enum=o},Mn=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")},Un=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Function types cannot be represented in JSON Schema")},Ln=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")},jn=(e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;"number"==typeof a&&(i.minItems=a),"number"==typeof s&&(i.maxItems=s),i.type="array",i.items=In(o.element,t,{...r,path:[...r.path,"items"]})},Gn=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const a=o.shape;for(const u in a)i.properties[u]=In(a[u],t,{...r,path:[...r.path,"properties",u]});const s=new Set(Object.keys(a)),c=new Set([...s].filter((e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout})));c.size>0&&(i.required=Array.from(c)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=In(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)},Zn=(e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,a=i.options.map(((e,n)=>In(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]})));o?n.oneOf=a:n.anyOf=a},qn=(e,t,n,r)=>{const i=e._zod.def,o=In(i.left,t,{...r,path:[...r.path,"allOf",0]}),a=In(i.right,t,{...r,path:[...r.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];n.allOf=c},Hn=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="array";const a="draft-2020-12"===t.target?"prefixItems":"items",s="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",c=o.items.map(((e,n)=>In(e,t,{...r,path:[...r.path,a,n]}))),u=o.rest?In(o.rest,t,{...r,path:[...r.path,s,..."openapi-3.0"===t.target?[o.items.length]:[]]}):null;"draft-2020-12"===t.target?(i.prefixItems=c,u&&(i.items=u)):"openapi-3.0"===t.target?(i.items={anyOf:c},u&&i.items.anyOf.push(u),i.minItems=c.length,u||(i.maxItems=c.length)):(i.items=c,u&&(i.additionalItems=u));const{minimum:l,maximum:f}=e._zod.bag;"number"==typeof l&&(i.minItems=l),"number"==typeof f&&(i.maxItems=f)},Jn=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object";const a=o.keyType,s=a._zod.bag,c=s?.patterns;if("loose"===o.mode&&c&&c.size>0){const e=In(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const t of c)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=In(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=In(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=a._zod.values;if(u){const e=[...u].filter((e=>"string"==typeof e||"number"==typeof e));e.length>0&&(i.required=e)}},Wn=(e,t,n,r)=>{const i=e._zod.def,o=In(i.innerType,t,r),a=t.seen.get(e);"openapi-3.0"===t.target?(a.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Xn=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType},Kn=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Qn=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Yn=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);let o;t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},er=(e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),a="input"===t.io?o?i.out:i.in:i.out;In(a,t,r);t.seen.get(e).ref=a},tr=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType,n.readOnly=!0},nr=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType};const rr=o("ZodISODateTime",((e,t)=>{ct.init(e,t),Ar.init(e,t)}));function ir(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...te(t)})}(rr,e)}const or=o("ZodISODate",((e,t)=>{ut.init(e,t),Ar.init(e,t)}));function ar(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...te(t)})}(or,e)}const sr=o("ZodISOTime",((e,t)=>{lt.init(e,t),Ar.init(e,t)}));function cr(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...te(t)})}(sr,e)}const ur=o("ZodISODuration",((e,t)=>{ft.init(e,t),Ar.init(e,t)}));function lr(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...te(t)})}(ur,e)}const fr=(e,t)=>{ke.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map((e=>r({issues:e},[...i,...o.path])));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;i<e.length;){const n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(o))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,P,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,P,2)}},isEmpty:{get:()=>0===e.issues.length}})},hr=o("ZodError",fr,{Parent:Error}),pr=Ae(hr),dr=_e(hr),mr=Ve(hr),gr=Ce(hr),yr=Fe(hr),wr=Me(hr),br=Ue(hr),vr=Le(hr),Tr=je(hr),Br=Ge(hr),Er=Ze(hr),zr=qe(hr);const Rr=new WeakMap;function xr(e,t,n){const r=Object.getPrototypeOf(e);let i=Rr.get(r);if(i||(i=new Set,Rr.set(r,i)),!i.has(t)){i.add(t);for(const e in n){const t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){const n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const Ir=o("ZodType",((e,t)=>(Je.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:An(e,"input"),output:An(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=xn({...n,processors:t});return In(e,r),$n(r,e),kn(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>pr(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>mr(e,t,n),e.parseAsync=async(t,n)=>dr(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>gr(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>yr(e,t,n),e.decode=(t,n)=>wr(e,t,n),e.encodeAsync=async(t,n)=>br(e,t,n),e.decodeAsync=async(t,n)=>vr(e,t,n),e.safeEncode=(t,n)=>Tr(e,t,n),e.safeDecode=(t,n)=>Br(e,t,n),e.safeEncodeAsync=async(t,n)=>Er(e,t,n),e.safeDecodeAsync=async(t,n)=>zr(e,t,n),xr(e,"ZodType",{check(...e){const t=this.def;return this.clone(Z(t,{checks:[...t.checks??[],...e.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ee(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...te(n)})}(Ui,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return Rn(e,t)}(e,t))},overwrite(e){return this.check(zn(e))},optional(){return $i(this)},exactOptional(){return new ki({type:"optional",innerType:this})},nullable(){return Ai(this)},nullish(){return $i(Ai(this))},nonoptional(e){return function(e,t){return new Di({type:"nonoptional",innerType:e,...te(t)})}(this,e)},array(){return hi(this)},or(e){return gi([this,e])},and(e){return new yi({type:"intersection",left:this,right:e})},transform(e){return Ci(this,xi(e))},default(e){return t=e,new Oi({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():K(t)}});var t},prefault(e){return t=e,new _i({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():K(t)}});var t},catch(e){return new Vi({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return Ci(this,e)},readonly(){return new Pi({type:"readonly",innerType:this})},describe(e){const t=this.clone();return dn.add(t,{description:e}),t},meta(...e){if(0===e.length)return dn.get(this);const t=this.clone();return dn.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>dn.get(e)?.description,configurable:!0}),e))),$r=o("_ZodString",((e,t)=>{We.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_n(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,xr(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new ve({check:"string_format",format:"regex",...te(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new Ee({check:"string_format",format:"includes",...te(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new ze({check:"string_format",format:"starts_with",...te(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new Re({check:"string_format",format:"ends_with",...te(t),suffix:e})}(...e))},min(...e){return this.check(Bn(...e))},max(...e){return this.check(Tn(...e))},length(...e){return this.check(En(...e))},nonempty(...e){return this.check(Bn(1,...e))},lowercase(e){return this.check(function(e){return new Te({check:"string_format",format:"lowercase",...te(e)})}(e))},uppercase(e){return this.check(function(e){return new Be({check:"string_format",format:"uppercase",...te(e)})}(e))},trim(){return this.check(zn((e=>e.trim())))},normalize(...e){return this.check(function(e){return zn((t=>t.normalize(e)))}(...e))},toLowerCase(){return this.check(zn((e=>e.toLowerCase())))},toUpperCase(){return this.check(zn((e=>e.toUpperCase())))},slugify(){return this.check(zn((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))))}})})),kr=o("ZodString",((e,t)=>{We.init(e,t),$r.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...te(t)})}(Or,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...te(t)})}(Vr,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...te(t)})}(Xr,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...te(t)})}(Nr,t)),e.guid=t=>e.check(mn(_r,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...te(t)})}(Dr,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...te(t)})}(Dr,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...te(t)})}(Dr,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...te(t)})}(Dr,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...te(t)})}(Cr,t)),e.guid=t=>e.check(mn(_r,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...te(t)})}(Pr,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...te(t)})}(Fr,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...te(t)})}(Mr,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...te(t)})}(Hr,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...te(t)})}(Jr,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...te(t)})}(Ur,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...te(t)})}(Lr,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...te(t)})}(jr,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...te(t)})}(Gr,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...te(t)})}(Zr,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...te(t)})}(qr,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...te(t)})}(Wr,t)),e.datetime=t=>e.check(ir(t)),e.date=t=>e.check(ar(t)),e.time=t=>e.check(cr(t)),e.duration=t=>e.check(lr(t))}));function Sr(e){return function(e,t){return new e({type:"string",...te(t)})}(kr,e)}const Ar=o("ZodStringFormat",((e,t)=>{Xe.init(e,t),$r.init(e,t)})),Or=o("ZodEmail",((e,t)=>{Ye.init(e,t),Ar.init(e,t)}));const _r=o("ZodGUID",((e,t)=>{Ke.init(e,t),Ar.init(e,t)}));const Dr=o("ZodUUID",((e,t)=>{Qe.init(e,t),Ar.init(e,t)}));const Vr=o("ZodURL",((e,t)=>{et.init(e,t),Ar.init(e,t)}));const Nr=o("ZodEmoji",((e,t)=>{tt.init(e,t),Ar.init(e,t)}));const Cr=o("ZodNanoID",((e,t)=>{nt.init(e,t),Ar.init(e,t)}));const Pr=o("ZodCUID",((e,t)=>{rt.init(e,t),Ar.init(e,t)}));const Fr=o("ZodCUID2",((e,t)=>{it.init(e,t),Ar.init(e,t)}));const Mr=o("ZodULID",((e,t)=>{ot.init(e,t),Ar.init(e,t)}));const Ur=o("ZodXID",((e,t)=>{at.init(e,t),Ar.init(e,t)}));const Lr=o("ZodKSUID",((e,t)=>{st.init(e,t),Ar.init(e,t)}));const jr=o("ZodIPv4",((e,t)=>{ht.init(e,t),Ar.init(e,t)}));const Gr=o("ZodIPv6",((e,t)=>{pt.init(e,t),Ar.init(e,t)}));const Zr=o("ZodCIDRv4",((e,t)=>{dt.init(e,t),Ar.init(e,t)}));const qr=o("ZodCIDRv6",((e,t)=>{mt.init(e,t),Ar.init(e,t)}));const Hr=o("ZodBase64",((e,t)=>{yt.init(e,t),Ar.init(e,t)}));const Jr=o("ZodBase64URL",((e,t)=>{wt.init(e,t),Ar.init(e,t)}));const Wr=o("ZodE164",((e,t)=>{bt.init(e,t),Ar.init(e,t)}));const Xr=o("ZodJWT",((e,t)=>{vt.init(e,t),Ar.init(e,t)}));const Kr=o("ZodNumber",((e,t)=>{Tt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dn(e,t,n),xr(e,"ZodNumber",{gt(e,t){return this.check(wn(e,t))},gte(e,t){return this.check(bn(e,t))},min(e,t){return this.check(bn(e,t))},lt(e,t){return this.check(gn(e,t))},lte(e,t){return this.check(yn(e,t))},max(e,t){return this.check(yn(e,t))},int(e){return this.check(ei(e))},safe(e){return this.check(ei(e))},positive(e){return this.check(wn(0,e))},nonnegative(e){return this.check(bn(0,e))},negative(e){return this.check(gn(0,e))},nonpositive(e){return this.check(yn(0,e))},multipleOf(e,t){return this.check(vn(e,t))},step(e,t){return this.check(vn(e,t))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function Qr(e){return function(e,t){return new e({type:"number",checks:[],...te(t)})}(Kr,e)}const Yr=o("ZodNumberFormat",((e,t)=>{Bt.init(e,t),Kr.init(e,t)}));function ei(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...te(t)})}(Yr,e)}const ti=o("ZodBoolean",((e,t)=>{Et.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Vn(0,0,t)}));function ni(e){return function(e,t){return new e({type:"boolean",...te(t)})}(ti,e)}const ri=o("ZodBigInt",((e,t)=>{zt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Nn(0,e),e.gte=(t,n)=>e.check(bn(t,n)),e.min=(t,n)=>e.check(bn(t,n)),e.gt=(t,n)=>e.check(wn(t,n)),e.gte=(t,n)=>e.check(bn(t,n)),e.min=(t,n)=>e.check(bn(t,n)),e.lt=(t,n)=>e.check(gn(t,n)),e.lte=(t,n)=>e.check(yn(t,n)),e.max=(t,n)=>e.check(yn(t,n)),e.positive=t=>e.check(wn(BigInt(0),t)),e.negative=t=>e.check(gn(BigInt(0),t)),e.nonpositive=t=>e.check(yn(BigInt(0),t)),e.nonnegative=t=>e.check(bn(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(vn(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function ii(e){return function(e,t){return new e({type:"bigint",...te(t)})}(ri,e)}const oi=o("ZodAny",((e,t)=>{Rt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function ai(){return function(e){return new e({type:"any"})}(oi)}const si=o("ZodUnknown",((e,t)=>{xt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function ci(){return function(e){return new e({type:"unknown"})}(si)}const ui=o("ZodNever",((e,t)=>{It.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Cn(0,0,t)}));function li(e){return function(e,t){return new e({type:"never",...te(t)})}(ui,e)}const fi=o("ZodArray",((e,t)=>{kt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jn(e,t,n,r),e.element=t.element,xr(e,"ZodArray",{min(e,t){return this.check(Bn(e,t))},nonempty(e){return this.check(Bn(1,e))},max(e,t){return this.check(Tn(e,t))},length(e,t){return this.check(En(e,t))},unwrap(){return this.element}})}));function hi(e,t){return function(e,t,n){return new e({type:"array",element:t,...te(n)})}(fi,e,t)}const pi=o("ZodObject",((e,t)=>{Dt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gn(e,t,n,r),j(e,"shape",(()=>t.shape)),xr(e,"ZodObject",{keyof(){return Ei(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ci()})},loose(){return this.clone({...this._zod.def,catchall:ci()})},strict(){return this.clone({...this._zod.def,catchall:li()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!X(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=Z(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return G(this,"shape",n),n}});return ee(e,r)}(this,e)},safeExtend(e){return function(e,t){if(!X(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Z(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return G(this,"shape",n),n}});return ee(e,n)}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Z(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return G(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ee(e,n)}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return ee(e,Z(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return G(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Z(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return G(this,"shape",r),r},checks:[]});return ee(e,i)}(this,e)},partial(...e){return function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Z(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return G(this,"shape",i),i},checks:[]});return ee(t,i)}(Ii,this,e[0])},required(...e){return function(e,t,n){const r=Z(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)i[t]=new e({type:"nonoptional",innerType:r[t]});return G(this,"shape",i),i}});return ee(t,r)}(Di,this,e[0])}})}));function di(e,t){const n={type:"object",shape:e??{},...te(t)};return new pi(n)}const mi=o("ZodUnion",((e,t)=>{Nt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zn(e,t,n,r),e.options=t.options}));function gi(e,t){return new mi({type:"union",options:e,...te(t)})}const yi=o("ZodIntersection",((e,t)=>{Ct.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qn(e,t,n,r)}));const wi=o("ZodTuple",((e,t)=>{Mt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hn(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})}));function bi(e,t,n){const r=t instanceof Je;return new wi({type:"tuple",items:e,rest:r?t:null,...te(r?n:t)})}const vi=o("ZodRecord",((e,t)=>{Gt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jn(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType}));function Ti(e,t,n){return t&&t._zod?new vi({type:"record",keyType:e,valueType:t,...te(n)}):new vi({type:"record",keyType:Sr(),valueType:e,...te(t)})}const Bi=o("ZodEnum",((e,t)=>{Zt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pn(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);i[o]=t.entries[o]}return new Bi({...t,checks:[],...te(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Bi({...t,checks:[],...te(r),entries:i})}}));function Ei(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Bi({type:"enum",entries:n,...te(t)})}const zi=o("ZodLiteral",((e,t)=>{qt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fn(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}));const Ri=o("ZodTransform",((e,t)=>{Ht.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Ln(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new s(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(ue(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(ue(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then((e=>(n.value=e,n.fallback=!0,n))):(n.value=i,n.fallback=!0,n)}}));function xi(e){return new Ri({type:"transform",transform:e})}const Ii=o("ZodOptional",((e,t)=>{Wt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));function $i(e){return new Ii({type:"optional",innerType:e})}const ki=o("ZodExactOptional",((e,t)=>{Xt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));const Si=o("ZodNullable",((e,t)=>{Kt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}));function Ai(e){return new Si({type:"nullable",innerType:e})}const Oi=o("ZodDefault",((e,t)=>{Qt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const _i=o("ZodPrefault",((e,t)=>{en.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}));const Di=o("ZodNonOptional",((e,t)=>{tn.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xn(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));const Vi=o("ZodCatch",((e,t)=>{rn.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const Ni=o("ZodPipe",((e,t)=>{on.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>er(e,t,0,r),e.in=t.in,e.out=t.out}));function Ci(e,t){return new Ni({type:"pipe",in:e,out:t})}const Pi=o("ZodReadonly",((e,t)=>{sn.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}));const Fi=o("ZodFunction",((e,t)=>{un.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Un(0,e)}));function Mi(e){return new Fi({type:"function",input:Array.isArray(e?.input)?bi(e?.input):e?.input??hi(ci()),output:e?.output??ci()})}const Ui=o("ZodCustom",((e,t)=>{ln.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Mn(0,e)}));var Li=n(878),ji=n.n(Li);const Gi=Sr().regex(/^(?:0x)?[0-9a-fA-F]*$/i,"expected hex string").refine((e=>e.replace(/^0x/i,"").length%2==0),"expected even-length hex string"),Zi=ji()("bee-js:bytes"),qi=new TextDecoder,Hi=new TextEncoder;class Ji{constructor(e,t){if(!e)throw Error(`Bytes#constructor: constructor parameter is falsy: ${e}`);if(e instanceof Ji)this.bytes=e.bytes;else if("string"==typeof e)this.bytes=i.yI.hexToUint8Array(Gi.parse(e));else if(e instanceof ArrayBuffer)this.bytes=new Uint8Array(e);else if(e instanceof Uint8Array)this.bytes=e;else{const t=e,n=i.Rb.getDeep(t,"toHex");if(!Mi().safeParse(n).success)throw Zi("bytes",e),new Error("Bytes#constructor: unsupported type: "+typeof e);{const e=n.call(t);this.bytes=i.yI.hexToUint8Array(Gi.parse(e))}}if(this.length=this.bytes.length,t)if(Array.isArray(t)){if(!t.includes(this.length))throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${t.join(" or ")}`)}else if(this.length!==t)throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${t}`)}static keccak256(e){return new Ji(i.yI.keccak256(new Ji(e).toUint8Array()))}static fromUtf8(e){return new Ji(Hi.encode(e))}static fromSlice(e,t,n){return new Ji(void 0===n?e.slice(t):e.slice(t,t+n))}offset(e){return new Uint8Array(this.bytes.slice(e))}toUint8Array(){return new Uint8Array(this.bytes)}toHex(){return i.yI.uint8ArrayToHex(this.bytes)}toBase64(){return i.yI.uint8ArrayToBase64(this.bytes)}toBase32(){return i.yI.uint8ArrayToBase32(this.bytes)}toString(){return this.toHex()}toUtf8(){return qi.decode(this.bytes)}toJSON(){return JSON.parse(this.toUtf8())}equals(e){return this.toHex()===new Ji(e).toHex()}represent(){return this.toHex()}}function Wi(e){const t=e.match(/^([\d.]+)\s*(B|kB|MB|GB|TB|PB)$/);if(!t)throw new Error(`Invalid size format: ${e}`);const n=parseFloat(t[1]),r=t[2];return Math.ceil(n*{B:1,kB:1e3,MB:1e6,GB:1e3**3,TB:1e3**4,PB:1e3**5}[r])}const Xi=250,Ki=251,Qi={[Xi]:"manifest",[Ki]:"feed"};const Yi=new TextEncoder;class eo extends Ji{static LENGTH=32;constructor(e){super(e,32)}publicKey(){const[e,t]=i.LQ.privateKeyToPublicKey(i.yI.uint256ToNumber(this.bytes,"BE"));return new to(i.yI.concatBytes(i.yI.numberToUint256(e,"BE"),i.yI.numberToUint256(t,"BE")))}sign(e){const t=i.yI.concatBytes(Yi.encode("Ethereum Signed Message:\n32"),i.yI.keccak256(e instanceof Uint8Array?e:Yi.encode(e))),[n,r,o]=i.LQ.signMessage(t,i.yI.uint256ToNumber(this.bytes,"BE"));return new uo(i.yI.concatBytes(i.yI.numberToUint256(n,"BE"),i.yI.numberToUint256(r,"BE"),new Uint8Array([Number(o)])))}}class to extends Ji{static LENGTH=64;constructor(e){const t=new Ji(e);if(33===t.length){const[e,n]=i.LQ.publicKeyFromCompressed(t.toUint8Array());super(i.yI.concatBytes(i.yI.numberToUint256(e,"BE"),i.yI.numberToUint256(n,"BE")),64)}else super(e,64)}address(){const e=i.yI.uint256ToNumber(this.bytes.slice(0,32),"BE"),t=i.yI.uint256ToNumber(this.bytes.slice(32,64),"BE");return new no(i.LQ.publicKeyToAddress([e,t]))}toCompressedUint8Array(){const e=i.yI.uint256ToNumber(this.bytes.slice(0,32),"BE"),t=i.yI.uint256ToNumber(this.bytes.slice(32,64),"BE");return i.LQ.compressPublicKey([e,t])}toCompressedHex(){return i.yI.uint8ArrayToHex(this.toCompressedUint8Array())}}class no extends Ji{static LENGTH=20;constructor(e){super(e,20)}toChecksum(){return i.LQ.checksumEncode(this.bytes)}}class ro extends Ji{static LENGTH=32;constructor(e){super(e,32)}static fromString(e){return new ro(i.yI.keccak256(Yi.encode(e)))}}class io extends Ji{static LENGTH=32;constructor(e){if("string"==typeof e&&e.startsWith("bah5")){const t=function(e){const t=i.yI.base32ToUint8Array(e.toUpperCase().slice(1)),n=t[1];if(!Qi[n])throw new Error("Unknown codec");const r=new io(t.slice(-32));return{type:Qi[n],reference:r}}(e);super(t.reference.bytes,32)}else super(e,[32,64])}toCid(e){return function(e,t){e=new io(e);const n=new Uint8Array([1]),r=new Uint8Array(["feed"===t?251:250]),o=new Uint8Array([1]),a=new Uint8Array([27]),s=new Uint8Array([32]);return`b${i.yI.uint8ArrayToBase32(i.yI.concatBytes(n,r,o,a,s)).replace(/\=+$/,"")}${e.toBase32().replace(/\=+$/,"")}`.toLowerCase()}(this.bytes,e)}static isValid(e){try{return new io(e),!0}catch{return!1}}}class oo extends Ji{static LENGTH=32;constructor(e){super(e,32)}}class ao extends Ji{static LENGTH=8;constructor(e){super(e,8)}static fromBigInt(e){return new ao(i.yI.numberToUint64(e,"LE"))}toBigInt(){return i.yI.uint64ToNumber(this.bytes,"LE")}static fromSlice(e,t){return new ao(e.slice(t,t+ao.LENGTH))}}class so extends Ji{static LENGTH=32;constructor(e){super(e,32)}}class co extends Ji{static LENGTH=32;constructor(e){super(e,32)}}class uo extends Ji{static LENGTH=65;constructor(e){super(e,65)}static fromSlice(e,t){return new uo(e.slice(t,t+uo.LENGTH))}recoverPublicKey(e){const t=i.yI.uint256ToNumber(this.bytes.slice(0,32),"BE"),n=i.yI.uint256ToNumber(this.bytes.slice(32,64),"BE"),r=BigInt(this.bytes[64]),[o,a]=i.LQ.recoverPublicKey(i.yI.concatBytes(Yi.encode("Ethereum Signed Message:\n32"),i.yI.keccak256(e instanceof Uint8Array?e:Yi.encode(e))),t,n,r);return new to(i.yI.concatBytes(i.yI.numberToUint256(o,"BE"),i.yI.numberToUint256(a,"BE")))}isValid(e,t){return this.recoverPublicKey(e).address().equals(t)}}class lo extends Ji{static LENGTH=32;constructor(e){super(e,32)}static fromString(e){return new lo(i.yI.keccak256(Yi.encode(e)))}}const fo=new Uint8Array(8).fill(255,0,8);class ho extends Ji{static LENGTH=8;static MINUS_ONE=new ho(fo);constructor(e){super(e,8)}static fromBigInt(e){return new ho(i.yI.numberToUint64(e,"BE"))}toBigInt(){return i.yI.uint64ToNumber(this.bytes,"BE")}next(){return i.yI.equals(this.bytes,fo)?ho.fromBigInt(0n):ho.fromBigInt(this.toBigInt()+1n)}}class po extends Error{constructor(e){super(e)}}class mo extends po{constructor(e,t){super(e),this.value=t}}class go extends po{constructor(e,t,n,r,i,o){super(n),this.method=e,this.url=t,this.responseBody=r,this.status=i,this.statusText=o,this.response={status:i,data:r,statusText:o}}}const yo=4096;function wo(e){const t=e.slice(0,ao.LENGTH),n=function(e){if(e.length>yo)throw new mo(`payload size ${e.length} exceeds maximum chunk payload size 4096`,e);const t=new Uint8Array(yo);return t.set(e),i.yI.log2Reduce(i.yI.partition(t,32),((e,t)=>i.yI.keccak256(i.yI.concatBytes(e,t))))}(e.slice(ao.LENGTH)),r=i.yI.keccak256(i.yI.concatBytes(t,n));return new io(r)}const bo=di({reference:Sr().transform((e=>new io(e)))});let vo=function(e){return e.FULL="full",e.LIGHT="light",e.ULTRA_LIGHT="ultra-light",e.DEV="dev",e}({});function To(e){switch(e){case"full":return vo.FULL;case"light":return vo.LIGHT;case"ultra-light":return vo.ULTRA_LIGHT;case"dev":return vo.DEV;default:throw new Error(`Unknown Bee mode: ${e}`)}}const Bo=32,Eo=128,zo=Bo*Eo,Ro=4,xo=17,Io=255,$o=1,ko=1e3;let So=function(e){return e[e.OFF=0]="OFF",e[e.MEDIUM=1]="MEDIUM",e[e.STRONG=2]="STRONG",e[e.INSANE=3]="INSANE",e[e.PARANOID=4]="PARANOID",e}({}),Ao=function(e){return e[e.NONE=0]="NONE",e[e.DATA=1]="DATA",e[e.PROX=2]="PROX",e[e.RACE=3]="RACE",e}({});const Oo={ENCRYPTION_OFF:{[So.OFF]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"44.70 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.66 MB",batchDepth:18,utilizationRate:"0.61%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"112.06 MB",batchDepth:19,utilizationRate:"5.09%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"687.62 MB",batchDepth:20,utilizationRate:"15.65%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.60 GB",batchDepth:21,utilizationRate:"30.27%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.73 GB",batchDepth:22,utilizationRate:"44.99%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"19.94 GB",batchDepth:23,utilizationRate:"58.03%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"47.06 GB",batchDepth:24,utilizationRate:"68.48%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"105.51 GB",batchDepth:25,utilizationRate:"76.77%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"227.98 GB",batchDepth:26,utilizationRate:"82.94%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"476.68 GB",batchDepth:27,utilizationRate:"86.71%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"993.65 GB",batchDepth:28,utilizationRate:"88.37%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"2.04 TB",batchDepth:29,utilizationRate:"92.88%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"4.17 TB",batchDepth:30,utilizationRate:"94.81%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"8.45 TB",batchDepth:31,utilizationRate:"96.06%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"17.07 TB",batchDepth:32,utilizationRate:"97.01%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"34.36 TB",batchDepth:33,utilizationRate:"97.65%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"69.04 TB",batchDepth:34,utilizationRate:"98.11%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"138.54 TB",batchDepth:35,utilizationRate:"98.44%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"277.72 TB",batchDepth:36,utilizationRate:"98.67%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"556.35 TB",batchDepth:37,utilizationRate:"98.83%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.11 PB",batchDepth:38,utilizationRate:"98.91%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.23 PB",batchDepth:39,utilizationRate:"98.96%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.46 PB",batchDepth:40,utilizationRate:"98.98%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.93 PB",batchDepth:41,utilizationRate:"99.11%"}],[So.MEDIUM]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"41.56 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.19 MB",batchDepth:18,utilizationRate:"0.57%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"104.18 MB",batchDepth:19,utilizationRate:"4.73%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"639.27 MB",batchDepth:20,utilizationRate:"14.54%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.41 GB",batchDepth:21,utilizationRate:"28.11%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.18 GB",batchDepth:22,utilizationRate:"41.79%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"18.54 GB",batchDepth:23,utilizationRate:"53.95%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"43.75 GB",batchDepth:24,utilizationRate:"63.66%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"98.09 GB",batchDepth:25,utilizationRate:"71.37%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"211.95 GB",batchDepth:26,utilizationRate:"77.11%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"443.16 GB",batchDepth:27,utilizationRate:"80.61%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"923.78 GB",batchDepth:28,utilizationRate:"82.16%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.90 TB",batchDepth:29,utilizationRate:"86.30%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.88 TB",batchDepth:30,utilizationRate:"88.14%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"7.86 TB",batchDepth:31,utilizationRate:"89.26%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"15.87 TB",batchDepth:32,utilizationRate:"90.21%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"31.94 TB",batchDepth:33,utilizationRate:"90.77%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"64.19 TB",batchDepth:34,utilizationRate:"91.22%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"128.80 TB",batchDepth:35,utilizationRate:"91.52%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"258.19 TB",batchDepth:36,utilizationRate:"91.73%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"517.23 TB",batchDepth:37,utilizationRate:"91.88%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.04 PB",batchDepth:38,utilizationRate:"91.95%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.07 PB",batchDepth:39,utilizationRate:"92.00%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.15 PB",batchDepth:40,utilizationRate:"92.15%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.30 PB",batchDepth:41,utilizationRate:"92.14%"}],[So.STRONG]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"37.37 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"5.57 MB",batchDepth:18,utilizationRate:"0.51%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"93.68 MB",batchDepth:19,utilizationRate:"4.25%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"574.81 MB",batchDepth:20,utilizationRate:"13.07%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.17 GB",batchDepth:21,utilizationRate:"25.26%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"6.46 GB",batchDepth:22,utilizationRate:"37.58%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"16.67 GB",batchDepth:23,utilizationRate:"48.50%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"39.34 GB",batchDepth:24,utilizationRate:"57.24%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"88.20 GB",batchDepth:25,utilizationRate:"64.17%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"190.58 GB",batchDepth:26,utilizationRate:"69.33%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"398.47 GB",batchDepth:27,utilizationRate:"72.48%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"830.63 GB",batchDepth:28,utilizationRate:"73.85%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.71 TB",batchDepth:29,utilizationRate:"77.59%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.49 TB",batchDepth:30,utilizationRate:"79.27%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"7.07 TB",batchDepth:31,utilizationRate:"80.34%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"14.27 TB",batchDepth:32,utilizationRate:"81.12%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"28.72 TB",batchDepth:33,utilizationRate:"81.63%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"57.71 TB",batchDepth:34,utilizationRate:"82.01%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"115.81 TB",batchDepth:35,utilizationRate:"82.29%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"232.16 TB",batchDepth:36,utilizationRate:"82.48%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"465.07 TB",batchDepth:37,utilizationRate:"82.61%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"931.23 TB",batchDepth:38,utilizationRate:"82.67%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.86 PB",batchDepth:39,utilizationRate:"82.71%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.73 PB",batchDepth:40,utilizationRate:"82.78%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"7.46 PB",batchDepth:41,utilizationRate:"82.79%"}],[So.INSANE]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"33.88 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"5.05 MB",batchDepth:18,utilizationRate:"0.46%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"84.92 MB",batchDepth:19,utilizationRate:"3.86%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"521.09 MB",batchDepth:20,utilizationRate:"11.85%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"1.97 GB",batchDepth:21,utilizationRate:"22.90%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"5.86 GB",batchDepth:22,utilizationRate:"34.09%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"15.11 GB",batchDepth:23,utilizationRate:"43.97%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"35.66 GB",batchDepth:24,utilizationRate:"51.90%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"79.96 GB",batchDepth:25,utilizationRate:"58.18%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"172.77 GB",batchDepth:26,utilizationRate:"62.85%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"361.23 GB",batchDepth:27,utilizationRate:"65.70%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"753.00 GB",batchDepth:28,utilizationRate:"66.95%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.55 TB",batchDepth:29,utilizationRate:"70.38%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.16 TB",batchDepth:30,utilizationRate:"71.92%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"6.41 TB",batchDepth:31,utilizationRate:"72.85%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"12.93 TB",batchDepth:32,utilizationRate:"73.53%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"26.04 TB",batchDepth:33,utilizationRate:"74.01%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"52.32 TB",batchDepth:34,utilizationRate:"74.35%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"104.99 TB",batchDepth:35,utilizationRate:"74.60%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"210.46 TB",batchDepth:36,utilizationRate:"74.77%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"421.61 TB",batchDepth:37,utilizationRate:"74.89%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"844.20 TB",batchDepth:38,utilizationRate:"74.94%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.69 PB",batchDepth:39,utilizationRate:"74.98%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.38 PB",batchDepth:40,utilizationRate:"75.03%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"6.77 PB",batchDepth:41,utilizationRate:"75.10%"}],[So.PARANOID]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"13.27 kB",batchDepth:17,utilizationRate:"0.00%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"1.98 MB",batchDepth:18,utilizationRate:"0.18%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"33.27 MB",batchDepth:19,utilizationRate:"1.51%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"204.14 MB",batchDepth:20,utilizationRate:"4.64%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"771.13 MB",batchDepth:21,utilizationRate:"8.75%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"2.29 GB",batchDepth:22,utilizationRate:"13.34%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"5.92 GB",batchDepth:23,utilizationRate:"17.22%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"13.97 GB",batchDepth:24,utilizationRate:"20.33%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"31.32 GB",batchDepth:25,utilizationRate:"22.79%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"67.68 GB",batchDepth:26,utilizationRate:"24.62%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"141.51 GB",batchDepth:27,utilizationRate:"25.74%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"294.99 GB",batchDepth:28,utilizationRate:"26.23%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"606.90 GB",batchDepth:29,utilizationRate:"27.56%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"1.24 TB",batchDepth:30,utilizationRate:"28.15%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"2.51 TB",batchDepth:31,utilizationRate:"28.54%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"5.07 TB",batchDepth:32,utilizationRate:"28.82%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"10.20 TB",batchDepth:33,utilizationRate:"28.99%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"20.50 TB",batchDepth:34,utilizationRate:"29.13%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"41.13 TB",batchDepth:35,utilizationRate:"29.22%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"82.45 TB",batchDepth:36,utilizationRate:"29.29%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"165.17 TB",batchDepth:37,utilizationRate:"29.34%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"330.72 TB",batchDepth:38,utilizationRate:"29.37%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"661.97 TB",batchDepth:39,utilizationRate:"29.39%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"1.32 PB",batchDepth:40,utilizationRate:"29.41%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"2.65 PB",batchDepth:41,utilizationRate:"29.43%"}]},ENCRYPTION_ON:{[So.OFF]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"44.35 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.61 MB",batchDepth:18,utilizationRate:"0.60%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"111.18 MB",batchDepth:19,utilizationRate:"5.05%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"682.21 MB",batchDepth:20,utilizationRate:"15.52%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.58 GB",batchDepth:21,utilizationRate:"30.04%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.67 GB",batchDepth:22,utilizationRate:"44.62%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"19.78 GB",batchDepth:23,utilizationRate:"57.56%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"46.69 GB",batchDepth:24,utilizationRate:"67.93%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"104.68 GB",batchDepth:25,utilizationRate:"76.16%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"226.19 GB",batchDepth:26,utilizationRate:"82.29%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"472.93 GB",batchDepth:27,utilizationRate:"86.02%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"985.83 GB",batchDepth:28,utilizationRate:"87.66%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"2.03 TB",batchDepth:29,utilizationRate:"92.25%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"4.14 TB",batchDepth:30,utilizationRate:"94.21%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"8.39 TB",batchDepth:31,utilizationRate:"95.37%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"16.93 TB",batchDepth:32,utilizationRate:"96.22%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"34.09 TB",batchDepth:33,utilizationRate:"96.88%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"68.50 TB",batchDepth:34,utilizationRate:"97.34%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"137.45 TB",batchDepth:35,utilizationRate:"97.67%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"275.53 TB",batchDepth:36,utilizationRate:"97.89%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"551.97 TB",batchDepth:37,utilizationRate:"98.05%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.11 PB",batchDepth:38,utilizationRate:"98.13%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.21 PB",batchDepth:39,utilizationRate:"98.18%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.43 PB",batchDepth:40,utilizationRate:"98.36%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.86 PB",batchDepth:41,utilizationRate:"98.37%"}],[So.MEDIUM]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"40.89 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.09 MB",batchDepth:18,utilizationRate:"0.56%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"102.49 MB",batchDepth:19,utilizationRate:"4.65%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"628.91 MB",batchDepth:20,utilizationRate:"14.30%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.38 GB",batchDepth:21,utilizationRate:"27.68%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.07 GB",batchDepth:22,utilizationRate:"41.15%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"18.24 GB",batchDepth:23,utilizationRate:"53.09%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"43.04 GB",batchDepth:24,utilizationRate:"62.63%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"96.50 GB",batchDepth:25,utilizationRate:"70.21%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"208.52 GB",batchDepth:26,utilizationRate:"75.86%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"435.98 GB",batchDepth:27,utilizationRate:"79.30%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"908.81 GB",batchDepth:28,utilizationRate:"80.82%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.87 TB",batchDepth:29,utilizationRate:"84.98%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.81 TB",batchDepth:30,utilizationRate:"86.67%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"7.73 TB",batchDepth:31,utilizationRate:"87.84%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"15.61 TB",batchDepth:32,utilizationRate:"88.74%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"31.43 TB",batchDepth:33,utilizationRate:"89.34%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"63.15 TB",batchDepth:34,utilizationRate:"89.74%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"126.71 TB",batchDepth:35,utilizationRate:"90.03%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"254.01 TB",batchDepth:36,utilizationRate:"90.24%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"508.85 TB",batchDepth:37,utilizationRate:"90.39%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.02 PB",batchDepth:38,utilizationRate:"90.47%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.04 PB",batchDepth:39,utilizationRate:"90.51%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.08 PB",batchDepth:40,utilizationRate:"90.64%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.17 PB",batchDepth:41,utilizationRate:"90.65%"}],[So.STRONG]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"36.73 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"5.47 MB",batchDepth:18,utilizationRate:"0.50%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"92.07 MB",batchDepth:19,utilizationRate:"4.18%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"564.95 MB",batchDepth:20,utilizationRate:"12.85%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.13 GB",batchDepth:21,utilizationRate:"24.86%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"6.35 GB",batchDepth:22,utilizationRate:"36.97%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"16.38 GB",batchDepth:23,utilizationRate:"47.67%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"38.66 GB",batchDepth:24,utilizationRate:"56.26%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"86.69 GB",batchDepth:25,utilizationRate:"63.07%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"187.31 GB",batchDepth:26,utilizationRate:"68.14%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"391.64 GB",batchDepth:27,utilizationRate:"71.24%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"816.39 GB",batchDepth:28,utilizationRate:"72.59%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.68 TB",batchDepth:29,utilizationRate:"76.34%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.43 TB",batchDepth:30,utilizationRate:"77.89%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"6.94 TB",batchDepth:31,utilizationRate:"78.86%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"14.02 TB",batchDepth:32,utilizationRate:"79.71%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"28.23 TB",batchDepth:33,utilizationRate:"80.23%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"56.72 TB",batchDepth:34,utilizationRate:"80.60%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"113.82 TB",batchDepth:35,utilizationRate:"80.88%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"228.18 TB",batchDepth:36,utilizationRate:"81.06%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"457.10 TB",batchDepth:37,utilizationRate:"81.20%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"915.26 TB",batchDepth:38,utilizationRate:"81.26%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.83 PB",batchDepth:39,utilizationRate:"81.30%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.67 PB",batchDepth:40,utilizationRate:"81.43%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"7.34 PB",batchDepth:41,utilizationRate:"81.45%"}],[So.INSANE]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"33.26 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"4.96 MB",batchDepth:18,utilizationRate:"0.45%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"83.38 MB",batchDepth:19,utilizationRate:"3.79%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"511.65 MB",batchDepth:20,utilizationRate:"11.64%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"1.93 GB",batchDepth:21,utilizationRate:"22.52%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"5.75 GB",batchDepth:22,utilizationRate:"33.50%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"14.84 GB",batchDepth:23,utilizationRate:"43.19%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"35.02 GB",batchDepth:24,utilizationRate:"50.96%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"78.51 GB",batchDepth:25,utilizationRate:"57.12%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"169.64 GB",batchDepth:26,utilizationRate:"61.71%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"354.69 GB",batchDepth:27,utilizationRate:"64.52%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"739.37 GB",batchDepth:28,utilizationRate:"65.74%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.52 TB",batchDepth:29,utilizationRate:"69.15%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.10 TB",batchDepth:30,utilizationRate:"70.56%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"6.29 TB",batchDepth:31,utilizationRate:"71.48%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"12.70 TB",batchDepth:32,utilizationRate:"72.18%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"25.57 TB",batchDepth:33,utilizationRate:"72.67%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"51.37 TB",batchDepth:34,utilizationRate:"73.00%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"103.08 TB",batchDepth:35,utilizationRate:"73.24%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"206.65 TB",batchDepth:36,utilizationRate:"73.42%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"413.98 TB",batchDepth:37,utilizationRate:"73.54%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"828.91 TB",batchDepth:38,utilizationRate:"73.59%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.66 PB",batchDepth:39,utilizationRate:"73.62%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.32 PB",batchDepth:40,utilizationRate:"73.72%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"6.64 PB",batchDepth:41,utilizationRate:"73.74%"}],[So.PARANOID]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"13.17 kB",batchDepth:17,utilizationRate:"0.00%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"1.96 MB",batchDepth:18,utilizationRate:"0.18%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"33.01 MB",batchDepth:19,utilizationRate:"1.50%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"202.53 MB",batchDepth:20,utilizationRate:"4.61%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"765.05 MB",batchDepth:21,utilizationRate:"8.68%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"2.28 GB",batchDepth:22,utilizationRate:"13.27%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"5.87 GB",batchDepth:23,utilizationRate:"17.08%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"13.86 GB",batchDepth:24,utilizationRate:"20.17%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"31.08 GB",batchDepth:25,utilizationRate:"22.61%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"67.15 GB",batchDepth:26,utilizationRate:"24.43%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"140.40 GB",batchDepth:27,utilizationRate:"25.54%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"292.67 GB",batchDepth:28,utilizationRate:"26.03%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"602.12 GB",batchDepth:29,utilizationRate:"27.35%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"1.23 TB",batchDepth:30,utilizationRate:"27.94%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"2.49 TB",batchDepth:31,utilizationRate:"28.32%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"5.03 TB",batchDepth:32,utilizationRate:"28.60%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"10.12 TB",batchDepth:33,utilizationRate:"28.77%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"20.34 TB",batchDepth:34,utilizationRate:"28.91%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"40.80 TB",batchDepth:35,utilizationRate:"29.00%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"81.80 TB",batchDepth:36,utilizationRate:"29.06%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"163.87 TB",batchDepth:37,utilizationRate:"29.11%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"328.11 TB",batchDepth:38,utilizationRate:"29.14%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"656.76 TB",batchDepth:39,utilizationRate:"29.16%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"1.31 PB",batchDepth:40,utilizationRate:"29.18%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"2.63 PB",batchDepth:41,utilizationRate:"29.19%"}]}};class _o{static ZERO=new _o(0);constructor(e){this.seconds=Math.ceil(e),e<0&&(this.seconds=0)}static fromMilliseconds(e){return new _o(e/1e3)}static fromSeconds(e){return new _o(e)}static fromHours(e){return new _o(60*e*60)}static fromDays(e){return new _o(24*e*60*60)}static fromWeeks(e){return new _o(7*e*24*60*60)}static fromYears(e){return new _o(365*e*24*60*60)}static fromEndDate(e,t){return new _o((e.getTime()-(t??new Date).getTime())/1e3)}static parseFromString(e){return _o.fromSeconds(i.AO.make(e)/1e3)}toSeconds(){return this.seconds}toHours(){return this.seconds/60/60}toDays(){return this.seconds/24/60/60}toWeeks(){return this.seconds/7/24/60/60}toYears(){return this.seconds/365/24/60/60}toEndDate(e){return new Date((e??new Date).getTime()+1e3*this.seconds)}represent(){return i.AO.secondsToHumanTime(this.seconds)}isZero(){return 0===this.seconds}}class Do{constructor(e){if(this.bytes=Math.ceil(e),e<0)throw Error("Size must be at least 0")}static fromBytes(e){return new Do(e)}static fromKilobytes(e){return new Do(1e3*e)}static fromMegabytes(e){return new Do(1e3*e*1e3)}static fromGigabytes(e){return new Do(1e3*e*1e3*1e3)}static parseFromString(e){return Do.fromBytes(i.FQ.makeStorage(e,1e3))}toBytes(){return this.bytes}toGigabytes(){return this.bytes/1e3/1e3/1e3}toFormattedString(){return i.FQ.convertBytes(this.bytes,1e3)}represent(){return this.toFormattedString()}}class Vo{static DIGITS=16;constructor(e){this.state=e}static fromDecimalString(e){return new Vo(i.ie.fromDecimalString(e,Vo.DIGITS))}static fromPLUR(e){return new Vo(new i.ie(e,Vo.DIGITS))}static fromFloat(e){return new Vo(i.ie.fromFloat(e,Vo.DIGITS))}toPLURString(){return this.state.toString()}toPLURBigInt(){return this.state.value}toDecimalString(){return this.state.toDecimalString()}toFloat(){return this.state.toFloat()}toSignificantDigits(e){return this.toDecimalString().slice(0,this.toDecimalString().indexOf(".")+e+1)}plus(e){return new Vo(this.state.add(e instanceof Vo?e.state:new i.ie(e,Vo.DIGITS)))}minus(e){return new Vo(this.state.subtract(e instanceof Vo?e.state:new i.ie(e,Vo.DIGITS)))}divide(e){return new Vo(this.state.divmod(e)[0])}gt(e){return 1===this.state.compare(e.state)}gte(e){return-1!==this.state.compare(e.state)}lt(e){return-1===this.state.compare(e.state)}lte(e){return 1!==this.state.compare(e.state)}eq(e){return 0===this.state.compare(e.state)}exchangeToDAI(e){return No.fromWei(this.state.exchange("*",new i.ie(e.toWeiBigInt(),No.DIGITS),No.DIGITS).value)}}class No{static DIGITS=18;constructor(e){this.state=e}static fromDecimalString(e){return new No(i.ie.fromDecimalString(e,No.DIGITS))}static fromWei(e){return new No(new i.ie(e,No.DIGITS))}static fromFloat(e){return new No(i.ie.fromFloat(e,No.DIGITS))}toWeiString(){return this.state.toString()}toWeiBigInt(){return this.state.value}toDecimalString(){return this.state.toDecimalString()}toSignificantDigits(e){return this.toDecimalString().slice(0,this.toDecimalString().indexOf(".")+e+1)}toFloat(){return this.state.toFloat()}plus(e){return new No(this.state.add(e instanceof No?e.state:new i.ie(e,No.DIGITS)))}minus(e){return new No(this.state.subtract(e instanceof No?e.state:new i.ie(e,No.DIGITS)))}divide(e){return new No(this.state.divmod(e)[0])}gt(e){return 1===this.state.compare(e.state)}gte(e){return-1!==this.state.compare(e.state)}lt(e){return-1===this.state.compare(e.state)}lte(e){return 1!==this.state.compare(e.state)}eq(e){return 0===this.state.compare(e.state)}exchangeToBZZ(e){return Vo.fromPLUR(this.state.exchange("/",new i.ie(e.toWeiBigInt(),No.DIGITS),Vo.DIGITS).value)}}var Co=n(320);function Po(e){if("function"==typeof File&&e instanceof File)return!0;const t=e;return"object"==typeof t&&"string"==typeof t.name&&("function"==typeof t.stream||"function"==typeof t.arrayBuffer)}function Fo(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...te(t)})}(Kr,e)}const Mo=ai().refine((e=>Mi().safeParse(e).success),"expected a function"),Uo=ai().transform((e=>(ii().safeParse(e).success&&(e=String(e)),Sr().regex(/^-?\d+$/,"expected integer string").parse(e)))),Lo=ai().transform((e=>(ii().safeParse(e).success&&(e=String(e)),Sr().regex(/^\d+$/,"expected non-negative integer string").parse(e)))),jo=di({baseURL:Sr().optional(),timeout:Qr().int().min(0).optional(),headers:Ti(Sr(),Sr()).optional(),onRequest:Mo.optional(),httpAgent:ci().optional(),httpsAgent:ci().optional(),endlesslyRetry:ni().optional(),signal:ai().optional()}),Go=di({redundancyStrategy:Qr().int().optional(),fallback:ni().optional(),timeoutMs:Qr().int().min(0).optional(),actPublisher:$i(ai().transform((e=>new to(e)))),actHistoryAddress:$i(ai().transform((e=>new io(e)))),actTimestamp:Fo().optional()}),Zo=di({act:ni().optional(),actHistoryAddress:$i(ai().transform((e=>new io(e)))),deferred:ni().optional(),encrypt:ni().optional(),pin:ni().optional(),tag:Qr().int().min(0).optional()}),qo=Zo.extend({redundancyLevel:Qr().int().min(0).optional()}),Ho=Zo.extend({size:Qr().int().min(0).optional(),contentType:Sr().optional(),redundancyLevel:Qr().int().min(0).optional()}),Jo=Zo.extend({errorDocument:Sr().optional(),indexDocument:Sr().optional(),redundancyLevel:Qr().int().min(0).optional()}),Wo=di({uid:Qr().int()}),Xo=Fo().min(0),Ko=di({onMessage:Mo,onError:Mo,onClose:Mo}),Qo=di({onMessage:Mo,onError:Mo,onClose:Mo}),Yo=di({gasPrice:Uo.optional(),immutableFlag:ni().optional(),label:Sr().optional(),waitForUsable:ni().optional(),waitForUsableTimeout:Qr().int().min(0).optional()}),ea=di({gasLimit:Lo.optional(),gasPrice:Lo.optional()}),ta=di({limit:Qr().int().min($o).max(ko).optional(),offset:Qr().int().min(0).optional()});function na(e){return void 0!==Co.Readable&&e instanceof Co.Readable}function ra(e,t){if("bigint"==typeof e&&(e=e.toString()),"string"!=typeof e||!/^-?\d+$/.test(e))throw new TypeError(`${t?.name??"value"} is not a valid integer string, got: ${e}`);if(void 0!==t?.min&&BigInt(e)<t.min)throw new RangeError(`${t?.name??"value"} must be >= ${t.min}, got: ${e}`);if(void 0!==t?.max&&BigInt(e)>t.max)throw new RangeError(`${t?.name??"value"} must be <= ${t.max}, got: ${e}`);return e}function ia(e){if("string"!=typeof e&&!(e instanceof Uint8Array))throw new TypeError("Data must be either string or Uint8Array!")}function oa(e){if(null==e)throw new TypeError(`Expected number | Tag | string from tagUid, got: ${e}`);if(t=e,Wo.safeParse(t).success)return e.uid;if("number"==typeof e||"string"==typeof e)return Xo.parse(e);var t;throw new TypeError(`Expected number | Tag | string from tagUid, got: ${e}`)}const aa=.9;function sa(e,t,n){return e/Math.pow(2,t-n)}function ca(e){return 4096*2**e}const ua=[[17,4089e-8],[18,.00609],[19,.10249],[20,.62891],[21,2.38],[22,7.07],[23,18.24],[24,43.04],[25,96.5],[26,208.52],[27,435.98],[28,908.81],[29,1870],[30,3810],[31,7730],[32,15610],[33,31430],[34,63150]];function la(e,t,n){if(e<17)return 0;if(void 0!==t&&void 0!==n){const r=Oo[t?"ENCRYPTION_ON":"ENCRYPTION_OFF"][n].find((t=>t.batchDepth===e));if(r?.effectiveVolume)return Wi(r.effectiveVolume)}else{const t=ua.find((([t,n])=>{if(e===t)return n}));if(t)return 1e3*t[1]*1e3*1e3}return Math.ceil(ca(e)*aa)}function fa(e,t){const n=new Map;for(let r=17;r<35;r++)n.set(r,la(r,e,t));return n}function ha(e,t){return Vo.fromPLUR(2n**BigInt(e)*BigInt(t))}function pa(e,t,n){const r=BigInt(ra(e));return _o.fromSeconds(Number(r*BigInt(n)/BigInt(t)))}function da(e,t,n){return BigInt(e.toSeconds())/BigInt(n)*BigInt(t)+1n}function ma(e,t,n){if(void 0!==t&&void 0!==n){const r=Oo[t?"ENCRYPTION_ON":"ENCRYPTION_OFF"][n].find((t=>e.toBytes()<=Wi(t.effectiveVolume)));if(r?.effectiveVolume)return r.batchDepth}else for(const[r,i]of ua)if(e.toBytes()<=1e3*i*1e3*1e3)return r;return 35}function ga(e){return function(e,t,n,r){if(65!==e.length)throw Error("invalid signature length");if(32!==t.length)throw Error("invalid batch ID length");if(8!==n.length)throw Error("invalid timestamp length");if(8!==r.length)throw Error("invalid index length");return new Ji(i.yI.concatBytes(t,r,n,e))}(e.signature,e.batchId.toUint8Array(),e.timestamp,e.index)}function ya(e,t,n){const r=function(e){return Number.isInteger(e)?e<1?1:e>3155695200?3155695200:e:1}(e.batchTTL),i=_o.fromSeconds(r),o=la(e.depth,t,n),a=e.utilizationRatio??sa(e.utilization,e.depth,e.bucketDepth);return{batchID:new co(e.batchID),utilization:e.utilization,usable:e.usable,label:e.label,depth:e.depth,amount:ra(e.amount),bucketDepth:e.bucketDepth,blockNumber:e.blockNumber,immutableFlag:e.immutableFlag,usage:a,usageText:`${Math.round(100*a)}%`,size:Do.fromBytes(o),remainingSize:Do.fromBytes(Math.ceil(o*(1-a))),theoreticalSize:Do.fromBytes(ca(e.depth)),duration:i,calculateSize(t,n){const r=la(e.depth,t,n);return Do.fromBytes(r)},calculateRemainingSize(t,n){const r=la(e.depth,t,n);return Do.fromBytes(Math.ceil(r*(1-this.usage)))}}}function wa(e){return{batchID:e.batchID.toHex(),utilization:e.utilization,utilizationRatio:e.usage,usable:e.usable,label:e.label,depth:e.depth,amount:e.amount,bucketDepth:e.bucketDepth,blockNumber:e.blockNumber,immutableFlag:e.immutableFlag,batchTTL:e.duration.toSeconds()}}function ba(e){return{name:function(e){if(!e)throw new po("missing content-disposition header");const t=e.match(/filename\*?=['"]?(?:UTF-\d['"]*)?([^;\r\n"']*)['"]?;?/i);if(t&&t.length>0)return t[1];throw new po("invalid content-disposition header")}(e["content-disposition"]),tagUid:function(e){if(!e)return;return parseInt(e,10)}(e["swarm-tag-uid"]),contentType:e["content-type"]||void 0}}function va(e,t){const n={};if(!function(e){if(!di({}).safeParse(e).success)return!1;const t=e;return void 0!==t.issuer&&void 0!==t.index&&void 0!==t.signature&&void 0!==t.timestamp&&void 0!==t.batchId}(e)?e&&(e=new co(e),n["swarm-postage-batch-id"]=e.toHex()):n["swarm-postage-stamp"]=ga(e).toHex(),!t)return n;const r=t;r.size&&(n["content-length"]=String(r.size)),r.contentType&&(n["content-type"]=String(r.contentType)),r.redundancyLevel&&(n["swarm-redundancy-level"]=String(r.redundancyLevel));const i=ni().safeParse(r.act);i.success&&(n["swarm-act"]=String(i.data));const o=ni().safeParse(r.pin);o.success&&(n["swarm-pin"]=String(o.data));const a=ni().safeParse(r.encrypt);a.success&&(n["swarm-encrypt"]=String(a.data)),r.tag&&(n["swarm-tag"]=String(r.tag));const s=ni().safeParse(r.deferred);s.success&&(n["swarm-deferred-upload"]=String(s.data)),r.redundancyStrategy&&(n["swarm-redundancy-strategy"]=String(r.redundancyStrategy));const c=ni().safeParse(r.fallback);return c.success&&(n["swarm-redundancy-fallback-mode"]=String(c.data)),r.timeoutMs&&(n["swarm-chunk-retrieval-timeout"]=String(r.timeoutMs)),r.indexDocument&&(n["swarm-index-document"]=String(r.indexDocument)),r.errorDocument&&(n["swarm-error-document"]=String(r.errorDocument)),r.actPublisher&&(n["swarm-act-publisher"]=new to(r.actPublisher).toCompressedHex()),r.actHistoryAddress&&(n["swarm-act-history-address"]=new io(r.actHistoryAddress).toHex()),r.actTimestamp&&(n["swarm-act-timestamp"]=String(r.actTimestamp)),(r.actPublisher||r.actHistoryAddress||r.actTimestamp)&&(n["swarm-act"]="true"),r.gasPrice&&(n["gas-price"]=String(r.gasPrice)),r.gasLimit&&(n["gas-limit"]=String(r.gasLimit)),n}const Ta=ji()("bee-js:http"),Ba={headers:{accept:"application/json, text/plain, */*"}};async function Ea(e,t){const n=i.Rb.deepMerge3(Ba,t,e);if(e.signal&&(n.signal=e.signal),function(e){if(void 0===e.data)return;const t=e.data;if(null!==t&&"object"==typeof t&&t.constructor===Object||Array.isArray(t))e.body=JSON.stringify(t),e.headers={"content-type":"application/json",...e.headers};else{e.body=t,e.duplex="half";const n=t instanceof Blob&&t.type?t.type:"application/octet-stream";e.headers={"content-type":n,...e.headers}}}(n),n.params)for(const i of Object.keys(n.params))void 0===n.params[i]&&delete n.params[i];const r=function(e){let t=i.DH.joinUrl([e.baseURL??"",e.url??""]);if(e.params){const n=new URLSearchParams(Object.entries(e.params).filter((([,e])=>void 0!==e)).map((([e,t])=>[e,String(t)]))).toString();n&&(t+=`?${n}`)}return t}(n),o=(n.method||"GET").toUpperCase();n.method=o,e.onRequest?.({method:o,url:i.DH.joinUrl([n.baseURL??"",n.url??""]),headers:{...n.headers},params:n.params});let a=0;for(;a<1e5;)try{Ta(`${o} ${r}`,{headers:n.headers,params:n.params});const e=await fetch(r,n);return e.ok||await za(o,r,e,n.responseType),xa(e,n.responseType)}catch(s){if(s instanceof go)throw s;const t=s;if("TimeoutError"!==t.name||!e.endlesslyRetry)throw Ra(t,o,r);a++,await i.iQ.sleepMillis(a<300?200:1e3)}throw Error("Max number of failed attempts reached")}async function za(e,t,n,r){const i=await xa(n,r).catch((()=>({data:void 0}))),o="string"==typeof i.data?i.data:JSON.stringify(i.data),a=o&&"undefined"!==o?`${n.statusText}: ${o}`:n.statusText;throw new go(e,t,a,i.data,n.status,n.statusText)}function Ra(e,t,n){if("AbortError"===e.name)return new go(t,n,"Request aborted",void 0,void 0,"ERR_CANCELED");const r=e.cause,i=r?.message?`${e.message}: ${r.message}`:e.message;return new go(t,n,i)}async function xa(e,t="json"){let n;switch(t){case"arraybuffer":n=await e.arrayBuffer();break;case"text":n=await e.text();break;case"blob":n=await e.blob();break;case"stream":n=e.body;break;default:{const t=await e.text();n=t?JSON.parse(t):null}}return{data:n,status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries()),raw:e}}const Ia="chunks";async function $a(e,t,n){t=new io(t);const r=await Ea(e,{responseType:"arraybuffer",url:`${Ia}/${t}`,headers:va(null,n)});return new Uint8Array(r.data)}const ka=ro.LENGTH,Sa=ro.LENGTH+uo.LENGTH,Aa=ro.LENGTH+uo.LENGTH+ao.LENGTH;function Oa(e,t){e=e instanceof Ji?e.toUint8Array():e,t=new io(t);const n=function(e){const t=wo(e.slice(Sa)),n=uo.fromSlice(e,ka),r=Ji.fromSlice(e,0,ro.LENGTH),o=i.yI.concatBytes(r.toUint8Array(),t.toUint8Array());return n.recoverPublicKey(o).address()}(e),r=Ji.fromSlice(e,0,ro.LENGTH),o=new io(i.yI.keccak256(i.yI.concatBytes(r.toUint8Array(),n.toUint8Array())));if(!i.yI.equals(t.toUint8Array(),o.toUint8Array()))throw new po("SOC data does not match given address!");return{data:e,identifier:r,signature:uo.fromSlice(e,ka),span:ao.fromSlice(e,Sa),payload:Ji.fromSlice(e,Aa),address:o,owner:n}}function _a(e,t){return new io(i.yI.keccak256(i.yI.concatBytes(e.toUint8Array(),t.toUint8Array())))}function Da(e,t,n,r,o){const a=_a(r=new ro(r),(o=new eo(o)).publicKey().address()),s=o.sign(i.yI.concatBytes(r.toUint8Array(),e.toUint8Array()));return{data:i.yI.concatBytes(r.toUint8Array(),s.toUint8Array(),t.toUint8Array(),n.toUint8Array()),identifier:r,signature:s,span:t,payload:n,address:a,owner:o.publicKey().address()}}async function Va(e,t,n,r){const o=i.yI.concatBytes(t.span.toUint8Array(),t.payload.toUint8Array());return async function(e,t,n,r,o,a,s){const c=await Ea(e,{method:"post",url:`soc/${t}/${n}`,data:o,headers:{"content-type":"application/octet-stream",...va(a,s)},responseType:"json",params:{sig:r.toHex()}});return{reference:bo.parse(c.data).reference,tagUid:c.headers["swarm-tag"]?oa(c.headers["swarm-tag"]):void 0,historyAddress:c.headers["swarm-act-history-address"]?i.Xx.of(new io(c.headers["swarm-act-history-address"])):i.Xx.empty()}}(e,t.owner,t.identifier,t.signature,o,n,r)}async function Na(e,t,n,r,i,o){t=new eo(t),r=new ro(r);return Va(e,Ua(i).toSingleOwnerChunk(r,t),n,o)}async function Ca(e,t,n){const r=_a(n=new ro(n),t=new no(t));return Oa(await $a(e,r.toHex()),r)}const Pa=1,Fa=4096;function Ma(e){return Ua((e=new Ji(e)).toUint8Array().slice(ao.LENGTH),ao.fromSlice(e.toUint8Array(),0))}function Ua(e,t){const n=Sr().safeParse(e);if(n.success&&(e=Ji.fromUtf8(n.data)),e.length<Pa||e.length>Fa)throw new RangeError(`payload size ${e.length} exceeds limits [${Pa}, ${Fa}]`);const r=t?"bigint"==typeof t?ao.fromBigInt(t):t:ao.fromBigInt(BigInt(e.length)),o=new Ji(e),a=i.yI.concatBytes(r.toUint8Array(),o.toUint8Array()),s=wo(a);return{data:a,span:r,payload:o,address:s,toSingleOwnerChunk:(e,t)=>Da(s,r,o,e,t)}}const La="bytes";async function ja(e,t,n,r){const o=await Ea(e,{url:La,method:"post",responseType:"json",data:t,headers:{"content-type":"application/octet-stream",...va(n,r)}});return{reference:bo.parse(o.data).reference,tagUid:o.headers["swarm-tag"]?oa(o.headers["swarm-tag"]):void 0,historyAddress:o.headers["swarm-act-history-address"]?i.Xx.of(new io(o.headers["swarm-act-history-address"])):i.Xx.empty()}}async function Ga(e,t,n){n&&(n=Go.parse(n));const r=await Ea(e,{responseType:"arraybuffer",url:`${La}/${t}`,headers:va(null,n)});return new Ji(r.data)}const Za="feeds";function qa(e){const t=e["swarm-feed-index"],n=e["swarm-feed-index-next"];if(!t)throw new po("Response did not contain expected swarm-feed-index!");if(!n)throw new po("Response did not contain expected swarm-feed-index-next!");return{feedIndex:new ho(t),feedIndexNext:new ho(n)}}async function Ha(e,t,n,r){const i=await Ea(e,{responseType:"arraybuffer",url:`${Za}/${t}/${n}`,params:{...r}});return{payload:new Ji(i.data),...qa(i.headers)}}class Ja{constructor(e){this.raw=e}toString(){const e=Sr().safeParse(this.raw);return e.success&&e.data.includes(".eth")?e.data:new io(this.raw).toHex()}}function Wa(e,t){return t="number"==typeof t?ho.fromBigInt(BigInt(t)):t,new ro(i.yI.keccak256(i.yI.concatBytes(e.toUint8Array(),t.toUint8Array())))}async function Xa(e,t,n){try{const r=await Ha(e,t,n);if(!r.feedIndexNext)throw Error("Feed index next is not defined. This should happen when fetching an exact index.");return r.feedIndexNext}catch(r){if(r instanceof go)return ho.fromBigInt(0n);throw r}}async function Ka(e,t,n,r,i,o){const a=Wa(n,o?.index??await Xa(e,t.publicKey().address(),n));if(r.length>4096){const n=await ja(e,r,i,o);return async function(e,t,n,r,i,o){return t=new eo(t),r=new ro(r),Va(e,i.toSingleOwnerChunk(r,t),n,o)}(e,t,i,a,Ma(await $a(e,n.reference)),o)}const s=Sr().safeParse(r);return Na(e,t,i,a,s.success?Ji.fromUtf8(s.data).toUint8Array():r,o)}function Qa(e,t,n){const r=Wa(t,n);return new io(i.yI.keccak256(i.yI.concatBytes(r.toUint8Array(),e.toUint8Array())))}async function Ya(e,t,n,r,o=!1){const a=Qa(t,n,r="number"==typeof r?ho.fromBigInt(BigInt(r)):r),s=Oa(await $a(e,a.toHex()),a);let c=i.Xx.empty();if(o){const e=Ji.fromSlice(s.payload.toUint8Array(),0,8);c=i.Xx.of(Number(i.yI.uint64ToNumber(e.toUint8Array(),"BE")))}return{timestamp:c,payload:new Ji(s.payload.offset(o?8:0))}}async function es(e,t,n,r){const i=Qa(t,n,r="number"==typeof r?ho.fromBigInt(BigInt(r)):r),o=Oa(await $a(e,i),i);return Ua(o.payload,o.span)}function ts(e,t,n){const r=async r=>{if(void 0===r?.index)return Ha(e,n,t);const i=await Ya(e,n,t,r.index,r.hasTimestamp??!0),o="number"==typeof r.index?ho.fromBigInt(BigInt(r.index)):r.index;return{payload:i.payload,feedIndex:o,feedIndexNext:o.next()}};return{download:r,downloadPayload:async r=>{if(void 0===r?.index)return Ha(e,n,t);const i=await es(e,n,t,r.index),o=i.span.toBigInt()<=4096n?i.payload:await Ga(e,new Ja(i.address)),a="number"==typeof r.index?ho.fromBigInt(BigInt(r.index)):r.index;return{payload:o,feedIndex:a,feedIndexNext:a.next()}},downloadReference:async i=>{let o=i?.index;void 0===o&&(o=(await async function(e,t,n){return qa((await Ea(e,{responseType:"arraybuffer",url:`${Za}/${t}/${n}`,params:{"Swarm-Only-Root-Chunk":!0}})).headers)}(e,n,t)).feedIndex);const a=await r({...i,index:o});return{reference:new io(a.payload.toUint8Array()),feedIndex:a.feedIndex,feedIndexNext:a.feedIndexNext??a.feedIndex.next()}},owner:n,topic:t}}function ns(e,t,n){const r=async(r,o,a)=>async function(e,t,n,r,o,a){r=new io(r);const s=Wa(n,a?.index??await Xa(e,t.publicKey().address(),n)),c=a?.at??Date.now()/1e3,u=i.yI.numberToUint64(BigInt(Math.floor(c)),"BE");return Na(e,t,o,s,i.yI.concatBytes(u,r.toUint8Array()),a)}(e,n,t,o,r,a);return{...ts(e,t,n.publicKey().address()),upload:r,uploadReference:r,uploadPayload:async(r,i,o)=>Ka(e,n,t,i,r,o)}}async function rs(e,t,n,r,o,a){const s=function(e,t,n){const r=n.toBigInt(),i=[];for(let o=0n;o<=r;o++)i.push(Qa(e,t,ho.fromBigInt(o)));return i}(t,n,r).map((async t=>async function(e,t,n,r){try{return await e.downloadChunk(t,n,r),!0}catch(o){const e=i.Rb.getDeep(o,"status");if(404===e||500===e)return!1;throw o}}(e,t,o,a)));return(await Promise.all(s)).every((e=>e))}function is(e){if(!function(e){return!!Array.isArray(e)&&e.every((e=>"object"==typeof e&&e.path&&void 0!==e.size))}(e))throw new mo("invalid collection",e)}function os(e){if(e.webkitRelativePath&&""!==e.webkitRelativePath)return e.webkitRelativePath.replace(/.*?\//i,"");if(e.name)return e.name;throw new TypeError("file is not valid File object")}function as(e){return Array.from(e).map((e=>({path:os(e),size:e.size,file:e})))}function ss(e){return Array.from(e).reduce(((e,t)=>e+t.size),0)}class cs{output=new Co.PassThrough;currentFileSize=0;beginFile(e,t){const{name:n,prefix:r,longLink:i}=function(e){if(e.length<=100)return{name:e,prefix:"",longLink:!1};for(let r=e.length-1;r>=0;r--)if("/"===e[r]){const t=e.substring(r+1),n=e.substring(0,r);if(t.length<=100&&n.length<=155)return{name:t,prefix:n,longLink:!1}}const t=e.lastIndexOf("/"),n=(t>=0?e.substring(t+1):e).slice(0,100);return{name:n,prefix:"",longLink:!0}}(e);if(i){const t=Buffer.from(e+"\0");this.output.write(function(e){const t=Buffer.alloc(512,0);t.write("././@LongLink",0,100),t.write("0000644\0",100,8),t.write("0000000\0",108,8),t.write("0000000\0",116,8),t.write(e.toString(8).padStart(11,"0")+"\0",124,12),t.write("00000000000\0",136,12),t.write(" ",148,8),t.write("L",156,1),t.write("ustar\0\0",257,8);let n=0;for(let r=0;r<512;r++)n+=t[r];return t.write(n.toString(8).padStart(6,"0")+"\0 ",148,8),t}(t.length)),this.output.write(t);const n=t.length%512==0?0:512-t.length%512;n>0&&this.output.write(Buffer.alloc(n,0))}const o=function(e,t,n){const r=Buffer.alloc(512,0);r.write(e.slice(0,100).padEnd(100,"\0"),0,100),r.write("0000777\0",100,8),r.write("0001750\0",108,8),r.write("0001750\0",116,8),r.write(n.toString(8).padStart(11,"0")+"\0",124,12);const i=Math.floor((new Date).getTime()/1e3);r.write(i.toString(8).padStart(11,"0")+"\0",136,12),r.write(" ",148,8),r.write("0",156,1),r.write("ustar\0\0",257,8),t&&r.write(t.slice(0,155).padEnd(155,"\0"),345,155);let o=0;for(let a=0;a<512;a++)o+=r[a];return r.write(o.toString(8).padStart(6,"0")+"\0 ",148,8),r}(n,r,t);this.output.write(o),this.currentFileSize=0}async appendFile(e){return new Promise((t=>{this.output.write(e)?t():this.output.once("drain",(()=>{t()})),this.currentFileSize+=e.length}))}async endFile(){const e=this.currentFileSize%512==0?0:512-this.currentFileSize%512;e>0&&this.output.write(Buffer.alloc(e,0))}async end(){return new Promise((e=>{this.output.write(Buffer.alloc(1024,0)),this.output.end((()=>{e()}))}))}}var us=n(497),ls=n.n(us);async function fs(e,t,n,r){const i=new cs,o=Ea(e,{method:"post",url:"bzz",data:i.output,responseType:"json",headers:{"content-type":"application/x-tar","swarm-collection":"true",...va(n,r)}});await async function(e,t){for(const n of e)if(t.beginFile(n.path,n.size),n.fsPath){const e=(0,us.createReadStream)(n.fsPath);for await(const n of e)await t.appendFile(n);await t.endFile(),e.close()}else{if(!n.file)throw new Error("Invalid collection item");await t.appendFile(new Uint8Array(await n.file.arrayBuffer())),await t.endFile()}}(t,i),await i.end();return await o}const hs="bzz";async function ps(e,t,n,r,o){na(t)&&!o?.contentType&&(o||(o={}),o.contentType="application/octet-stream");const a=await Ea(e,{method:"post",url:hs,data:t,headers:va(n,o),params:{name:r},responseType:"json"});return{reference:bo.parse(a.data).reference,tagUid:a.headers["swarm-tag"]?oa(a.headers["swarm-tag"]):void 0,historyAddress:a.headers["swarm-act-history-address"]?i.Xx.of(new io(a.headers["swarm-act-history-address"])):i.Xx.empty()}}async function ds(e,t,n,r){is(t);const o=await fs(e,t,n,r);return{reference:bo.parse(o.data).reference,tagUid:o.headers["swarm-tag"]?oa(o.headers["swarm-tag"]):void 0,historyAddress:o.headers["swarm-act-history-address"]?i.Xx.of(new io(o.headers["swarm-act-history-address"])):i.Xx.empty()}}const ms=di({peer:Sr(),balance:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"balance"}))))}),gs=di({balances:hi(ms)}),ys=ms,ws="balances",bs="consumed";const vs=di({beneficiary:Sr().transform((e=>new no(e))),chequebook:Sr().transform((e=>new no(e))),payout:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"payout"}))))}),Ts=di({recipient:Sr(),lastPayout:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"lastPayout"})))),bounced:ni()}),Bs=di({chequebookAddress:Sr().transform((e=>new no(e)))}),Es=di({availableBalance:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"availableBalance"})))),totalBalance:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"totalBalance"}))))}),zs=di({peer:Sr(),uncashedAmount:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"uncashedAmount"})))),transactionHash:Sr().nullish().transform((e=>e??null)),lastCashedCheque:vs.nullish().transform((e=>e??null)),result:Ts.nullish().transform((e=>e??null))}),Rs=di({peer:Sr(),lastreceived:vs.nullish().transform((e=>e??null)),lastsent:vs.nullish().transform((e=>e??null))}),xs=di({lastcheques:hi(di({peer:Sr(),lastreceived:vs.nullish().transform((e=>e??null)),lastsent:vs.nullish().transform((e=>e??null))}))}),Is=di({transactionHash:Sr().transform((e=>new oo(e)))}),$s="chequebook";const ks=di({address:Sr(),fullNode:ni()}),Ss=di({population:Qr(),connected:Qr(),connectedPeers:hi(di({address:Sr()})).nullish().transform((e=>e??[])),disconnectedPeers:hi(di({address:Sr()})).nullish().transform((e=>e??[]))}),As=Ti(Sr(),Ss),Os=di({overlay:Sr().transform((e=>new so(e))),underlay:hi(Sr()),ethereum:Sr().transform((e=>new no(e))),publicKey:Sr().transform((e=>new to(e))),pssPublicKey:Sr().transform((e=>new to(e)))}),_s=di({peers:hi(ks)}),Ds=di({peers:hi(ks)}),Vs=di({baseAddr:Sr(),population:Qr(),connected:Qr(),timestamp:Sr(),nnLowWatermark:Qr(),depth:Qr(),reachability:Sr(),networkAvailability:Sr(),bins:As});const Ns=di({peer:Sr(),sent:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"sent"})))),received:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"received"}))))}),Cs=Ns,Ps=di({totalSent:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"totalSent"})))),totalReceived:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"totalReceived"})))),settlements:hi(Ns)}),Fs="settlements";const Ms=di({stakedAmount:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"stakedAmount"}))))}),Us=di({withdrawableAmount:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"withdrawableAmount"}))))}),Ls=di({txHash:Sr().transform((e=>new oo(e)))}),js=di({minimumGasFunds:Sr().transform((e=>No.fromWei(ra(e,{name:"minimumGasFunds"})))),hasSufficientFunds:ni(),isFrozen:ni(),isFullySynced:ni(),phase:Sr(),round:Qr(),lastWonRound:Qr(),lastPlayedRound:Qr(),lastFrozenRound:Qr(),lastSelectedRound:Qr(),lastSampleDurationSeconds:Qr(),block:Qr(),reward:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"reward"})))),fees:Sr().transform((e=>No.fromWei(ra(e,{name:"fees"})))),isHealthy:ni()}),Gs="stake";const Zs=di({batchID:Sr(),utilization:Qr(),utilizationRatio:Qr().optional(),usable:ni(),label:Sr(),depth:Qr(),amount:Sr(),bucketDepth:Qr(),blockNumber:Qr(),immutableFlag:ni(),batchTTL:Qr()}),qs=di({batchID:Sr().transform((e=>new co(e))),batchTTL:Qr(),bucketDepth:Qr(),depth:Qr(),immutable:ni(),owner:Sr().transform((e=>new no(e))),start:Qr(),value:Sr().transform((e=>ra(e,{name:"value"})))}),Hs=di({batches:hi(qs)}),Js=di({stamps:hi(Zs)}),Ws=Zs,Xs=di({depth:Qr(),bucketDepth:Qr(),bucketUpperBound:Qr(),buckets:hi(di({bucketID:Qr(),collisions:Qr()}))}),Ks=di({batchID:Sr().transform((e=>new co(e)))}),Qs="stamps",Ys="batches";async function ec(e){const t=await Ea(e,{method:"get",url:`${Ys}`,responseType:"json"});return Hs.parse(t.data).batches}async function tc(e){const t=await Ea(e,{method:"get",url:`${Qs}`,responseType:"json"});return Js.parse(t.data).stamps.map((e=>ya(e)))}const nc=di({commitment:Qr(),radius:Qr(),storageRadius:Qr(),reserveCapacityDoubling:Qr()}),rc=di({block:Qr(),chainTip:Qr(),totalAmount:Sr().transform((e=>ra(e,{name:"totalAmount"}))),currentPrice:Sr().transform(Number).transform((e=>{return t=e,Number.isInteger(t)?t<24e3?24e3:t:24e3;var t})),minimumValidityBlocks:Qr().optional()}),ic=di({bzzBalance:Sr().transform((e=>Vo.fromPLUR(ra(e,{name:"bzzBalance"})))),nativeTokenBalance:Sr().transform((e=>No.fromWei(ra(e,{name:"nativeTokenBalance"})))),chainID:Qr(),chequebookContractAddress:Sr(),walletAddress:Sr()}),oc=di({transactionHash:Sr().transform((e=>new oo(e)))}),ac="wallet";var sc=n(359),cc=n.n(sc);const uc=di({overlay:Sr(),proximity:Qr(),beeMode:Sr().transform(To),reserveSize:Qr(),reserveSizeWithinRadius:Qr(),pullsyncRate:Qr(),storageRadius:Qr(),connectedPeers:Qr(),neighborhoodSize:Qr(),batchCommitment:Qr(),isReachable:ni(),lastSyncedBlock:Qr(),committedDepth:Qr(),isWarmingUp:ni()}),lc=di({apiVersion:Sr(),version:Sr(),status:(fc="ok",new zi({type:"literal",values:Array.isArray(fc)?fc:[fc],...te(hc)}))});var fc,hc;const pc=di({apiVersion:Sr(),version:Sr(),status:Ei(["ready","notReady"])}),dc=di({beeMode:Sr().transform(To),chequebookEnabled:ni(),swapEnabled:ni()}),mc=di({gateway:ni()}),gc="2.8.1-7cf53193",yc=gc.split("-")[0],wc="8.1.0";async function bc(e){const t=await Ea(e,{method:"get",url:"health",responseType:"json"});return lc.parse(t.data)}const vc=di({transactionHash:Sr().transform((e=>new oo(e))),to:Sr(),nonce:Qr(),gasPrice:Sr().transform((e=>ra(e,{name:"gasPrice"}))),gasLimit:Qr(),data:Sr(),created:Sr(),description:Sr(),value:Sr().transform((e=>ra(e,{name:"value"})))}),Tc=di({pendingTransactions:hi(vc)}),Bc=vc,Ec=di({transactionHash:Sr().transform((e=>new oo(e)))}),zc="transactions";const Rc=di({issuer:Sr().transform((e=>i.yI.hexToUint8Array(e))),index:Sr().transform((e=>i.yI.hexToUint8Array(e))),timestamp:Sr().transform((e=>i.yI.hexToUint8Array(e))),signature:Sr().transform((e=>i.yI.hexToUint8Array(e)))});const xc=hi(Sr().transform((e=>new to(e)))),Ic=di({ref:Sr().transform((e=>new io(e))),historyref:Sr().transform((e=>new io(e)))}),$c="grantee";var kc=n(666),Sc=n.n(kc);const Ac="gsoc";const Oc=di({references:hi(Sr()).nullable()}),_c="pins";const Dc="pss";async function Vc(e,t,n,r,i,o){await Ea(e,{method:"post",url:`${Dc}/send/${t}/${n}`,data:r,responseType:"json",params:{recipient:o},headers:va(i)})}const Nc=di({durationSeconds:Qr()});async function Cc(e){await Ea(e,{url:"",responseType:"text"})}const Pc=di({isRetrievable:ni()}),Fc="stewardship";const Mc=di({address:Sr().nullish().transform((e=>e??"")),seen:Qr(),sent:Qr(),split:Qr(),startedAt:Sr(),stored:Qr(),synced:Qr(),uid:Qr()}),Uc=di({tags:hi(Mc)}),Lc="tags";const jc=ji()("bee-js:manifest"),Gc=new TextEncoder,Zc=new TextDecoder,qc=new Uint8Array([47]),Hc=i.yI.hexToUint8Array("5768b3b6a7db56d21d1abff40d41cebfc83448fed8d7e9b06ec0d3b073f28f7b");class Jc{constructor(e,t){this.prefix=e,this.node=t}static split(e,t){const n=i.yI.commonPrefix(e.prefix,t.prefix);if(n.length===e.prefix.length){const r=t.prefix.slice(n.length);return t.node.path=t.prefix.slice(n.length),t.prefix=t.prefix.slice(n.length),t.node.parent=e.node,e.node.forks.set(r[0],t),e}if(n.length===t.prefix.length){const r=e.prefix.slice(n.length);return e.node.path=e.prefix.slice(n.length),e.prefix=e.prefix.slice(n.length),e.node.parent=t.node,t.node.forks.set(r[0],e),t}const r=new Wc({path:n}),o=new Jc(e.prefix.slice(n.length),e.node),a=new Jc(t.prefix.slice(n.length),t.node);return e.node.path=e.prefix.slice(n.length),t.node.path=t.prefix.slice(n.length),e.prefix=e.prefix.slice(n.length),t.prefix=t.prefix.slice(n.length),r.forks.set(o.prefix[0],o),r.forks.set(a.prefix[0],a),o.node.parent=r,a.node.parent=r,new Jc(n,r)}marshal(){if(!this.node.selfAddress)throw Error("Fork#marshal node.selfAddress is not set");const e=[];if(e.push(new Uint8Array([this.node.determineType()])),e.push(i.yI.numberToUint8(this.prefix.length)),e.push(this.prefix),this.prefix.length<30&&e.push(new Uint8Array(30-this.prefix.length)),e.push(this.node.selfAddress),jc("marshalling fork",{prefixLength:this.prefix.length,prefix:Zc.decode(this.prefix),address:i.yI.uint8ArrayToHex(this.node.selfAddress)}),this.node.metadata){const t=i.yI.padEndToMultiple(new Uint8Array([0,0,...Gc.encode(JSON.stringify(this.node.metadata))]),32,10),n=i.yI.numberToUint16(t.length-2,"BE");t.set(n,0),e.push(t)}return i.yI.concatBytes(...e)}static unmarshal(e,t){const n=i.yI.uint8ToNumber(e.read(1)),r=i.yI.uint8ToNumber(e.read(1)),o=e.read(r);r<30&&e.read(30-r);const a=e.read(t);let s;if(jc("unmarshalling fork",{type:n,prefixLength:r,prefix:Zc.decode(o),addressLength:t,address:i.yI.uint8ArrayToHex(a)}),function(e,t){return(e&t)===t}(n,16)){const t=i.yI.uint16ToNumber(e.read(2),"BE");s=JSON.parse(Zc.decode(e.read(t)))}return new Jc(o,new Wc({selfAddress:a,metadata:s,path:o}))}}class Wc{obfuscationKey=new Uint8Array(32);selfAddress=null;targetAddress=new Uint8Array(32);metadata=null;path=new Uint8Array(0);forks=new Map;parent=null;constructor(e){e?.targetAddress&&(this.targetAddress=e.targetAddress),e?.selfAddress&&(this.selfAddress=e.selfAddress),e?.metadata&&(this.metadata=e.metadata),e?.obfuscationKey&&(this.obfuscationKey=e.obfuscationKey),e?.path&&(this.path=e.path),e?.parent&&(this.parent=e.parent)}get fullPath(){return i.yI.concatBytes(this.parent?.fullPath??new Uint8Array(0),this.path)}get fullPathString(){return Zc.decode(this.fullPath)}getRootMetadata(){const e=this.find("/");return e&&e.metadata?i.Xx.of(e.metadata):i.Xx.empty()}getDocsMetadata(){const e=this.find("/");return e&&e.metadata?{indexDocument:e.metadata["website-index-document"]??null,errorDocument:e.metadata["website-error-document"]??null}:{indexDocument:null,errorDocument:null}}async resolveFeed(e,t){const n=this.find("/");if(!n||!n.metadata)return i.Xx.empty();const r=n.metadata["swarm-feed-owner"],o=n.metadata["swarm-feed-topic"];return r&&o?i.Xx.of(await e.fetchLatestFeedUpdate(o,r,t)):i.Xx.empty()}async marshal(){for(const i of this.forks.values())i.node.selfAddress||(i.node.selfAddress=(await i.node.calculateSelfAddress()).toUint8Array());const e=new Uint8Array(32);e.set(Hc,0),e.set(i.yI.equals(this.targetAddress,fu)&&i.yI.equals(this.path,new Uint8Array([47]))?i.yI.numberToUint8(0):i.yI.numberToUint8(this.targetAddress.length),31);const t=new Uint8Array(32);for(const o of this.forks.keys())i.yI.setBit(t,o,1,"LE");const n=[];for(let o=0;o<256;o++)i.yI.getBit(t,o,"LE")&&n.push(this.forks.get(o).marshal());const r=i.yI.xorCypher(i.yI.concatBytes(e,i.yI.equals(this.targetAddress,fu)&&i.yI.equals(this.path,new Uint8Array([47]))?new Uint8Array(0):this.targetAddress,t,...n),this.obfuscationKey);return i.yI.concatBytes(this.obfuscationKey,r)}static async unmarshal(e,t,n,r){t=new io(t);const i=(await e.downloadData(t,n,r)).toUint8Array();return this.unmarshalFromData(i,t.toUint8Array())}static unmarshalFromData(e,t){const n=e.subarray(0,32),r=i.yI.xorCypher(e.subarray(32),n),o=new i.pp(r),a=o.read(31);if(!i.yI.equals(a,Hc.slice(0,31)))throw new Error("MantarayNode#unmarshal invalid version hash");const s=i.yI.uint8ToNumber(o.read(1)),c=s?o.read(s):fu,u=new Wc({selfAddress:t,targetAddress:c,obfuscationKey:n}),l=o.read(32);for(let f=0;f<256;f++)if(i.yI.getBit(l,f,"LE")){const e=Jc.unmarshal(o,t.length);u.forks.set(f,e),e.node.parent=u}return u}addFork(e,t,n){this.selfAddress=null,e=e instanceof Uint8Array?e:Gc.encode(e),jc("adding fork",{path:Zc.decode(e),reference:new io(t).represent()});let r=this;for(;e.length;){const i=e.slice(0,30),o=0===(e=e.slice(30)).length,[a,s]=r.findClosest(i),c=i.slice(s.length);if(s.length&&(r=a),!c.length)continue;const u=new Jc(c,new Wc({targetAddress:o?new io(t).toUint8Array():void 0,metadata:o?n:void 0,path:c})),l=a.forks.get(c[0]);if(l){const e=Jc.split(u,l);r.forks.set(c[0],e),e.node.parent=r,r.selfAddress=null,r=u.node}else r.forks.set(c[0],u),u.node.parent=r,r.selfAddress=null,r=u.node}}removeFork(e){if(this.selfAddress=null,0===(e=e instanceof Uint8Array?e:Gc.encode(e)).length)throw Error("MantarayNode#removeFork [path] parameter cannot be empty");const t=this.find(e);if(!t)throw Error("MantarayNode#removeFork fork not found");const[n,r]=this.findClosest(e.slice(0,e.length-1));n.forks.delete(e.slice(r.length)[0]);for(const o of t.forks.values())n.addFork(i.yI.concatBytes(t.path,o.prefix),o.node.targetAddress,o.node.metadata)}async calculateSelfAddress(){return this.selfAddress?new io(this.selfAddress):new io((await i.vU.root(await this.marshal())).hash())}async saveRecursively(e,t,n,r){for(const o of this.forks.values()){const i=await o.node.saveRecursively(e,t,n,r);if(n?.act){let e;i.historyAddress.ifPresent((t=>e=t)),e&&(o.node.metadata||(o.node.metadata={}),o.node.metadata["swarm-act-history-address"]=e.toHex())}}const i=await e.uploadData(t,await this.marshal(),n,r);return this.selfAddress=i.reference.toUint8Array(),i}async loadRecursively(e,t,n){for(const r of this.forks.values()){if(!r.node.selfAddress)throw Error("MantarayNode#loadRecursively fork.node.selfAddress is not set");let i=t;r.node.metadata&&r.node.metadata["swarm-act-history-address"]&&(i={...t,actHistoryAddress:r.node.metadata["swarm-act-history-address"]});const o=await Wc.unmarshal(e,r.node.selfAddress,i,n);r.node.targetAddress=o.targetAddress,r.node.forks=o.forks,r.node.path=r.prefix,r.node.parent=this,await r.node.loadRecursively(e,t,n)}}find(e){const[t,n]=this.findClosest(e);return n.length===e.length?t:null}findClosest(e,t=new Uint8Array){if(0===(e=e instanceof Uint8Array?e:Gc.encode(e)).length)return[this,t];const n=this.forks.get(e[0]);return n&&i.yI.commonPrefix(n.prefix,e).length===n.prefix.length?n.node.findClosest(e.slice(n.prefix.length),i.yI.concatBytes(t,n.prefix)):[this,t]}collect(e=[]){for(const t of this.forks.values())i.yI.equals(t.node.targetAddress,fu)||e.push(t.node),t.node.collect(e);return e}collectAndMap(){const e=this.collect(),t={};for(const n of e)t[n.fullPathString]=new io(n.targetAddress).toHex();return t}determineType(){let e=0;return i.yI.equals(this.targetAddress,fu)&&!i.yI.equals(this.path,qc)||(e|=2),this.forks.size>0&&(e|=4),-1===i.yI.indexOf(this.path,qc)||i.yI.equals(this.path,qc)||(e|=8),this.metadata&&(e|=16),e}}var Xc=n(61),Kc=n.n(Xc);async function Qc(e){if("string"!=typeof e)throw new TypeError("dir has to be string!");if(""===e)throw new TypeError("dir must not be empty string!");return Yc(e,"")}async function Yc(e,t){const n=Kc().join(e,t),r=await ls().promises.opendir(n);let i=[];for await(const o of r){const n=Kc().join(e,t,o.name),r=Kc().join(t,o.name);o.isFile()?i.push({path:r,size:(await ls().promises.stat(n)).size,fsPath:n}):o.isDirectory()&&(i=[...await Yc(e,r),...i])}return i}async function eu(e){if("string"!=typeof e)throw new TypeError("dir has to be string!");if(""===e)throw new TypeError("dir must not be empty string!");const t=await ls().promises.opendir(e);let n=0;for await(const r of t)if(r.isFile()){n+=(await ls().promises.stat(Kc().join(e,r.name))).size}else r.isDirectory()&&(n+=await eu(Kc().join(e,r.name)));return n}const tu={aac:"audio/aac",abw:"application/x-abiword",ai:"application/postscript",arc:"application/octet-stream",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",dll:"application/octet-stream",dmg:"application/x-apple-diskimage",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/x-icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"application/javascript",json:"application/json",mid:"audio/midi",midi:"audio/midi",mp2:"audio/mpeg",mp3:"audio/mpeg",mp4:"video/mp4",mpa:"video/mpeg",mpe:"video/mpeg",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",otf:"font/otf",png:"image/png",pdf:"application/pdf",ppt:"application/vnd.ms-powerpoint",rar:"application/x-rar-compressed",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"application/typescript",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/x-wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.ms-excel",xml:"application/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3gp2":"video/3gpp2","7z":"application/x-7z-compressed"};function nu(e){return["text/html","text/css"].includes(e)?`${e}; charset=utf-8`:e}async function ru(e){if("string"==typeof e)return(new TextEncoder).encode(e);if(e instanceof Buffer)return new Uint8Array(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(t=e,Array.isArray(t)&&t.length>0&&t.every((e=>e instanceof Buffer)))return new Uint8Array(Buffer.concat(e));var t;throw new TypeError("unknown websocket data type")}const iu=["1","7","9","11","13","15","17","19","20","21","22","23","25","37","42","43","53","69","77","79","87","95","101","102","103","104","109","110","111","113","115","117","119","123","135","137","139","143","161","179","389","427","465","512","513","514","515","526","530","531","532","540","548","554","556","563","587","601","636","989","990","993","995","1719","1720","1723","2049","3659","4045","4190","5060","5061","6000","6566","6665","6666","6667","6668","6669","6679","6697","10080"];function ou(e){if(!function(e){try{if("string"!=typeof e)return!1;const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch(t){return!1}}(e))throw new mo("URL is not valid!",e);const t=new URL(e).port;if(t&&!function(e){if("string"!=typeof e)return!1;if(iu.includes(e))return!1;const t=parseInt(e,10);return t>0&&t<65536&&!isNaN(t)}(t))throw new mo("Port in URL is considered bad port and cannot be used!",t)}class au{constructor(e,t){ou(e),this.url=function(e){return e.endsWith("/")?e.slice(0,-1):e}(e),t?.signer&&(this.signer=new eo(t.signer)),this.network=t?.network??"gnosis",this.requestOptions={baseURL:this.url,timeout:t?.timeout??0,headers:t?.headers,onRequest:t?.onRequest,httpAgent:t?.httpAgent,httpsAgent:t?.httpsAgent}}async uploadData(e,t,n,r){return e=new co(e),ia(t),n&&(n=qo.parse(n)),ja(this.getRequestOptionsForCall(r),t,e,n)}async probeData(e,t){return e=new io(e),async function(e,t){t=new io(t);const n=await Ea(e,{url:`${La}/${t}`,method:"head",responseType:"json"});return{contentLength:parseInt(n.headers["content-length"])}}(this.getRequestOptionsForCall(t),e)}async downloadData(e,t,n){return t&&(t=Go.parse(t)),Ga(this.getRequestOptionsForCall(n),new Ja(e),t)}async downloadReadableData(e,t,n){return t&&(t=Go.parse(t)),async function(e,t,n){return n&&(n=Go.parse(n)),(await Ea(e,{responseType:"stream",url:`${La}/${t}`,headers:va(null,n)})).data}(this.getRequestOptionsForCall(n),new Ja(e),t)}async uploadChunk(e,t,n,r){const o="identifier"in t&&"signature"in t&&"owner"in t;if(t=t instanceof Uint8Array?t:t.data,n&&(n=Zo.parse(n)),t.length<ao.LENGTH)throw new mo(`Chunk has to have size of at least ${ao.LENGTH}.`,t);if(!o&&t.length>zo+ao.LENGTH)throw new mo(`Content Addressed Chunk must not exceed ${zo+ao.LENGTH} bytes.`,t);if(o&&t.length>zo+ao.LENGTH+uo.LENGTH+ro.LENGTH)throw new mo(`Single Owner Chunk must not exceed ${zo+ao.LENGTH+uo.LENGTH+ro.LENGTH} bytes.`,t);return async function(e,t,n,r){const o=await Ea(e,{method:"post",url:`${Ia}`,data:t,headers:{"content-type":"application/octet-stream",...va(n,r)},responseType:"json"});return{reference:bo.parse(o.data).reference,tagUid:o.headers["swarm-tag"]?oa(o.headers["swarm-tag"]):void 0,historyAddress:o.headers["swarm-act-history-address"]?i.Xx.of(new io(o.headers["swarm-act-history-address"])):i.Xx.empty()}}(this.getRequestOptionsForCall(r),t,e,n)}async downloadChunk(e,t,n){return e=new io(e),t&&(t=Go.parse(t)),$a(this.getRequestOptionsForCall(n),e,t)}async createGrantees(e,t,n){return e=new co(e),t=t.map((e=>new to(e))),async function(e,t,n){const r=await Ea(e,{method:"post",url:$c,data:{grantees:n.map((e=>e.toCompressedHex()))},headers:va(t),responseType:"json"}),i=Ic.parse(r.data);return{status:r.status,statusText:r.statusText,ref:i.ref,historyref:i.historyref}}(this.getRequestOptionsForCall(n),e,t)}async getGrantees(e,t){return async function(e,t){const n=await Ea(t,{method:"get",url:`${$c}/${e}`,responseType:"json"});return{status:n.status,statusText:n.statusText,grantees:xc.parse(n.data)}}(e=new io(e),this.getRequestOptionsForCall(t))}async patchGrantees(e,t,n,r,i){return async function(e,t,n,r,i){const o=await Ea(i,{method:"patch",url:`${$c}/${t}`,data:{add:r.add?.map((e=>e.toCompressedHex())),revoke:r.revoke?.map((e=>e.toCompressedHex()))},headers:{...va(e),"swarm-act-history-address":n.toHex()},responseType:"json"}),a=Ic.parse(o.data);return{status:o.status,statusText:o.statusText,ref:a.ref,historyref:a.historyref}}(e=new co(e),t=new io(t),n=new io(n),{add:r.add?.map((e=>new to(e)))??[],revoke:r.revoke?.map((e=>new to(e)))??[]},this.getRequestOptionsForCall(i))}async uploadFile(e,t,n,r,i){if(e=new co(e),function(e){if(!("string"==typeof e||e instanceof Uint8Array||Po(e)||na(e)))throw new TypeError("Data must be either string, Readable, Uint8Array or File!")}(t),r&&(r=Ho.parse(r)),n&&"string"!=typeof n)throw new TypeError("name has to be string or undefined!");if(Po(t)){const o=await async function(e){return e.arrayBuffer?e.arrayBuffer():new Promise((t=>{const n=new FileReader;n.onload=()=>t(n.result),n.readAsArrayBuffer(e)}))}(t),a=n??t.name,s=t.type,c={...r,contentType:s};return ps(this.getRequestOptionsForCall(i),o,e,a,c)}return ps(this.getRequestOptionsForCall(i),t,e,n,r)}async downloadFile(e,t="",n,r){return n&&(n=Go.parse(n)),async function(e,t,n="",r){const i=await Ea(e,{method:"GET",responseType:"arraybuffer",url:`${hs}/${t}/${n}`,headers:va(null,r)});return{...ba(i.headers),data:new Ji(i.data)}}(this.getRequestOptionsForCall(r),new Ja(e),t,n)}async downloadReadableFile(e,t="",n,r){return e=new io(e),n&&(n=Go.parse(n)),async function(e,t,n="",r){t=new io(t);const i=await Ea(e,{method:"GET",responseType:"stream",url:`${hs}/${t}/${n}`,headers:va(null,r)});return{...ba(i.headers),data:i.data}}(this.getRequestOptionsForCall(r),e,t,n)}async uploadFiles(e,t,n,r){e=new co(e),n&&(n=Jo.parse(n));const i=as(t);return ds(this.getRequestOptionsForCall(r),i,e,n)}async hashDirectory(e){return async function(e){const t=await Qc(e),n=new Wc;for(const r of t){const e=new i.vU(i.vU.NOOP);if(!r.fsPath)throw Error("File does not have fsPath, which should never happen in node. Please report this issue.");const t=(0,us.createReadStream)(r.fsPath);for await(const n of t)await e.append(n);const o=await e.finalize(),{filename:a,extension:s}=i.DH.parseFilename(r.path);n.addFork(r.path,o.hash(),{"Content-Type":nu(tu[s.toLowerCase()]||"application/octet-stream"),Filename:a})}return n.calculateSelfAddress()}(e)}async streamDirectory(e,t,n,r,o){return async function(e,t,n,r,o,a){const s=new i.O3(64,64);let c=0,u=0;n=new co(n);const l=await Qc(t);for(const i of l)c+=(f=i.size,function e(t){return t<=1?t:t+e(Math.ceil(t/128))}(Math.ceil(f/4096)));var f;let h=!1;async function p(t){await s.enqueue((async()=>{await e.uploadChunk(n,t.build(),o,a),r?.({total:c,processed:++u})}))}const d=new Wc;for(const m of l){if(!m.fsPath)throw Error("File does not have fsPath, which should never happen in node. Please report this issue.");const e=(0,us.createReadStream)(m.fsPath),t=new i.vU(p);for await(const i of e)await t.append(i);const n=await t.finalize();await s.drain();const{filename:r,extension:o}=i.DH.parseFilename(m.path);d.addFork(m.path,n.hash(),{"Content-Type":nu(tu[o.toLowerCase()]||"application/octet-stream"),Filename:r}),"index.html"===m.path&&(h=!0)}if(h||o?.indexDocument||o?.errorDocument){const e={};o?.indexDocument?e["website-index-document"]=o.indexDocument:h&&(e["website-index-document"]="index.html"),o?.errorDocument&&(e["website-error-document"]=o.errorDocument),d.addFork("/",fu,e)}return d.saveRecursively(e,n,o,a)}(this,t,e=new co(e),n,r,this.getRequestOptionsForCall(o))}async streamFiles(e,t,n,r,i){return e=new co(e),async function(){throw new Error("Streaming files is not supported in Node.js")}(0,0,0,0,0,this.getRequestOptionsForCall(i))}async uploadCollection(e,t,n,r){return e=new co(e),is(t),n&&(n=Jo.parse(n)),ds(this.getRequestOptionsForCall(r),t,e,n)}async uploadFilesFromDirectory(e,t,n,r){e=new co(e),n&&(n=Jo.parse(n));const i=await Qc(t);return ds(this.getRequestOptionsForCall(r),i,e,n)}async createTag(e){return async function(e){const t=await Ea(e,{method:"post",url:Lc,responseType:"json"});return Mc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getAllTags(e,t){return e&&(e=ta.parse(e)),async function(e,t,n){const r=await Ea(e,{url:Lc,params:{offset:t,limit:n},responseType:"json"});return Uc.parse(r.data).tags}(this.getRequestOptionsForCall(t),e?.offset,e?.limit)}async retrieveTag(e,t){return e=oa(e),async function(e,t){const n=await Ea(e,{url:`${Lc}/${t}`,responseType:"json"});return Mc.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async deleteTag(e,t){return e=oa(e),async function(e,t){await Ea(e,{method:"delete",url:`${Lc}/${t}`})}(this.getRequestOptionsForCall(t),e)}async updateTag(e,t,n){return t=new io(t),e=oa(e),async function(e,t,n){await Ea(e,{method:"patch",url:`${Lc}/${t}`,data:{reference:n}})}(this.getRequestOptionsForCall(n),e,t)}async pin(e,t){return e=new io(e),async function(e,t){await Ea(e,{method:"post",responseType:"json",url:`${_c}/${t}`})}(this.getRequestOptionsForCall(t),e)}async unpin(e,t){return e=new io(e),async function(e,t){await Ea(e,{method:"delete",responseType:"json",url:`${_c}/${t}`})}(this.getRequestOptionsForCall(t),e)}async getAllPins(e){return async function(e){const t=await Ea(e,{method:"get",responseType:"json",url:`${_c}`}),{references:n}=Oc.parse(t.data);return(n??[]).map((e=>new io(e)))}(this.getRequestOptionsForCall(e))}async getPin(e,t){return e=new io(e),async function(e,t){const n=await Ea(e,{method:"get",responseType:"json",url:`${_c}/${t}`});return bo.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async reuploadPinnedData(e,t,n){e=new co(e),t=new io(t),await async function(e,t,n){await Ea(e,{method:"put",url:`${Fc}/${n}`,headers:{"swarm-postage-batch-id":t.toHex()}})}(this.getRequestOptionsForCall(n),e,t)}async isReferenceRetrievable(e,t){return e=new io(e),async function(e,t){t=new io(t);const n=await Ea(e,{method:"get",responseType:"json",url:`${Fc}/${t}`});return Pc.parse(n.data).isRetrievable}(this.getRequestOptionsForCall(t),e)}async isFeedRetrievable(e,t,n,r,o){if(e=new no(e),t=new lo(t),r&&(r=Go.parse(r)),!n)try{return await this.makeFeedReader(t,e,o).download(),!0}catch(a){const e=i.Rb.getDeep(a,"status");if(404===e||500===e)return!1;throw a}return rs(this,e,t,n,r,this.getRequestOptionsForCall(o))}async pssSend(e,t,n,r,i,o){return e=new co(e),ia(r),i?(i=new to(i),Vc(this.getRequestOptionsForCall(o),t,n,r,e,i)):Vc(this.getRequestOptionsForCall(o),t,n,r,e)}pssSubscribe(e,t){t=Ko.parse(t);const n=function(e,t,n){const r=e.replace(/^http/i,"ws");return"browser"===i.iQ.whereAmI()?new(Sc())(`${r}/${Dc}/subscribe/${t.toHex()}`):new(Sc())(`${r}/${Dc}/subscribe/${t.toHex()}`,{headers:n})}(this.url,e,this.requestOptions.headers);let r=!1;const o={topic:e,cancel:()=>{r||(r=!0,n.terminate?n.terminate():n.close())}};return n.onmessage=async e=>{const n=await ru(e.data);n.length&&t.onMessage(new Ji(n),o)},n.onerror=e=>{r||t.onError(new po(e.message),o)},n.onclose=()=>{t.onClose(o)},o}async pssReceive(e,t=0){if("number"!=typeof t)throw new TypeError("timeoutMsc parameter has to be a number!");return new Promise(((n,r)=>{let i;const o=this.pssSubscribe(e,{onError:e=>{clearTimeout(i),o.cancel(),r(e.message)},onMessage:e=>{clearTimeout(i),o.cancel(),n(e)},onClose:()=>{clearTimeout(i),o.cancel()}});t>0&&(i=setTimeout((()=>{o.cancel(),r(new po("pssReceive timeout"))}),t))}))}gsocMine(e,t,n=12){e=new so(e),t=new ro(t);for(let r=0n;r<0xffffn;r++){const o=new eo(i.yI.numberToUint256(2867n+r,"BE")),a=_a(t,o.publicKey().address());if(256-i.yI.proximity(a.toUint8Array(),e.toUint8Array())<=256-n)return o}throw Error("Could not mine a valid signer")}async gsocSend(e,t,n,r,i,o){e=new co(e),t=new eo(t),n=new ro(n);const a=Ua(r).toSingleOwnerChunk(n,t);return async function(e,t,n,r){return Va(e,t,n,r)}(this.getRequestOptionsForCall(o),a,e,i)}gsocSubscribe(e,t,n){e=new no(e),t=new ro(t),n=Qo.parse(n);const r=_a(t,e),o=function(e,t,n){const r=e.replace(/^http/i,"ws");return"browser"===i.iQ.whereAmI()?new(Sc())(`${r}/${Ac}/subscribe/${t.toHex()}`):new(Sc())(`${r}/${Ac}/subscribe/${t.toHex()}`,{headers:n})}(this.url,r,this.requestOptions.headers);let a=!1;const s={address:e,cancel:()=>{a||(a=!0,o.terminate?o.terminate():o.close())}};return o.onmessage=async e=>{const t=await ru(e.data);t.length&&n.onMessage(new Ji(t),s)},o.onerror=e=>{a||n.onError(new po(e.message),s)},o.onclose=()=>{n.onClose(s)},s}async createFeedManifest(e,t,n,r,i){return e=new co(e),t=new lo(t),n=new no(n),r&&(r=Zo.parse(r)),async function(e,t,n,r,i){const o=await Ea(e,{method:"post",responseType:"json",url:`${Za}/${t}/${n}`,headers:va(r,i)});return bo.parse(o.data).reference}(this.getRequestOptionsForCall(i),n,t,e,r)}makeFeedReader(e,t,n){return e=new lo(e),t=new no(t),ts(this.getRequestOptionsForCall(n),e,t)}makeFeedWriter(e,t,n){if(e=new lo(e),!(t=t?new eo(t):this.signer))throw Error("No signer provided");return ns(this.getRequestOptionsForCall(n),e,t)}async fetchLatestFeedUpdate(e,t,n){return e=new lo(e),t=new no(t),Ha(this.getRequestOptionsForCall(n),t,e)}makeContentAddressedChunk(e,t){return Ua(e,t)}unmarshalContentAddressedChunk(e){return Ma(e)}makeSingleOwnerChunk(e,t,n,r,i){return Da(e,t,n,r,i)}calculateSingleOwnerChunkAddress(e,t){return _a(e,t)}unmarshalSingleOwnerChunk(e,t){return Oa(e,t)}makeSOCReader(e,t){return{owner:e=new no(e),download:Ca.bind(null,this.getRequestOptionsForCall(t),e)}}makeSOCWriter(e,t){if(!(e=e?new eo(e):this.signer))throw Error("No signer provided");return{...this.makeSOCReader(e.publicKey().address(),t),upload:Na.bind(null,this.getRequestOptionsForCall(t),e)}}async createEnvelope(e,t,n){return e=new co(e),t=new io(t),async function(e,t,n){const r=await Ea(e,{method:"post",responseType:"json",url:`envelope/${n}`,headers:{"swarm-postage-batch-id":t.toHex()}}),i=Rc.parse(r.data);return{issuer:i.issuer,index:i.index,timestamp:i.timestamp,signature:i.signature,batchId:t}}(this.getRequestOptionsForCall(n),e,t)}async rchash(e,t,n,r){return async function(e,t,n,r){const i=await Ea(e,{responseType:"json",url:`rchash/${t}/${n}/${r}`});return Nc.parse(i.data).durationSeconds}(this.getRequestOptionsForCall(r),e,t,n)}async checkConnection(e){return Cc(this.getRequestOptionsForCall(e))}async isConnected(e){try{await Cc(this.getRequestOptionsForCall(e))}catch(t){return!1}return!0}async isGateway(e){return async function(e){try{const t=await Ea(e,{url:"/gateway"});return mc.parse(t.data).gateway}catch(t){return!1}}(this.getRequestOptionsForCall(e))}async getNodeAddresses(e){return async function(e){const t=await Ea(e,{url:"addresses",responseType:"json"});return Os.parse(t.data)}(this.getRequestOptionsForCall(e))}async getBlocklist(e){return async function(e){const t=await Ea(e,{url:"blocklist",responseType:"json"});return Ds.parse(t.data).peers}(this.getRequestOptionsForCall(e))}async getPeers(e){return async function(e){const t=await Ea(e,{url:"peers",responseType:"json"});return _s.parse(t.data).peers}(this.getRequestOptionsForCall(e))}async removePeer(e,t){return e=new so(e),async function(e,t){return(await Ea(e,{url:`peers/${t}`,responseType:"json",method:"DELETE"})).data}(this.getRequestOptionsForCall(t),e)}async getTopology(e){return async function(e){const t=await Ea(e,{url:"topology",responseType:"json"});return Vs.parse(t.data)}(this.getRequestOptionsForCall(e))}async pingPeer(e,t){return e=new so(e),async function(e,t){return(await Ea(e,{url:`pingpong/${t}`,responseType:"json",method:"POST"})).data}(this.getRequestOptionsForCall(t),e)}async getAllBalances(e){return async function(e){const t=await Ea(e,{url:ws,responseType:"json"});return gs.parse(t.data)}(this.getRequestOptionsForCall(e))}async getPeerBalance(e,t){return e=new so(e),async function(e,t){const n=await Ea(e,{url:`${ws}/${t}`,responseType:"json"});return ys.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getPastDueConsumptionBalances(e){return async function(e){const t=await Ea(e,{url:bs,responseType:"json"});return gs.parse(t.data)}(this.getRequestOptionsForCall(e))}async getPastDueConsumptionPeerBalance(e,t){return e=new so(e),async function(e,t){const n=await Ea(e,{url:`${bs}/${t}`,responseType:"json"});return ys.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getChequebookAddress(e){return async function(e){const t=await Ea(e,{url:$s+"/address",responseType:"json"});return Bs.parse(t.data)}(this.getRequestOptionsForCall(e))}async getChequebookBalance(e){return async function(e){const t=await Ea(e,{url:$s+"/balance",responseType:"json"});return Es.parse(t.data)}(this.getRequestOptionsForCall(e))}async getLastCheques(e){return async function(e){const t=await Ea(e,{url:$s+"/cheque",responseType:"json"});return xs.parse(t.data)}(this.getRequestOptionsForCall(e))}async getLastChequesForPeer(e,t){return e=new so(e),async function(e,t){const n=await Ea(e,{url:$s+`/cheque/${t}`,responseType:"json"});return Rs.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getLastCashoutAction(e,t){return e=new so(e),async function(e,t){const n=await Ea(e,{url:$s+`/cashout/${t}`,responseType:"json"});return zs.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async cashoutLastCheque(e,t,n){return e=new so(e),t&&(t=ea.parse(t)),async function(e,t,n){const r=await Ea(e,{method:"post",url:$s+`/cashout/${t}`,responseType:"json",headers:va(null,n)});return Is.parse(r.data).transactionHash}(this.getRequestOptionsForCall(n),e,t)}async depositTokens(e,t,n){return this.depositBZZToChequebook(e,t,n)}async depositBZZToChequebook(e,t,n){const r=e instanceof Vo?e.toPLURString():ra(e,{min:1n,name:"amount"});let i;return t&&(i=ra(e,{min:0n,name:"gasPrice"})),async function(e,t,n){const r={};n&&(r["gas-price"]=n.toString());const i=await Ea(e,{method:"post",url:$s+"/deposit",responseType:"json",params:{amount:t.toString(10)},headers:r});return Is.parse(i.data).transactionHash}(this.getRequestOptionsForCall(n),r,i)}async withdrawTokens(e,t,n){return this.withdrawBZZFromChequebook(e,t,n)}async withdrawBZZFromChequebook(e,t,n){const r=e instanceof Vo?e.toPLURString():ra(e,{min:1n,name:"amount"});let i;return t&&(i=ra(e,{min:0n,name:"gasPrice"})),async function(e,t,n){const r={};n&&(r["gas-price"]=n.toString());const i=await Ea(e,{method:"post",url:$s+"/withdraw",responseType:"json",params:{amount:t.toString(10)},headers:r});return Is.parse(i.data).transactionHash}(this.getRequestOptionsForCall(n),r,i)}async withdrawBZZToExternalWallet(e,t,n){return e=e instanceof Vo?e:Vo.fromPLUR(e),t=new no(t),async function(e,t,n){const r=await Ea(e,{method:"post",url:`${ac}/withdraw/bzz`,responseType:"json",params:{amount:t.toPLURString(),address:n.toHex()}});return oc.parse(r.data).transactionHash}(this.getRequestOptionsForCall(n),e,t)}async withdrawDAIToExternalWallet(e,t,n){return e=e instanceof No?e:No.fromWei(e),t=new no(t),async function(e,t,n){const r=await Ea(e,{method:"post",url:`${ac}/withdraw/nativetoken`,responseType:"json",params:{amount:t.toWeiString(),address:n.toHex()}});return oc.parse(r.data).transactionHash}(this.getRequestOptionsForCall(n),e,t)}async getSettlements(e,t){return e=new so(e),async function(e,t){const n=await Ea(e,{url:`${Fs}/${t}`,responseType:"json"});return Cs.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getAllSettlements(e){return async function(e){const t=await Ea(e,{url:Fs,responseType:"json"});return Ps.parse(t.data)}(this.getRequestOptionsForCall(e))}async getStatus(e){return async function(e){const t=await Ea(e,{method:"get",url:"status",responseType:"json"});return uc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getHealth(e){return bc(this.getRequestOptionsForCall(e))}async getReadiness(e){return async function(e){const t=await Ea(e,{method:"get",url:"readiness"});return pc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getNodeInfo(e){return async function(e){const t=await Ea(e,{method:"get",url:"node",responseType:"json"});return dc.parse(t.data)}(this.getRequestOptionsForCall(e))}async isSupportedExactVersion(e){return async function(e){const{version:t}=await bc(e);return t===gc}(this.getRequestOptionsForCall(e))}async isSupportedApiVersion(e){return async function(e){const{apiVersion:t}=await bc(e);return cc()(t)===cc()(wc)}(this.getRequestOptionsForCall(e))}async getVersions(e){return async function(e){const{version:t,apiVersion:n}=await bc(e);return{supportedBeeVersion:gc,supportedBeeApiVersion:wc,beeVersion:t,beeApiVersion:n}}(this.getRequestOptionsForCall(e))}async getReserveState(e){return async function(e){const t=await Ea(e,{method:"get",url:"reservestate",responseType:"json"});return nc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getChainState(e){return async function(e){const t=await Ea(e,{method:"get",url:"chainstate",responseType:"json"});return rc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getWalletBalance(e){return async function(e){const t=await Ea(e,{method:"get",url:`${ac}`,responseType:"json"});return ic.parse(t.data)}(this.getRequestOptionsForCall(e))}async createPostageBatch(e,t,n,r){const i=ra(e,{min:0n,name:"amount"});if(n&&(n=Yo.parse(n)),t<xo||t>Io)throw new mo(`Depth has to be between ${xo}..${Io}`,t);const o=await this.getChainState(),a=17280n*BigInt(o.currentPrice)+1n;if(BigInt(i)<a)throw new mo(`Amount has to be at least ${a} (1 day at current price ${o.currentPrice})`,i);const s=await async function(e,t,n,r){const i={};r?.gasPrice&&(i["gas-price"]=r.gasPrice.toString()),void 0!==r?.immutableFlag&&(i.immutable=String(r.immutableFlag));const o=await Ea(e,{method:"post",url:`${Qs}/${t}/${n}`,responseType:"json",params:{label:r?.label},headers:i});return Ks.parse(o.data).batchID}(this.getRequestOptionsForCall(r),i,t,n);return!1!==n?.waitForUsable&&await this.waitForUsablePostageStamp(s,n?.waitForUsableTimeout),s}async buyStorage(e,t,n,r,i,o){const a=da(t,(await this.getChainState(r)).currentPrice,"gnosis"===this.network?5:15),s=ma(e,i,o);return n&&(n=Yo.parse(n)),this.createPostageBatch(a,s,n,r)}async getStorageCost(e,t,n,r,i){const o=da(t,(await this.getChainState(n)).currentPrice,"gnosis"===this.network?5:15);return ha(ma(e,r,i),o)}async extendStorage(e,t,n,r,i,o){const a=await this.getPostageBatch(e,r),s=ma(t,i,o),c=await this.getChainState(r),u=s-a.depth,l=u<=0?1n:2n**BigInt(u),f="gnosis"===this.network?5:15,h=da(n,c.currentPrice,f),p=da(a.duration,c.currentPrice,f),d=(n.isZero()?p*l:(p+h)*l)-p;let m;if(d>0n&&(m=await this.topUpBatch(a.batchID,d,r)),u>0)return this.diluteBatch(a.batchID,s,r);if(!m)throw new Error("Nothing to extend, both size and duration are already sufficient");return m}async extendStorageSize(e,t,n,r,i){const o=await this.getChainState(n),a=await this.getPostageBatch(e,n),s=ma(t,r,i),c=s-a.depth;if(c<=0)throw new mo("New depth has to be greater than the original depth",s);const u=da(a.duration,o.currentPrice,"gnosis"===this.network?5:15);return await this.topUpBatch(a.batchID,u*(2n**BigInt(c)-1n)+1n,n),this.diluteBatch(a.batchID,s,n)}async extendStorageDuration(e,t,n){const r=await this.getPostageBatch(e,n),i=da(t,(await this.getChainState(n)).currentPrice,"gnosis"===this.network?5:15);return this.topUpBatch(r.batchID,i,n)}async getExtensionCost(e,t,n,r,i,o){const a=await this.getPostageBatch(e,r),s=await this.getChainState(r),c="gnosis"===this.network?5:15,u=n.isZero()?0n:da(n,s.currentPrice,c),l=ma(t,i,o),f=da(a.duration,s.currentPrice,c),h=ha(a.depth,f);return ha(Math.max(a.depth,l),f+u).minus(h)}async getSizeExtensionCost(e,t,n,r,i){const o=await this.getPostageBatch(e,n),a=await this.getChainState(n),s=ma(t,r,i);if(s-o.depth<=0)throw new mo("New depth has to be greater than the original depth",s);const c=da(o.duration,a.currentPrice,"gnosis"===this.network?5:15),u=ha(o.depth,c);return ha(s,c).minus(u)}async getDurationExtensionCost(e,t,n){const r=await this.getPostageBatch(e,n),i=da(t,(await this.getChainState(n)).currentPrice,"gnosis"===this.network?5:15);return ha(r.depth,i)}async updatePostageBatchLabel(e,t,n){return e=new co(e),async function(e,t,n){await Ea(e,{method:"patch",url:`${Qs}/${t}`,responseType:"json",data:{label:n}})}(this.getRequestOptionsForCall(n),e,t)}async renameStorage(e,t,n){return this.updatePostageBatchLabel(e,t,n)}async calculateTopUpForBzz(e,t,n){const r=await this.getChainState(n),i="gnosis"===this.network?5:15,o=t.toPLURBigInt()/2n**BigInt(e);return{amount:o,duration:pa(o,r.currentPrice,i)}}async topUpBatch(e,t,n){e=new co(e);const r=ra(t,{min:1n,name:"amount"});return async function(e,t,n){const r=await Ea(e,{method:"patch",url:`${Qs}/topup/${t}/${n}`,responseType:"json"});return Ks.parse(r.data).batchID}(this.getRequestOptionsForCall(n),e,r)}async diluteBatch(e,t,n){return e=new co(e),t=Qr().int().min(18).max(255).parse(t),async function(e,t,n){const r=await Ea(e,{method:"patch",url:`${Qs}/dilute/${t}/${n}`,responseType:"json"});return Ks.parse(r.data).batchID}(this.getRequestOptionsForCall(n),e,t)}async getPostageBatch(e,t,n,r){return e=new co(e),async function(e,t,n,r){const i=await Ea(e,{method:"get",url:`${Qs}/${t}`,responseType:"json"});return ya(Ws.parse(i.data),n,r)}(this.getRequestOptionsForCall(t),e,n,r)}async getGlobalPostageBatch(e,t){return e=new co(e),async function(e,t){const n=await Ea(e,{method:"get",url:`${Ys}/${t}`,responseType:"json"});return qs.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getPostageBatchBuckets(e,t){return e=new co(e),async function(e,t){const n=await Ea(e,{method:"get",url:`${Qs}/${t}/buckets`,responseType:"json"});return Xs.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getAllPostageBatch(e){return tc(this.getRequestOptionsForCall(e))}async getAllGlobalPostageBatch(e){return ec(this.getRequestOptionsForCall(e))}async getPostageBatches(e){return tc(this.getRequestOptionsForCall(e))}async getGlobalPostageBatches(e){return ec(this.getRequestOptionsForCall(e))}async getAllPendingTransactions(e){return async function(e){const t=await Ea(e,{url:zc,responseType:"json"});return Tc.parse(t.data).pendingTransactions}(this.getRequestOptionsForCall(e))}async getPendingTransaction(e,t){return e=new oo(e),async function(e,t){const n=await Ea(e,{url:`${zc}/${t}`,responseType:"json"});return Bc.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async rebroadcastPendingTransaction(e,t){return e=new oo(e),async function(e,t){const n=await Ea(e,{method:"post",url:`${zc}/${t}`,responseType:"json"});return Ec.parse(n.data).transactionHash}(this.getRequestOptionsForCall(t),e)}async cancelPendingTransaction(e,t,n){let r;return e=new oo(e),t&&(r=ra(t,{min:0n,name:"gasPrice"})),async function(e,t,n){const r={};n&&(r["gas-price"]=n.toString());const i=await Ea(e,{method:"delete",headers:r,url:`${zc}/${t}`,responseType:"json"});return Ec.parse(i.data).transactionHash}(this.getRequestOptionsForCall(n),e,r)}async getStake(e){return async function(e){const t=await Ea(e,{method:"get",responseType:"json",url:`${Gs}`});return Ms.parse(t.data).stakedAmount}(this.getRequestOptionsForCall(e))}async getWithdrawableStake(e){return async function(e){const t=await Ea(e,{method:"get",responseType:"json",url:`${Gs}/withdrawable`});return Us.parse(t.data).withdrawableAmount}(this.getRequestOptionsForCall(e))}async withdrawSurplusStake(e){return async function(e){const t=await Ea(e,{method:"delete",responseType:"json",url:`${Gs}/withdrawable`});return Ls.parse(t.data).txHash}(this.getRequestOptionsForCall(e))}async migrateStake(e){return async function(e){const t=await Ea(e,{method:"delete",responseType:"json",url:Gs});return Ls.parse(t.data).txHash}(this.getRequestOptionsForCall(e))}async depositStake(e,t,n){const r=e instanceof Vo?e.toPLURString():ra(e,{min:1n,name:"amount"});return t&&(t=ea.parse(t)),async function(e,t,n){const r=await Ea(e,{method:"post",responseType:"json",url:`${Gs}/${t}`,headers:va(null,n)});return Ls.parse(r.data).txHash}(this.getRequestOptionsForCall(n),r,t)}async getRedistributionState(e){return async function(e){const t=await Ea(e,{method:"get",responseType:"json",url:"redistributionstate"});return js.parse(t.data)}(this.getRequestOptionsForCall(e))}async waitForUsablePostageStamp(e,t=24e4){for(let r=0;r<t;r+=3e3){try{if((await this.getPostageBatch(e)).usable)return}catch(n){}await i.iQ.sleepMillis(3e3)}throw new po("Timeout on waiting for postage stamp to become usable")}getRequestOptionsForCall(e){return e&&(e=jo.parse(e)),e?i.Rb.deepMerge2(this.requestOptions,e):this.requestOptions}}class su{constructor(e,t,n,r){this.signer=new eo(e),this.batchId=new co(t),this.buckets=n,this.depth=r,this.maxSlot=2**(this.depth-16)}static fromBlank(e,t,n){return new su(e,t,new Uint32Array(65536),n)}static fromState(e,t,n,r){return new su(e,t,n,r)}stamp(e){const t=e.hash(),n=i.yI.uint16ToNumber(t,"BE"),r=this.buckets[n];if(r>=this.maxSlot)throw Error("Bucket is full");this.buckets[n]++;const o=i.yI.concatBytes(i.yI.numberToUint32(n,"BE"),i.yI.numberToUint32(r,"BE")),a=1000000n*BigInt(Date.now()),s=i.yI.numberToUint64(a,"BE"),c=this.signer.sign(i.yI.concatBytes(t,this.batchId.toUint8Array(),o,s));return{batchId:this.batchId,index:o,issuer:this.signer.publicKey().address().toUint8Array(),signature:c.toUint8Array(),timestamp:s}}getState(){return this.buckets}}const cu="https://api.gateway.ethswarm.org",uu=new co("0000000000000000000000000000000000000000000000000000000000000000"),lu=new lo("0000000000000000000000000000000000000000000000000000000000000000"),fu=new Uint8Array(32),hu=new Uint8Array(32),pu=new Uint8Array(20);function du(e){return(e=new so(e)).toHex().slice(0,Ro)}const mu=[[94,68,46,28,14,5,1],[9,8,7,6,5,4,3]],gu=[[47,34,23,14,7,2],[9,8,7,6,5,4]],yu=[[104,95,86,77,69,61,53,46,39,32,26,20,15,10,6,3,1],[21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5]],wu=[[52,47,43,38,34,30,26,23,19,16,13,10,7,5,3,1],[21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6]],bu=[[92,87,82,77,73,68,63,59,54,50,45,41,37,33,29,26,22,19,16,13,10,8,5,3,2,1],[31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6]],vu=[[46,43,41,38,36,34,31,29,27,25,22,20,18,16,14,13,11,9,8,6,5,4,2,1],[31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,7]],Tu=[[37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1],[90,88,87,85,84,82,81,79,77,76,74,72,71,69,67,66,64,62,60,59,57,55,53,51,49,48,46,44,41,39,37,35,32,30,27,24,20]],Bu=[[18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1],[88,85,82,79,76,72,69,66,62,59,55,51,48,44,39,35,30,24]];function Eu(e,t,n){if(t===So.OFF)return 0;const r=function(e,t){switch(e){case So.MEDIUM:return t?gu:mu;case So.STRONG:return t?wu:yu;case So.INSANE:return t?vu:bu;case So.PARANOID:return t?Bu:Tu;default:throw new Error(`Unknown redundancy level ${e}`)}}(t,n),[i,o]=r;for(let a=0;a<i.length;a++)if(e>=i[a])return o[a]/i[a];return o[o.length-1]/i[i.length-1]}const zu={label:"medium",value:So.MEDIUM,errorTolerance:.01},Ru={label:"strong",value:So.STRONG,errorTolerance:.05},xu={label:"insane",value:So.INSANE,errorTolerance:.1},Iu={label:"paranoid",value:So.PARANOID,errorTolerance:.5};function $u(){return{medium:zu,strong:Ru,insane:xu,paranoid:Iu}}function ku(e){if("string"==typeof e)switch(e.toLowerCase()){case"medium":return zu;case"strong":return Ru;case"insane":return xu;case"paranoid":return Iu;default:throw new Error(`Unknown redundancy level '${e}'`)}switch(e){case So.MEDIUM:return zu;case So.STRONG:return Ru;case So.INSANE:return xu;case So.PARANOID:return Iu;default:throw new Error(`Unknown redundancy level '${e}'`)}}})(),r})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BeeJs=t():e.BeeJs=t()}(this,(()=>(()=>{var e={20(e,t){"use strict";var n;async function r(e){return new Promise(((t,n)=>e.then(n,t)))}async function i(e){return new Promise((t=>setTimeout((()=>{t(!0)}),e)))}function o(e,t=Math.random){for(let n=e.length-1;n>0;n--){const r=Math.floor(t()*(n+1)),i=e[n];e[n]=e[r],e[r]=i}return e}function s(e,t,n=Math.random){return o(H(0,e.length-1),n).slice(0,t)}function a(e,t,n=Math.random){return Math.floor(n()*(t-e+1))+e}function c(e,t,n){return t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height}function u(e,t=Math.random){return t()<e}function l(e,t=Math.random){return e[Math.floor(e.length*t())]}function f(e){if(!e.length)throw Error("Received empty array");return e[e.length-1]}function h(e,t,n){return n(t.reduce(((e,t)=>t(e)),e))}function p(e,t){if(null==e)return null;const n=t.split(".");let r=e;for(const i of n){if(null===r[i]||void 0===r[i])return null;r=r[i]}return r}function d(e,t,n){const r=t.split(/\.|\[/);let i=e;for(let o=0;o<r.length;o++){const e=r[o],t=o<r.length-1&&r[o+1].includes("]"),s=e.includes("]")?e.replace(/\[|\]/g,""):e;if(o===r.length-1)return i[s]=n,n;g(i[s])||(i[s]=t?[]:{}),i=i[s]}return n}function m(e,t){return Math.round(e/t)*t}function g(e,t=!0){return!(!e||t&&!b(e._readableState)||t&&e.constructor&&(e.constructor.isBuffer||"AbortController"==e.constructor.name||"AbortSignal"==e.constructor.name||"Uint8Array"==e.constructor.name||"ArrayBuffer"===e.constructor.name||"ReadableStream"===e.constructor.name))&&"object"==typeof e}function y(e){return g(e)&&!Array.isArray(e)}function w(e){return Array.isArray(e)&&0===e.length}function b(e){return void 0===e}function v(e){return"[object Function]"===Object.prototype.toString.call(e)||"[object AsyncFunction]"===Object.prototype.toString.call(e)}function T(e){return"[object String]"===Object.prototype.toString.call(e)}function B(e){return"number"==typeof e&&isFinite(e)}function E(e){return!0===e||!1===e}function z(e){return"[object Date]"===Object.prototype.toString.call(e)}function R(e){return!T(e)||0===e.trim().length}function x(e){return B(e)&&Number.isInteger(e)&&e>=1}function I(e){return T(e)&&null!==e.match(/^-?\d+$/)}function $(e){return T(e)&&null!==e.match(/^(0x)?[0-9a-f]+$/i)}t.DH=t.Or=t.Rb=t.AO=t.FQ=t.iQ=t.DO=t.o8=t.LQ=t.yI=t.O3=t.ie=t.vU=t.pp=t.Xx=void 0;const k="!@#$%^&*()_+-=[]{}|;:<>?,./".split(""),S="abcdefghijklmnopqrstuvwxyz",A=S+"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",O=A+"!@#$%^&*()_+-=[]{}|;:<>?,./",_=["—","\\","東","京","都","𝖆","𝖇","𝖈","👾","🙇","💁","🙅","ᚠ","ᛇ","ᚻ","ᛦ"],D="0123456789abcdef";function V(e,t){if(R(e))throw new TypeError(`Expected string${t?.name?` for ${t.name}`:""}, got: `+e);if(t&&(void 0!==t.min&&e.length<t.min||void 0!==t.max&&e.length>t.max))throw RangeError(`Expected string${t?.name?` for ${t.name}`:""} length in range: ${t.min??"-inf"}..${t.max??"inf"}; got: ${e.length}`);return e}function N(e,t){if(void 0!==t.min&&e<t.min||void 0!==t.max&&e>t.max)throw RangeError(`Expected value${t?.name?` for ${t.name}`:""} in range: ${t.min??"-inf"}..${t.max??"inf"}; got: ${e}`)}function C(e,t){if(B(e))return t&&N(e,t),e;if(!T(e)||!e.match(/^-?\d+(\.\d+)?$/))throw new TypeError(`Expected number${t?.name?` for ${t.name}`:""}, got: `+e);const n=parseFloat(e);return t&&N(n,t),n}function P(e,t){return Math.trunc(C(e,t))}function F(e,t){if(!y(e))throw new TypeError(`Expected object${t?.name?` for ${t.name}`:""}, got: `+e);return e}function M(e){return T(e)&&null!==e.match(/^https?:\/\/.+/)}function U(e){return"bigint"==typeof e}function L(e,t){if(!U(e))throw new TypeError(`Expected bigint${t?.name?` for ${t.name}`:""}, got: `+e);if(void 0!==t?.min&&e<t?.min||void 0!==t?.max&&e>t?.max)throw RangeError(`Expected value${t?.name?` for ${t.name}`:""} in range: ${t.min??"-inf"}..${t.max??"inf"}; got: ${e}`);return e}function j(e,t){for(const[n,r]of Object.entries(t))if(!r(e[n]))throw TypeError(`${n} in value does not exist or match shape`);for(const n of Object.keys(e))if(!t[n])throw TypeError(`${n} exists in value but not in shape`);return!0}function G(e,t){if(y(e)&&y(t))for(const n in t)y(t[n])?(e[n]||(e[n]={}),G(e[n],t[n])):Array.isArray(t[n])?e[n]=[...t[n]]:(null!==t[n]&&void 0!==t[n]||null===e[n]||void 0===e[n])&&(e[n]=t[n]);return e}function Z(e,t){const n={};for(const r of e)for(const e of Object.keys(r))n[e]?n[e]=t(n[e],r[e]):n[e]=r[e];return n}function q(e,t){Array.prototype.push.apply(e,t)}function H(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}function J(e,t=()=>!1){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").split("").map((e=>/[a-z0-9]/.test(e)||t(e)?e:"-")).join("").replace(/-+/g,"-").replace(/^-|-$/g,"")}function W(e,t){if(0===t.length)return 0;const n=e.toLowerCase(),r=t.toLowerCase();return e===t?1e4:n.startsWith(r)?1e4-e.length:n.includes(r)?5e3-e.length:new RegExp(".*"+r.split("").join(".*")+".*").test(n)?1e3-e.length:0}const X={"&":"&",""":'"',"'":"'",">":">","<":"<"};function K(e,t){const n=e.indexOf(t);return-1===n?null:e.slice(0,n)}function Q(e,t){const n=e.indexOf(t);return-1===n?null:e.slice(n+t.length)}function Y(e,t){const n=e.lastIndexOf(t);return-1===n?null:e.slice(0,n)}function ee(e,t){const n=e.lastIndexOf(t);return-1===n?null:e.slice(n+t.length)}function te(e,t,n=!1){const r=n?e.lastIndexOf(t):e.indexOf(t);return-1===r?n?[null,e]:[e,null]:[e.slice(0,r),e.slice(r+t.length)]}function ne(e,t){let n=[e];for(const r of t)n=n.flatMap((e=>e.split(r)));return n.filter((e=>e))}function re(e){const t=f(e.split(/\\|\//g)),n=t.lastIndexOf(".",t.length-1);return n<=0?"":t.slice(n+1)}function ie(e){const t=f(e.split(/\\|\//g)),n=t.lastIndexOf(".",t.length-1);return n<=0?t:t.slice(0,n)}function oe(e){return e.split("\n").map((e=>e.trim().replace(/\s+/g," "))).filter((e=>e.length>0)).join("\n")}function se(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ae(e){return e.charAt(0).toLowerCase()+e.slice(1)}function ce(e){if(!e)return!1;const t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122}function ue(e){if(!e)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}function le(e){return ce(e)||ue(e)}const fe=" \n\t\r.,?!:;\"'`(){}[]~@#$%^&*-+=|<>/\\".split("");function he(e){return fe.includes(e)}function pe(e,t,n=0){const r=t.exec(e.slice(n));return r?{index:r.index,match:r[0]}:null}function de(e,t,n=!0){if(!n)return t.every((t=>t instanceof RegExp?t.test(e):-1!==e.indexOf(t,0)));let r=0;for(const i of t)if(i instanceof RegExp){const t=pe(e,i,r);if(!t)return!1;r=t.index+t.match.length}else{const t=e.indexOf(i,r);if(-1===t)return!1;r=t+i.length}return!0}function me(e,t,n=0){const r=[];let i=e.indexOf(t,n);for(;-1!==i;)r.push(i),i=e.indexOf(t,i+t.length);return r}function ge(e,t,n=0){let r=-1;for(const i of t){const t=e.indexOf(i,n);-1!==t&&(-1===r||t<r)&&(r=t)}return r}function ye(e,t=0){for(let n=t;n<e.length;n++)if(he(e[n]))return n;return-1}function we(e,t=0){for(let n=t;n<e.length;n++)if("#"===e[n]&&le(e[n+1]))return n;return-1}function be(e,t,n=0){return e.slice(0,n).lastIndexOf(t)}function ve(e,t=0,n="{",r="}"){let i=1;for(let o=t;o<e.length;o++)if(e.slice(o,o+r.length)===r){if(0==--i)return o}else e.slice(o,o+n.length)===n&&i++;return-1}function Te(e,t){const n=t.wordBoundary?ge(e,[`${t.opening} `,`${t.opening}\n`],t.start||0):e.indexOf(t.opening,t.start||0);if(-1===n)return null;const r=ve(e,n+t.opening.length,t.opening,t.closing);return-1===r?null:t.exclusive?e.slice(n+t.opening.length,r):e.slice(n,r+t.closing.length)}const Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ee="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function ze(e,t){const n=t.length;let r=0,i=0;const o=[];for(let s=0;s<e.length;s++){const a=e[s];if("="===a)break;const c=t.indexOf(a);if(-1===c)throw new Error(`Invalid character: ${a}`);i=i<<Math.log2(n)|c,r+=Math.log2(n),r>=8&&(r-=8,o.push(i>>r&255))}return new Uint8Array(o)}function Re(e,t){const n=t.length;let r=0,i=0,o="";for(let s=0;s<e.length;s++)for(i=i<<8|e[s],r+=8;r>=Math.log2(n);)r-=Math.log2(n),o+=t[i>>r&n-1];return r>0&&(o+=t[i<<Math.log2(n)-r&n-1]),o.length%4!=0&&(o+="=".repeat(4-o.length%4)),o}function xe(e,t,n){const r=[];for(const i of n)i!==t&&r.push(e.replace(t,i));return r}function Ie(e){const t=e.lastIndexOf(" ");if(-1===t)return{line:e,rest:""};return{line:e.slice(0,t),rest:e.slice(t+1)}}function $e(e){const t=e.reduce(((e,t)=>e.length<t.length?e:t));let n="";for(let r=0;r<t.length;r++){const i=t[r];if(!e.every((e=>e[r]===i)))break;n+=i}return n}function ke(e,t){return new RegExp(`\\b${t}\\b`).test(e)}function Se(e,t,n=[]){let r="";for(;t<e.length&&(le(e[t])||n.includes(e[t]));)r+=e[t++];return r}function Ae(e,t,n,r="$",i=":"){if(""===n)return e;let o=e.indexOf(`${r}${t}`);for(;-1!==o;){if(e[o+t.length+1]===i)if(e[o+t.length+2]===i)e=e.replace(`${r}${t}${i}${i}`,n);else{const s=Se(e,o+t.length+2,["_"]);e=e.replace(`${r}${t}${i}${s}`,n)}else e=e.replace(`${r}${t}`,n);o=e.indexOf(`${r}${t}`,o+n.length)}return e}function Oe(e,t="$",n=":"){let r=e.indexOf(t);for(;-1!==r;){const i=Se(e,r+1);if(e[r+i.length+1]===n)if(e[r+i.length+2]===n)e=e.replace(`${t}${i}${n}${n}`,"");else{const o=Se(e,r+i.length+2);e=e.replace(`${t}${i}${n}${o}`,o)}r=e.indexOf(t,r+1)}return e}function _e(e,t=!0){const n=Object.entries(e).filter((([e,t])=>null!=t)).map((([e,t])=>`${e}=${encodeURIComponent(t)}`)).join("&");return n?(t?"?":"")+n:""}function De(e){return String(Math.floor(e)).padStart(2,"0")}function Ve(e){const t=Math.floor(e/36e5);e%=36e5;const n=Math.floor(e/6e4);e%=6e4;const r=Math.floor(e/1e3);return t?`${De(t)}:${De(n)}:${De(r)}`:`${De(n)}:${De(r)}`}function Ne(e){return Math.floor((z(e)?e.getTime():e)/864e5)}const Ce={today:(e,t)=>De(e)+":"+De(t),yesterday:()=>"Yesterday",monday:()=>"Mon",tuesday:()=>"Tue",wednesday:()=>"Wed",thursday:()=>"Thu",friday:()=>"Fri",saturday:()=>"Sat",sunday:()=>"Sun",weeks:e=>`${e}w`};const Pe={now:()=>"A few seconds",seconds:e=>`${e} seconds`,minutes:e=>`${e} minutes`,hours:e=>`${e} hours`,days:e=>`${e} days`,weeks:e=>`${e} weeks`};function Fe(e,n){const r=n?.now??Date.now(),i=n?.labels||Pe;let o=(r-(t.Or.isDate(e)?e.getTime():e))/1e3;return o<10?i.now():o<120?i.seconds(Math.floor(o)):(o/=60,o<120?i.minutes(Math.floor(o)):(o/=60,o<48?i.hours(Math.floor(o)):(o/=24,o<14?i.days(Math.floor(o)):(o/=7,i.weeks(Math.floor(o))))))}const Me={};const Ue={s:1e3,m:6e4,h:36e5,d:864e5};const Le={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"};function je(e){return{zeroBasedIndex:e,day:Le[e]}}function Ge(e){return je(e.getDay())}const Ze={ms:1,milli:1,millis:1,millisecond:1,milliseconds:1,s:1e3,sec:1e3,second:1e3,seconds:1e3,m:6e4,min:6e4,minute:6e4,minutes:6e4,h:36e5,hour:36e5,hours:36e5,d:864e5,day:864e5,days:864e5,w:6048e5,week:6048e5,weeks:6048e5,month:2592e6,months:2592e6,y:31536e6,year:31536e6,years:31536e6};const qe={b:0,byte:0,bytes:0,kb:1,kilobyte:1,kilobytes:1,mb:2,megabyte:2,megabytes:2,gb:3,gigabyte:3,gigabytes:3,tb:4,terabyte:4,terabytes:4};const He=new Map;function Je(e,t=!1){e=e.filter((e=>e)),t&&T(e[1])&&(e[1]="../"+e[1]);let n="";T(e[0])&&e[0].includes("://")&&(n=K(e[0],"://")??"",e[0]=Q(e[0],"://")??"");const r=e.map((e=>String(e))).flatMap((e=>e.split("/"))),i=[];for(let o=0;o<r.length;o++)"."!==r[o]&&(".."===r[o]?(!n||i.length>1)&&i.pop():i.push(r[o]));return(n?n+"://":"")+i.join("/").replaceAll(/\/{2,}/g,"/")}function We(e){const t=Object.keys(e).sort(((e,t)=>e.localeCompare(t))),n={};for(const r of t)n[r]=Ke(e[r]);return n}function Xe(e){const t=[];return e.sort(((e,t)=>JSON.stringify(Ke(e)).localeCompare(JSON.stringify(Ke(t))))).forEach((e=>t.push(Ke(e)))),t}function Ke(e){return Array.isArray(e)?Xe(e):g(e)?We(e):e}function Qe(e,t){return JSON.stringify(Ke(e))===JSON.stringify(Ke(t))}function Ye(e){const t=Object.keys(e);return t[Math.floor(Math.random()*t.length)]}const et=[1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24,1e27,1e30,1e9,1e16,1e18,1e18,1e18,1e33],tt=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","gwei","bzz","btc","eth","dai","decillion"],nt=["K","M","B","T","Qa","Qi","Sx","Sp","O","N","gwei","bzz","eth","btc","dai","D"];function rt(e){const t=parseFloat(e);if(isNaN(t))throw Error("makeNumber got NaN for input");const n=e.replace(/^-?[0-9.]+/,"").trim(),r=nt.findIndex((e=>e.toLowerCase()===n.toLowerCase()));return-1===r?t:t*et[r]}function it(e,t,n){return e<t?t:e>n?n:e}function ot(e,t,n){return e+(n?"["+t+"]":(e.length?".":"")+t)}function st(e,t,n,r,i){if(!g(t))return t;for(const[o,s]of Object.entries(t)){const t=ot(n,o,r);Array.isArray(s)?i?st(e,s,t,!0,i):e[t]=s.map((e=>st(Array.isArray(e)?[]:{},e,"",!1,i))):g(s)?st(e,s,t,!1,i):e[t]=s}return e}function at(e,t){const n={};for(const r of e){n[t(r)]=r}return n}function ct(e,t){const n=Math.ceil(e.length/t),r=[];for(let i=0;i<e.length;i+=n)r.push(e.slice(i,i+n));return r}function ut(e,t){const n=[],r=Math.ceil(e.length/t);for(let i=0;i<r;i++)n.push(e.slice(i*t,i*t+t));return n}function lt(e,t){return Object.fromEntries(Object.entries(e).sort(t))}function ft(e,t){const n=[];let r=[];return e.forEach(((i,o)=>{(0===o||!t(i,e[o-1]))&&(r=[],n.push(r)),r.push(i)})),n}function ht(e,t,n,r=100){if(e.map.has(t)){const n=e.keys.indexOf(t);e.keys.splice(n,1)}if(e.map.set(t,n),e.keys.push(t),e.keys.length>r){const t=e.keys.shift();t&&e.map.delete(t)}}class pt{constructor(e){this.value=e}static of(e){return new pt(e)}static empty(){return new pt(null)}map(e){return new pt(null!==this.value&&void 0!==this.value?e(this.value):null)}mapAsync(e){return null!==this.value&&void 0!==this.value?e(this.value).then((e=>pt.of(e))):Promise.resolve(pt.empty())}ifPresent(e){return null!==this.value&&void 0!==this.value&&e(this.value),this}ifPresentAsync(e){return null!==this.value&&void 0!==this.value?e(this.value).then((()=>this)):Promise.resolve(this)}ifAbsent(e){return(null===this.value||void 0===this.value)&&e(),this}ifAbsentAsync(e){return null===this.value||void 0===this.value?e().then((()=>this)):Promise.resolve(this)}getOrFallback(e){return this.value??e()}getOrFallbackAsync(e){return null!==this.value&&void 0!==this.value?Promise.resolve(this.value):e()}getOrThrow(){if(null===this.value||void 0===this.value)throw Error("Optional.value is empty");return this.value}}t.Xx=pt;class dt{constructor(e){this.value=e,this.children=[]}}function mt(e,t){if(Math.log2(e.length)%1!=0)throw new Error("Array length must be a power of 2");let n=[...e];for(;n.length>1;){const e=[];for(let r=0;r<n.length;r+=2){const i=n[r+1];e.push(t(n[r],i))}n=e}return n[0]}function gt(...e){const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;return e.forEach((e=>{n.set(e,r),r+=e.length})),n}function yt(e){return 137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]}function wt(e){return 255===e[0]&&216===e[1]}function bt(e){return 87===e[8]&&69===e[9]&&66===e[10]&&80===e[11]}function vt(e,t){const n=new ArrayBuffer(8);return new DataView(n).setBigUint64(0,BigInt(e),"LE"===t),new Uint8Array(n)}function Tt(e,t){const n=new Uint8Array(32);let r=e;if("LE"===t){for(let e=0;e<32;e++)n[e]=Number(0xffn&r),r>>=8n;return n}for(let i=31;i>=0;i--)n[i]=Number(0xffn&r),r>>=8n;return n}function Bt(e,t){let n=0n;if("LE"===t){for(let t=31;t>=0;t--)n=n<<8n|BigInt(e[t]);return n}for(let r=0;r<32;r++)n=n<<8n|BigInt(e[r]);return n}function Et(e,t){const n=[];for(let r=0;r<e.length;r+=t)n.push(e.subarray(r,r+t));return n}const zt=[0,1,0,32898,2147483648,32906,2147483648,2147516416,0,32907,0,2147483649,2147483648,2147516545,2147483648,32777,0,138,0,136,0,2147516425,0,2147483658,0,2147516555,2147483648,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,0,32778,2147483648,2147483658,2147483648,2147516545,2147483648,32896,0,2147483649,2147483648,2147516424];function Rt(e){for(let t=0;t<24;t++){const n=e[0]^e[10]^e[20]^e[30]^e[40],r=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],o=e[3]^e[13]^e[23]^e[33]^e[43],s=e[4]^e[14]^e[24]^e[34]^e[44],a=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],u=e[7]^e[17]^e[27]^e[37]^e[47],l=e[8]^e[18]^e[28]^e[38]^e[48],f=e[9]^e[19]^e[29]^e[39]^e[49],h=l^(i<<1|o>>>31),p=f^(o<<1|i>>>31),d=n^(s<<1|a>>>31),m=r^(a<<1|s>>>31),g=i^(c<<1|u>>>31),y=o^(u<<1|c>>>31),w=s^(l<<1|f>>>31),b=a^(f<<1|l>>>31),v=c^(n<<1|r>>>31),T=u^(r<<1|n>>>31);e[0]^=h,e[1]^=p,e[2]^=d,e[3]^=m,e[4]^=g,e[5]^=y,e[6]^=w,e[7]^=b,e[8]^=v,e[9]^=T,e[10]^=h,e[11]^=p,e[12]^=d,e[13]^=m,e[14]^=g,e[15]^=y,e[16]^=w,e[17]^=b,e[18]^=v,e[19]^=T,e[20]^=h,e[21]^=p,e[22]^=d,e[23]^=m,e[24]^=g,e[25]^=y,e[26]^=w,e[27]^=b,e[28]^=v,e[29]^=T,e[30]^=h,e[31]^=p,e[32]^=d,e[33]^=m,e[34]^=g,e[35]^=y,e[36]^=w,e[37]^=b,e[38]^=v,e[39]^=T,e[40]^=h,e[41]^=p,e[42]^=d,e[43]^=m,e[44]^=g,e[45]^=y,e[46]^=w,e[47]^=b,e[48]^=v,e[49]^=T;const B=e[0],E=e[1],z=e[2]<<1|e[3]>>>31,R=e[3]<<1|e[2]>>>31,x=e[5]<<30|e[4]>>>2,I=e[4]<<30|e[5]>>>2,$=e[6]<<28|e[7]>>>4,k=e[7]<<28|e[6]>>>4,S=e[8]<<27|e[9]>>>5,A=e[9]<<27|e[8]>>>5,O=e[11]<<4|e[10]>>>28,_=e[10]<<4|e[11]>>>28,D=e[13]<<12|e[12]>>>20,V=e[12]<<12|e[13]>>>20,N=e[14]<<6|e[15]>>>26,C=e[15]<<6|e[14]>>>26,P=e[17]<<23|e[16]>>>9,F=e[16]<<23|e[17]>>>9,M=e[18]<<20|e[19]>>>12,U=e[19]<<20|e[18]>>>12,L=e[20]<<3|e[21]>>>29,j=e[21]<<3|e[20]>>>29,G=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,q=e[25]<<11|e[24]>>>21,H=e[24]<<11|e[25]>>>21,J=e[26]<<25|e[27]>>>7,W=e[27]<<25|e[26]>>>7,X=e[29]<<7|e[28]>>>25,K=e[28]<<7|e[29]>>>25,Q=e[31]<<9|e[30]>>>23,Y=e[30]<<9|e[31]>>>23,ee=e[33]<<13|e[32]>>>19,te=e[32]<<13|e[33]>>>19,ne=e[34]<<15|e[35]>>>17,re=e[35]<<15|e[34]>>>17,ie=e[36]<<21|e[37]>>>11,oe=e[37]<<21|e[36]>>>11,se=e[38]<<8|e[39]>>>24,ae=e[39]<<8|e[38]>>>24,ce=e[40]<<18|e[41]>>>14,ue=e[41]<<18|e[40]>>>14,le=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,he=e[45]<<29|e[44]>>>3,pe=e[44]<<29|e[45]>>>3,de=e[47]<<24|e[46]>>>8,me=e[46]<<24|e[47]>>>8,ge=e[48]<<14|e[49]>>>18,ye=e[49]<<14|e[48]>>>18;e[0]=B^~D&q,e[1]=E^~V&H,e[2]=D^~q&ie,e[3]=V^~H&oe,e[4]=q^~ie&ge,e[5]=H^~oe&ye,e[6]=ie^~ge&B,e[7]=oe^~ye&E,e[8]=ge^~B&D,e[9]=ye^~E&V,e[10]=$^~M&L,e[11]=k^~U&j,e[12]=M^~L&ee,e[13]=U^~j&te,e[14]=L^~ee&he,e[15]=j^~te&pe,e[16]=ee^~he&$,e[17]=te^~pe&k,e[18]=he^~$&M,e[19]=pe^~k&U,e[20]=z^~N&J,e[21]=R^~C&W,e[22]=N^~J&se,e[23]=C^~W&ae,e[24]=J^~se&ce,e[25]=W^~ae&ue,e[26]=se^~ce&z,e[27]=ae^~ue&R,e[28]=ce^~z&N,e[29]=ue^~R&C,e[30]=S^~O&G,e[31]=A^~_&Z,e[32]=O^~G&ne,e[33]=_^~Z&re,e[34]=G^~ne&de,e[35]=Z^~re&me,e[36]=ne^~de&S,e[37]=re^~me&A,e[38]=de^~S&O,e[39]=me^~A&_,e[40]=x^~P&X,e[41]=I^~F&K,e[42]=P^~X&Q,e[43]=F^~K&Y,e[44]=X^~Q&le,e[45]=K^~Y&fe,e[46]=Q^~le&x,e[47]=Y^~fe&I,e[48]=le^~x&P,e[49]=fe^~I&F,e[0]^=zt[2*t],e[1]^=zt[2*t+1]}}function xt(e){const t=[];for(let n=0;n<e.length;n+=4)t.push(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24);return t}function It(e,t){if(!e.length){const e=new Uint8Array(136);return e[0]=t,e[135]=128,[xt(e)]}const n=Et(e,136),r=n[n.length-1];if(r.length<136){const e=new Uint8Array(136);e.set(r),e[r.length]=t,e[135]|=128,n[n.length-1]=e}if(136===r.length){const e=new Uint8Array(136);e[0]=t,e[135]=128,n.push(e)}return n.map(xt)}function $t(e,t){for(const n of t){for(let t=0;t<34;t+=2)e[t]^=n[t+1],e[t+1]^=n[t];Rt(e)}return e}function kt(e){return new Uint8Array([e[1],e[1]>>-24,e[1]>>-16,e[1]>>-8,e[0],e[0]>>8,e[0]>>16,e[0]>>24,e[3],e[3]>>-24,e[3]>>-16,e[3]>>-8,e[2],e[2]>>8,e[2]>>16,e[2]>>24,e[5],e[5]>>-24,e[5]>>-16,e[5]>>-8,e[4],e[4]>>8,e[4]>>16,e[4]>>24,e[7],e[7]>>-24,e[7]>>-16,e[7]>>-8,e[6],e[6]>>8,e[6]>>16,e[6]>>24])}function St(e){return kt($t(new Array(50).fill(0),It(e,1)))}function At(e,t,n=0){if(e.length>=t)return e;const r=new Uint8Array(t);return r.fill(n),r.set(e,t-e.length),r}function Ot(e,t,n=0){if(e.length>=t)return e;const r=new Uint8Array(t);return r.fill(n),r.set(e,0),r}function _t(e,t){return(e%t+t)%t}function Dt(e,t){e=_t(e,t);let[n,r]=[0n,1n],[i,o]=[t,e];for(;0n!==o;){const e=i/o;[n,r]=[r,n-e*r],[i,o]=[o,i-e*o]}if(i>1n)throw new Error("a is not invertible");return n<0n&&(n+=t),n}function Vt(e,t){return 0n===_t(e,t)?0n:t%4n===3n?function(e,t,n){let r=1n;for(e=_t(e,n);t>0;)t%2n===1n&&(r=_t(r*e,n)),e=_t(e*e,n),t/=2n;return r}(e,(t+1n)/4n,t):null}const Nt=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,Ct=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,Pt=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Ft=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;function Mt(e,t,n){if(0n===t)return[0n,0n];const r=_t(3n*e*e*Dt(2n*t,n),n),i=_t(r*r-2n*e,n);return[i,_t(r*(e-i)-t,n)]}function Ut(e,t,n,r,i){if(0n===e&&0n===t)return[n,r];if(0n===n&&0n===r)return[e,t];if(e===n&&t===_t(-r,i))return[0n,0n];if(e===n&&t===r)return Mt(e,t,i);const o=_t((r-t)*Dt(n-e,i),i),s=_t(o*o-e-n,i);return[s,_t(o*(e-s)-t,i)]}function Lt(e,t,n,r){let i=[0n,0n],o=[e,t];const s=n.toString(2);for(const a of s)"0"===a?(o=Ut(i[0],i[1],o[0],o[1],r),i=Mt(i[0],i[1],r)):(i=Ut(i[0],i[1],o[0],o[1],r),o=Mt(o[0],o[1],r));return i}function jt(e,t,n){if(t<=0n||t>=Ct)throw new Error("Invalid private key");if(n||(n=_t(Bt(St(gt(St(Tt(t,"BE")),Tt(e,"BE"))),"BE"),Ct)),n<=0n||n>=Ct)throw new Error("Invalid nonce");const r=_t(e,Ct),i=Lt(Pt,Ft,n,Nt),o=_t(i[0],Ct);let s=_t((r+_t(o,Ct)*t)*Dt(n,Ct),Ct);if(0n===o||0n===s)throw new Error("Invalid r or s value");let a=i[1]%2n===0n?27n:28n;return s>Ct/2n&&(s=Ct-s,a=27n===a?28n:27n),[o,s,a]}class Gt{constructor(e){this.cursor=0,this.buffer=e}read(e){const t=this.buffer.subarray(this.cursor,this.cursor+e);return this.cursor+=e,t}max(){return this.buffer.length-this.cursor}}t.pp=Gt;class Zt{constructor(e){this.buffer=e,this.cursor=0}write(e){const t=Math.min(this.max(),e.max());return this.buffer.set(e.read(t),this.cursor),this.cursor+=t,t}max(){return this.buffer.length-this.cursor}}class qt{constructor(e,t=0n){this.span=t,this.writer=new Zt(new Uint8Array(e))}build(){return gt(vt(this.span,"LE"),this.writer.buffer)}hash(){const e=mt(Et(this.writer.buffer,32),((e,t)=>qt.hashFunction(gt(e,t))));return qt.hashFunction(gt(vt(this.span,"LE"),e))}}qt.hashFunction=St;class Ht{constructor(e,t=4096){this.counters=[1],this.capacity=t,this.chunks=[new qt(t)],this.onChunk=e}static async root(e,t=4096){const r=new n(n.NOOP,t);return await r.append(e),r.finalize()}async append(e,t=0,n=0n){const r=new Gt(e);for(;r.max()>0;){0===this.chunks[t].writer.max()&&await this.elevate(t);const e=this.chunks[t].writer.write(r);n?this.chunks[t].span+=n:this.chunks[0].span+=BigInt(e)}}async elevate(e){this.counters[e]=++this.counters[e]%(this.capacity/32),this.chunks[e+1]||(this.chunks.push(new qt(this.capacity)),this.counters.push(1)),await this.append(this.chunks[e].hash(),e+1,this.chunks[e].span),await this.onChunk(this.chunks[e]),this.chunks[e]=new qt(this.capacity)}async finalize(e=0){return this.chunks[e+1]?1===this.counters[e]?(await this.elevate(e+1),this.chunks[e+1]=this.chunks[e],this.finalize(e+1)):(await this.elevate(e),this.finalize(e+1)):(await this.onChunk(this.chunks[e]),this.chunks[e])}}t.vU=Ht,n=Ht,Ht.NOOP=async e=>{};class Jt{constructor(e,t){if(t<0)throw Error("Scale must be non-negative");this.value=BigInt(e),this.scale=t}static cast(e){if(!e)throw Error("Cannot cast falsy value to FixedPointNumber");if(e instanceof Jt)return e;const t=L(e.value),n=C(e.scale);return new Jt(t,n)}static fromDecimalString(e,t){/e\-\d+$/i.test(e)&&(e=parseFloat(e).toFixed(t));let[n,r]=e.split(".");return r=(r||"").padEnd(t,"0").slice(0,t),new Jt(BigInt(n+r),t)}static fromFloat(e,t){return Jt.fromDecimalString(e.toString(),t)}add(e){return this.assertSameScale(e),new Jt(this.value+e.value,this.scale)}subtract(e){return this.assertSameScale(e),new Jt(this.value-e.value,this.scale)}multiply(e){return new Jt(this.value*e,this.scale)}divmod(e){if(0n===e)throw new Error("Division by zero is not allowed");const t=this.value/e,n=this.value%e;return[new Jt(t,this.scale),new Jt(n,this.scale)]}exchange(e,t,n){if("*"===e){const e=this.value*t.value/10n**BigInt(this.scale);return new Jt(e,n)}this.assertSameScale(t);const r=this.value*10n**BigInt(n)/t.value;return new Jt(r,n)}compare(e){return this.assertSameScale(e),this.value>e.value?1:this.value<e.value?-1:0}toDecimalString(){if(0===this.scale)return this.value.toString();const e=this.value.toString();return`${e.slice(0,-this.scale)||"0"}.${e.slice(-this.scale).padStart(this.scale,"0")}`}toString(){return this.value.toString()}toJSON(){return this.toString()}toFloat(){return parseFloat(this.toDecimalString())}assertSameScale(e){if(this.scale!==e.scale)throw new Error(`Scale mismatch: expected ${this.scale}, but got ${e.scale}`)}}function Wt(e,t,n,r){const i=e.findIndex((e=>e===`--${t}`||e.startsWith(`--${t}=`))),o=e[i];if(!o)return(n||{})[r||t||""]||null;if(o.includes("="))return o.split("=")[1];const s=e[i+1];return s&&!s.startsWith("-")?s:(n||{})[r||t||""]||null}function Xt(e,t,n,r){const i=Wt(e,t,n,r);if(!i)throw new Error(`Missing argument ${t}`);return i}function Kt(e,t){const n=e[t];e.splice(t,1),e.unshift(n)}function Qt(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Yt(e,t){return{x:e.x*t,y:e.y*t}}function en(e,t,n){return{x:e.x+Math.cos(t)*n,y:e.y+Math.sin(t)*n}}function tn(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function nn(e,t,n="row-first"){const r=[];if("column-first"===n)for(let i=0;i<e.length;i++)for(let n=0;n<e[0].length;n++)t(i,n)&&r.push({x:i,y:n});else for(let i=0;i<e[0].length;i++)for(let n=0;n<e.length;n++)t(n,i)&&r.push({x:n,y:i});return r}function rn(e,t,n){return!e[t-1]?.[n]}function on(e,t,n){return!e[t+1]?.[n]}function sn(e,t,n){return!e[t][n-1]}function an(e,t,n){return!e[t][n+1]}function cn(e,t,n){const r=[];return e[t][n]?function(e,t,n){return e[t+1]?.[n]&&e[t-1]?.[n]&&!e[t][n-1]&&!e[t][n+1]}(e,t,n)||function(e,t,n){return e[t][n+1]&&e[t][n-1]&&!e[t-1]?.[n]&&!e[t+1]?.[n]}(e,t,n)?[]:(!e[t-1]?.[n-1]&&rn(e,t,n)&&sn(e,t,n)&&r.push({x:t,y:n}),!e[t+1]?.[n-1]&&on(e,t,n)&&sn(e,t,n)&&r.push({x:t+1,y:n}),!e[t-1]?.[n+1]&&rn(e,t,n)&&an(e,t,n)&&r.push({x:t,y:n+1}),!e[t+1]?.[n+1]&&on(e,t,n)&&an(e,t,n)&&r.push({x:t+1,y:n+1}),r):(e[t-1]?.[n]&&e[t][n-1]&&r.push({x:t,y:n}),e[t+1]?.[n]&&e[t][n-1]&&r.push({x:t+1,y:n}),e[t-1]?.[n]&&e[t][n+1]&&r.push({x:t,y:n+1}),e[t+1]?.[n]&&e[t][n+1]&&r.push({x:t+1,y:n+1}),r)}function un(e,t){return t.map((t=>function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}(e,t))).sort(((e,t)=>e-t))}function ln(e,t,n,r){const i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y);if(0===i)return null;let o=e.y-n.y,s=e.x-n.x;const a=(r.x-n.x)*o-(r.y-n.y)*s,c=(t.x-e.x)*o-(t.y-e.y)*s;return o>0&&o<1&&s>0&&s<1?{x:e.x+o*(t.x-e.x),y:e.y+o*(t.y-e.y)}:null}function fn(e,t,n){const r=[],i=en(e,n,1e4);for(const o of t){const t=ln(e,i,o.start,o.end);t&&r.push(t)}return r.length?r.reduce(((t,n)=>tn(e,n)<tn(e,t)?n:t)):null}t.ie=Jt;class hn{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),()=>{this.subscribers=this.subscribers.filter((t=>t!==e))}}publish(e){this.subscribers.forEach((t=>t(e)))}clear(){this.subscribers=[]}getSubscriberCount(){return this.subscribers.length}}t.O3=class{constructor(e,t){this.queue=[],this.running=0,this.onProcessed=new hn,this.onDrained=new hn,this.concurrency=e,this.capacity=t}process(){if(this.running>=this.concurrency)return;const e=this.queue.shift();e&&(this.running++,e().finally((()=>{this.running--,this.process(),this.onProcessed.publish(),0===this.running&&this.onDrained.publish()})))}enqueue(e){if(this.queue.length<this.capacity)return this.queue.push(e),this.process(),Promise.resolve();if(this.onProcessed.getSubscriberCount())throw Error("Queue capacity is full");return new Promise((t=>{this.onProcessed.subscribe((()=>{this.queue.length<this.capacity&&(this.queue.push(e),this.process(),this.onProcessed.clear(),t())}))}))}drain(){if(0===this.running)return Promise.resolve();if(this.onDrained.getSubscriberCount())throw Error("Already draining");return new Promise((e=>{this.onDrained.subscribe((()=>{this.onDrained.clear(),e()}))}))}};class pn{constructor(){this.forks=new Map}insert(e,t){if(0===e.length)return void(this.handler=t);const n=e[0];let r,i=n;if(n.startsWith(":")&&n.slice(1),!this.forks.has(i)){const e=new pn;r&&(e.variableName=r),this.forks.set(i,e)}this.forks.get(i).insert(e.slice(1),t)}async handle(e,t,n,r){if(0===e.length)return!!this.handler&&(await this.handler(t,n,r),!0);const i=e[0],o=this.forks.get(i);if(o)return o.handle(e.slice(1),t,n,r);const s=this.forks.get(":");if(s)return s.variableName&&r.set(s.variableName,decodeURIComponent(i)),s.handle(e.slice(1),t,n,r);const a=this.forks.get("*");return!!a&&(r.set("wildcard",e.join("/")),!!a.handler&&(await a.handler(t,n,r),!0))}}t.yI={hexToUint8Array:function(e){(e.startsWith("0x")||e.startsWith("0X"))&&(e=e.slice(2));const t=e.length/2,n=new Uint8Array(t);for(let r=0;r<t;r++){const t=parseInt(e.slice(2*r,2*r+2),16);n[r]=t}return n},uint8ArrayToHex:function(e){return Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join("")},binaryToUint8Array:function(e){const t=Math.ceil(e.length/8),n=new Uint8Array(t);for(let r=0;r<t;r++){const t=parseInt(e.slice(8*r,8*r+8),2);n[r]=t}return n},uint8ArrayToBinary:function(e){return Array.from(e).map((e=>e.toString(2).padStart(8,"0"))).join("")},base64ToUint8Array:function(e){return ze(e,Be)},uint8ArrayToBase64:function(e){return Re(e,Be)},base32ToUint8Array:function(e){return ze(e,Ee)},uint8ArrayToBase32:function(e){return Re(e,Ee)},log2Reduce:mt,partition:Et,concatBytes:gt,numberToUint8:function(e){return new Uint8Array([e])},uint8ToNumber:function(e){return e[0]},numberToUint16:function(e,t){const n=new ArrayBuffer(2);return new DataView(n).setUint16(0,e,"LE"===t),new Uint8Array(n)},uint16ToNumber:function(e,t){return new DataView(e.buffer).getUint16(e.byteOffset,"LE"===t)},numberToUint32:function(e,t){const n=new ArrayBuffer(4);return new DataView(n).setUint32(0,e,"LE"===t),new Uint8Array(n)},uint32ToNumber:function(e,t){return new DataView(e.buffer).getUint32(e.byteOffset,"LE"===t)},numberToUint64:vt,uint64ToNumber:function(e,t){return new DataView(e.buffer).getBigUint64(e.byteOffset,"LE"===t)},numberToUint256:Tt,uint256ToNumber:Bt,sliceBytes:function(e,t){const n=[];let r=0;for(const i of t)n.push(e.subarray(r,r+i)),r+=i;return n},keccak256:St,sha3_256:function(e){return kt($t(new Array(50).fill(0),It(e,6)))},proximity:function(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=e[r]^t[r];for(let e=0;e<8;e++)if(n>>7-e&1)return 8*r+e}return 8*Math.min(e.length,t.length)},commonPrefix:function(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return e.subarray(0,r);return e.subarray(0,n)},setBit:function(e,t,n,r){const i=Math.floor(t/8),o=t%8;1===n?e[i]|=1<<("BE"===r?7-o:o):e[i]&=~(1<<("BE"===r?7-o:o))},getBit:function(e,t,n){const r=t%8;return e[Math.floor(t/8)]>>("BE"===n?7-r:r)&1},indexOf:function(e,t,n=0){for(let r=n;r<e.length;r++)for(let n=0;n<t.length&&e[r+n]===t[n];n++)if(n===t.length-1)return r;return-1},equals:function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},padStart:At,padStartToMultiple:function(e,t,n=0){const r=e.length%t;return 0===r?e:At(e,e.length+t-r,n)},padEnd:Ot,padEndToMultiple:function(e,t,n=0){const r=e.length%t;return 0===r?e:Ot(e,e.length+t-r,n)},xorCypher:function(e,t){const n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]^t[r%t.length];return n},isUtf8:function(e){for(let t=0;t<e.length;t++){const n=e[t];if(!(n<128))if(192==(224&n)){if(t+1>=e.length||128!=(192&e[t+1]))return!1;t+=1}else if(224==(240&n)){if(t+2>=e.length||128!=(192&e[t+1])||128!=(192&e[t+2]))return!1;t+=2}else{if(240!=(248&n))return!1;if(t+3>=e.length||128!=(192&e[t+1])||128!=(192&e[t+2])||128!=(192&e[t+3]))return!1;t+=3}}return!0}},t.LQ={privateKeyToPublicKey:function(e){if(e<=0n||e>=Ct)throw new Error("Invalid private key");return Lt(Pt,Ft,e,Nt)},compressPublicKey:function(e){const t=e[1]%2n===0n?2:3;return new Uint8Array([t,...Tt(e[0],"BE")])},publicKeyFromCompressed:function(e){if(33!==e.length||2!==e[0]&&3!==e[0])throw new Error("Invalid compressed public key");const t=Bt(e.slice(1),"BE"),n=Vt(_t(t**3n+7n,Nt),Nt);if(!n)throw Error("Invalid x: does not correspond to a valid curve point");const r=_t(-n,Nt),i=n%2n===0n;return[t,2===e[0]?i?n:r:i?r:n]},publicKeyToAddress:function(e){const t=new Uint8Array(20),n=St(gt(Tt(e[0],"BE"),Tt(e[1],"BE")));return t.set(n.subarray(12)),t},signMessage:function(e,t,n){return jt(Bt(St(e),"BE"),t,n)},signHash:jt,verifySignature:function(e,t,n,r){const i=_t(Bt(St(e),"BE"),Ct),o=Dt(r,Ct),s=_t(i*o,Ct),a=_t(n*o,Ct),c=Lt(Pt,Ft,s,Nt),u=Lt(t[0],t[1],a,Nt);return n===_t(Ut(c[0],c[1],u[0],u[1],Nt)[0],Ct)},recoverPublicKey:function(e,t,n,r){const i=Vt(_t(t**3n+7n,Nt),Nt);if(!i)throw new Error("Invalid r: does not correspond to a valid curve point");const o=i%2n===(27n===r?0n:1n)?i:Nt-i,s=_t(Bt(St(e),"BE"),Ct),a=Lt(t,o,n,Nt),c=Lt(Pt,Ft,s,Nt),u=Ut(a[0],a[1],c[0],_t(-c[1],Nt),Nt);return Lt(u[0],u[1],Dt(t,Ct),Nt)},checksumEncode:function(e){const n=t.yI.uint8ArrayToHex(e),r=t.yI.uint8ArrayToHex(t.yI.keccak256(new Uint8Array([...n].map((e=>e.charCodeAt(0))))));let i="0x";for(let t=0;t<n.length;t++)parseInt(r[t],16)>7?i+=n[t].toUpperCase():i+=n[t];return i}},t.o8={intBetween:a,floatBetween:function(e,t,n=Math.random){return n()*(t-e)+e},chance:u,signed:function(){return 2*Math.random()-1},makeSeededRng:function(e){let t=e,n=3405648695,r=3735928559;return function(){return t+=n,n^=t<<7,t*=r,r^=t<<13,t^=n^r,(t>>>0)/4294967296}},point:function(e,t,n,r=Math.random){let i,o;do{i=a(0,e-1,r),o=a(0,t-1,r)}while(n&&c(n,i,o));return[i,o]},procs:function(e,t=Math.random){const n=Math.floor(e);return u(e-n,t)?n+1:n}},t.DO={countUnique:function(e,t,n,r,i){const o=t?e.map(t):e,s={};for(const c of o)s[c]=(s[c]||0)+1;const a=r?lt(s,i?(e,t)=>e[1]-t[1]:(e,t)=>t[1]-e[1]):s;return n?Object.keys(a):a},makeUnique:function(e,t){return Object.values(at(e,t))},splitBySize:function(e,t){const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},splitByCount:ct,index:at,indexCollection:function(e,t){const n={};for(const r of e){const e=t(r);n[e]||(n[e]=[]),n[e].push(r)}return n},onlyOrThrow:function(e){if(1===e.length)return e[0];throw Error(`Expected exactly one element, actual: ${e.length}`)},onlyOrNull:function(e){return 1===e.length?e[0]:null},firstOrThrow:function(e){if(!e.length)throw Error("Received empty array");return e[0]},firstOrNull:function(e){return e.length>0?e[0]:null},shuffle:o,initialize:function(e,t){const n=[];for(let r=0;r<e;r++)n.push(t(r));return n},initialize2D:function(e,t,n){const r=[];for(let i=0;i<e;i++){r.push([]);for(let e=0;e<t;e++)r[i].push(n)}return r},rotate2D:function(e){const t=[];for(let n=0;n<e[0].length;n++){t.push([]);for(let r=0;r<e.length;r++)t[n].push(e[r][n])}return t},containsShape:function(e,t,n,r){if(n<0||r<0||r+t[0].length>e[0].length||n+t.length>e.length)return!1;for(let i=0;i<t.length;i++)for(let o=0;o<t[i].length;o++)if(void 0!==t[i][o]&&e[n+i][r+o]!==t[i][o])return!1;return!0},glue:function(e,t){const n=[];for(let r=0;r<e.length;r++)n.push(e[r]),r<e.length-1&&(v(t)?n.push(t()):n.push(t));return n},pluck:function(e,t){return e.map((e=>e[t]))},pick:l,pickMany:function(e,t,n=Math.random){if(t>e.length)throw new Error(`Count (${t}) is greater than array length (${e.length})`);return s(e,t,n).map((t=>e[t]))},pickManyUnique:function(e,t,n,r=Math.random){if(t>e.length)throw new Error(`Count (${t}) is greater than array length (${e.length})`);const i=[];for(;i.length<t;){const t=l(e,r);i.some((e=>n(e,t)))||i.push(t)}return i},pickWeighted:function(e,t,n){if(void 0===n&&(n=Math.random()),e.length!==t.length)throw new Error("Array length mismatch");let r=t.reduce(((e,t)=>e+t),0);const i=n*r;for(let o=0;o<e.length-1;o++)if(r-=t[o],i>=r)return e[o];return f(e)},pickRandomIndices:s,pickGuaranteed:function(e,n,r,i,s,a=Math.random){const c=e.filter((e=>e!==n&&e!==r)),u=[];for(null!==n&&u.push(n);c.length&&u.length<i;){const e=t.o8.intBetween(0,c.length-1,a);s(c[e],u)&&u.push(c[e]),c.splice(e,1)}return o(u,a),{values:u,indexOfGuaranteed:null!==n?u.indexOf(n):-1}},last:f,pipe:h,makePipe:function(e,t){return n=>h(n,e,t)},sortWeighted:function(e,t,n=Math.random){const r=t.map((e=>n()*e)),i=[];for(let o=0;o<e.length;o++)i.push([e[o],r[o]]);return i.sort(((e,t)=>t[1]-e[1])).map((e=>e[0]))},pushAll:q,unshiftAll:function(e,t){Array.prototype.unshift.apply(e,t)},filterAndRemove:function(e,t){const n=[];for(let r=e.length-1;r>=0;r--)t(e[r])&&n.push(e.splice(r,1)[0]);return n},merge:function(e,t){const n=Object.keys(t);for(const r of n)Array.isArray(t[r])&&Array.isArray(e[r])&&q(e[r],t[r])},empty:function(e){return e.splice(0,e.length),e},pushToBucket:function(e,t,n){e[t]||(e[t]=[]),e[t].push(n)},unshiftAndLimit:function(e,t,n){for(e.unshift(t);e.length>n;)e.pop()},atRolling:function(e,t){let n=t%e.length;return n<0&&(n+=e.length),e[n]},group:ft,createOscillator:function(e){let t=0;return{next:()=>e[t++%e.length]}},organiseWithLimits:function(e,t,n,r,i){const o={};for(const s of Object.keys(t))o[s]=[];o[r]=[],i&&(e=e.sort(i));for(const s of e){const e=s[n],i=t[e]?e:r;o[i].length>=t[i]?o[r].push(s):o[i].push(s)}return o},tickPlaybook:function(e){if(0===e.length)return null;const t=e[0];return t.ttlMax?--t.ttl<=0&&e.shift():t.ttlMax=t.ttl,{progress:(t.ttlMax-t.ttl)/t.ttlMax,data:t.data}},getArgument:Wt,getBooleanArgument:function(e,t,n,r){const i=e.some((e=>e.endsWith("-"+t))),o=Wt(e,t,n,r);if(!o&&i)return!0;if(!o&&!i)return null;if(["true","1","yes","y","on"].includes(o.toLowerCase()))return!0;if(["false","0","no","n","off"].includes(o.toLowerCase()))return!1;throw Error(`Invalid boolean argument ${t}: ${o}`)},getNumberArgument:function(e,t,n,r){const i=Wt(e,t,n,r);if(!i)return null;try{return rt(i)}catch{throw new Error(`Invalid number argument ${t}: ${i}`)}},requireStringArgument:Xt,requireNumberArgument:function(e,t,n,r){const i=Xt(e,t,n,r);try{return rt(i)}catch{throw new Error(`Invalid argument ${t}: ${i}`)}},bringToFront:function(e,t){const n=[...e];return Kt(n,t),n},bringToFrontInPlace:Kt,findInstance:function(e,t){const n=e.find((e=>e instanceof t));return pt.of(n)},filterInstances:function(e,t){return e.filter((e=>e instanceof t))},interleave:function(e,t){const n=[],r=Math.max(e.length,t.length);for(let i=0;i<r;i++)e[i]&&n.push(e[i]),t[i]&&n.push(t[i]);return n},toggle:function(e,t){return e.includes(t)?e.filter((e=>e!==t)):[...e,t]},createHierarchy:function(e,t,n,r,i=!1){const o=new Map,s=[];e.forEach((e=>{const n=new dt(e);o.set(e[t],n)})),e.forEach((e=>{const r=o.get(e[t]);if(!r)return;const i=e[n];if(i){const e=o.get(i);e&&e.children.push(r)}else s.push(r)}));const a=e=>{e.children.sort(((e,t)=>{const n=e.value[r],o=t.value[r];return i?o-n:n-o})),e.children.forEach(a)};return s.forEach(a),s},multicall:function(e){return()=>e.forEach((e=>e()))},maxBy:function(e,t){return e.reduce(((e,n)=>t(e)>t(n)?e:n))},minBy:function(e,t){return e.reduce(((e,n)=>t(e)<t(n)?e:n))},allIndexOf:function(e,t){const n=[];return e.forEach(((e,r)=>{t(e)&&n.push(r)})),n}},t.iQ={sleepMillis:i,forever:async function(e,t,n){for(;;){try{await e()}catch(r){n&&n("Error in forever",r)}await i(t)}},scheduleMany:function(e,t){for(let n=0;n<e.length;n++){const r=e[n],i=t[n],o=Math.max(0,i.getTime()-Date.now());setTimeout(r,o)}},waitFor:async function(e,t){let n=t.requiredConsecutivePasses||1,r=0;for(let o=0;o<t.attempts;o++){try{if(await e()){if(r++,r>=n)return}else r=0}catch{r=0}o<t.attempts-1&&await i(t.waitMillis)}throw Error("Timed out waiting for predicate")},expandError:function(e,t){if(T(e))return e;const n=Object.keys(e);e.message&&!n.includes("message")&&n.push("message");const r=n.map((t=>`${t}: ${e[t]}`)).join("; ");return t&&e.stack?r+"\n"+e.stack:r},runAndSetInterval:function(e,t){e();const n=setInterval((()=>{e()}),t);return()=>clearInterval(n)},whereAmI:function(){const e=globalThis.process;return e?!0===e.browser?"browser":"node":"browser"},withRetries:async function(e,t,n,r,o,s){let a=null;for(let u=0;u<=t;u++)try{return await e()}catch(c){if(a=c,u===t)break;const e=n+u/(t-1)*(r-n);o&&o("Error in withRetries, retrying",{attempt:u+1,allowedFailures:t,delayMillis:e,error:c}),s&&s(),await i(e)}throw a}},t.FQ={make:rt,sum:function(e){return e.reduce(((e,t)=>e+t),0)},average:function(e){return e.reduce(((e,t)=>e+t),0)/e.length},median:function(e){const t=[...e].sort(((e,t)=>e-t)),n=Math.floor(t.length/2);return t.length%2==0?(t[n]+t[n-1])/2:t[n]},getDistanceFromMidpoint:function(e,t){return e-(t-1)/2},clamp:it,range:H,interpolate:function(e,t,n){return e+(t-e)*n},createSequence:function(){let e=0;return{next:()=>e++}},increment:function(e,t,n){const r=e+t;return r>n?n:r},decrement:function(e,t,n){const r=e-t;return r<n?n:r},format:function(e,t){const n=t?.longForm??!1,r=t?.unit?` ${t.unit}`:"",i=n?tt:nt,o=t?.precision??1;if(e<et[0])return`${e}${r}`;for(let s=0;s<et.length-1;s++)if(e<et[s+1])return`${(e/et[s]).toFixed(o)}${n?" ":""}${i[s]}${r}`;return`${(e/et[et.length-1]).toFixed(o)}${n?" ":""}${i[et.length-1]}${r}`},fromDecimals:function(e,t,n){let r=e.length-t;if(r<=0)return"0."+"0".repeat(-r)+e+(n?" "+n:"");let i=e.substring(0,r);return""===i&&(i="0"),i+"."+e.substring(r)+(n?" "+n:"")},makeStorage:function(e,t=1024){const n=parseFloat(e);if(isNaN(n))throw Error("makeStorage got NaN for input");const r=e.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),i=""===r?0:qe[r];if(null==i)throw Error(`Unknown unit: "${r}"`);return Math.ceil(n*t**i)},asMegabytes:function(e){return e/1024/1024},convertBytes:function(e,t=1024){return e>=t*t*t*t?(e/t/t/t/t).toFixed(3)+" TB":e>=t*t*t?(e/t/t/t).toFixed(3)+" GB":e>=t*t?(e/t/t).toFixed(3)+" MB":e>=t?(e/t).toFixed(3)+" KB":e+" B"},hexToRgb:function(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e.toLowerCase());if(!t)throw new Error("Invalid hex color: "+e);return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]},rgbToHex:function(e){return"#"+e.map((e=>e.toString(16).padStart(2,"0"))).join("")},haversineDistanceToMeters:function(e,t,n,r){const i=e*Math.PI/180,o=n*Math.PI/180,s=(n-e)*Math.PI/180,a=(r-t)*Math.PI/180,c=Math.sin(s/2)*Math.sin(s/2)+Math.cos(i)*Math.cos(o)*Math.sin(a/2)*Math.sin(a/2);return 2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*6371e3},roundToNearest:m,formatDistance:function(e){return e>1e3?(e/1e3).toFixed(0)+" km":e>=500?m(e,100)+" m":e>=100?m(e,50)+" m":m(e,10)+" m"},triangularNumber:function(e){return e*(e+1)/2},searchFloat:function(e){const t=e.match(/-?\d+(\.\d+)?/);if(!t)throw Error("No float found in "+e);return parseFloat(t[0])},binomialSample:function(e,t,n=Math.random){const r=e*t,i=Math.sqrt(e*t*(1-t)),o=(n()+n()+n()+n()+n()+n()-3)*Math.SQRT2,s=Math.round(r+i*o);return Math.max(0,Math.min(e,s))},toSignificantDigits:function(e,t){if(!e.includes("."))return e;if(0===parseFloat(e))return"0";const[n,r]=e.split("."),i=n.replace("-",""),o=i.length;if(o>=t)return n;if("0"!==i){const e=t-o,i=r.slice(0,e);return/[1-9]/.test(i)?`${n}.${i.replace(/0+$/,"")}`:n}const s=t+(r.match(/^0*/)?.[0].length??0);return`${n}.${r.slice(0,s)}`}},t.AO={getTimestamp:function(e,t){const n=new Date(t?.now||Date.now()),r=t?.labels||Ce,i=z(e)?e:new Date(e);if(Ne(n)===Ne(i))return r.today(i.getUTCHours(),i.getUTCMinutes(),i.getUTCHours()>12);if(Ne(n)-Ne(i)==1)return r.yesterday();const o=Ge(i);return Ne(n)-Ne(i)<7?r[o.day]():r.weeks(Math.round((n.getTime()-i.getTime())/6048e5))},getTimeDelta:Fe,secondsToHumanTime:function(e,t=Pe){return Fe(0,{now:1e3*e,labels:t})},countCycles:function(e,t,n){const r=(n?.now??Date.now())-e;return{cycles:Math.floor(r/t),remaining:t/(n?.precision??1)-Math.ceil(r%t/(n?.precision??1))}},isoDate:function(e){return(e||new Date).toISOString().slice(0,10)},throttle:function(e,t){return(!Me[e]||Date.now()>Me[e])&&(Me[e]=Date.now()+t,!0)},timeSince:function(e,t,n){return t=z(t)?t.getTime():t,((n=n?z(n)?n.getTime():n:Date.now())-t)/Ue[e]},dateTimeSlug:function(e){return(e||new Date).toISOString().slice(0,19).replace(/T|:/g,"-")},unixTimestamp:function(e){return Math.ceil((e||Date.now())/1e3)},fromUtcString:function(e){const t=new Date(e);return new Date(t.getTime()-6e4*t.getTimezoneOffset())},fromMillis:function(e){return new Date(e)},getProgress:function(e,t,n,r){r||(r=Date.now());const i=r-e,o=i/t,s=o*n;return{deltaMs:i,progress:t/n,baseTimeMs:o,totalTimeMs:s,remainingTimeMs:s-i}},humanizeTime:Ve,humanizeProgress:function(e){return`[${Math.floor(100*e.progress)}%] ${Ve(e.deltaMs)} out of ${Ve(e.totalTimeMs)} (${Ve(e.remainingTimeMs)} left) [${Math.round(e.baseTimeMs)} ms each]`},createTimeDigits:De,mapDayNumber:je,getDayInfoFromDate:Ge,getDayInfoFromDateTimeString:function(e){return Ge(new Date(e))},seconds:function(e){return 1e3*e},minutes:function(e){return 6e4*e},hours:function(e){return 36e5*e},days:function(e){return 864e5*e},make:function(e){const t=parseFloat(e);if(isNaN(t))throw Error("makeDate got NaN for input");const n=e.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),r=""===n?1:Ze[n];if(!r)throw Error(`Unknown unit: "${n}"`);return Math.ceil(t*r)},normalizeTime:function(e){let[t,n]=e.split(":");B(parseInt(t,10))||(t="0"),B(parseInt(n,10))||(n="0");let r=it(P(t),0,23),i=it(P(n),0,59);return`${De(r)}:${De(i)}`},absoluteDays:Ne},t.Rb={safeParse:function(e){try{return JSON.parse(e)}catch{return null}},deleteDeep:function(e,t){const n=Y(t,"."),r=ee(t,".");if(!n||!r)return;const i=p(e,n);i&&delete i[r]},getDeep:p,setDeep:d,incrementDeep:function(e,t,n=1){const r=p(e,t)||0;return d(e,t,r+n),r},ensureDeep:function(e,t,n){return p(e,t)||d(e,t,n)},replaceDeep:function(e,t,n){const r=p(e,t);if(!r)throw new Error("Key '"+t+"' does not exist.");return d(e,t,n),r},getFirstDeep:function(e,t,n){for(const r of t){const t=p(e,r);if(t)return t}if(n){const t=Object.values(e);if(t.length)return t[0]}return null},deepMergeInPlace:G,deepMerge2:function(e,t){const n={};return G(n,e),G(n,t),n},deepMerge3:function(e,t,n){const r={};return G(r,e),G(r,t),G(r,n),r},mapAllAsync:async function(e,t){const n=[];for(const r of e)n.push(await t(r));return n},cloneWithJson:function(e){return JSON.parse(JSON.stringify(e))},sortObject:We,sortArray:Xe,sortAny:Ke,deepEquals:Qe,deepEqualsEvery:function(...e){for(let t=1;t<e.length;t++)if(!Qe(e[t-1],e[t]))return!1;return!0},runOn:function(e,t){return t(e),e},ifPresent:function(e,t){e&&t(e)},zip:Z,zipSum:function(e){return Z(e,((e,t)=>e+t))},removeEmptyArrays:function(e){for(const t of Object.keys(e))(w(e[t])||Array.isArray(e[t])&&e[t].every((e=>null==e)))&&delete e[t];return e},removeEmptyValues:function(e){for(const t of Object.entries(e))(null===t[1]||void 0===t[1]||T(t[1])&&R(t[1]))&&delete e[t[0]];return e},flatten:function(e,t=!1,n){return st({},e,n||"",!1,t)},unflatten:function e(t){if(!g(t))return t;const n=Array.isArray(t)?[]:{};for(const[r,i]of Object.entries(t))Array.isArray(i)?d(n,r,i.map((t=>e(t)))):d(n,r,i);return n},match:function(e,t,n){return t[e]?t[e]:n},sort:lt,map:function(e,t){const n={};for(const r of Object.entries(e))n[r[0]]=t(r[1]);return n},mapIterable:function(e,t){const n=[];let r=0;for(const i of e)n.push(t(i,r++));return n},filterKeys:function(e,t){const n={};for(const[r,i]of Object.entries(e))t(r)&&(n[r]=i);return n},filterValues:function(e,t){const n={};for(const[r,i]of Object.entries(e))t(i)&&(n[r]=i);return n},rethrow:async function(e,t){try{return await e()}catch{throw t}},setSomeOnObject:function(e,t,n){null!=n&&(e[t]=n)},setSomeDeep:function(e,t,n,r){const i=p(n,r);null!=i&&d(e,t,i)},flip:function(e){const t={};for(const[n,r]of Object.entries(e))t[r]=n;return t},getAllPermutations:function(e){const t=Object.keys(e),n=t.map((t=>e[t].length)),r=n.reduce(((e,t)=>e*t));let i=1;const o=[1];for(let a=0;a<n.length-1;a++)i*=n[a],o.push(i);const s=[];for(let a=0;a<r;a++){const n={};for(let r=0;r<t.length;r++){const i=e[t[r]],s=Math.floor(a/o[r])%i.length;n[t[r]]=i[s]}s.push(n)}return s},countTruthyValues:function(e){return Object.values(e).filter((e=>e)).length},transformToArray:function(e){const t=[],n=Object.keys(e),r=e[n[0]].length;for(let i=0;i<r;i++){const r={};for(const t of n)r[t]=e[t][i];t.push(r)}return t},setMulti:function(e,t,n){for(const r of e)r[t]=n},incrementMulti:function(e,t,n=1){for(const r of e)r[t]+=n},createBidirectionalMap:function(){return{map:new Map,keys:[]}},createTemporalBidirectionalMap:function(){return{map:new Map,keys:[]}},pushToBidirectionalMap:ht,unshiftToBidirectionalMap:function(e,t,n,r=100){if(e.map.has(t)){const n=e.keys.indexOf(t);e.keys.splice(n,1)}if(e.map.set(t,n),e.keys.unshift(t),e.keys.length>r){const t=e.keys.shift();t&&e.map.delete(t)}},addToTemporalBidirectionalMap:function(e,t,n,r,i=100){ht(e,t,{validUntil:Date.now()+r,data:n},i)},getFromTemporalBidirectionalMap:function(e,t){const n=e.map.get(t);return n&&n.validUntil>Date.now()?n.data:null},createStatefulToggle:function(e){let t;return n=>{const r=n===e&&t!==e;return t=n,r}},diffKeys:function(e,t){const n=Object.keys(e),r=Object.keys(t);return{uniqueToA:n.filter((e=>!r.includes(e))),uniqueToB:r.filter((e=>!n.includes(e)))}},pickRandomKey:Ye,mapRandomKey:function(e,t){const n=Ye(e);return e[n]=t(e[n]),n},fromObjectString:function(e){return e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/\r\n/g,"\n")).replace(/(\w+)\((.+)\)/g,((e,t,n)=>`${t}(${n.replaceAll(",",",")})`))).replace(/(,)(\s+})/g,"$2")).replace(/\.\.\..+?,/g,"")).replace(/({\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',")).replace(/(,\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',")).replace(/:(.+)\?(.+):/g,((e,t,n)=>`: (${t.trim()} && ${n.trim()}) ||`))).replace(/([a-zA-Z0-9]+)( ?: ?{)/g,'"$1"$2')).replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g,((e,t,n,r)=>`"${t}":"${n.trim()}"${r}`))).replace(/("'|'")/g,'"')).replaceAll(",",","),JSON.parse(e)},toQueryString:_e,parseQueryString:function(e){const t={},n=e.split("&");for(const r of n){const[e,n]=r.split("=");e&&n&&(t[e]=decodeURIComponent(n))}return t},hasKey:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},selectMax:function(e,t){let n=null,r=-1/0;for(const[i,o]of Object.entries(e)){const e=t(o);e>r&&(r=e,n=i)}return n?[n,e[n]]:null},reposition:function(e,t,n,r){const i=e.find((e=>e[t]===n)),o=e.find((e=>e[t]===n+r));i&&o?(i[t]=n+r,o[t]=n):i&&(i[t]=n+r),e.sort(((e,n)=>C(e[t])-C(n[t]))),e.forEach(((e,n)=>e[t]=n+1))},unwrapSingleKey:function(e){const t=Object.keys(e);if(1===t.length)return e[t[0]];throw new Error("Expected object to have a single key")},parseKeyValues:function(e,t=":"){return Object.fromEntries(e.map((e=>te(e,t))).map((e=>e[0]&&e[1]?[oe(e[0]),oe(e[1])]:null)).filter((e=>e)))},errorMatches:function(e,t){if(!e)return!1;const n=e.message;return"string"==typeof n&&n.includes(t)}},t.Or={isFunction:v,isObject:g,isStrictlyObject:y,isEmptyArray:w,isEmptyObject:function(e){return y(e)&&0===Object.keys(e).length},isUndefined:b,isString:T,isNumber:B,isBoolean:E,isDate:z,isBlank:R,isId:x,isIntegerString:I,isHexString:$,isUrl:M,isBigint:U,isNullable:function(e,t){return null==t||e(t)},asString:V,asHexString:function(e,t){if(!$(e))throw new TypeError(`Expected hex string${t?.name?` for ${t.name}`:""}, got: `+e);if(t?.strictPrefix&&!e.startsWith("0x")&&!e.startsWith("0X"))throw new TypeError(`Expected hex string with 0x prefix${t?.name?` for ${t.name}`:""}, got: `+e);const n=e.replace(/^0x/i,"");if(n.length%2!=0&&!t?.uneven)throw RangeError(`Expected even number of hex digits${t?.name?` for ${t.name}`:""}; got: `+e);if(t&&t.byteLength&&n.length!==2*t.byteLength)throw RangeError(`Expected hex string${t?.name?` for ${t.name}`:""} of byte length ${t.byteLength}; got: `+n);return`0x${n}`},asSafeString:function(e,t){if(!V(e,t).split("").every((e=>"_"===e||le(e))))throw new TypeError(`Expected safe string${t?.name?` for ${t.name}`:""}, got: `+e);return e},asIntegerString:function(e,t){if(!I(e))throw new TypeError(`Expected integer string${t?.name?` for ${t.name}`:""}, got: `+e);const n=BigInt(e);if(t&&(t.min&&n<t.min||t.max&&n>t.max))throw RangeError(`Expected integer string${t?.name?` for ${t.name}`:""} in range: ${t.min??"-inf"}..${t.max??"inf"}; got: `+n);return e},asNumber:C,asFunction:function(e,t){if(!v(e))throw new TypeError(`Expected function${t?.name?` for ${t.name}`:""}, got: `+e);return e},asInteger:P,asBoolean:function(e,t){if("true"===e)return!0;if("false"===e)return!1;if(!E(e))throw new TypeError(`Expected boolean${t?.name?` for ${t.name}`:""}, got: `+e);return e},asDate:function(e,t){if(!z(e))throw new TypeError(`Expected date${t?.name?` for ${t.name}`:""}, got: `+e);return e},asNullableString:function(e){return R(e)?null:e},asEmptiableString:function(e,t){if(!T(e))throw new TypeError(`Expected string${t?.name?` for ${t.name}`:""}, got: `+e);return e},asId:function(e,t){if(x(e))return e;const n=parseInt(e,10);if(!x(n))throw new TypeError(`Expected id${t?.name?` for ${t.name}`:""}, got: `+e);return n},asTime:function(e,t){if(!T(e))throw new TypeError(`Expected time${t?.name?` for ${t.name}`:""}, got: `+e);const n=e.split(":");if(2!==n.length)throw new TypeError(`Expected time${t?.name?` for ${t.name}`:""}, got: `+e);const r=parseInt(n[0],10),i=parseInt(n[1],10);if(!B(r)||!B(i)||r<0||r>23||i<0||i>59)throw new TypeError(`Expected time, got${t?.name?` for ${t.name}`:""}: `+e);return`${String(r).padStart(2,"0")}:${String(i).padStart(2,"0")}`},asArray:function(e,t){if(!Array.isArray(e))throw new TypeError(`Expected array${t?.name?` for ${t.name}`:""}, got: `+e);return e},asObject:F,asNullableObject:function(e,t){return null===e?null:F(e,t)},asStringMap:function(e,t){const n=F(e,t);for(const r of Object.keys(n))if(!T(n[r]))throw new TypeError(`Expected string map${t?.name?` for ${t.name}`:""}, got: `+e);return n},asNumericDictionary:function(e,t){const n=F(e),r=Object.keys(n),i=Object.values(n);if(!r.every(T)||!i.every(B))throw new TypeError(`Expected numeric dictionary${t?.name?` for ${t.name}`:""}, got: `+e);return n},asUrl:function(e,t){if(!M(e))throw new TypeError(`Expected url${t?.name?` for ${t.name}`:""}, got: `+e);return e},asBigint:L,asEmptiable:function(e,t){return""===t?void 0:e(t)},asNullable:function(e,t){return null==t?null:e(t)},asOptional:function(e,t){return null==t?void 0:e(t)},enforceObjectShape:j,enforceArrayShape:function(e,t){return e.every((e=>j(e,t)))},isPng:yt,isJpg:wt,isWebp:bt,isImage:function(e){return yt(e)||wt(e)||bt(e)}},t.DH={tokenizeByCount:function(e,t){return ut(e,Math.ceil(e.length/t))},tokenizeByLength:ut,searchHex:function(e,t){const n=new RegExp(`[0-9a-f]{${t}}`,"i"),r=e.match(n);return r?r[0]:null},searchSubstring:function(e,t,n=k){const r=ne(e,n);for(const i of r)if(t(i))return i;return null},randomHex:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=D[Math.floor(16*t())];return n},randomLetter:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=S[Math.floor(26*t())];return n},randomAlphanumeric:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=A[Math.floor(62*t())];return n},randomRichAscii:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=O[Math.floor(89*t())];return n},randomUnicode:function(e,t=Math.random){let n="";for(let r=0;r<e;r++)n+=_[Math.floor(t()*_.length)];return n},includesAny:function(e,t){return t.some((t=>e.includes(t)))},slugify:J,normalForm:function(e){return J(e).replaceAll("-","")},enumify:function(e){return J(e).replace(/-/g,"_").toUpperCase()},escapeHtml:function(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},decodeHtmlEntities:function(e){let t=e.replace(/&#(\d+);/g,((e,t)=>String.fromCharCode(t))).replace(/&#x(\d+);/g,((e,t)=>String.fromCharCode(parseInt(t,16))));for(const[n,r]of Object.entries(X))t=t.replaceAll(n,r);return t},after:Q,afterLast:ee,before:K,beforeLast:Y,betweenWide:function(e,t,n){const r=Y(e,n);return r?Q(r,t):null},betweenNarrow:function(e,t,n){const r=Q(e,t);return r?K(r,n):null},getPreLine:function(e){return e.replace(/ +/g," ").replace(/^ /gm,"")},containsWord:ke,containsWords:function(e,t,n){return"any"===n?t.some((t=>ke(e,t))):t.every((t=>ke(e,t)))},joinUrl:Je,getFuzzyMatchScore:W,sortByFuzzyScore:function(e,t){return e.filter((e=>W(e,t))).sort(((e,n)=>W(n,t)-W(e,t)))},splitOnce:te,splitAll:ne,randomize:function(e,t=Math.random){return e.replace(/\{(.+?)\}/g,((e,n)=>l(n.split("|"),t)))},expand:function e(t){const n=t.match(/\{(.+?)\}/);if(!n||!n.index)return[t];const r=n[1].split(","),i=t.slice(0,n.index),o=t.slice(n.index+n[0].length);let s=[];for(const a of r){const t=e(i+a+o);s=s.concat(t)}return s},shrinkTrim:oe,capitalize:se,decapitalize:ae,csvEscape:function(e){return e.match(/"|,/)?`"${e.replace(/"/g,'""')}"`:e},parseCsv:function(e,t=",",n='"'){const r=[];let i="",o=!1;const s=e.split("");for(const a of s)a!==t||o?a!==n||(i||o)&&!o?i+=a:o=!o:(r.push(i),i="");return r.push(i),r},surroundInOut:function(e,t){return t+e.split("").join(t)+t},getExtension:re,getBasename:ie,normalizeEmail:function(e){let[t,n]=e.split("@");t=oe(t.replaceAll(".","").toLowerCase()).replaceAll(" ","");const[r]=t.split("+");if(!r||!n||-1===n.indexOf(".")||n.indexOf(".")===n.length-1)throw new Error("Invalid email");return n=oe(n.toLowerCase()).replaceAll(" ",""),`${r}@${n}`},normalizeFilename:function(e){const t=ie(e),n=re(e);return n?`${t}.${n}`:t},parseFilename:function(e){const t=ie(e),n=re(e);return{basename:t,extension:n,filename:n?`${t}.${n}`:t}},camelToTitle:function(e){return se(e.replace(/([A-Z])/g," $1"))},slugToTitle:function(e){return e.split("-").map(se).join(" ")},slugToCamel:function(e){return ae(e.split("-").map(se).join(""))},joinHumanly:function(e,t=", ",n=" and "){return e&&e.length?1===e.length?e[0]:2===e.length?`${e[0]}${n}${e[1]}`:`${e.slice(0,e.length-1).join(t)}${n}${e[e.length-1]}`:""},findWeightedPair:ve,extractBlock:Te,extractAllBlocks:function(e,t){const n=[];let r=t.wordBoundary?ge(e,[`${t.opening} `,`${t.opening}\n`],t.start||0):e.indexOf(t.opening,t.start||0);for(;;){if(-1===r)return n;const i=Te(e,{...t,start:r});if(!i)return n;n.push(i),r=t.wordBoundary?ge(e,[`${t.opening} `,`${t.opening}\n`],r+i.length):e.indexOf(t.opening,r+i.length)}},replaceBlocks:function(e,n,r){let i=0;for(;;){const o=t.DH.extractBlock(e,{...r,start:i});if(!o)return e;const s=n(o);i=e.indexOf(o,i)+s.length,e=e.replace(o,s)}},indexOfEarliest:ge,lastIndexOfBefore:be,parseHtmlAttributes:function(e){const t={},n=e.match(/([a-z\-]+)="([^"]+)"/g);if(n)for(const r of n){const[e,n]=te(r,"=");t[e]=n.slice(1,n.length-1)}return t},readNextWord:Se,readWordsAfterAll:function(e,t,n=[]){const r=me(e,t),i=[];for(const o of r)i.push(Se(e,o+t.length,n));return i},resolveVariables:function(e,t,n="$",r=":"){for(const i in t)e=Ae(e,i,t[i],n,r);return e=Oe(e)},resolveVariableWithDefaultSyntax:Ae,resolveRemainingVariablesWithDefaults:Oe,isLetter:ce,isDigit:ue,isLetterOrDigit:le,isValidObjectPathCharacter:function(e){return le(e)||"."===e||"["===e||"]"===e||"_"===e},insert:function(e,t,n,r,i){return e.slice(0,t)+r+e.slice(t,t+n)+i+e.slice(t+n)},indexOfRegex:pe,allIndexOf:me,lineMatches:de,linesMatchInOrder:function(e,t,n=!0){let r=0;for(const i of t){let t=!1;for(;!t&&r<e.length;)de(e[r],i,n)&&(t=!0),r++;if(!t)return!1}return!0},represent:function e(t,n="json",r=0){if(t&&v(t.represent)){const e=t.represent();if(T(e))return"json"===n&&0===r?JSON.stringify(e):e}if(g(t,!1)){if(r>1)return"[object Object]";if("json"===n){if(Array.isArray(t)){const n=t.map((t=>e(t,"json",r+1)));return 0===r?JSON.stringify(n):n}const n={};t.message&&(n.message=e(t.message,"json",r+1));for(const[i,o]of Object.entries(t))n[i]=e(o,"json",r+1);return 0===r?JSON.stringify(n):n}if("key-value"===n){const n=Object.keys(t);return t.message&&!n.includes("message")&&n.unshift("message"),n.map((n=>`${n}=${JSON.stringify(e(t[n],"json",r+1))}`)).join(" ")}}return b(t)&&(t="undefined"),0===r?JSON.stringify(t):t},resolveMarkdownLinks:function(e,t){let n=e.indexOf("](");for(;-1!==n;){const r=be(e,"[",n),i=e.indexOf(")",n);if(-1!==r&&-1!==i){const[n,o]=e.slice(r+1,i).split("]("),s=t(n,o);e=e.slice(0,r)+s+e.slice(i+1)}n=e.indexOf("](",n+1)}return e},buildUrl:function(e,t,n){return Je([e,t])+_e(n||{})},isChinese:function(e){return/^[\u4E00-\u9FA5]+$/.test(e)},replaceBetweenStrings:function(e,t,n,r,i=!0){const o=e.indexOf(t),s=e.indexOf(n,o+t.length);if(-1===o||-1===s)throw Error("Start or end not found");return i?e.substring(0,o+t.length)+r+e.substring(s):e.substring(0,o)+r+e.substring(s+n.length)},describeMarkdown:function(e){let t="p";return e.startsWith("#")?(t="h1",e=e.slice(1).trim()):e.startsWith("-")&&(t="li",e=e.slice(1).trim()),{type:t,isCapitalized:e[0]===e[0].toUpperCase(),hasPunctuation:/[.?!]$/.test(e),endsWithColon:/:$/.test(e)}},isBalanced:function(e,t="(",n=")"){let r=0,i=0;for(;i<e.length;)if(e.startsWith(t,i)?(r++,i+=t.length):e.startsWith(n,i)?(r--,i+=n.length):i++,r<0)return!1;return t===n?r%2==0:0===r},textToFormat:function(e){let t=(e=e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")).length;for(;(e=e.replace(/(\w+)[\s,']+\w+/g,"$1")).length!==t;)t=e.length;return e=(e=(e=e.replaceAll(/[A-Z][a-zA-Z0-9]*/g,"A")).replaceAll(/[a-z][a-zA-Z0-9]*/g,"a")).replaceAll(/[\u4E00-\u9FA5]+/g,"Z")},splitFormatting:function(e,t){const n=[];let r=0;for(;r<e.length;){const i=e.indexOf(t,r);if(-1===i){n.push({string:e.slice(r),symbol:null});break}const o=e.indexOf(t,i+t.length);if(i>r&&-1!==o&&n.push({string:e.slice(r,i),symbol:null}),-1===o){n.push({string:e.slice(r),symbol:null});break}n.push({string:e.slice(i+t.length,o),symbol:t}),r=o+t.length}return n},splitHashtags:function(e){const t=[];let n=0;for(;n<e.length;){const r=we(e,n);if(-1===r){t.push({string:e.slice(n),symbol:null});break}const i=ye(e,r+1);if(-1===i){t.push({string:e.slice(n,r),symbol:null}),t.push({string:e.slice(r+1),symbol:"#"});break}r>n&&t.push({string:e.slice(n,r),symbol:null}),t.push({string:e.slice(r+1,i),symbol:"#"}),n=i}return t},splitUrls:function(e){const t=[];let n=0;for(;n<e.length;){const r=ge(e,["http://","https://"],n);if(-1===r){t.push({string:e.slice(n),symbol:null});break}const i=ge(e,[" ","\n"],r);if(-1===i){r>n&&t.push({string:e.slice(n,r),symbol:null}),t.push({string:e.slice(r),symbol:"http"});break}r>n&&t.push({string:e.slice(n,r),symbol:null}),t.push({string:e.slice(r,i),symbol:"http"}),n=i}return t},route:function(e,t){const n=e.split("/").filter((e=>e)),r=t.split("/").filter((e=>e));if(n.length!==r.length)return null;const i={};for(let o=0;o<n.length;o++){const e=n[o];if(e.startsWith(":"))i[e.slice(1)]=r[o];else if(e!==r[o])return null}return i},explodeReplace:xe,generateVariants:function(e,n,r,i=Math.random){const o=t.DO.shuffle(n.map((e=>({variants:t.DO.shuffle(e.variants.map((e=>e)),i),avoid:e.avoid}))),i),s=[];for(const t of o){const n=t.variants.filter((e=>e!==t.avoid)),i=n.find((t=>e.includes(t)));if(i&&(q(s,xe(e,i,n)),s.length>=r))break}if(s.length<r)for(const t of o){const n=t.variants.find((t=>e.includes(t)));if(n&&(q(s,xe(e,n,t.variants)),s.length>=r))break}return s.slice(0,r)},replaceWord:function(e,t,n,r=!1){const i=new RegExp(r?`(?<=\\s|^)${t}(?=\\s|$)`:`\\b${t}\\b`,"g");return e.replace(i,n)},replacePascalCaseWords:function(e,t){return e.replace(/\b[A-Z][a-zA-Z0-9]*\b/g,(e=>e.toUpperCase()===e?e:t(e)))},stripHtml:function(e){return e.replace(/<[^>]*>/g,"")},breakLine:Ie,measureTextWidth:function(e,t={}){return[...e].reduce(((e,n)=>e+(t[n]||1)),0)},toLines:function(e,t,n={}){const r=[];let i="",o=0;for(let s=0;s<e.length;s++){const a=e[s];if(i+=a,o+=n[a]||1,o>t){const{line:e,rest:t}=Ie(i);r.push(e),i=t,o=t.split("").map((e=>n[e]||1)).reduce(((e,t)=>e+t),0)}}return i&&r.push(i),r},levenshteinDistance:function(e,t){const n=[];for(let r=0;r<=e.length;r++)n[r]=[r];for(let r=0;r<=t.length;r++)n[0][r]=r;for(let r=1;r<=e.length;r++)for(let i=1;i<=t.length;i++){const o=e[r-1]===t[i-1]?0:1;n[r][i]=Math.min(n[r-1][i]+1,n[r][i-1]+1,n[r-1][i-1]+o)}return n[e.length][t.length]},findCommonPrefix:$e,findCommonDirectory:function(e){const t=$e(e),n=t.lastIndexOf("/");return-1===n?"":t.slice(0,n+1)}}},878(e,t,n){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(n){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(n){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(945)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},945(e,t,n){e.exports=function(e){function t(e){let n,i,o,s=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];n=o.call(r,t),e.splice(s,1),s--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e,t){let n=0,r=0,i=-1,o=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||"*"===t[r]))"*"===t[r]?(i=r,o=n,r++):(n++,r++);else{if(-1===i)return!1;r=i+1,o++,n=o}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const r of n)"-"===r[0]?t.skips.push(r.slice(1)):t.names.push(r)},t.enabled=function(e){for(const n of t.skips)if(i(e,n))return!1;for(const n of t.names)if(i(e,n))return!0;return!1},t.humanize=n(192),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},192(e){var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i,s=365.25*i;function a(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=r)return a(e,o,r,"hour");if(o>=n)return a(e,o,n,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=r)return Math.round(e/r)+"h";if(o>=n)return Math.round(e/n)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},963(e,t,n){"use strict";const r=n(527),{MAX_LENGTH:i,MAX_SAFE_INTEGER:o}=n(197),{safeRe:s,t:a}=n(423),c=n(676),{compareIdentifiers:u}=n(956);class l{constructor(e,t){if(t=c(t),e instanceof l){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);r("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?s[a.LOOSE]:s[a.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<o)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(r("SemVer.compare",this.version,this.options,e),!(e instanceof l)){if("string"==typeof e&&e===this.version)return 0;e=new l(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof l||(e=new l(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof l||(e=new l(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],i=e.prerelease[t];if(r("prerelease compare",t,n,i),void 0===n&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===n)return-1;if(n!==i)return u(n,i)}while(++t)}compareBuild(e){e instanceof l||(e=new l(e,this.options));let t=0;do{const n=this.build[t],i=e.build[t];if(r("build compare",t,n,i),void 0===n&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===n)return-1;if(n!==i)return u(n,i)}while(++t)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?s[a.PRERELEASELOOSE]:s[a.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];if(!1===n&&(r=[t]),((e,t)=>{const n=t.split(".");if(n.length>e.length)return!1;for(let r=0;r<n.length;r++)if(0!==u(e[r],n[r]))return!1;return!0})(this.prerelease,t)){const e=this.prerelease[t.split(".").length];isNaN(e)&&(this.prerelease=r)}else this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=l},359(e,t,n){"use strict";const r=n(963);e.exports=(e,t)=>new r(e,t).major},197(e){"use strict";const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},527(e){"use strict";const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},956(e){"use strict";const t=/^[0-9]+$/,n=(e,n)=>{if("number"==typeof e&&"number"==typeof n)return e===n?0:e<n?-1:1;const r=t.test(e),i=t.test(n);return r&&i&&(e=+e,n=+n),e===n?0:r&&!i?-1:i&&!r?1:e<n?-1:1};e.exports={compareIdentifiers:n,rcompareIdentifiers:(e,t)=>n(t,e)}},676(e){"use strict";const t=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:n},423(e,t,n){"use strict";const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:o}=n(197),s=n(527),a=(t=e.exports={}).re=[],c=t.safeRe=[],u=t.src=[],l=t.safeSrc=[],f=t.t={};let h=0;const p="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",o],[p,i]],m=(e,t,n)=>{const r=(e=>{for(const[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=h++;s(e,i,t),f[e]=i,u[i]=t,l[i]=r,a[i]=new RegExp(t,n?"g":void 0),c[i]=new RegExp(r,n?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),m("MAINVERSION",`(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${u[f.PRERELEASEIDENTIFIER]}(?:\\.${u[f.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${u[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[f.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${p}+`),m("BUILD",`(?:\\+(${u[f.BUILDIDENTIFIER]}(?:\\.${u[f.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${u[f.MAINVERSION]}${u[f.PRERELEASE]}?${u[f.BUILD]}?`),m("FULL",`^${u[f.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${u[f.MAINVERSIONLOOSE]}${u[f.PRERELEASELOOSE]}?${u[f.BUILD]}?`),m("LOOSE",`^${u[f.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${u[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${u[f.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:${u[f.PRERELEASE]})?${u[f.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:${u[f.PRERELEASELOOSE]})?${u[f.BUILD]}?)?)?`),m("XRANGE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),m("COERCE",`${u[f.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",u[f.COERCEPLAIN]+`(?:${u[f.PRERELEASE]})?`+`(?:${u[f.BUILD]})?(?:$|[^\\d])`),m("COERCERTL",u[f.COERCE],!0),m("COERCERTLFULL",u[f.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${u[f.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${u[f.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${u[f.LONECARET]}${u[f.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${u[f.LONECARET]}${u[f.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${u[f.GTLT]}\\s*(${u[f.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]}|${u[f.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${u[f.XRANGEPLAIN]})\\s+-\\s+(${u[f.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${u[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[f.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},497(){},61(){},320(){}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{BRANCHES:()=>Eo,BZZ:()=>Vo,BatchId:()=>co,Bee:()=>su,BeeArgumentError:()=>mo,BeeError:()=>po,BeeModes:()=>vo,BeeResponseError:()=>go,Bytes:()=>Ji,CHUNK_SIZE:()=>zo,DAI:()=>No,Duration:()=>_o,EthAddress:()=>no,FeedIndex:()=>ho,Identifier:()=>ro,MantarayNode:()=>Wc,MerkleTree:()=>i.vU,NULL_ADDRESS:()=>fu,NULL_IDENTIFIER:()=>hu,NULL_OWNER:()=>pu,NULL_STAMP:()=>uu,NULL_TOPIC:()=>lu,PSS_TARGET_HEX_LENGTH_MAX:()=>Ro,PeerAddress:()=>ao,PrivateKey:()=>eo,PublicKey:()=>to,RedundancyLevel:()=>So,RedundancyStrategy:()=>Ao,Reference:()=>io,SECTION_SIZE:()=>Bo,STAMPS_DEPTH_MAX:()=>Io,STAMPS_DEPTH_MIN:()=>xo,SUPPORTED_BEE_VERSION:()=>yc,SUPPORTED_BEE_VERSION_EXACT:()=>gc,SWARM_GATEWAY_URL:()=>cu,Signature:()=>uo,Size:()=>Do,Span:()=>so,Stamper:()=>au,TAGS_LIMIT_MAX:()=>ko,TAGS_LIMIT_MIN:()=>$o,Topic:()=>lo,TransactionId:()=>oo,Utils:()=>e,capacityBreakpoints:()=>Oo,toBeeMode:()=>To});var e={};n.r(e),n.d(e,{approximateOverheadForRedundancyLevel:()=>Eu,convertEnvelopeToMarshaledStamp:()=>gs,getAmountForDuration:()=>ds,getCollectionSize:()=>aa,getDepthForSize:()=>ms,getFolderSize:()=>eu,getRedundancyStat:()=>ku,getRedundancyStats:()=>$u,getStampCost:()=>hs,getStampDuration:()=>ps,getStampEffectiveBytes:()=>ls,getStampEffectiveBytesBreakpoints:()=>fs,getStampTheoreticalBytes:()=>cs,getStampUsage:()=>as,makeCollectionFromFileList:()=>sa,makeMaxTarget:()=>du,mapPostageBatch:()=>ys,unmapPostageBatch:()=>ws});var t,i=n(20);function o(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=s.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class o extends i{}function s(e){var t;const i=n?.Parent?new o:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}Symbol("zod_brand");class s extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class a extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(t=globalThis).__zod_globalConfig??(t.__zod_globalConfig={});const c=globalThis.__zod_globalConfig;function u(e){return e&&Object.assign(c,e),c}const l=/^[cC][0-9a-z]{6,}$/,f=/^[0-9a-z]+$/,h=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,p=/^[0-9a-vA-V]{20}$/,d=/^[A-Za-z0-9]{27}$/,m=/^[a-zA-Z0-9_-]{21}$/,g=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,y=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,w=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,b=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const v=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,T=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,B=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,E=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,z=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,R=/^[A-Za-z0-9_-]*$/,x=/^https?$/,I=/^\+[1-9]\d{6,14}$/,$="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",k=new RegExp(`^${$}$`);function S(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const A=/^-?\d+n?$/,O=/^-?\d+$/,_=/^-?\d+(?:\.\d+)?$/,D=/^(?:true|false)$/i,V=/^[^A-Z]*$/,N=/^[^a-z]*$/;function C(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}function P(e,t){return"bigint"==typeof t?t.toString():t}function F(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function M(e){return null==e}function U(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const L=Symbol("evaluating");function j(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==L)return void 0===r&&(r=L,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function G(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Z(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function q(e){return JSON.stringify(e)}const H="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function J(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const W=F((()=>{if(c.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function X(e){if(!1===J(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==J(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function K(e){return X(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Q=new Set(["string","number","symbol"]);function Y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ee(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function te(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const ne={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function re(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function ie(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function oe(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function se(e){return"string"==typeof e?e:e?.message}function ae(e,t,n){const r=e.message?e.message:se(e.inst?._zod.def?.error?.(e))??se(t?.error?.(e))??se(n.customError?.(e))??se(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function ce(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ue(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const le=o("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),fe={number:"number",bigint:"bigint",object:"date"},he=o("$ZodCheckLessThan",((e,t)=>{le.init(e,t);const n=fe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),pe=o("$ZodCheckGreaterThan",((e,t)=>{le.init(e,t);const n=fe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),de=o("$ZodCheckMultipleOf",((e,t)=>{le.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),me=o("$ZodCheckNumberFormat",((e,t)=>{le.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=ne[t.format];e._zod.onattach.push((e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=o,n&&(r.pattern=O)})),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}})),ge=o("$ZodCheckMaxLength",((e,t)=>{var n;le.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!M(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=ce(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}})),ye=o("$ZodCheckMinLength",((e,t)=>{var n;le.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!M(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=ce(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}})),we=o("$ZodCheckLengthEquals",((e,t)=>{var n;le.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!M(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const o=ce(r),s=i>t.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),be=o("$ZodCheckStringFormat",((e,t)=>{var n,r;le.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})})),ve=o("$ZodCheckRegex",((e,t)=>{be.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),Te=o("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=V),be.init(e,t)})),Be=o("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=N),be.init(e,t)})),Ee=o("$ZodCheckIncludes",((e,t)=>{le.init(e,t);const n=Y(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)})),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}})),ze=o("$ZodCheckStartsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`^${Y(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),Re=o("$ZodCheckEndsWith",((e,t)=>{le.init(e,t);const n=new RegExp(`.*${Y(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}));const xe=o("$ZodCheckOverwrite",((e,t)=>{le.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class Ie{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),r=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const i of r)this.content.push(i)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const $e=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,P,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ke=o("$ZodError",$e),Se=o("$ZodError",$e,{Parent:Error});const Ae=e=>(t,n,r,i)=>{const o=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new s;if(a.issues.length){const t=new(i?.Err??e)(a.issues.map((e=>ae(e,o,u()))));throw H(t,i?.callee),t}return a.value},Oe=Ae(Se),_e=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(i?.Err??e)(s.issues.map((e=>ae(e,o,u()))));throw H(t,i?.callee),t}return s.value},De=_e(Se),Ve=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new s;return o.issues.length?{success:!1,error:new(e??ke)(o.issues.map((e=>ae(e,i,u()))))}:{success:!0,data:o.value}},Ne=Ve(Se),Ce=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map((e=>ae(e,i,u()))))}:{success:!0,data:o.value}},Pe=Ce(Se),Fe=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ae(e)(t,n,i)},Me=e=>(t,n,r)=>Ae(e)(t,n,r),Ue=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return _e(e)(t,n,i)},Le=e=>async(t,n,r)=>_e(e)(t,n,r),je=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ve(e)(t,n,i)},Ge=e=>(t,n,r)=>Ve(e)(t,n,r),Ze=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ce(e)(t,n,i)},qe=e=>async(t,n,r)=>Ce(e)(t,n,r),He={major:4,minor:4,patch:3};const Je=o("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=He;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const t of i._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let r,i=re(e);for(const o of t){if(o._zod.def.when){if(ie(e))continue;if(!o._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,a=o._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new s;if(r||a instanceof Promise)r=(r??Promise.resolve()).then((async()=>{await a;e.issues.length!==t&&(i||(i=re(e,t)))}));else{if(e.issues.length===t)continue;i||(i=re(e,t))}}return r?r.then((()=>e)):e},n=(n,i,o)=>{if(re(n))return n.aborted=!0,n;const a=t(i,r,o);if(a instanceof Promise){if(!1===o.async)throw new s;return a.then((t=>e._zod.parse(t,o)))}return e._zod.parse(a,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if("backward"===o.direction){const t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then((e=>n(e,i,o))):n(t,i,o)}const a=e._zod.parse(i,o);if(a instanceof Promise){if(!1===o.async)throw new s;return a.then((e=>t(e,r,o)))}return t(a,r,o)}}j(e,"~standard",(()=>({validate:t=>{try{const n=Ne(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Pe(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1})))})),We=o("$ZodString",((e,t)=>{var n;Je.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Xe=o("$ZodStringFormat",((e,t)=>{be.init(e,t),We.init(e,t)})),Ke=o("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=y),Xe.init(e,t)})),Qe=o("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=w(e))}else t.pattern??(t.pattern=w());Xe.init(e,t)})),Ye=o("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=b),Xe.init(e,t)})),et=o("$ZodURL",((e,t)=>{Xe.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===x.source&&!/^https?:\/\//i.test(r))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),tt=o("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Xe.init(e,t)})),nt=o("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=m),Xe.init(e,t)})),rt=o("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=l),Xe.init(e,t)})),it=o("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=f),Xe.init(e,t)})),ot=o("$ZodULID",((e,t)=>{t.pattern??(t.pattern=h),Xe.init(e,t)})),st=o("$ZodXID",((e,t)=>{t.pattern??(t.pattern=p),Xe.init(e,t)})),at=o("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=d),Xe.init(e,t)})),ct=o("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){const t=S({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${$}T(?:${r})$`)}(t)),Xe.init(e,t)})),ut=o("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=k),Xe.init(e,t)})),lt=o("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${S(t)}$`)),Xe.init(e,t)})),ft=o("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=g),Xe.init(e,t)})),ht=o("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=v),Xe.init(e,t),e._zod.bag.format="ipv4"})),pt=o("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=T),Xe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),dt=o("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=B),Xe.init(e,t)})),mt=o("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=E),Xe.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function gt(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const yt=o("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=z),Xe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{gt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}));const wt=o("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=R),Xe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!R.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return gt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),bt=o("$ZodE164",((e,t)=>{t.pattern??(t.pattern=I),Xe.init(e,t)}));const vt=o("$ZodJWT",((e,t)=>{Xe.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),Tt=o("$ZodNumber",((e,t)=>{Je.init(e,t),e._zod.pattern=e._zod.bag.pattern??_,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}})),Bt=o("$ZodNumberFormat",((e,t)=>{me.init(e,t),Tt.init(e,t)})),Et=o("$ZodBoolean",((e,t)=>{Je.init(e,t),e._zod.pattern=D,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(o){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}})),zt=o("$ZodBigInt",((e,t)=>{Je.init(e,t),e._zod.pattern=A,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(i){}return"bigint"==typeof n.value||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}})),Rt=o("$ZodAny",((e,t)=>{Je.init(e,t),e._zod.parse=e=>e})),xt=o("$ZodUnknown",((e,t)=>{Je.init(e,t),e._zod.parse=e=>e})),It=o("$ZodNever",((e,t)=>{Je.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function $t(e,t,n){e.issues.length&&t.issues.push(...oe(n,e.issues)),t.value[n]=e.value}const kt=o("$ZodArray",((e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?o.push(a.then((t=>$t(t,n,e)))):$t(a,n,e)}return o.length?Promise.all(o).then((()=>n)):n}}));function St(e,t,n,r,i,o){const s=n in r;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...oe(n,e.issues))}s||i?void 0===e.value?s&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function At(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter((e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout)));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ot(e,t,n,r,i,o){const s=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,l="optional"===c.optin,f="optional"===c.optout;for(const h in t){if("__proto__"===h)continue;if(a.has(h))continue;if("never"===u){s.push(h);continue}const i=c.run({value:t[h],issues:[]},r);i instanceof Promise?e.push(i.then((e=>St(e,n,h,t,l,f)))):St(i,n,h,t,l,f)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then((()=>n)):n}const _t=o("$ZodObject",((e,t)=>{Je.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=F((()=>At(t)));j(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n}));const i=J,o=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=r.value);const a=t.value;if(!i(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],u=s.shape;for(const e of s.keys){const r=u[e],i="optional"===r._zod.optin,o="optional"===r._zod.optout,s=r._zod.run({value:a[e],issues:[]},n);s instanceof Promise?c.push(s.then((n=>St(n,t,e,a,i,o)))):St(s,t,e,a,i,o)}return o?Ot(c,a,t,n,r.value,e):c.length?Promise.all(c).then((()=>t)):t}})),Dt=o("$ZodObjectJIT",((e,t)=>{_t.init(e,t);const n=e._zod.parse,r=F((()=>At(t)));let i;const o=J,s=!c.jitless,a=s&&W.value,u=t.catchall;let l;e._zod.parse=(c,f)=>{l??(l=r.value);const h=c.value;return o(h)?s&&a&&!1===f?.async&&!0!==f.jitless?(i||(i=(e=>{const t=new Ie(["shape","payload","ctx"]),n=r.value,i=e=>{const t=q(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let s=0;for(const r of n.keys)o[r]="key_"+s++;t.write("const newResult = {};");for(const r of n.keys){const n=o[r],s=q(r),a=e[r],c="optional"===a?._zod?.optin,u="optional"===a?._zod?.optout;t.write(`const ${n} = ${i(r)};`),c&&u?t.write(`\n if (${n}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):c?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${s} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${s}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${s}] = undefined;\n } else {\n newResult[${s}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),c=i(c,f),u?Ot([],h,c,f,l,e):c):n(c,f):(c.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),c)}}));function Vt(e,t,n,r){for(const o of e)if(0===o.issues.length)return t.value=o.value,t;const i=e.filter((e=>!re(e)));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>ae(e,r,u())))))}),t)}const Nt=o("$ZodUnion",((e,t)=>{Je.init(e,t),j(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),j(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),j(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),j(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>U(e.source))).join("|")})$`)}}));const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then((t=>Vt(t,r,e,i))):Vt(s,r,e,i)}}));const Ct=o("$ZodIntersection",((e,t)=>{Je.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then((([t,n])=>Ft(e,t,n))):Ft(e,i,o)}}));function Pt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(X(e)&&X(t)){const n=Object.keys(t),r=Object.keys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const o of r){const n=Pt(e[o],t[o]);if(!n.valid)return{valid:!1,mergeErrorPath:[o,...n.mergeErrorPath]};i[o]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=Pt(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ft(e,t,n){const r=new Map;let i;for(const a of t.issues)if("unrecognized_keys"===a.code){i??(i=a);for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(a);for(const a of n.issues)if("unrecognized_keys"===a.code)for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(a);const o=[...r].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(o.length&&i&&e.issues.push({...i,keys:o}),re(e))return e;const s=Pt(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Mt=o("$ZodTuple",((e,t)=>{Je.init(e,t);const n=t.items;e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];const s=[],a=Ut(n,"optin"),c=Ut(n,"optout");if(!t.rest){if(o.length<a)return r.issues.push({code:"too_small",minimum:a,inclusive:!0,input:o,inst:e,origin:"array"}),r;o.length>n.length&&r.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:o,inst:e,origin:"array"})}const u=new Array(n.length);for(let e=0;e<n.length;e++){const t=n[e]._zod.run({value:o[e],issues:[]},i);t instanceof Promise?s.push(t.then((t=>{u[e]=t}))):u[e]=t}if(t.rest){let e=n.length-1;const a=o.slice(n.length);for(const n of a){e++;const o=t.rest._zod.run({value:n,issues:[]},i);o instanceof Promise?s.push(o.then((t=>Lt(t,r,e)))):Lt(o,r,e)}}return s.length?Promise.all(s).then((()=>jt(u,r,n,o,c))):jt(u,r,n,o,c)}}));function Ut(e,t){for(let n=e.length-1;n>=0;n--)if("optional"!==e[n]._zod[t])return n+1;return 0}function Lt(e,t,n){e.issues.length&&t.issues.push(...oe(n,e.issues)),t.value[n]=e.value}function jt(e,t,n,r,i){for(let o=0;o<n.length;o++){const n=e[o],s=o<r.length;if(n.issues.length){if(!s&&o>=i){t.value.length=o;break}t.issues.push(...oe(o,n.issues))}t.value[o]=n.value}for(let o=t.value.length-1;o>=r.length&&("optional"===n[o]._zod.optout&&void 0===t.value[o]);o--)t.value.length=o;return t}const Gt=o("$ZodRecord",((e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!X(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const o=[],s=t.keyType._zod.values;if(s){n.value={};const a=new Set;for(const l of s)if("string"==typeof l||"number"==typeof l||"symbol"==typeof l){a.add("number"==typeof l?l.toString():l);const s=t.keyType._zod.run({value:l,issues:[]},r);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map((e=>ae(e,r,u()))),input:l,path:[l],inst:e});continue}const c=s.value,f=t.valueType._zod.run({value:i[l],issues:[]},r);f instanceof Promise?o.push(f.then((e=>{e.issues.length&&n.issues.push(...oe(l,e.issues)),n.value[c]=e.value}))):(f.issues.length&&n.issues.push(...oe(l,f.issues)),n.value[c]=f.value)}let c;for(const e in i)a.has(e)||(c=c??[],c.push(e));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{n.value={};for(const s of Reflect.ownKeys(i)){if("__proto__"===s)continue;if(!Object.prototype.propertyIsEnumerable.call(i,s))continue;let a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&_.test(s)&&a.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?n.value[s]=i[s]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map((e=>ae(e,r,u()))),input:s,path:[s],inst:e});continue}const c=t.valueType._zod.run({value:i[s],issues:[]},r);c instanceof Promise?o.push(c.then((e=>{e.issues.length&&n.issues.push(...oe(s,e.issues)),n.value[a.value]=e.value}))):(c.issues.length&&n.issues.push(...oe(s,c.issues)),n.value[a.value]=c.value)}}return o.length?Promise.all(o).then((()=>n)):n}}));const Zt=o("$ZodEnum",((e,t)=>{Je.init(e,t);const n=C(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter((e=>Q.has(typeof e))).map((e=>"string"==typeof e?Y(e):e.toString())).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}})),qt=o("$ZodLiteral",((e,t)=>{if(Je.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?Y(e):e?Y(e.toString()):String(e))).join("|")})$`),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}})),Ht=o("$ZodTransform",((e,t)=>{Je.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new a(e.constructor.name);const i=t.transform(n.value,n);if(r.async){return(i instanceof Promise?i:Promise.resolve(i)).then((e=>(n.value=e,n.fallback=!0,n)))}if(i instanceof Promise)throw new s;return n.value=i,n.fallback=!0,n}}));function Jt(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Wt=o("$ZodOptional",((e,t)=>{Je.init(e,t),e._zod.optin="optional",e._zod.optout="optional",j(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),j(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${U(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((e=>Jt(e,r))):Jt(i,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),Xt=o("$ZodExactOptional",((e,t)=>{Wt.init(e,t),j(e._zod,"values",(()=>t.innerType._zod.values)),j(e._zod,"pattern",(()=>t.innerType._zod.pattern)),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)})),Kt=o("$ZodNullable",((e,t)=>{Je.init(e,t),j(e._zod,"optin",(()=>t.innerType._zod.optin)),j(e._zod,"optout",(()=>t.innerType._zod.optout)),j(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${U(e.source)}|null)$`):void 0})),j(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),Qt=o("$ZodDefault",((e,t)=>{Je.init(e,t),e._zod.optin="optional",j(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then((e=>Yt(e,t))):Yt(r,t)}}));function Yt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const en=o("$ZodPrefault",((e,t)=>{Je.init(e,t),e._zod.optin="optional",j(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),tn=o("$ZodNonOptional",((e,t)=>{Je.init(e,t),j(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then((t=>nn(t,e))):nn(i,e)}}));function nn(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const rn=o("$ZodCatch",((e,t)=>{Je.init(e,t),e._zod.optin="optional",j(e._zod,"optout",(()=>t.innerType._zod.optout)),j(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then((r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map((e=>ae(e,n,u())))},input:e.value}),e.issues=[],e.fallback=!0),e))):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map((e=>ae(e,n,u())))},input:e.value}),e.issues=[],e.fallback=!0),e)}})),on=o("$ZodPipe",((e,t)=>{Je.init(e,t),j(e._zod,"values",(()=>t.in._zod.values)),j(e._zod,"optin",(()=>t.in._zod.optin)),j(e._zod,"optout",(()=>t.out._zod.optout)),j(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then((e=>sn(e,t.in,n))):sn(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then((e=>sn(e,t.out,n))):sn(r,t.out,n)}}));function sn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const an=o("$ZodReadonly",((e,t)=>{Je.init(e,t),j(e._zod,"propValues",(()=>t.innerType._zod.propValues)),j(e._zod,"values",(()=>t.innerType._zod.values)),j(e._zod,"optin",(()=>t.innerType?._zod?.optin)),j(e._zod,"optout",(()=>t.innerType?._zod?.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(cn):cn(r)}}));function cn(e){return e.value=Object.freeze(e.value),e}const un=o("$ZodFunction",((e,t)=>(Je.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if("function"!=typeof t)throw new Error("implement() must be called with a function");return function(...n){const r=e._def.input?Oe(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?Oe(e._def.output,i):i}},e.implementAsync=t=>{if("function"!=typeof t)throw new Error("implementAsync() must be called with a function");return async function(...n){const r=e._def.input?await De(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await De(e._def.output,i):i}},e._zod.parse=(t,n)=>{if("function"!=typeof t.value)return t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}),t;const r=e._def.output&&"promise"===e._def.output._zod.def.type;return t.value=r?e.implementAsync(t.value):e.implement(t.value),t},e.input=(...t)=>{const n=e.constructor;return Array.isArray(t[0])?new n({type:"function",input:new Mt({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output}):new n({type:"function",input:t[0],output:e._def.output})},e.output=t=>new(0,e.constructor)({type:"function",input:e._def.input,output:t}),e))),ln=o("$ZodCustom",((e,t)=>{le.init(e,t),Je.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then((t=>fn(t,n,r,e)));fn(i,n,r,e)}}));function fn(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ue(e))}}var hn;Symbol("ZodOutput"),Symbol("ZodInput");class pn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(hn=globalThis).__zod_globalRegistry??(hn.__zod_globalRegistry=new pn);const dn=globalThis.__zod_globalRegistry;function mn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...te(t)})}function gn(e,t){return new he({check:"less_than",...te(t),value:e,inclusive:!1})}function yn(e,t){return new he({check:"less_than",...te(t),value:e,inclusive:!0})}function wn(e,t){return new pe({check:"greater_than",...te(t),value:e,inclusive:!1})}function bn(e,t){return new pe({check:"greater_than",...te(t),value:e,inclusive:!0})}function vn(e,t){return new de({check:"multiple_of",...te(t),value:e})}function Tn(e,t){return new ge({check:"max_length",...te(t),maximum:e})}function Bn(e,t){return new ye({check:"min_length",...te(t),minimum:e})}function En(e,t){return new we({check:"length_equals",...te(t),length:e})}function zn(e){return new xe({check:"overwrite",tx:e})}function Rn(e,t){const n=function(e,t){const n=new le({check:"custom",...te(t)});return n._zod.check=e,n}((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(ue(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(ue(r))}},e(t.value,t))),t);return n}function xn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??dn,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function In(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o){o.count++;return n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema}const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),In(o,t,r),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(s.schema,c),"input"===t.io&&Sn(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault;return t.seen.get(e).schema}function $n(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const o of e.seen.entries()){const t=e.metadataRegistry.get(o[0])?.id;if(t){const e=r.get(t);if(e&&e!==o[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,o[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const o of e.seen.entries()){const e=o[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const o of e.seen.entries()){const n=o[1];if(t===o[0]){i(o);continue}if(e.external){const n=e.external.registry.get(o[0])?.id;if(t!==o[0]&&n){i(o);continue}}const r=e.metadataRegistry.get(o[0])?.id;r?i(o):(n.cycle||n.count>1&&"ref"===e.reused)&&i(o)}}function kn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Object.assign(i,o);if(t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(const c of[...e.seen.entries()].reverse())r(c[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const s=e.external?.defs??{};for(const c of e.seen.entries()){const e=c[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:An(t,"input",e.processors),output:An(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(a){throw new Error("Error converting schema to JSON.")}}function Sn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return Sn(r.element,n);if("set"===r.type)return Sn(r.valueType,n);if("lazy"===r.type)return Sn(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return Sn(r.innerType,n);if("intersection"===r.type)return Sn(r.left,n)||Sn(r.right,n);if("record"===r.type||"map"===r.type)return Sn(r.keyType,n)||Sn(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||(Sn(r.in,n)||Sn(r.out,n));if("object"===r.type){for(const e in r.shape)if(Sn(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(Sn(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(Sn(e,n))return!0;return!(!r.rest||!Sn(r.rest,n))}return!1}const An=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=xn({...i??{},target:o,io:t,processors:n});return In(e,s),$n(s,e),kn(s,e)};const On={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},_n=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if("number"==typeof o&&(i.minLength=o),"number"==typeof s&&(i.maxLength=s),a&&(i.format=On[a]??a,""===i.format&&delete i.format,"time"===a&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const e=[...c];1===e.length?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map((e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source})))])}},Dn=(e,t,n,r)=>{const i=n,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;"string"==typeof a&&a.includes("int")?i.type="integer":i.type="number";const f="number"==typeof l&&l>=(o??Number.NEGATIVE_INFINITY),h="number"==typeof u&&u<=(s??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;f?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:"number"==typeof o&&(i.minimum=o),h?p?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u:"number"==typeof s&&(i.maximum=s),"number"==typeof c&&(i.multipleOf=c)},Vn=(e,t,n,r)=>{n.type="boolean"},Nn=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema")},Cn=(e,t,n,r)=>{n.not={}},Pn=(e,t,n,r)=>{const i=C(e._zod.def.entries);i.every((e=>"number"==typeof e))&&(n.type="number"),i.every((e=>"string"==typeof e))&&(n.type="string"),n.enum=i},Fn=(e,t,n,r)=>{const i=e._zod.def,o=[];for(const s of i.values)if(void 0===s){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof s){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){const e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every((e=>"number"==typeof e))&&(n.type="number"),o.every((e=>"string"==typeof e))&&(n.type="string"),o.every((e=>"boolean"==typeof e))&&(n.type="boolean"),o.every((e=>null===e))&&(n.type="null"),n.enum=o},Mn=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")},Un=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Function types cannot be represented in JSON Schema")},Ln=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")},jn=(e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=In(o.element,t,{...r,path:[...r.path,"items"]})},Gn=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const u in s)i.properties[u]=In(s[u],t,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(s)),c=new Set([...a].filter((e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout})));c.size>0&&(i.required=Array.from(c)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=In(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)},Zn=(e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map(((e,n)=>In(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]})));o?n.oneOf=s:n.anyOf=s},qn=(e,t,n,r)=>{const i=e._zod.def,o=In(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=In(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=c},Hn=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="array";const s="draft-2020-12"===t.target?"prefixItems":"items",a="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",c=o.items.map(((e,n)=>In(e,t,{...r,path:[...r.path,s,n]}))),u=o.rest?In(o.rest,t,{...r,path:[...r.path,a,..."openapi-3.0"===t.target?[o.items.length]:[]]}):null;"draft-2020-12"===t.target?(i.prefixItems=c,u&&(i.items=u)):"openapi-3.0"===t.target?(i.items={anyOf:c},u&&i.items.anyOf.push(u),i.minItems=c.length,u||(i.maxItems=c.length)):(i.items=c,u&&(i.additionalItems=u));const{minimum:l,maximum:f}=e._zod.bag;"number"==typeof l&&(i.minItems=l),"number"==typeof f&&(i.maxItems=f)},Jn=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object";const s=o.keyType,a=s._zod.bag,c=a?.patterns;if("loose"===o.mode&&c&&c.size>0){const e=In(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const t of c)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=In(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=In(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=s._zod.values;if(u){const e=[...u].filter((e=>"string"==typeof e||"number"==typeof e));e.length>0&&(i.required=e)}},Wn=(e,t,n,r)=>{const i=e._zod.def,o=In(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Xn=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType},Kn=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Qn=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Yn=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);let o;t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},er=(e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;In(s,t,r);t.seen.get(e).ref=s},tr=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType,n.readOnly=!0},nr=(e,t,n,r)=>{const i=e._zod.def;In(i.innerType,t,r);t.seen.get(e).ref=i.innerType};const rr=o("ZodISODateTime",((e,t)=>{ct.init(e,t),Ar.init(e,t)}));function ir(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...te(t)})}(rr,e)}const or=o("ZodISODate",((e,t)=>{ut.init(e,t),Ar.init(e,t)}));function sr(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...te(t)})}(or,e)}const ar=o("ZodISOTime",((e,t)=>{lt.init(e,t),Ar.init(e,t)}));function cr(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...te(t)})}(ar,e)}const ur=o("ZodISODuration",((e,t)=>{ft.init(e,t),Ar.init(e,t)}));function lr(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...te(t)})}(ur,e)}const fr=(e,t)=>{ke.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map((e=>r({issues:e},[...i,...o.path])));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;i<e.length;){const n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(o))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,P,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,P,2)}},isEmpty:{get:()=>0===e.issues.length}})},hr=o("ZodError",fr,{Parent:Error}),pr=Ae(hr),dr=_e(hr),mr=Ve(hr),gr=Ce(hr),yr=Fe(hr),wr=Me(hr),br=Ue(hr),vr=Le(hr),Tr=je(hr),Br=Ge(hr),Er=Ze(hr),zr=qe(hr);const Rr=new WeakMap;function xr(e,t,n){const r=Object.getPrototypeOf(e);let i=Rr.get(r);if(i||(i=new Set,Rr.set(r,i)),!i.has(t)){i.add(t);for(const e in n){const t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){const n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const Ir=o("ZodType",((e,t)=>(Je.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:An(e,"input"),output:An(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=xn({...n,processors:t});return In(e,r),$n(r,e),kn(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>pr(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>mr(e,t,n),e.parseAsync=async(t,n)=>dr(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>gr(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>yr(e,t,n),e.decode=(t,n)=>wr(e,t,n),e.encodeAsync=async(t,n)=>br(e,t,n),e.decodeAsync=async(t,n)=>vr(e,t,n),e.safeEncode=(t,n)=>Tr(e,t,n),e.safeDecode=(t,n)=>Br(e,t,n),e.safeEncodeAsync=async(t,n)=>Er(e,t,n),e.safeDecodeAsync=async(t,n)=>zr(e,t,n),xr(e,"ZodType",{check(...e){const t=this.def;return this.clone(Z(t,{checks:[...t.checks??[],...e.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ee(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...te(n)})}(Ui,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return Rn(e,t)}(e,t))},overwrite(e){return this.check(zn(e))},optional(){return $i(this)},exactOptional(){return new ki({type:"optional",innerType:this})},nullable(){return Ai(this)},nullish(){return $i(Ai(this))},nonoptional(e){return function(e,t){return new Di({type:"nonoptional",innerType:e,...te(t)})}(this,e)},array(){return hi(this)},or(e){return gi([this,e])},and(e){return new yi({type:"intersection",left:this,right:e})},transform(e){return Ci(this,xi(e))},default(e){return t=e,new Oi({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():K(t)}});var t},prefault(e){return t=e,new _i({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():K(t)}});var t},catch(e){return new Vi({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return Ci(this,e)},readonly(){return new Pi({type:"readonly",innerType:this})},describe(e){const t=this.clone();return dn.add(t,{description:e}),t},meta(...e){if(0===e.length)return dn.get(this);const t=this.clone();return dn.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>dn.get(e)?.description,configurable:!0}),e))),$r=o("_ZodString",((e,t)=>{We.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_n(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,xr(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new ve({check:"string_format",format:"regex",...te(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new Ee({check:"string_format",format:"includes",...te(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new ze({check:"string_format",format:"starts_with",...te(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new Re({check:"string_format",format:"ends_with",...te(t),suffix:e})}(...e))},min(...e){return this.check(Bn(...e))},max(...e){return this.check(Tn(...e))},length(...e){return this.check(En(...e))},nonempty(...e){return this.check(Bn(1,...e))},lowercase(e){return this.check(function(e){return new Te({check:"string_format",format:"lowercase",...te(e)})}(e))},uppercase(e){return this.check(function(e){return new Be({check:"string_format",format:"uppercase",...te(e)})}(e))},trim(){return this.check(zn((e=>e.trim())))},normalize(...e){return this.check(function(e){return zn((t=>t.normalize(e)))}(...e))},toLowerCase(){return this.check(zn((e=>e.toLowerCase())))},toUpperCase(){return this.check(zn((e=>e.toUpperCase())))},slugify(){return this.check(zn((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))))}})})),kr=o("ZodString",((e,t)=>{We.init(e,t),$r.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...te(t)})}(Or,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...te(t)})}(Vr,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...te(t)})}(Xr,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...te(t)})}(Nr,t)),e.guid=t=>e.check(mn(_r,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...te(t)})}(Dr,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...te(t)})}(Dr,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...te(t)})}(Dr,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...te(t)})}(Dr,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...te(t)})}(Cr,t)),e.guid=t=>e.check(mn(_r,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...te(t)})}(Pr,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...te(t)})}(Fr,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...te(t)})}(Mr,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...te(t)})}(Hr,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...te(t)})}(Jr,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...te(t)})}(Ur,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...te(t)})}(Lr,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...te(t)})}(jr,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...te(t)})}(Gr,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...te(t)})}(Zr,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...te(t)})}(qr,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...te(t)})}(Wr,t)),e.datetime=t=>e.check(ir(t)),e.date=t=>e.check(sr(t)),e.time=t=>e.check(cr(t)),e.duration=t=>e.check(lr(t))}));function Sr(e){return function(e,t){return new e({type:"string",...te(t)})}(kr,e)}const Ar=o("ZodStringFormat",((e,t)=>{Xe.init(e,t),$r.init(e,t)})),Or=o("ZodEmail",((e,t)=>{Ye.init(e,t),Ar.init(e,t)}));const _r=o("ZodGUID",((e,t)=>{Ke.init(e,t),Ar.init(e,t)}));const Dr=o("ZodUUID",((e,t)=>{Qe.init(e,t),Ar.init(e,t)}));const Vr=o("ZodURL",((e,t)=>{et.init(e,t),Ar.init(e,t)}));const Nr=o("ZodEmoji",((e,t)=>{tt.init(e,t),Ar.init(e,t)}));const Cr=o("ZodNanoID",((e,t)=>{nt.init(e,t),Ar.init(e,t)}));const Pr=o("ZodCUID",((e,t)=>{rt.init(e,t),Ar.init(e,t)}));const Fr=o("ZodCUID2",((e,t)=>{it.init(e,t),Ar.init(e,t)}));const Mr=o("ZodULID",((e,t)=>{ot.init(e,t),Ar.init(e,t)}));const Ur=o("ZodXID",((e,t)=>{st.init(e,t),Ar.init(e,t)}));const Lr=o("ZodKSUID",((e,t)=>{at.init(e,t),Ar.init(e,t)}));const jr=o("ZodIPv4",((e,t)=>{ht.init(e,t),Ar.init(e,t)}));const Gr=o("ZodIPv6",((e,t)=>{pt.init(e,t),Ar.init(e,t)}));const Zr=o("ZodCIDRv4",((e,t)=>{dt.init(e,t),Ar.init(e,t)}));const qr=o("ZodCIDRv6",((e,t)=>{mt.init(e,t),Ar.init(e,t)}));const Hr=o("ZodBase64",((e,t)=>{yt.init(e,t),Ar.init(e,t)}));const Jr=o("ZodBase64URL",((e,t)=>{wt.init(e,t),Ar.init(e,t)}));const Wr=o("ZodE164",((e,t)=>{bt.init(e,t),Ar.init(e,t)}));const Xr=o("ZodJWT",((e,t)=>{vt.init(e,t),Ar.init(e,t)}));const Kr=o("ZodNumber",((e,t)=>{Tt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dn(e,t,n),xr(e,"ZodNumber",{gt(e,t){return this.check(wn(e,t))},gte(e,t){return this.check(bn(e,t))},min(e,t){return this.check(bn(e,t))},lt(e,t){return this.check(gn(e,t))},lte(e,t){return this.check(yn(e,t))},max(e,t){return this.check(yn(e,t))},int(e){return this.check(ei(e))},safe(e){return this.check(ei(e))},positive(e){return this.check(wn(0,e))},nonnegative(e){return this.check(bn(0,e))},negative(e){return this.check(gn(0,e))},nonpositive(e){return this.check(yn(0,e))},multipleOf(e,t){return this.check(vn(e,t))},step(e,t){return this.check(vn(e,t))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function Qr(e){return function(e,t){return new e({type:"number",checks:[],...te(t)})}(Kr,e)}const Yr=o("ZodNumberFormat",((e,t)=>{Bt.init(e,t),Kr.init(e,t)}));function ei(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...te(t)})}(Yr,e)}const ti=o("ZodBoolean",((e,t)=>{Et.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Vn(0,0,t)}));function ni(e){return function(e,t){return new e({type:"boolean",...te(t)})}(ti,e)}const ri=o("ZodBigInt",((e,t)=>{zt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Nn(0,e),e.gte=(t,n)=>e.check(bn(t,n)),e.min=(t,n)=>e.check(bn(t,n)),e.gt=(t,n)=>e.check(wn(t,n)),e.gte=(t,n)=>e.check(bn(t,n)),e.min=(t,n)=>e.check(bn(t,n)),e.lt=(t,n)=>e.check(gn(t,n)),e.lte=(t,n)=>e.check(yn(t,n)),e.max=(t,n)=>e.check(yn(t,n)),e.positive=t=>e.check(wn(BigInt(0),t)),e.negative=t=>e.check(gn(BigInt(0),t)),e.nonpositive=t=>e.check(yn(BigInt(0),t)),e.nonnegative=t=>e.check(bn(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(vn(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function ii(e){return function(e,t){return new e({type:"bigint",...te(t)})}(ri,e)}const oi=o("ZodAny",((e,t)=>{Rt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function si(){return function(e){return new e({type:"any"})}(oi)}const ai=o("ZodUnknown",((e,t)=>{xt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function ci(){return function(e){return new e({type:"unknown"})}(ai)}const ui=o("ZodNever",((e,t)=>{It.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Cn(0,0,t)}));function li(e){return function(e,t){return new e({type:"never",...te(t)})}(ui,e)}const fi=o("ZodArray",((e,t)=>{kt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jn(e,t,n,r),e.element=t.element,xr(e,"ZodArray",{min(e,t){return this.check(Bn(e,t))},nonempty(e){return this.check(Bn(1,e))},max(e,t){return this.check(Tn(e,t))},length(e,t){return this.check(En(e,t))},unwrap(){return this.element}})}));function hi(e,t){return function(e,t,n){return new e({type:"array",element:t,...te(n)})}(fi,e,t)}const pi=o("ZodObject",((e,t)=>{Dt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gn(e,t,n,r),j(e,"shape",(()=>t.shape)),xr(e,"ZodObject",{keyof(){return Ei(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ci()})},loose(){return this.clone({...this._zod.def,catchall:ci()})},strict(){return this.clone({...this._zod.def,catchall:li()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!X(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=Z(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return G(this,"shape",n),n}});return ee(e,r)}(this,e)},safeExtend(e){return function(e,t){if(!X(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Z(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return G(this,"shape",n),n}});return ee(e,n)}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Z(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return G(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ee(e,n)}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return ee(e,Z(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return G(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Z(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return G(this,"shape",r),r},checks:[]});return ee(e,i)}(this,e)},partial(...e){return function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Z(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return G(this,"shape",i),i},checks:[]});return ee(t,i)}(Ii,this,e[0])},required(...e){return function(e,t,n){const r=Z(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)i[t]=new e({type:"nonoptional",innerType:r[t]});return G(this,"shape",i),i}});return ee(t,r)}(Di,this,e[0])}})}));function di(e,t){const n={type:"object",shape:e??{},...te(t)};return new pi(n)}const mi=o("ZodUnion",((e,t)=>{Nt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zn(e,t,n,r),e.options=t.options}));function gi(e,t){return new mi({type:"union",options:e,...te(t)})}const yi=o("ZodIntersection",((e,t)=>{Ct.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qn(e,t,n,r)}));const wi=o("ZodTuple",((e,t)=>{Mt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hn(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})}));function bi(e,t,n){const r=t instanceof Je;return new wi({type:"tuple",items:e,rest:r?t:null,...te(r?n:t)})}const vi=o("ZodRecord",((e,t)=>{Gt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jn(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType}));function Ti(e,t,n){return t&&t._zod?new vi({type:"record",keyType:e,valueType:t,...te(n)}):new vi({type:"record",keyType:Sr(),valueType:e,...te(t)})}const Bi=o("ZodEnum",((e,t)=>{Zt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pn(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);i[o]=t.entries[o]}return new Bi({...t,checks:[],...te(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Bi({...t,checks:[],...te(r),entries:i})}}));function Ei(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Bi({type:"enum",entries:n,...te(t)})}const zi=o("ZodLiteral",((e,t)=>{qt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fn(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}));const Ri=o("ZodTransform",((e,t)=>{Ht.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Ln(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new a(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(ue(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(ue(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then((e=>(n.value=e,n.fallback=!0,n))):(n.value=i,n.fallback=!0,n)}}));function xi(e){return new Ri({type:"transform",transform:e})}const Ii=o("ZodOptional",((e,t)=>{Wt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));function $i(e){return new Ii({type:"optional",innerType:e})}const ki=o("ZodExactOptional",((e,t)=>{Xt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));const Si=o("ZodNullable",((e,t)=>{Kt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}));function Ai(e){return new Si({type:"nullable",innerType:e})}const Oi=o("ZodDefault",((e,t)=>{Qt.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const _i=o("ZodPrefault",((e,t)=>{en.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}));const Di=o("ZodNonOptional",((e,t)=>{tn.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xn(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));const Vi=o("ZodCatch",((e,t)=>{rn.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const Ni=o("ZodPipe",((e,t)=>{on.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>er(e,t,0,r),e.in=t.in,e.out=t.out}));function Ci(e,t){return new Ni({type:"pipe",in:e,out:t})}const Pi=o("ZodReadonly",((e,t)=>{an.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}));const Fi=o("ZodFunction",((e,t)=>{un.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Un(0,e)}));function Mi(e){return new Fi({type:"function",input:Array.isArray(e?.input)?bi(e?.input):e?.input??hi(ci()),output:e?.output??ci()})}const Ui=o("ZodCustom",((e,t)=>{ln.init(e,t),Ir.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Mn(0,e)}));var Li=n(878),ji=n.n(Li);const Gi=Sr().regex(/^(?:0x)?[0-9a-fA-F]*$/i,"expected hex string").refine((e=>e.replace(/^0x/i,"").length%2==0),"expected even-length hex string"),Zi=ji()("bee-js:bytes"),qi=new TextDecoder,Hi=new TextEncoder;class Ji{constructor(e,t){if(!e)throw Error(`Bytes#constructor: constructor parameter is falsy: ${e}`);if(e instanceof Ji)this.bytes=e.bytes;else if("string"==typeof e)this.bytes=i.yI.hexToUint8Array(Gi.parse(e));else if(e instanceof ArrayBuffer)this.bytes=new Uint8Array(e);else if(e instanceof Uint8Array)this.bytes=e;else{const t=e,n=i.Rb.getDeep(t,"toHex");if(!Mi().safeParse(n).success)throw Zi("bytes",e),new Error("Bytes#constructor: unsupported type: "+typeof e);{const e=n.call(t);this.bytes=i.yI.hexToUint8Array(Gi.parse(e))}}if(this.length=this.bytes.length,t)if(Array.isArray(t)){if(!t.includes(this.length))throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${t.join(" or ")}`)}else if(this.length!==t)throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${t}`)}static keccak256(e){return new Ji(i.yI.keccak256(new Ji(e).toUint8Array()))}static fromUtf8(e){return new Ji(Hi.encode(e))}static fromSlice(e,t,n){return new Ji(void 0===n?e.slice(t):e.slice(t,t+n))}offset(e){return new Uint8Array(this.bytes.slice(e))}toUint8Array(){return new Uint8Array(this.bytes)}toHex(){return i.yI.uint8ArrayToHex(this.bytes)}toBase64(){return i.yI.uint8ArrayToBase64(this.bytes)}toBase32(){return i.yI.uint8ArrayToBase32(this.bytes)}toString(){return this.toHex()}toUtf8(){return qi.decode(this.bytes)}toJSON(){return JSON.parse(this.toUtf8())}equals(e){return this.toHex()===new Ji(e).toHex()}represent(){return this.toHex()}}function Wi(e){const t=e.match(/^([\d.]+)\s*(B|kB|MB|GB|TB|PB)$/);if(!t)throw new Error(`Invalid size format: ${e}`);const n=parseFloat(t[1]),r=t[2];return Math.ceil(n*{B:1,kB:1e3,MB:1e6,GB:1e3**3,TB:1e3**4,PB:1e3**5}[r])}const Xi=250,Ki=251,Qi={[Xi]:"manifest",[Ki]:"feed"};const Yi=new TextEncoder;class eo extends Ji{static LENGTH=32;constructor(e){super(e,32)}publicKey(){const[e,t]=i.LQ.privateKeyToPublicKey(i.yI.uint256ToNumber(this.bytes,"BE"));return new to(i.yI.concatBytes(i.yI.numberToUint256(e,"BE"),i.yI.numberToUint256(t,"BE")))}sign(e){const t=i.yI.concatBytes(Yi.encode("Ethereum Signed Message:\n32"),i.yI.keccak256(e instanceof Uint8Array?e:Yi.encode(e))),[n,r,o]=i.LQ.signMessage(t,i.yI.uint256ToNumber(this.bytes,"BE"));return new uo(i.yI.concatBytes(i.yI.numberToUint256(n,"BE"),i.yI.numberToUint256(r,"BE"),new Uint8Array([Number(o)])))}}class to extends Ji{static LENGTH=64;constructor(e){const t=new Ji(e);if(33===t.length){const[e,n]=i.LQ.publicKeyFromCompressed(t.toUint8Array());super(i.yI.concatBytes(i.yI.numberToUint256(e,"BE"),i.yI.numberToUint256(n,"BE")),64)}else super(e,64)}address(){const e=i.yI.uint256ToNumber(this.bytes.slice(0,32),"BE"),t=i.yI.uint256ToNumber(this.bytes.slice(32,64),"BE");return new no(i.LQ.publicKeyToAddress([e,t]))}toCompressedUint8Array(){const e=i.yI.uint256ToNumber(this.bytes.slice(0,32),"BE"),t=i.yI.uint256ToNumber(this.bytes.slice(32,64),"BE");return i.LQ.compressPublicKey([e,t])}toCompressedHex(){return i.yI.uint8ArrayToHex(this.toCompressedUint8Array())}}class no extends Ji{static LENGTH=20;constructor(e){super(e,20)}toChecksum(){return i.LQ.checksumEncode(this.bytes)}}class ro extends Ji{static LENGTH=32;constructor(e){super(e,32)}static fromString(e){return new ro(i.yI.keccak256(Yi.encode(e)))}}class io extends Ji{static LENGTH=32;constructor(e){if("string"==typeof e&&e.startsWith("bah5")){const t=function(e){const t=i.yI.base32ToUint8Array(e.toUpperCase().slice(1)),n=t[1];if(!Qi[n])throw new Error("Unknown codec");const r=new io(t.slice(-32));return{type:Qi[n],reference:r}}(e);super(t.reference.bytes,32)}else super(e,[32,64])}toCid(e){return function(e,t){e=new io(e);const n=new Uint8Array([1]),r=new Uint8Array(["feed"===t?251:250]),o=new Uint8Array([1]),s=new Uint8Array([27]),a=new Uint8Array([32]);return`b${i.yI.uint8ArrayToBase32(i.yI.concatBytes(n,r,o,s,a)).replace(/\=+$/,"")}${e.toBase32().replace(/\=+$/,"")}`.toLowerCase()}(this.bytes,e)}static isValid(e){try{return new io(e),!0}catch{return!1}}}class oo extends Ji{static LENGTH=32;constructor(e){super(e,32)}}class so extends Ji{static LENGTH=8;constructor(e){super(e,8)}static fromBigInt(e){return new so(i.yI.numberToUint64(e,"LE"))}toBigInt(){return i.yI.uint64ToNumber(this.bytes,"LE")}static fromSlice(e,t){return new so(e.slice(t,t+so.LENGTH))}}class ao extends Ji{static LENGTH=32;constructor(e){super(e,32)}}class co extends Ji{static LENGTH=32;constructor(e){super(e,32)}}class uo extends Ji{static LENGTH=65;constructor(e){super(e,65)}static fromSlice(e,t){return new uo(e.slice(t,t+uo.LENGTH))}recoverPublicKey(e){const t=i.yI.uint256ToNumber(this.bytes.slice(0,32),"BE"),n=i.yI.uint256ToNumber(this.bytes.slice(32,64),"BE"),r=BigInt(this.bytes[64]),[o,s]=i.LQ.recoverPublicKey(i.yI.concatBytes(Yi.encode("Ethereum Signed Message:\n32"),i.yI.keccak256(e instanceof Uint8Array?e:Yi.encode(e))),t,n,r);return new to(i.yI.concatBytes(i.yI.numberToUint256(o,"BE"),i.yI.numberToUint256(s,"BE")))}isValid(e,t){return this.recoverPublicKey(e).address().equals(t)}}class lo extends Ji{static LENGTH=32;constructor(e){super(e,32)}static fromString(e){return new lo(i.yI.keccak256(Yi.encode(e)))}}const fo=new Uint8Array(8).fill(255,0,8);class ho extends Ji{static LENGTH=8;static MINUS_ONE=new ho(fo);constructor(e){super(e,8)}static fromBigInt(e){return new ho(i.yI.numberToUint64(e,"BE"))}toBigInt(){return i.yI.uint64ToNumber(this.bytes,"BE")}next(){return i.yI.equals(this.bytes,fo)?ho.fromBigInt(0n):ho.fromBigInt(this.toBigInt()+1n)}}class po extends Error{constructor(e){super(e)}}class mo extends po{constructor(e,t){super(e),this.value=t}}class go extends po{constructor(e,t,n,r,i,o){super(n),this.method=e,this.url=t,this.responseBody=r,this.status=i,this.statusText=o,this.response={status:i,data:r,statusText:o}}}const yo=4096;function wo(e){const t=e.slice(0,so.LENGTH),n=function(e){if(e.length>yo)throw new mo(`payload size ${e.length} exceeds maximum chunk payload size 4096`,e);const t=new Uint8Array(yo);return t.set(e),i.yI.log2Reduce(i.yI.partition(t,32),((e,t)=>i.yI.keccak256(i.yI.concatBytes(e,t))))}(e.slice(so.LENGTH)),r=i.yI.keccak256(i.yI.concatBytes(t,n));return new io(r)}const bo=di({reference:Sr().transform((e=>new io(e)))});let vo=function(e){return e.FULL="full",e.LIGHT="light",e.ULTRA_LIGHT="ultra-light",e.DEV="dev",e}({});function To(e){switch(e){case"full":return vo.FULL;case"light":return vo.LIGHT;case"ultra-light":return vo.ULTRA_LIGHT;case"dev":return vo.DEV;default:throw new Error(`Unknown Bee mode: ${e}`)}}const Bo=32,Eo=128,zo=Bo*Eo,Ro=4,xo=17,Io=255,$o=1,ko=1e3;let So=function(e){return e[e.OFF=0]="OFF",e[e.MEDIUM=1]="MEDIUM",e[e.STRONG=2]="STRONG",e[e.INSANE=3]="INSANE",e[e.PARANOID=4]="PARANOID",e}({}),Ao=function(e){return e[e.NONE=0]="NONE",e[e.DATA=1]="DATA",e[e.PROX=2]="PROX",e[e.RACE=3]="RACE",e}({});const Oo={ENCRYPTION_OFF:{[So.OFF]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"44.70 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.66 MB",batchDepth:18,utilizationRate:"0.61%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"112.06 MB",batchDepth:19,utilizationRate:"5.09%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"687.62 MB",batchDepth:20,utilizationRate:"15.65%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.60 GB",batchDepth:21,utilizationRate:"30.27%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.73 GB",batchDepth:22,utilizationRate:"44.99%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"19.94 GB",batchDepth:23,utilizationRate:"58.03%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"47.06 GB",batchDepth:24,utilizationRate:"68.48%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"105.51 GB",batchDepth:25,utilizationRate:"76.77%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"227.98 GB",batchDepth:26,utilizationRate:"82.94%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"476.68 GB",batchDepth:27,utilizationRate:"86.71%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"993.65 GB",batchDepth:28,utilizationRate:"88.37%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"2.04 TB",batchDepth:29,utilizationRate:"92.88%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"4.17 TB",batchDepth:30,utilizationRate:"94.81%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"8.45 TB",batchDepth:31,utilizationRate:"96.06%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"17.07 TB",batchDepth:32,utilizationRate:"97.01%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"34.36 TB",batchDepth:33,utilizationRate:"97.65%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"69.04 TB",batchDepth:34,utilizationRate:"98.11%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"138.54 TB",batchDepth:35,utilizationRate:"98.44%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"277.72 TB",batchDepth:36,utilizationRate:"98.67%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"556.35 TB",batchDepth:37,utilizationRate:"98.83%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.11 PB",batchDepth:38,utilizationRate:"98.91%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.23 PB",batchDepth:39,utilizationRate:"98.96%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.46 PB",batchDepth:40,utilizationRate:"98.98%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.93 PB",batchDepth:41,utilizationRate:"99.11%"}],[So.MEDIUM]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"41.56 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.19 MB",batchDepth:18,utilizationRate:"0.57%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"104.18 MB",batchDepth:19,utilizationRate:"4.73%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"639.27 MB",batchDepth:20,utilizationRate:"14.54%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.41 GB",batchDepth:21,utilizationRate:"28.11%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.18 GB",batchDepth:22,utilizationRate:"41.79%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"18.54 GB",batchDepth:23,utilizationRate:"53.95%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"43.75 GB",batchDepth:24,utilizationRate:"63.66%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"98.09 GB",batchDepth:25,utilizationRate:"71.37%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"211.95 GB",batchDepth:26,utilizationRate:"77.11%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"443.16 GB",batchDepth:27,utilizationRate:"80.61%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"923.78 GB",batchDepth:28,utilizationRate:"82.16%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.90 TB",batchDepth:29,utilizationRate:"86.30%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.88 TB",batchDepth:30,utilizationRate:"88.14%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"7.86 TB",batchDepth:31,utilizationRate:"89.26%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"15.87 TB",batchDepth:32,utilizationRate:"90.21%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"31.94 TB",batchDepth:33,utilizationRate:"90.77%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"64.19 TB",batchDepth:34,utilizationRate:"91.22%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"128.80 TB",batchDepth:35,utilizationRate:"91.52%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"258.19 TB",batchDepth:36,utilizationRate:"91.73%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"517.23 TB",batchDepth:37,utilizationRate:"91.88%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.04 PB",batchDepth:38,utilizationRate:"91.95%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.07 PB",batchDepth:39,utilizationRate:"92.00%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.15 PB",batchDepth:40,utilizationRate:"92.15%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.30 PB",batchDepth:41,utilizationRate:"92.14%"}],[So.STRONG]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"37.37 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"5.57 MB",batchDepth:18,utilizationRate:"0.51%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"93.68 MB",batchDepth:19,utilizationRate:"4.25%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"574.81 MB",batchDepth:20,utilizationRate:"13.07%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.17 GB",batchDepth:21,utilizationRate:"25.26%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"6.46 GB",batchDepth:22,utilizationRate:"37.58%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"16.67 GB",batchDepth:23,utilizationRate:"48.50%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"39.34 GB",batchDepth:24,utilizationRate:"57.24%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"88.20 GB",batchDepth:25,utilizationRate:"64.17%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"190.58 GB",batchDepth:26,utilizationRate:"69.33%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"398.47 GB",batchDepth:27,utilizationRate:"72.48%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"830.63 GB",batchDepth:28,utilizationRate:"73.85%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.71 TB",batchDepth:29,utilizationRate:"77.59%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.49 TB",batchDepth:30,utilizationRate:"79.27%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"7.07 TB",batchDepth:31,utilizationRate:"80.34%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"14.27 TB",batchDepth:32,utilizationRate:"81.12%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"28.72 TB",batchDepth:33,utilizationRate:"81.63%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"57.71 TB",batchDepth:34,utilizationRate:"82.01%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"115.81 TB",batchDepth:35,utilizationRate:"82.29%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"232.16 TB",batchDepth:36,utilizationRate:"82.48%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"465.07 TB",batchDepth:37,utilizationRate:"82.61%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"931.23 TB",batchDepth:38,utilizationRate:"82.67%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.86 PB",batchDepth:39,utilizationRate:"82.71%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.73 PB",batchDepth:40,utilizationRate:"82.78%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"7.46 PB",batchDepth:41,utilizationRate:"82.79%"}],[So.INSANE]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"33.88 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"5.05 MB",batchDepth:18,utilizationRate:"0.46%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"84.92 MB",batchDepth:19,utilizationRate:"3.86%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"521.09 MB",batchDepth:20,utilizationRate:"11.85%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"1.97 GB",batchDepth:21,utilizationRate:"22.90%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"5.86 GB",batchDepth:22,utilizationRate:"34.09%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"15.11 GB",batchDepth:23,utilizationRate:"43.97%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"35.66 GB",batchDepth:24,utilizationRate:"51.90%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"79.96 GB",batchDepth:25,utilizationRate:"58.18%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"172.77 GB",batchDepth:26,utilizationRate:"62.85%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"361.23 GB",batchDepth:27,utilizationRate:"65.70%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"753.00 GB",batchDepth:28,utilizationRate:"66.95%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.55 TB",batchDepth:29,utilizationRate:"70.38%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.16 TB",batchDepth:30,utilizationRate:"71.92%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"6.41 TB",batchDepth:31,utilizationRate:"72.85%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"12.93 TB",batchDepth:32,utilizationRate:"73.53%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"26.04 TB",batchDepth:33,utilizationRate:"74.01%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"52.32 TB",batchDepth:34,utilizationRate:"74.35%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"104.99 TB",batchDepth:35,utilizationRate:"74.60%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"210.46 TB",batchDepth:36,utilizationRate:"74.77%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"421.61 TB",batchDepth:37,utilizationRate:"74.89%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"844.20 TB",batchDepth:38,utilizationRate:"74.94%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.69 PB",batchDepth:39,utilizationRate:"74.98%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.38 PB",batchDepth:40,utilizationRate:"75.03%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"6.77 PB",batchDepth:41,utilizationRate:"75.10%"}],[So.PARANOID]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"13.27 kB",batchDepth:17,utilizationRate:"0.00%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"1.98 MB",batchDepth:18,utilizationRate:"0.18%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"33.27 MB",batchDepth:19,utilizationRate:"1.51%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"204.14 MB",batchDepth:20,utilizationRate:"4.64%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"771.13 MB",batchDepth:21,utilizationRate:"8.75%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"2.29 GB",batchDepth:22,utilizationRate:"13.34%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"5.92 GB",batchDepth:23,utilizationRate:"17.22%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"13.97 GB",batchDepth:24,utilizationRate:"20.33%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"31.32 GB",batchDepth:25,utilizationRate:"22.79%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"67.68 GB",batchDepth:26,utilizationRate:"24.62%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"141.51 GB",batchDepth:27,utilizationRate:"25.74%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"294.99 GB",batchDepth:28,utilizationRate:"26.23%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"606.90 GB",batchDepth:29,utilizationRate:"27.56%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"1.24 TB",batchDepth:30,utilizationRate:"28.15%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"2.51 TB",batchDepth:31,utilizationRate:"28.54%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"5.07 TB",batchDepth:32,utilizationRate:"28.82%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"10.20 TB",batchDepth:33,utilizationRate:"28.99%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"20.50 TB",batchDepth:34,utilizationRate:"29.13%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"41.13 TB",batchDepth:35,utilizationRate:"29.22%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"82.45 TB",batchDepth:36,utilizationRate:"29.29%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"165.17 TB",batchDepth:37,utilizationRate:"29.34%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"330.72 TB",batchDepth:38,utilizationRate:"29.37%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"661.97 TB",batchDepth:39,utilizationRate:"29.39%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"1.32 PB",batchDepth:40,utilizationRate:"29.41%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"2.65 PB",batchDepth:41,utilizationRate:"29.43%"}]},ENCRYPTION_ON:{[So.OFF]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"44.35 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.61 MB",batchDepth:18,utilizationRate:"0.60%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"111.18 MB",batchDepth:19,utilizationRate:"5.05%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"682.21 MB",batchDepth:20,utilizationRate:"15.52%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.58 GB",batchDepth:21,utilizationRate:"30.04%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.67 GB",batchDepth:22,utilizationRate:"44.62%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"19.78 GB",batchDepth:23,utilizationRate:"57.56%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"46.69 GB",batchDepth:24,utilizationRate:"67.93%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"104.68 GB",batchDepth:25,utilizationRate:"76.16%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"226.19 GB",batchDepth:26,utilizationRate:"82.29%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"472.93 GB",batchDepth:27,utilizationRate:"86.02%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"985.83 GB",batchDepth:28,utilizationRate:"87.66%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"2.03 TB",batchDepth:29,utilizationRate:"92.25%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"4.14 TB",batchDepth:30,utilizationRate:"94.21%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"8.39 TB",batchDepth:31,utilizationRate:"95.37%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"16.93 TB",batchDepth:32,utilizationRate:"96.22%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"34.09 TB",batchDepth:33,utilizationRate:"96.88%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"68.50 TB",batchDepth:34,utilizationRate:"97.34%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"137.45 TB",batchDepth:35,utilizationRate:"97.67%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"275.53 TB",batchDepth:36,utilizationRate:"97.89%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"551.97 TB",batchDepth:37,utilizationRate:"98.05%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.11 PB",batchDepth:38,utilizationRate:"98.13%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.21 PB",batchDepth:39,utilizationRate:"98.18%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.43 PB",batchDepth:40,utilizationRate:"98.36%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.86 PB",batchDepth:41,utilizationRate:"98.37%"}],[So.MEDIUM]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"40.89 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"6.09 MB",batchDepth:18,utilizationRate:"0.56%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"102.49 MB",batchDepth:19,utilizationRate:"4.65%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"628.91 MB",batchDepth:20,utilizationRate:"14.30%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.38 GB",batchDepth:21,utilizationRate:"27.68%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"7.07 GB",batchDepth:22,utilizationRate:"41.15%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"18.24 GB",batchDepth:23,utilizationRate:"53.09%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"43.04 GB",batchDepth:24,utilizationRate:"62.63%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"96.50 GB",batchDepth:25,utilizationRate:"70.21%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"208.52 GB",batchDepth:26,utilizationRate:"75.86%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"435.98 GB",batchDepth:27,utilizationRate:"79.30%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"908.81 GB",batchDepth:28,utilizationRate:"80.82%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.87 TB",batchDepth:29,utilizationRate:"84.98%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.81 TB",batchDepth:30,utilizationRate:"86.67%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"7.73 TB",batchDepth:31,utilizationRate:"87.84%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"15.61 TB",batchDepth:32,utilizationRate:"88.74%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"31.43 TB",batchDepth:33,utilizationRate:"89.34%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"63.15 TB",batchDepth:34,utilizationRate:"89.74%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"126.71 TB",batchDepth:35,utilizationRate:"90.03%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"254.01 TB",batchDepth:36,utilizationRate:"90.24%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"508.85 TB",batchDepth:37,utilizationRate:"90.39%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"1.02 PB",batchDepth:38,utilizationRate:"90.47%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"2.04 PB",batchDepth:39,utilizationRate:"90.51%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"4.08 PB",batchDepth:40,utilizationRate:"90.64%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"8.17 PB",batchDepth:41,utilizationRate:"90.65%"}],[So.STRONG]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"36.73 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"5.47 MB",batchDepth:18,utilizationRate:"0.50%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"92.07 MB",batchDepth:19,utilizationRate:"4.18%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"564.95 MB",batchDepth:20,utilizationRate:"12.85%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"2.13 GB",batchDepth:21,utilizationRate:"24.86%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"6.35 GB",batchDepth:22,utilizationRate:"36.97%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"16.38 GB",batchDepth:23,utilizationRate:"47.67%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"38.66 GB",batchDepth:24,utilizationRate:"56.26%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"86.69 GB",batchDepth:25,utilizationRate:"63.07%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"187.31 GB",batchDepth:26,utilizationRate:"68.14%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"391.64 GB",batchDepth:27,utilizationRate:"71.24%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"816.39 GB",batchDepth:28,utilizationRate:"72.59%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.68 TB",batchDepth:29,utilizationRate:"76.34%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.43 TB",batchDepth:30,utilizationRate:"77.89%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"6.94 TB",batchDepth:31,utilizationRate:"78.86%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"14.02 TB",batchDepth:32,utilizationRate:"79.71%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"28.23 TB",batchDepth:33,utilizationRate:"80.23%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"56.72 TB",batchDepth:34,utilizationRate:"80.60%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"113.82 TB",batchDepth:35,utilizationRate:"80.88%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"228.18 TB",batchDepth:36,utilizationRate:"81.06%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"457.10 TB",batchDepth:37,utilizationRate:"81.20%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"915.26 TB",batchDepth:38,utilizationRate:"81.26%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.83 PB",batchDepth:39,utilizationRate:"81.30%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.67 PB",batchDepth:40,utilizationRate:"81.43%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"7.34 PB",batchDepth:41,utilizationRate:"81.45%"}],[So.INSANE]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"33.26 kB",batchDepth:17,utilizationRate:"0.01%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"4.96 MB",batchDepth:18,utilizationRate:"0.45%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"83.38 MB",batchDepth:19,utilizationRate:"3.79%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"511.65 MB",batchDepth:20,utilizationRate:"11.64%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"1.93 GB",batchDepth:21,utilizationRate:"22.52%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"5.75 GB",batchDepth:22,utilizationRate:"33.50%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"14.84 GB",batchDepth:23,utilizationRate:"43.19%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"35.02 GB",batchDepth:24,utilizationRate:"50.96%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"78.51 GB",batchDepth:25,utilizationRate:"57.12%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"169.64 GB",batchDepth:26,utilizationRate:"61.71%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"354.69 GB",batchDepth:27,utilizationRate:"64.52%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"739.37 GB",batchDepth:28,utilizationRate:"65.74%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"1.52 TB",batchDepth:29,utilizationRate:"69.15%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"3.10 TB",batchDepth:30,utilizationRate:"70.56%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"6.29 TB",batchDepth:31,utilizationRate:"71.48%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"12.70 TB",batchDepth:32,utilizationRate:"72.18%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"25.57 TB",batchDepth:33,utilizationRate:"72.67%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"51.37 TB",batchDepth:34,utilizationRate:"73.00%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"103.08 TB",batchDepth:35,utilizationRate:"73.24%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"206.65 TB",batchDepth:36,utilizationRate:"73.42%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"413.98 TB",batchDepth:37,utilizationRate:"73.54%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"828.91 TB",batchDepth:38,utilizationRate:"73.59%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"1.66 PB",batchDepth:39,utilizationRate:"73.62%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"3.32 PB",batchDepth:40,utilizationRate:"73.72%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"6.64 PB",batchDepth:41,utilizationRate:"73.74%"}],[So.PARANOID]:[{theoreticalVolume:"536.87 MB",effectiveVolume:"13.17 kB",batchDepth:17,utilizationRate:"0.00%"},{theoreticalVolume:"1.07 GB",effectiveVolume:"1.96 MB",batchDepth:18,utilizationRate:"0.18%"},{theoreticalVolume:"2.15 GB",effectiveVolume:"33.01 MB",batchDepth:19,utilizationRate:"1.50%"},{theoreticalVolume:"4.29 GB",effectiveVolume:"202.53 MB",batchDepth:20,utilizationRate:"4.61%"},{theoreticalVolume:"8.59 GB",effectiveVolume:"765.05 MB",batchDepth:21,utilizationRate:"8.68%"},{theoreticalVolume:"17.18 GB",effectiveVolume:"2.28 GB",batchDepth:22,utilizationRate:"13.27%"},{theoreticalVolume:"34.36 GB",effectiveVolume:"5.87 GB",batchDepth:23,utilizationRate:"17.08%"},{theoreticalVolume:"68.72 GB",effectiveVolume:"13.86 GB",batchDepth:24,utilizationRate:"20.17%"},{theoreticalVolume:"137.44 GB",effectiveVolume:"31.08 GB",batchDepth:25,utilizationRate:"22.61%"},{theoreticalVolume:"274.88 GB",effectiveVolume:"67.15 GB",batchDepth:26,utilizationRate:"24.43%"},{theoreticalVolume:"549.76 GB",effectiveVolume:"140.40 GB",batchDepth:27,utilizationRate:"25.54%"},{theoreticalVolume:"1.10 TB",effectiveVolume:"292.67 GB",batchDepth:28,utilizationRate:"26.03%"},{theoreticalVolume:"2.20 TB",effectiveVolume:"602.12 GB",batchDepth:29,utilizationRate:"27.35%"},{theoreticalVolume:"4.40 TB",effectiveVolume:"1.23 TB",batchDepth:30,utilizationRate:"27.94%"},{theoreticalVolume:"8.80 TB",effectiveVolume:"2.49 TB",batchDepth:31,utilizationRate:"28.32%"},{theoreticalVolume:"17.59 TB",effectiveVolume:"5.03 TB",batchDepth:32,utilizationRate:"28.60%"},{theoreticalVolume:"35.18 TB",effectiveVolume:"10.12 TB",batchDepth:33,utilizationRate:"28.77%"},{theoreticalVolume:"70.37 TB",effectiveVolume:"20.34 TB",batchDepth:34,utilizationRate:"28.91%"},{theoreticalVolume:"140.74 TB",effectiveVolume:"40.80 TB",batchDepth:35,utilizationRate:"29.00%"},{theoreticalVolume:"281.47 TB",effectiveVolume:"81.80 TB",batchDepth:36,utilizationRate:"29.06%"},{theoreticalVolume:"562.95 TB",effectiveVolume:"163.87 TB",batchDepth:37,utilizationRate:"29.11%"},{theoreticalVolume:"1.13 PB",effectiveVolume:"328.11 TB",batchDepth:38,utilizationRate:"29.14%"},{theoreticalVolume:"2.25 PB",effectiveVolume:"656.76 TB",batchDepth:39,utilizationRate:"29.16%"},{theoreticalVolume:"4.50 PB",effectiveVolume:"1.31 PB",batchDepth:40,utilizationRate:"29.18%"},{theoreticalVolume:"9.01 PB",effectiveVolume:"2.63 PB",batchDepth:41,utilizationRate:"29.19%"}]}};class _o{static ZERO=new _o(0);constructor(e){this.seconds=Math.ceil(e),e<0&&(this.seconds=0)}static fromMilliseconds(e){return new _o(e/1e3)}static fromSeconds(e){return new _o(e)}static fromHours(e){return new _o(60*e*60)}static fromDays(e){return new _o(24*e*60*60)}static fromWeeks(e){return new _o(7*e*24*60*60)}static fromYears(e){return new _o(365*e*24*60*60)}static fromEndDate(e,t){return new _o((e.getTime()-(t??new Date).getTime())/1e3)}static parseFromString(e){return _o.fromSeconds(i.AO.make(e)/1e3)}toSeconds(){return this.seconds}toHours(){return this.seconds/60/60}toDays(){return this.seconds/24/60/60}toWeeks(){return this.seconds/7/24/60/60}toYears(){return this.seconds/365/24/60/60}toEndDate(e){return new Date((e??new Date).getTime()+1e3*this.seconds)}represent(){return i.AO.secondsToHumanTime(this.seconds)}isZero(){return 0===this.seconds}}class Do{constructor(e){if(this.bytes=Math.ceil(e),e<0)throw Error("Size must be at least 0")}static fromBytes(e){return new Do(e)}static fromKilobytes(e){return new Do(1e3*e)}static fromMegabytes(e){return new Do(1e3*e*1e3)}static fromGigabytes(e){return new Do(1e3*e*1e3*1e3)}static parseFromString(e){return Do.fromBytes(i.FQ.makeStorage(e,1e3))}toBytes(){return this.bytes}toGigabytes(){return this.bytes/1e3/1e3/1e3}toFormattedString(){return i.FQ.convertBytes(this.bytes,1e3)}represent(){return this.toFormattedString()}}class Vo{static DIGITS=16;constructor(e){this.state=e}static fromDecimalString(e){return new Vo(i.ie.fromDecimalString(e,Vo.DIGITS))}static fromPLUR(e){return new Vo(new i.ie(e,Vo.DIGITS))}static fromFloat(e){return new Vo(i.ie.fromFloat(e,Vo.DIGITS))}toPLURString(){return this.state.toString()}toPLURBigInt(){return this.state.value}toDecimalString(){return this.state.toDecimalString()}toFloat(){return this.state.toFloat()}toSignificantDigits(e){return this.toDecimalString().slice(0,this.toDecimalString().indexOf(".")+e+1)}plus(e){return new Vo(this.state.add(e instanceof Vo?e.state:new i.ie(e,Vo.DIGITS)))}minus(e){return new Vo(this.state.subtract(e instanceof Vo?e.state:new i.ie(e,Vo.DIGITS)))}divide(e){return new Vo(this.state.divmod(e)[0])}gt(e){return 1===this.state.compare(e.state)}gte(e){return-1!==this.state.compare(e.state)}lt(e){return-1===this.state.compare(e.state)}lte(e){return 1!==this.state.compare(e.state)}eq(e){return 0===this.state.compare(e.state)}exchangeToDAI(e){return No.fromWei(this.state.exchange("*",new i.ie(e.toWeiBigInt(),No.DIGITS),No.DIGITS).value)}}class No{static DIGITS=18;constructor(e){this.state=e}static fromDecimalString(e){return new No(i.ie.fromDecimalString(e,No.DIGITS))}static fromWei(e){return new No(new i.ie(e,No.DIGITS))}static fromFloat(e){return new No(i.ie.fromFloat(e,No.DIGITS))}toWeiString(){return this.state.toString()}toWeiBigInt(){return this.state.value}toDecimalString(){return this.state.toDecimalString()}toSignificantDigits(e){return this.toDecimalString().slice(0,this.toDecimalString().indexOf(".")+e+1)}toFloat(){return this.state.toFloat()}plus(e){return new No(this.state.add(e instanceof No?e.state:new i.ie(e,No.DIGITS)))}minus(e){return new No(this.state.subtract(e instanceof No?e.state:new i.ie(e,No.DIGITS)))}divide(e){return new No(this.state.divmod(e)[0])}gt(e){return 1===this.state.compare(e.state)}gte(e){return-1!==this.state.compare(e.state)}lt(e){return-1===this.state.compare(e.state)}lte(e){return 1!==this.state.compare(e.state)}eq(e){return 0===this.state.compare(e.state)}exchangeToBZZ(e){return Vo.fromPLUR(this.state.exchange("/",new i.ie(e.toWeiBigInt(),No.DIGITS),Vo.DIGITS).value)}}var Co=n(320);function Po(e){if("function"==typeof File&&e instanceof File)return!0;const t=e;return"object"==typeof t&&"string"==typeof t.name&&("function"==typeof t.stream||"function"==typeof t.arrayBuffer)}function Fo(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...te(t)})}(Kr,e)}const Mo=si().refine((e=>Mi().safeParse(e).success),"expected a function"),Uo=si().transform((e=>(ii().safeParse(e).success&&(e=String(e)),Sr().regex(/^-?\d+$/,"expected integer string").parse(e)))),Lo=si().transform((e=>(ii().safeParse(e).success&&(e=String(e)),Sr().regex(/^\d+$/,"expected non-negative integer string").parse(e)))),jo=di({baseURL:Sr().optional(),timeout:Qr().int().min(0).optional(),headers:Ti(Sr(),Sr()).optional(),onRequest:Mo.optional(),httpAgent:ci().optional(),httpsAgent:ci().optional(),endlesslyRetry:ni().optional(),signal:si().optional()}),Go=di({redundancyStrategy:Qr().int().optional(),fallback:ni().optional(),timeoutMs:Qr().int().min(0).optional(),actPublisher:$i(si().transform((e=>new to(e)))),actHistoryAddress:$i(si().transform((e=>new io(e)))),actTimestamp:Fo().optional()}),Zo=di({act:ni().optional(),actHistoryAddress:$i(si().transform((e=>new io(e)))),deferred:ni().optional(),encrypt:ni().optional(),pin:ni().optional(),tag:Qr().int().min(0).optional()}),qo=Zo.extend({redundancyLevel:Qr().int().min(0).optional()}),Ho=Zo.extend({size:Qr().int().min(0).optional(),contentType:Sr().optional(),redundancyLevel:Qr().int().min(0).optional()}),Jo=Zo.extend({errorDocument:Sr().optional(),indexDocument:Sr().optional(),redundancyLevel:Qr().int().min(0).optional()}),Wo=di({uid:Qr().int()}),Xo=Fo().min(0),Ko=di({onMessage:Mo,onError:Mo,onClose:Mo}),Qo=di({onMessage:Mo,onError:Mo,onClose:Mo}),Yo=di({gasPrice:Uo.optional(),immutableFlag:ni().optional(),label:Sr().optional(),waitForUsable:ni().optional(),waitForUsableTimeout:Qr().int().min(0).optional()}),es=di({gasLimit:Lo.optional(),gasPrice:Lo.optional()}),ts=di({limit:Qr().int().min($o).max(ko).optional(),offset:Qr().int().min(0).optional()});function ns(e){return void 0!==Co.Readable&&e instanceof Co.Readable}function rs(e,t){if("bigint"==typeof e&&(e=e.toString()),"string"!=typeof e||!/^-?\d+$/.test(e))throw new TypeError(`${t?.name??"value"} is not a valid integer string, got: ${e}`);if(void 0!==t?.min&&BigInt(e)<t.min)throw new RangeError(`${t?.name??"value"} must be >= ${t.min}, got: ${e}`);if(void 0!==t?.max&&BigInt(e)>t.max)throw new RangeError(`${t?.name??"value"} must be <= ${t.max}, got: ${e}`);return e}function is(e){if("string"!=typeof e&&!(e instanceof Uint8Array))throw new TypeError("Data must be either string or Uint8Array!")}function os(e){if(null==e)throw new TypeError(`Expected number | Tag | string from tagUid, got: ${e}`);if(t=e,Wo.safeParse(t).success)return e.uid;if("number"==typeof e||"string"==typeof e)return Xo.parse(e);var t;throw new TypeError(`Expected number | Tag | string from tagUid, got: ${e}`)}const ss=.9;function as(e,t,n){return e/Math.pow(2,t-n)}function cs(e){return 4096*2**e}const us=[[17,4089e-8],[18,.00609],[19,.10249],[20,.62891],[21,2.38],[22,7.07],[23,18.24],[24,43.04],[25,96.5],[26,208.52],[27,435.98],[28,908.81],[29,1870],[30,3810],[31,7730],[32,15610],[33,31430],[34,63150]];function ls(e,t,n){if(e<17)return 0;if(void 0!==t&&void 0!==n){const r=Oo[t?"ENCRYPTION_ON":"ENCRYPTION_OFF"][n].find((t=>t.batchDepth===e));if(r?.effectiveVolume)return Wi(r.effectiveVolume)}else{const t=us.find((([t,n])=>{if(e===t)return n}));if(t)return 1e3*t[1]*1e3*1e3}return Math.ceil(cs(e)*ss)}function fs(e,t){const n=new Map;for(let r=17;r<35;r++)n.set(r,ls(r,e,t));return n}function hs(e,t){return Vo.fromPLUR(2n**BigInt(e)*BigInt(t))}function ps(e,t,n){const r=BigInt(rs(e));return _o.fromSeconds(Number(r*BigInt(n)/BigInt(t)))}function ds(e,t,n){return BigInt(e.toSeconds())/BigInt(n)*BigInt(t)+1n}function ms(e,t,n){if(void 0!==t&&void 0!==n){const r=Oo[t?"ENCRYPTION_ON":"ENCRYPTION_OFF"][n].find((t=>e.toBytes()<=Wi(t.effectiveVolume)));if(r?.effectiveVolume)return r.batchDepth}else for(const[r,i]of us)if(e.toBytes()<=1e3*i*1e3*1e3)return r;return 35}function gs(e){return function(e,t,n,r){if(65!==e.length)throw Error("invalid signature length");if(32!==t.length)throw Error("invalid batch ID length");if(8!==n.length)throw Error("invalid timestamp length");if(8!==r.length)throw Error("invalid index length");return new Ji(i.yI.concatBytes(t,r,n,e))}(e.signature,e.batchId.toUint8Array(),e.timestamp,e.index)}function ys(e,t,n){const r=function(e){return Number.isInteger(e)?e<1?1:e>3155695200?3155695200:e:1}(e.batchTTL),i=_o.fromSeconds(r),o=ls(e.depth,t,n),s=e.utilizationRatio??as(e.utilization,e.depth,e.bucketDepth);return{batchID:new co(e.batchID),utilization:e.utilization,usable:e.usable,label:e.label,depth:e.depth,amount:rs(e.amount),bucketDepth:e.bucketDepth,blockNumber:e.blockNumber,immutableFlag:e.immutableFlag,usage:s,usageText:`${Math.round(100*s)}%`,size:Do.fromBytes(o),remainingSize:Do.fromBytes(Math.ceil(o*(1-s))),theoreticalSize:Do.fromBytes(cs(e.depth)),duration:i,calculateSize(t,n){const r=ls(e.depth,t,n);return Do.fromBytes(r)},calculateRemainingSize(t,n){const r=ls(e.depth,t,n);return Do.fromBytes(Math.ceil(r*(1-this.usage)))}}}function ws(e){return{batchID:e.batchID.toHex(),utilization:e.utilization,utilizationRatio:e.usage,usable:e.usable,label:e.label,depth:e.depth,amount:e.amount,bucketDepth:e.bucketDepth,blockNumber:e.blockNumber,immutableFlag:e.immutableFlag,batchTTL:e.duration.toSeconds()}}function bs(e){return{name:function(e){if(!e)throw new po("missing content-disposition header");const t=e.match(/filename\*?=['"]?(?:UTF-\d['"]*)?([^;\r\n"']*)['"]?;?/i);if(t&&t.length>0)return t[1];throw new po("invalid content-disposition header")}(e["content-disposition"]),tagUid:function(e){if(!e)return;return parseInt(e,10)}(e["swarm-tag-uid"]),contentType:e["content-type"]||void 0}}function vs(e,t){const n={};if(!function(e){if(!di({}).safeParse(e).success)return!1;const t=e;return void 0!==t.issuer&&void 0!==t.index&&void 0!==t.signature&&void 0!==t.timestamp&&void 0!==t.batchId}(e)?e&&(e=new co(e),n["swarm-postage-batch-id"]=e.toHex()):n["swarm-postage-stamp"]=gs(e).toHex(),!t)return n;const r=t;r.size&&(n["content-length"]=String(r.size)),r.contentType&&(n["content-type"]=String(r.contentType)),r.redundancyLevel&&(n["swarm-redundancy-level"]=String(r.redundancyLevel));const i=ni().safeParse(r.act);i.success&&(n["swarm-act"]=String(i.data));const o=ni().safeParse(r.pin);o.success&&(n["swarm-pin"]=String(o.data));const s=ni().safeParse(r.encrypt);s.success&&(n["swarm-encrypt"]=String(s.data)),r.tag&&(n["swarm-tag"]=String(r.tag));const a=ni().safeParse(r.deferred);a.success&&(n["swarm-deferred-upload"]=String(a.data)),r.redundancyStrategy&&(n["swarm-redundancy-strategy"]=String(r.redundancyStrategy));const c=ni().safeParse(r.fallback);return c.success&&(n["swarm-redundancy-fallback-mode"]=String(c.data)),r.timeoutMs&&(n["swarm-chunk-retrieval-timeout"]=String(r.timeoutMs)),r.indexDocument&&(n["swarm-index-document"]=String(r.indexDocument)),r.errorDocument&&(n["swarm-error-document"]=String(r.errorDocument)),r.actPublisher&&(n["swarm-act-publisher"]=new to(r.actPublisher).toCompressedHex()),r.actHistoryAddress&&(n["swarm-act-history-address"]=new io(r.actHistoryAddress).toHex()),r.actTimestamp&&(n["swarm-act-timestamp"]=String(r.actTimestamp)),(r.actPublisher||r.actHistoryAddress||r.actTimestamp)&&(n["swarm-act"]="true"),r.gasPrice&&(n["gas-price"]=String(r.gasPrice)),r.gasLimit&&(n["gas-limit"]=String(r.gasLimit)),n}const Ts=ji()("bee-js:http"),Bs={headers:{accept:"application/json, text/plain, */*"}};async function Es(e,t){const n=i.Rb.deepMerge3(Bs,t,e);if(e.signal&&(n.signal=e.signal),function(e){if(void 0===e.data)return;const t=e.data;if(null!==t&&"object"==typeof t&&t.constructor===Object||Array.isArray(t))e.body=JSON.stringify(t),e.headers={"content-type":"application/json",...e.headers};else{e.body=t,e.duplex="half";const n=t instanceof Blob&&t.type?t.type:"application/octet-stream";e.headers={"content-type":n,...e.headers}}}(n),n.params)for(const i of Object.keys(n.params))void 0===n.params[i]&&delete n.params[i];const r=function(e){let t=i.DH.joinUrl([e.baseURL??"",e.url??""]);if(e.params){const n=new URLSearchParams(Object.entries(e.params).filter((([,e])=>void 0!==e)).map((([e,t])=>[e,String(t)]))).toString();n&&(t+=`?${n}`)}return t}(n),o=(n.method||"GET").toUpperCase();n.method=o,e.onRequest?.({method:o,url:i.DH.joinUrl([n.baseURL??"",n.url??""]),headers:{...n.headers},params:n.params});let s=0;for(;s<1e5;)try{Ts(`${o} ${r}`,{headers:n.headers,params:n.params});const e=await fetch(r,n);return e.ok||await zs(o,r,e,n.responseType),xs(e,n.responseType)}catch(a){if(a instanceof go)throw a;const t=a;if("TimeoutError"!==t.name||!e.endlesslyRetry)throw Rs(t,o,r);s++,await i.iQ.sleepMillis(s<300?200:1e3)}throw Error("Max number of failed attempts reached")}async function zs(e,t,n,r){const i=await xs(n,r).catch((()=>({data:void 0}))),o="string"==typeof i.data?i.data:JSON.stringify(i.data),s=o&&"undefined"!==o?`${n.statusText}: ${o}`:n.statusText;throw new go(e,t,s,i.data,n.status,n.statusText)}function Rs(e,t,n){if("AbortError"===e.name)return new go(t,n,"Request aborted",void 0,void 0,"ERR_CANCELED");const r=e.cause,i=r?.message?`${e.message}: ${r.message}`:e.message;return new go(t,n,i)}async function xs(e,t="json"){let n;switch(t){case"arraybuffer":n=await e.arrayBuffer();break;case"text":n=await e.text();break;case"blob":n=await e.blob();break;case"stream":n=e.body;break;default:{const t=await e.text();n=t?JSON.parse(t):null}}return{data:n,status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries()),raw:e}}const Is="chunks";async function $s(e,t,n){t=new io(t);const r=await Es(e,{responseType:"arraybuffer",url:`${Is}/${t}`,headers:vs(null,n)});return new Uint8Array(r.data)}const ks=ro.LENGTH,Ss=ro.LENGTH+uo.LENGTH,As=ro.LENGTH+uo.LENGTH+so.LENGTH;function Os(e,t){e=e instanceof Ji?e.toUint8Array():e,t=new io(t);const n=function(e){const t=wo(e.slice(Ss)),n=uo.fromSlice(e,ks),r=Ji.fromSlice(e,0,ro.LENGTH),o=i.yI.concatBytes(r.toUint8Array(),t.toUint8Array());return n.recoverPublicKey(o).address()}(e),r=Ji.fromSlice(e,0,ro.LENGTH),o=new io(i.yI.keccak256(i.yI.concatBytes(r.toUint8Array(),n.toUint8Array())));if(!i.yI.equals(t.toUint8Array(),o.toUint8Array()))throw new po("SOC data does not match given address!");return{data:e,identifier:r,signature:uo.fromSlice(e,ks),span:so.fromSlice(e,Ss),payload:Ji.fromSlice(e,As),address:o,owner:n}}function _s(e,t){return new io(i.yI.keccak256(i.yI.concatBytes(e.toUint8Array(),t.toUint8Array())))}function Ds(e,t,n,r,o){const s=_s(r=new ro(r),(o=new eo(o)).publicKey().address()),a=o.sign(i.yI.concatBytes(r.toUint8Array(),e.toUint8Array()));return{data:i.yI.concatBytes(r.toUint8Array(),a.toUint8Array(),t.toUint8Array(),n.toUint8Array()),identifier:r,signature:a,span:t,payload:n,address:s,owner:o.publicKey().address()}}async function Vs(e,t,n,r){const o=i.yI.concatBytes(t.span.toUint8Array(),t.payload.toUint8Array());return async function(e,t,n,r,o,s,a){const c=await Es(e,{method:"post",url:`soc/${t}/${n}`,data:o,headers:{"content-type":"application/octet-stream",...vs(s,a)},responseType:"json",params:{sig:r.toHex()}});return{reference:bo.parse(c.data).reference,tagUid:c.headers["swarm-tag"]?os(c.headers["swarm-tag"]):void 0,historyAddress:c.headers["swarm-act-history-address"]?i.Xx.of(new io(c.headers["swarm-act-history-address"])):i.Xx.empty()}}(e,t.owner,t.identifier,t.signature,o,n,r)}async function Ns(e,t,n,r,i,o){t=new eo(t),r=new ro(r);return Vs(e,Us(i).toSingleOwnerChunk(r,t),n,o)}async function Cs(e,t,n){const r=_s(n=new ro(n),t=new no(t));return Os(await $s(e,r.toHex()),r)}const Ps=1,Fs=4096;function Ms(e){return Us((e=new Ji(e)).toUint8Array().slice(so.LENGTH),so.fromSlice(e.toUint8Array(),0))}function Us(e,t){const n=Sr().safeParse(e);if(n.success&&(e=Ji.fromUtf8(n.data)),e.length<Ps||e.length>Fs)throw new RangeError(`payload size ${e.length} exceeds limits [${Ps}, ${Fs}]`);const r=t?"bigint"==typeof t?so.fromBigInt(t):t:so.fromBigInt(BigInt(e.length)),o=new Ji(e),s=i.yI.concatBytes(r.toUint8Array(),o.toUint8Array()),a=wo(s);return{data:s,span:r,payload:o,address:a,toSingleOwnerChunk:(e,t)=>Ds(a,r,o,e,t)}}const Ls="bytes";async function js(e,t,n,r){const o=await Es(e,{url:Ls,method:"post",responseType:"json",data:t,headers:{"content-type":"application/octet-stream",...vs(n,r)}});return{reference:bo.parse(o.data).reference,tagUid:o.headers["swarm-tag"]?os(o.headers["swarm-tag"]):void 0,historyAddress:o.headers["swarm-act-history-address"]?i.Xx.of(new io(o.headers["swarm-act-history-address"])):i.Xx.empty()}}async function Gs(e,t,n){n&&(n=Go.parse(n));const r=await Es(e,{responseType:"arraybuffer",url:`${Ls}/${t}`,headers:vs(null,n)});return new Ji(r.data)}const Zs="feeds";function qs(e){const t=e["swarm-feed-index"],n=e["swarm-feed-index-next"];if(!t)throw new po("Response did not contain expected swarm-feed-index!");if(!n)throw new po("Response did not contain expected swarm-feed-index-next!");return{feedIndex:new ho(t),feedIndexNext:new ho(n)}}async function Hs(e,t,n,r){const i=await Es(e,{responseType:"arraybuffer",url:`${Zs}/${t}/${n}`,params:{...r}});return{payload:new Ji(i.data),...qs(i.headers)}}class Js{constructor(e){this.raw=e}toString(){const e=Sr().safeParse(this.raw);return e.success&&e.data.includes(".eth")?e.data:new io(this.raw).toHex()}}function Ws(e,t){return t="number"==typeof t?ho.fromBigInt(BigInt(t)):t,new ro(i.yI.keccak256(i.yI.concatBytes(e.toUint8Array(),t.toUint8Array())))}async function Xs(e,t,n){try{const r=await Hs(e,t,n);if(!r.feedIndexNext)throw Error("Feed index next is not defined. This should happen when fetching an exact index.");return r.feedIndexNext}catch(r){if(r instanceof go)return ho.fromBigInt(0n);throw r}}async function Ks(e,t,n,r,i,o){const s=Ws(n,o?.index??await Xs(e,t.publicKey().address(),n));if(r.length>4096){const n=await js(e,r,i,o);return async function(e,t,n,r,i,o){return t=new eo(t),r=new ro(r),Vs(e,i.toSingleOwnerChunk(r,t),n,o)}(e,t,i,s,Ms(await $s(e,n.reference)),o)}const a=Sr().safeParse(r);return Ns(e,t,i,s,a.success?Ji.fromUtf8(a.data).toUint8Array():r,o)}function Qs(e,t,n){const r=Ws(t,n);return new io(i.yI.keccak256(i.yI.concatBytes(r.toUint8Array(),e.toUint8Array())))}async function Ys(e,t,n,r,o=!1){const s=Qs(t,n,r="number"==typeof r?ho.fromBigInt(BigInt(r)):r),a=Os(await $s(e,s.toHex()),s);let c=i.Xx.empty();if(o){const e=Ji.fromSlice(a.payload.toUint8Array(),0,8);c=i.Xx.of(Number(i.yI.uint64ToNumber(e.toUint8Array(),"BE")))}return{timestamp:c,payload:new Ji(a.payload.offset(o?8:0))}}async function ea(e,t,n,r){const i=Qs(t,n,r="number"==typeof r?ho.fromBigInt(BigInt(r)):r),o=Os(await $s(e,i),i);return Us(o.payload,o.span)}function ta(e,t,n){const r=async r=>{if(void 0===r?.index)return Hs(e,n,t);const i=await Ys(e,n,t,r.index,r.hasTimestamp??!0),o="number"==typeof r.index?ho.fromBigInt(BigInt(r.index)):r.index;return{payload:i.payload,feedIndex:o,feedIndexNext:o.next()}};return{download:r,downloadPayload:async r=>{if(void 0===r?.index)return Hs(e,n,t);const i=await ea(e,n,t,r.index),o=i.span.toBigInt()<=4096n?i.payload:await Gs(e,new Js(i.address)),s="number"==typeof r.index?ho.fromBigInt(BigInt(r.index)):r.index;return{payload:o,feedIndex:s,feedIndexNext:s.next()}},downloadReference:async i=>{let o=i?.index;void 0===o&&(o=(await async function(e,t,n){return qs((await Es(e,{responseType:"arraybuffer",url:`${Zs}/${t}/${n}`,params:{"Swarm-Only-Root-Chunk":!0}})).headers)}(e,n,t)).feedIndex);const s=await r({...i,index:o});return{reference:new io(s.payload.toUint8Array()),feedIndex:s.feedIndex,feedIndexNext:s.feedIndexNext??s.feedIndex.next()}},owner:n,topic:t}}function na(e,t,n){const r=async(r,o,s)=>async function(e,t,n,r,o,s){r=new io(r);const a=Ws(n,s?.index??await Xs(e,t.publicKey().address(),n)),c=s?.at??Date.now()/1e3,u=i.yI.numberToUint64(BigInt(Math.floor(c)),"BE");return Ns(e,t,o,a,i.yI.concatBytes(u,r.toUint8Array()),s)}(e,n,t,o,r,s);return{...ta(e,t,n.publicKey().address()),upload:r,uploadReference:r,uploadPayload:async(r,i,o)=>Ks(e,n,t,i,r,o)}}async function ra(e,t,n,r,o,s){const a=function(e,t,n){const r=n.toBigInt(),i=[];for(let o=0n;o<=r;o++)i.push(Qs(e,t,ho.fromBigInt(o)));return i}(t,n,r).map((async t=>async function(e,t,n,r){try{return await e.downloadChunk(t,n,r),!0}catch(o){const e=i.Rb.getDeep(o,"status");if(404===e||500===e)return!1;throw o}}(e,t,o,s)));return(await Promise.all(a)).every((e=>e))}function ia(e){if(!function(e){return!!Array.isArray(e)&&e.every((e=>"object"==typeof e&&e.path&&void 0!==e.size))}(e))throw new mo("invalid collection",e)}function oa(e){if(e.webkitRelativePath&&""!==e.webkitRelativePath)return e.webkitRelativePath.replace(/.*?\//i,"");if(e.name)return e.name;throw new TypeError("file is not valid File object")}function sa(e){return Array.from(e).map((e=>({path:oa(e),size:e.size,file:e})))}function aa(e){return Array.from(e).reduce(((e,t)=>e+t.size),0)}class ca{output=new Co.PassThrough;currentFileSize=0;beginFile(e,t){const{name:n,prefix:r,longLink:i}=function(e){if(e.length<=100)return{name:e,prefix:"",longLink:!1};for(let r=e.length-1;r>=0;r--)if("/"===e[r]){const t=e.substring(r+1),n=e.substring(0,r);if(t.length<=100&&n.length<=155)return{name:t,prefix:n,longLink:!1}}const t=e.lastIndexOf("/"),n=(t>=0?e.substring(t+1):e).slice(0,100);return{name:n,prefix:"",longLink:!0}}(e);if(i){const t=Buffer.from(e+"\0");this.output.write(function(e){const t=Buffer.alloc(512,0);t.write("././@LongLink",0,100),t.write("0000644\0",100,8),t.write("0000000\0",108,8),t.write("0000000\0",116,8),t.write(e.toString(8).padStart(11,"0")+"\0",124,12),t.write("00000000000\0",136,12),t.write(" ",148,8),t.write("L",156,1),t.write("ustar\0\0",257,8);let n=0;for(let r=0;r<512;r++)n+=t[r];return t.write(n.toString(8).padStart(6,"0")+"\0 ",148,8),t}(t.length)),this.output.write(t);const n=t.length%512==0?0:512-t.length%512;n>0&&this.output.write(Buffer.alloc(n,0))}const o=function(e,t,n){const r=Buffer.alloc(512,0);r.write(e.slice(0,100).padEnd(100,"\0"),0,100),r.write("0000777\0",100,8),r.write("0001750\0",108,8),r.write("0001750\0",116,8),r.write(n.toString(8).padStart(11,"0")+"\0",124,12);const i=Math.floor((new Date).getTime()/1e3);r.write(i.toString(8).padStart(11,"0")+"\0",136,12),r.write(" ",148,8),r.write("0",156,1),r.write("ustar\0\0",257,8),t&&r.write(t.slice(0,155).padEnd(155,"\0"),345,155);let o=0;for(let s=0;s<512;s++)o+=r[s];return r.write(o.toString(8).padStart(6,"0")+"\0 ",148,8),r}(n,r,t);this.output.write(o),this.currentFileSize=0}async appendFile(e){return new Promise((t=>{this.output.write(e)?t():this.output.once("drain",(()=>{t()})),this.currentFileSize+=e.length}))}async endFile(){const e=this.currentFileSize%512==0?0:512-this.currentFileSize%512;e>0&&this.output.write(Buffer.alloc(e,0))}async end(){return new Promise((e=>{this.output.write(Buffer.alloc(1024,0)),this.output.end((()=>{e()}))}))}}var ua=n(497),la=n.n(ua);async function fa(e,t,n,r){const i=new ca,o=Es(e,{method:"post",url:"bzz",data:i.output,responseType:"json",headers:{"content-type":"application/x-tar","swarm-collection":"true",...vs(n,r)}});await async function(e,t){for(const n of e)if(t.beginFile(n.path,n.size),n.fsPath){const e=(0,ua.createReadStream)(n.fsPath);for await(const n of e)await t.appendFile(n);await t.endFile(),e.close()}else{if(!n.file)throw new Error("Invalid collection item");await t.appendFile(new Uint8Array(await n.file.arrayBuffer())),await t.endFile()}}(t,i),await i.end();return await o}const ha="bzz";async function pa(e,t,n,r,o){ns(t)&&!o?.contentType&&(o||(o={}),o.contentType="application/octet-stream");const s=await Es(e,{method:"post",url:ha,data:t,headers:vs(n,o),params:{name:r},responseType:"json"});return{reference:bo.parse(s.data).reference,tagUid:s.headers["swarm-tag"]?os(s.headers["swarm-tag"]):void 0,historyAddress:s.headers["swarm-act-history-address"]?i.Xx.of(new io(s.headers["swarm-act-history-address"])):i.Xx.empty()}}async function da(e,t,n,r){ia(t);const o=await fa(e,t,n,r);return{reference:bo.parse(o.data).reference,tagUid:o.headers["swarm-tag"]?os(o.headers["swarm-tag"]):void 0,historyAddress:o.headers["swarm-act-history-address"]?i.Xx.of(new io(o.headers["swarm-act-history-address"])):i.Xx.empty()}}const ma=di({peer:Sr(),balance:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"balance"}))))}),ga=di({balances:hi(ma)}),ya=ma,wa="balances",ba="consumed";const va=di({beneficiary:Sr().transform((e=>new no(e))),chequebook:Sr().transform((e=>new no(e))),payout:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"payout"}))))}),Ta=di({recipient:Sr(),lastPayout:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"lastPayout"})))),bounced:ni()}),Ba=di({chequebookAddress:Sr().transform((e=>new no(e)))}),Ea=di({availableBalance:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"availableBalance"})))),totalBalance:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"totalBalance"}))))}),za=di({peer:Sr(),uncashedAmount:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"uncashedAmount"})))),transactionHash:Sr().nullish().transform((e=>e??null)),lastCashedCheque:va.nullish().transform((e=>e??null)),result:Ta.nullish().transform((e=>e??null))}),Ra=di({peer:Sr(),lastreceived:va.nullish().transform((e=>e??null)),lastsent:va.nullish().transform((e=>e??null))}),xa=di({lastcheques:hi(di({peer:Sr(),lastreceived:va.nullish().transform((e=>e??null)),lastsent:va.nullish().transform((e=>e??null))}))}),Ia=di({transactionHash:Sr().transform((e=>new oo(e)))}),$a="chequebook";const ka=di({address:Sr(),fullNode:ni()}),Sa=di({population:Qr(),connected:Qr(),connectedPeers:hi(di({address:Sr()})).nullish().transform((e=>e??[])),disconnectedPeers:hi(di({address:Sr()})).nullish().transform((e=>e??[]))}),Aa=Ti(Sr(),Sa),Oa=di({overlay:Sr().transform((e=>new ao(e))),underlay:hi(Sr()),ethereum:Sr().transform((e=>new no(e))),publicKey:Sr().transform((e=>new to(e))),pssPublicKey:Sr().transform((e=>new to(e)))}),_a=di({peers:hi(ka)}),Da=di({peers:hi(ka)}),Va=di({baseAddr:Sr(),population:Qr(),connected:Qr(),timestamp:Sr(),nnLowWatermark:Qr(),depth:Qr(),reachability:Sr(),networkAvailability:Sr(),bins:Aa});const Na=di({peer:Sr(),sent:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"sent"})))),received:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"received"}))))}),Ca=Na,Pa=di({totalSent:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"totalSent"})))),totalReceived:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"totalReceived"})))),settlements:hi(Na)}),Fa="settlements";const Ma=di({stakedAmount:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"stakedAmount"}))))}),Ua=di({withdrawableAmount:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"withdrawableAmount"}))))}),La=di({txHash:Sr().transform((e=>new oo(e)))}),ja=di({minimumGasFunds:Sr().transform((e=>No.fromWei(rs(e,{name:"minimumGasFunds"})))),hasSufficientFunds:ni(),isFrozen:ni(),isFullySynced:ni(),phase:Sr(),round:Qr(),lastWonRound:Qr(),lastPlayedRound:Qr(),lastFrozenRound:Qr(),lastSelectedRound:Qr(),lastSampleDurationSeconds:Qr(),block:Qr(),reward:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"reward"})))),fees:Sr().transform((e=>No.fromWei(rs(e,{name:"fees"})))),isHealthy:ni()}),Ga="stake";const Za=di({batchID:Sr(),utilization:Qr(),utilizationRatio:Qr().optional(),usable:ni(),label:Sr(),depth:Qr(),amount:Sr(),bucketDepth:Qr(),blockNumber:Qr(),immutableFlag:ni(),batchTTL:Qr()}),qa=di({batchID:Sr().transform((e=>new co(e))),batchTTL:Qr(),bucketDepth:Qr(),depth:Qr(),immutable:ni(),owner:Sr().transform((e=>new no(e))),start:Qr(),value:Sr().transform((e=>rs(e,{name:"value"})))}),Ha=di({batches:hi(qa)}),Ja=di({stamps:hi(Za)}),Wa=Za,Xa=di({depth:Qr(),bucketDepth:Qr(),bucketUpperBound:Qr(),buckets:hi(di({bucketID:Qr(),collisions:Qr()}))}),Ka=di({batchID:Sr().transform((e=>new co(e)))}),Qa="stamps",Ya="batches";async function ec(e){const t=await Es(e,{method:"get",url:`${Ya}`,responseType:"json"});return Ha.parse(t.data).batches}async function tc(e){const t=await Es(e,{method:"get",url:`${Qa}`,responseType:"json"});return Ja.parse(t.data).stamps.map((e=>ys(e)))}const nc=di({commitment:Qr(),radius:Qr(),storageRadius:Qr(),reserveCapacityDoubling:Qr()}),rc=di({block:Qr(),chainTip:Qr(),totalAmount:Sr().transform((e=>rs(e,{name:"totalAmount"}))),currentPrice:Sr().transform(Number).transform((e=>{return t=e,Number.isInteger(t)?t<24e3?24e3:t:24e3;var t})),minimumValidityBlocks:Qr().optional()}),ic=di({bzzBalance:Sr().transform((e=>Vo.fromPLUR(rs(e,{name:"bzzBalance"})))),nativeTokenBalance:Sr().transform((e=>No.fromWei(rs(e,{name:"nativeTokenBalance"})))),chainID:Qr(),chequebookContractAddress:Sr(),walletAddress:Sr()}),oc=di({transactionHash:Sr().transform((e=>new oo(e)))}),sc="wallet";var ac=n(359),cc=n.n(ac);const uc=di({overlay:Sr(),proximity:Qr(),beeMode:Sr().transform(To),reserveSize:Qr(),reserveSizeWithinRadius:Qr(),pullsyncRate:Qr(),storageRadius:Qr(),connectedPeers:Qr(),neighborhoodSize:Qr(),batchCommitment:Qr(),isReachable:ni(),lastSyncedBlock:Qr(),committedDepth:Qr(),isWarmingUp:ni()}),lc=di({apiVersion:Sr(),version:Sr(),status:(fc="ok",new zi({type:"literal",values:Array.isArray(fc)?fc:[fc],...te(hc)}))});var fc,hc;const pc=di({apiVersion:Sr(),version:Sr(),status:Ei(["ready","notReady"])}),dc=di({beeMode:Sr().transform(To),chequebookEnabled:ni(),swapEnabled:ni()}),mc=di({gateway:ni()}),gc="2.8.1-7cf53193",yc=gc.split("-")[0],wc="8.1.0";async function bc(e){const t=await Es(e,{method:"get",url:"health",responseType:"json"});return lc.parse(t.data)}const vc=di({transactionHash:Sr().transform((e=>new oo(e))),to:Sr(),nonce:Qr(),gasPrice:Sr().transform((e=>rs(e,{name:"gasPrice"}))),gasLimit:Qr(),data:Sr(),created:Sr(),description:Sr(),value:Sr().transform((e=>rs(e,{name:"value"})))}),Tc=di({pendingTransactions:hi(vc)}),Bc=vc,Ec=di({transactionHash:Sr().transform((e=>new oo(e)))}),zc="transactions";const Rc=di({issuer:Sr().transform((e=>i.yI.hexToUint8Array(e))),index:Sr().transform((e=>i.yI.hexToUint8Array(e))),timestamp:Sr().transform((e=>i.yI.hexToUint8Array(e))),signature:Sr().transform((e=>i.yI.hexToUint8Array(e)))});const xc=hi(Sr().transform((e=>new to(e)))),Ic=di({ref:Sr().transform((e=>new io(e))),historyref:Sr().transform((e=>new io(e)))}),$c="grantee";var kc=null;"undefined"!=typeof WebSocket?kc=WebSocket:"undefined"!=typeof MozWebSocket?kc=MozWebSocket:void 0!==n.g?kc=n.g.WebSocket||n.g.MozWebSocket:"undefined"!=typeof window?kc=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(kc=self.WebSocket||self.MozWebSocket);const Sc=kc,Ac="gsoc";const Oc=di({references:hi(Sr()).nullable()}),_c="pins";const Dc="pss";async function Vc(e,t,n,r,i,o){await Es(e,{method:"post",url:`${Dc}/send/${t}/${n}`,data:r,responseType:"json",params:{recipient:o},headers:vs(i)})}const Nc=di({durationSeconds:Qr()});async function Cc(e){await Es(e,{url:"",responseType:"text"})}const Pc=di({isRetrievable:ni()}),Fc="stewardship";const Mc=di({address:Sr().nullish().transform((e=>e??"")),seen:Qr(),sent:Qr(),split:Qr(),startedAt:Sr(),stored:Qr(),synced:Qr(),uid:Qr()}),Uc=di({tags:hi(Mc)}),Lc="tags";const jc=ji()("bee-js:manifest"),Gc=new TextEncoder,Zc=new TextDecoder,qc=new Uint8Array([47]),Hc=i.yI.hexToUint8Array("5768b3b6a7db56d21d1abff40d41cebfc83448fed8d7e9b06ec0d3b073f28f7b");class Jc{constructor(e,t){this.prefix=e,this.node=t}static split(e,t){const n=i.yI.commonPrefix(e.prefix,t.prefix);if(n.length===e.prefix.length){const r=t.prefix.slice(n.length);return t.node.path=t.prefix.slice(n.length),t.prefix=t.prefix.slice(n.length),t.node.parent=e.node,e.node.forks.set(r[0],t),e}if(n.length===t.prefix.length){const r=e.prefix.slice(n.length);return e.node.path=e.prefix.slice(n.length),e.prefix=e.prefix.slice(n.length),e.node.parent=t.node,t.node.forks.set(r[0],e),t}const r=new Wc({path:n}),o=new Jc(e.prefix.slice(n.length),e.node),s=new Jc(t.prefix.slice(n.length),t.node);return e.node.path=e.prefix.slice(n.length),t.node.path=t.prefix.slice(n.length),e.prefix=e.prefix.slice(n.length),t.prefix=t.prefix.slice(n.length),r.forks.set(o.prefix[0],o),r.forks.set(s.prefix[0],s),o.node.parent=r,s.node.parent=r,new Jc(n,r)}marshal(){if(!this.node.selfAddress)throw Error("Fork#marshal node.selfAddress is not set");const e=[];if(e.push(new Uint8Array([this.node.type??this.node.determineType()])),e.push(i.yI.numberToUint8(this.prefix.length)),e.push(this.prefix),this.prefix.length<30&&e.push(new Uint8Array(30-this.prefix.length)),e.push(this.node.selfAddress),jc("marshalling fork",{prefixLength:this.prefix.length,prefix:Zc.decode(this.prefix),address:i.yI.uint8ArrayToHex(this.node.selfAddress)}),this.node.metadata){const t=i.yI.padEndToMultiple(new Uint8Array([0,0,...Gc.encode(JSON.stringify(this.node.metadata))]),32,10),n=i.yI.numberToUint16(t.length-2,"BE");t.set(n,0),e.push(t)}return i.yI.concatBytes(...e)}static unmarshal(e,t){const n=i.yI.uint8ToNumber(e.read(1)),r=i.yI.uint8ToNumber(e.read(1)),o=e.read(r);r<30&&e.read(30-r);const s=e.read(t);let a;if(jc("unmarshalling fork",{type:n,prefixLength:r,prefix:Zc.decode(o),addressLength:t,address:i.yI.uint8ArrayToHex(s)}),function(e,t){return(e&t)===t}(n,16)){const t=i.yI.uint16ToNumber(e.read(2),"BE");a=JSON.parse(Zc.decode(e.read(t)))}return new Jc(o,new Wc({selfAddress:s,metadata:a,path:o,type:n}))}}class Wc{obfuscationKey=new Uint8Array(32);selfAddress=null;targetAddress=new Uint8Array(32);metadata=null;path=new Uint8Array(0);forks=new Map;parent=null;type=null;constructor(e){e?.targetAddress&&(this.targetAddress=e.targetAddress),e?.selfAddress&&(this.selfAddress=e.selfAddress),e?.metadata&&(this.metadata=e.metadata),e?.obfuscationKey&&(this.obfuscationKey=e.obfuscationKey),e?.path&&(this.path=e.path),e?.parent&&(this.parent=e.parent),this.type=e?.type??null}get fullPath(){return i.yI.concatBytes(this.parent?.fullPath??new Uint8Array(0),this.path)}get fullPathString(){return Zc.decode(this.fullPath)}getRootMetadata(){const e=this.find("/");return e&&e.metadata?i.Xx.of(e.metadata):i.Xx.empty()}getDocsMetadata(){const e=this.find("/");return e&&e.metadata?{indexDocument:e.metadata["website-index-document"]??null,errorDocument:e.metadata["website-error-document"]??null}:{indexDocument:null,errorDocument:null}}async resolveFeed(e,t){const n=this.find("/");if(!n||!n.metadata)return i.Xx.empty();const r=n.metadata["swarm-feed-owner"],o=n.metadata["swarm-feed-topic"];return r&&o?i.Xx.of(await e.fetchLatestFeedUpdate(o,r,t)):i.Xx.empty()}async marshal(){for(const i of this.forks.values())i.node.selfAddress||(i.node.selfAddress=(await i.node.calculateSelfAddress()).toUint8Array());const e=!i.yI.equals(this.targetAddress,fu);let t=0;if(e)t=this.targetAddress.length;else for(const i of this.forks.values())if(i.node.selfAddress){t=i.node.selfAddress.length;break}const n=new Uint8Array(32);n.set(Hc,0),n.set(i.yI.numberToUint8(t),31);const r=e?this.targetAddress:new Uint8Array(t),o=new Uint8Array(32);for(const c of this.forks.keys())i.yI.setBit(o,c,1,"LE");const s=[];for(let c=0;c<256;c++)i.yI.getBit(o,c,"LE")&&s.push(this.forks.get(c).marshal());const a=i.yI.xorCypher(i.yI.concatBytes(n,r,o,...s),this.obfuscationKey);return i.yI.concatBytes(this.obfuscationKey,a)}static async unmarshal(e,t,n,r){t=new io(t);const i=(await e.downloadData(t,n,r)).toUint8Array();return this.unmarshalFromData(i,t.toUint8Array())}static unmarshalFromData(e,t){const n=e.subarray(0,32),r=i.yI.xorCypher(e.subarray(32),n),o=new i.pp(r),s=o.read(31);if(!i.yI.equals(s,Hc.slice(0,31)))throw new Error("MantarayNode#unmarshal invalid version hash");const a=i.yI.uint8ToNumber(o.read(1)),c=a?o.read(a):fu,u=new Wc({selfAddress:t,targetAddress:c,obfuscationKey:n}),l=o.read(32);if(a>0)for(let f=0;f<256;f++)if(i.yI.getBit(l,f,"LE")){const e=Jc.unmarshal(o,t.length);u.forks.set(f,e),e.node.parent=u}return u}addFork(e,t,n){this.selfAddress=null,this.type=null,e=e instanceof Uint8Array?e:Gc.encode(e),jc("adding fork",{path:Zc.decode(e),reference:new io(t).represent()});let r=this;for(;e.length;){const i=e.slice(0,30),o=0===(e=e.slice(30)).length,[s,a]=r.findClosest(i),c=i.slice(a.length);if(a.length&&(r=s),!c.length)continue;const u=new Jc(c,new Wc({targetAddress:o?new io(t).toUint8Array():void 0,metadata:o?n:void 0,path:c})),l=s.forks.get(c[0]);if(l){const e=Jc.split(u,l);r.forks.set(c[0],e),e.node.parent=r,r.selfAddress=null,r.type=null,r=u.node}else r.forks.set(c[0],u),u.node.parent=r,r.selfAddress=null,r.type=null,r=u.node}}removeFork(e){if(this.selfAddress=null,this.type=null,0===(e=e instanceof Uint8Array?e:Gc.encode(e)).length)throw Error("MantarayNode#removeFork [path] parameter cannot be empty");const t=this.find(e);if(!t)throw Error("MantarayNode#removeFork fork not found");const[n,r]=this.findClosest(e.slice(0,e.length-1));n.forks.delete(e.slice(r.length)[0]);for(const o of t.forks.values())n.addFork(i.yI.concatBytes(t.path,o.prefix),o.node.targetAddress,o.node.metadata)}async calculateSelfAddress(){return this.selfAddress?new io(this.selfAddress):new io((await i.vU.root(await this.marshal())).hash())}async saveRecursively(e,t,n,r){for(const o of this.forks.values()){const i=await o.node.saveRecursively(e,t,n,r);if(n?.act){let e;i.historyAddress.ifPresent((t=>e=t)),e&&(o.node.metadata||(o.node.metadata={}),o.node.metadata["swarm-act-history-address"]=e.toHex())}}const i=await e.uploadData(t,await this.marshal(),n,r);return this.selfAddress=i.reference.toUint8Array(),i}async loadRecursively(e,t,n){for(const r of this.forks.values()){if(!r.node.selfAddress)throw Error("MantarayNode#loadRecursively fork.node.selfAddress is not set");let i=t;r.node.metadata&&r.node.metadata["swarm-act-history-address"]&&(i={...t,actHistoryAddress:r.node.metadata["swarm-act-history-address"]});const o=await Wc.unmarshal(e,r.node.selfAddress,i,n);r.node.targetAddress=o.targetAddress,r.node.forks=o.forks,r.node.path=r.prefix,r.node.parent=this,await r.node.loadRecursively(e,t,n)}}find(e){const[t,n]=this.findClosest(e);return n.length===e.length?t:null}findClosest(e,t=new Uint8Array){if(0===(e=e instanceof Uint8Array?e:Gc.encode(e)).length)return[this,t];const n=this.forks.get(e[0]);return n&&i.yI.commonPrefix(n.prefix,e).length===n.prefix.length?n.node.findClosest(e.slice(n.prefix.length),i.yI.concatBytes(t,n.prefix)):[this,t]}collect(e=[]){for(const t of this.forks.values())i.yI.equals(t.node.targetAddress,fu)||e.push(t.node),t.node.collect(e);return e}collectAndMap(){const e=this.collect(),t={};for(const n of e)t[n.fullPathString]=new io(n.targetAddress).toHex();return t}determineType(){let e=0;return i.yI.equals(this.targetAddress,fu)&&0!==this.forks.size||(e|=2),this.forks.size>0&&(e|=4),i.yI.indexOf(this.path,qc)>0&&(e|=8),this.metadata&&(e|=16),e}}var Xc=n(61),Kc=n.n(Xc);async function Qc(e){if("string"!=typeof e)throw new TypeError("dir has to be string!");if(""===e)throw new TypeError("dir must not be empty string!");return Yc(e,"")}async function Yc(e,t){const n=Kc().join(e,t),r=await la().promises.opendir(n);let i=[];for await(const o of r){const n=Kc().join(e,t,o.name),r=Kc().join(t,o.name);o.isFile()?i.push({path:r,size:(await la().promises.stat(n)).size,fsPath:n}):o.isDirectory()&&(i=[...await Yc(e,r),...i])}return i}async function eu(e){if("string"!=typeof e)throw new TypeError("dir has to be string!");if(""===e)throw new TypeError("dir must not be empty string!");const t=await la().promises.opendir(e);let n=0;for await(const r of t)if(r.isFile()){n+=(await la().promises.stat(Kc().join(e,r.name))).size}else r.isDirectory()&&(n+=await eu(Kc().join(e,r.name)));return n}const tu={aac:"audio/aac",abw:"application/x-abiword",ai:"application/postscript",arc:"application/octet-stream",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",dll:"application/octet-stream",dmg:"application/x-apple-diskimage",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/x-icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"application/javascript",json:"application/json",mid:"audio/midi",midi:"audio/midi",mp2:"audio/mpeg",mp3:"audio/mpeg",mp4:"video/mp4",mpa:"video/mpeg",mpe:"video/mpeg",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",otf:"font/otf",png:"image/png",pdf:"application/pdf",ppt:"application/vnd.ms-powerpoint",rar:"application/x-rar-compressed",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"application/typescript",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/x-wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.ms-excel",xml:"application/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3gp2":"video/3gpp2","7z":"application/x-7z-compressed"};function nu(e){return["text/html","text/css"].includes(e)?`${e}; charset=utf-8`:e}async function ru(e){if("string"==typeof e)return(new TextEncoder).encode(e);if(e instanceof Buffer)return new Uint8Array(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(t=e,Array.isArray(t)&&t.length>0&&t.every((e=>e instanceof Buffer)))return new Uint8Array(Buffer.concat(e));var t;throw new TypeError("unknown websocket data type")}const iu=["1","7","9","11","13","15","17","19","20","21","22","23","25","37","42","43","53","69","77","79","87","95","101","102","103","104","109","110","111","113","115","117","119","123","135","137","139","143","161","179","389","427","465","512","513","514","515","526","530","531","532","540","548","554","556","563","587","601","636","989","990","993","995","1719","1720","1723","2049","3659","4045","4190","5060","5061","6000","6566","6665","6666","6667","6668","6669","6679","6697","10080"];function ou(e){if(!function(e){try{if("string"!=typeof e)return!1;const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch(t){return!1}}(e))throw new mo("URL is not valid!",e);const t=new URL(e).port;if(t&&!function(e){if("string"!=typeof e)return!1;if(iu.includes(e))return!1;const t=parseInt(e,10);return t>0&&t<65536&&!isNaN(t)}(t))throw new mo("Port in URL is considered bad port and cannot be used!",t)}class su{constructor(e,t){ou(e),this.url=function(e){return e.endsWith("/")?e.slice(0,-1):e}(e),t?.signer&&(this.signer=new eo(t.signer)),this.network=t?.network??"gnosis",this.requestOptions={baseURL:this.url,timeout:t?.timeout??0,headers:t?.headers,onRequest:t?.onRequest,httpAgent:t?.httpAgent,httpsAgent:t?.httpsAgent}}async uploadData(e,t,n,r){return e=new co(e),is(t),n&&(n=qo.parse(n)),js(this.getRequestOptionsForCall(r),t,e,n)}async probeData(e,t){return e=new io(e),async function(e,t){t=new io(t);const n=await Es(e,{url:`${Ls}/${t}`,method:"head",responseType:"json"});return{contentLength:parseInt(n.headers["content-length"])}}(this.getRequestOptionsForCall(t),e)}async downloadData(e,t,n){return t&&(t=Go.parse(t)),Gs(this.getRequestOptionsForCall(n),new Js(e),t)}async downloadReadableData(e,t,n){return t&&(t=Go.parse(t)),async function(e,t,n){return n&&(n=Go.parse(n)),(await Es(e,{responseType:"stream",url:`${Ls}/${t}`,headers:vs(null,n)})).data}(this.getRequestOptionsForCall(n),new Js(e),t)}async uploadChunk(e,t,n,r){const o="identifier"in t&&"signature"in t&&"owner"in t;if(t=t instanceof Uint8Array?t:t.data,n&&(n=Zo.parse(n)),t.length<so.LENGTH)throw new mo(`Chunk has to have size of at least ${so.LENGTH}.`,t);if(!o&&t.length>zo+so.LENGTH)throw new mo(`Content Addressed Chunk must not exceed ${zo+so.LENGTH} bytes.`,t);if(o&&t.length>zo+so.LENGTH+uo.LENGTH+ro.LENGTH)throw new mo(`Single Owner Chunk must not exceed ${zo+so.LENGTH+uo.LENGTH+ro.LENGTH} bytes.`,t);return async function(e,t,n,r){const o=await Es(e,{method:"post",url:`${Is}`,data:t,headers:{"content-type":"application/octet-stream",...vs(n,r)},responseType:"json"});return{reference:bo.parse(o.data).reference,tagUid:o.headers["swarm-tag"]?os(o.headers["swarm-tag"]):void 0,historyAddress:o.headers["swarm-act-history-address"]?i.Xx.of(new io(o.headers["swarm-act-history-address"])):i.Xx.empty()}}(this.getRequestOptionsForCall(r),t,e,n)}async downloadChunk(e,t,n){return e=new io(e),t&&(t=Go.parse(t)),$s(this.getRequestOptionsForCall(n),e,t)}async createGrantees(e,t,n){return e=new co(e),t=t.map((e=>new to(e))),async function(e,t,n){const r=await Es(e,{method:"post",url:$c,data:{grantees:n.map((e=>e.toCompressedHex()))},headers:vs(t),responseType:"json"}),i=Ic.parse(r.data);return{status:r.status,statusText:r.statusText,ref:i.ref,historyref:i.historyref}}(this.getRequestOptionsForCall(n),e,t)}async getGrantees(e,t){return async function(e,t){const n=await Es(t,{method:"get",url:`${$c}/${e}`,responseType:"json"});return{status:n.status,statusText:n.statusText,grantees:xc.parse(n.data)}}(e=new io(e),this.getRequestOptionsForCall(t))}async patchGrantees(e,t,n,r,i){return async function(e,t,n,r,i){const o=await Es(i,{method:"patch",url:`${$c}/${t}`,data:{add:r.add?.map((e=>e.toCompressedHex())),revoke:r.revoke?.map((e=>e.toCompressedHex()))},headers:{...vs(e),"swarm-act-history-address":n.toHex()},responseType:"json"}),s=Ic.parse(o.data);return{status:o.status,statusText:o.statusText,ref:s.ref,historyref:s.historyref}}(e=new co(e),t=new io(t),n=new io(n),{add:r.add?.map((e=>new to(e)))??[],revoke:r.revoke?.map((e=>new to(e)))??[]},this.getRequestOptionsForCall(i))}async uploadFile(e,t,n,r,i){if(e=new co(e),function(e){if(!("string"==typeof e||e instanceof Uint8Array||Po(e)||ns(e)))throw new TypeError("Data must be either string, Readable, Uint8Array or File!")}(t),r&&(r=Ho.parse(r)),n&&"string"!=typeof n)throw new TypeError("name has to be string or undefined!");if(Po(t)){const o=await async function(e){return e.arrayBuffer?e.arrayBuffer():new Promise((t=>{const n=new FileReader;n.onload=()=>t(n.result),n.readAsArrayBuffer(e)}))}(t),s=n??t.name,a=t.type,c={...r,contentType:a};return pa(this.getRequestOptionsForCall(i),o,e,s,c)}return pa(this.getRequestOptionsForCall(i),t,e,n,r)}async downloadFile(e,t="",n,r){return n&&(n=Go.parse(n)),async function(e,t,n="",r){const i=await Es(e,{method:"GET",responseType:"arraybuffer",url:`${ha}/${t}/${n}`,headers:vs(null,r)});return{...bs(i.headers),data:new Ji(i.data)}}(this.getRequestOptionsForCall(r),new Js(e),t,n)}async downloadReadableFile(e,t="",n,r){return e=new io(e),n&&(n=Go.parse(n)),async function(e,t,n="",r){t=new io(t);const i=await Es(e,{method:"GET",responseType:"stream",url:`${ha}/${t}/${n}`,headers:vs(null,r)});return{...bs(i.headers),data:i.data}}(this.getRequestOptionsForCall(r),e,t,n)}async uploadFiles(e,t,n,r){e=new co(e),n&&(n=Jo.parse(n));const i=sa(t);return da(this.getRequestOptionsForCall(r),i,e,n)}async hashDirectory(e){return async function(e){const t=await Qc(e),n=new Wc;for(const r of t){const e=new i.vU(i.vU.NOOP);if(!r.fsPath)throw Error("File does not have fsPath, which should never happen in node. Please report this issue.");const t=(0,ua.createReadStream)(r.fsPath);for await(const n of t)await e.append(n);const o=await e.finalize(),{filename:s,extension:a}=i.DH.parseFilename(r.path);n.addFork(r.path,o.hash(),{"Content-Type":nu(tu[a.toLowerCase()]||"application/octet-stream"),Filename:s})}return n.calculateSelfAddress()}(e)}async streamDirectory(e,t,n,r,o){return async function(e,t,n,r,o,s){const a=new i.O3(64,64);let c=0,u=0;n=new co(n);const l=await Qc(t);for(const i of l)c+=(f=i.size,function e(t){return t<=1?t:t+e(Math.ceil(t/128))}(Math.ceil(f/4096)));var f;let h=!1;async function p(t){await a.enqueue((async()=>{await e.uploadChunk(n,t.build(),o,s),r?.({total:c,processed:++u})}))}const d=new Wc;for(const m of l){if(!m.fsPath)throw Error("File does not have fsPath, which should never happen in node. Please report this issue.");const e=(0,ua.createReadStream)(m.fsPath),t=new i.vU(p);for await(const i of e)await t.append(i);const n=await t.finalize();await a.drain();const{filename:r,extension:o}=i.DH.parseFilename(m.path);d.addFork(m.path,n.hash(),{"Content-Type":nu(tu[o.toLowerCase()]||"application/octet-stream"),Filename:r}),"index.html"===m.path&&(h=!0)}if(h||o?.indexDocument||o?.errorDocument){const e={};o?.indexDocument?e["website-index-document"]=o.indexDocument:h&&(e["website-index-document"]="index.html"),o?.errorDocument&&(e["website-error-document"]=o.errorDocument),d.addFork("/",fu,e)}return d.saveRecursively(e,n,o,s)}(this,t,e=new co(e),n,r,this.getRequestOptionsForCall(o))}async streamFiles(e,t,n,r,i){return e=new co(e),async function(){throw new Error("Streaming files is not supported in Node.js")}(0,0,0,0,0,this.getRequestOptionsForCall(i))}async uploadCollection(e,t,n,r){return e=new co(e),ia(t),n&&(n=Jo.parse(n)),da(this.getRequestOptionsForCall(r),t,e,n)}async uploadFilesFromDirectory(e,t,n,r){e=new co(e),n&&(n=Jo.parse(n));const i=await Qc(t);return da(this.getRequestOptionsForCall(r),i,e,n)}async createTag(e){return async function(e){const t=await Es(e,{method:"post",url:Lc,responseType:"json"});return Mc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getAllTags(e,t){return e&&(e=ts.parse(e)),async function(e,t,n){const r=await Es(e,{url:Lc,params:{offset:t,limit:n},responseType:"json"});return Uc.parse(r.data).tags}(this.getRequestOptionsForCall(t),e?.offset,e?.limit)}async retrieveTag(e,t){return e=os(e),async function(e,t){const n=await Es(e,{url:`${Lc}/${t}`,responseType:"json"});return Mc.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async deleteTag(e,t){return e=os(e),async function(e,t){await Es(e,{method:"delete",url:`${Lc}/${t}`})}(this.getRequestOptionsForCall(t),e)}async updateTag(e,t,n){return t=new io(t),e=os(e),async function(e,t,n){await Es(e,{method:"patch",url:`${Lc}/${t}`,data:{reference:n}})}(this.getRequestOptionsForCall(n),e,t)}async pin(e,t){return e=new io(e),async function(e,t){await Es(e,{method:"post",responseType:"json",url:`${_c}/${t}`})}(this.getRequestOptionsForCall(t),e)}async unpin(e,t){return e=new io(e),async function(e,t){await Es(e,{method:"delete",responseType:"json",url:`${_c}/${t}`})}(this.getRequestOptionsForCall(t),e)}async getAllPins(e){return async function(e){const t=await Es(e,{method:"get",responseType:"json",url:`${_c}`}),{references:n}=Oc.parse(t.data);return(n??[]).map((e=>new io(e)))}(this.getRequestOptionsForCall(e))}async getPin(e,t){return e=new io(e),async function(e,t){const n=await Es(e,{method:"get",responseType:"json",url:`${_c}/${t}`});return bo.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async reuploadPinnedData(e,t,n){e=new co(e),t=new io(t),await async function(e,t,n){await Es(e,{method:"put",url:`${Fc}/${n}`,headers:{"swarm-postage-batch-id":t.toHex()}})}(this.getRequestOptionsForCall(n),e,t)}async isReferenceRetrievable(e,t){return e=new io(e),async function(e,t){t=new io(t);const n=await Es(e,{method:"get",responseType:"json",url:`${Fc}/${t}`});return Pc.parse(n.data).isRetrievable}(this.getRequestOptionsForCall(t),e)}async isFeedRetrievable(e,t,n,r,o){if(e=new no(e),t=new lo(t),r&&(r=Go.parse(r)),!n)try{return await this.makeFeedReader(t,e,o).download(),!0}catch(s){const e=i.Rb.getDeep(s,"status");if(404===e||500===e)return!1;throw s}return ra(this,e,t,n,r,this.getRequestOptionsForCall(o))}async pssSend(e,t,n,r,i,o){return e=new co(e),is(r),i?(i=new to(i),Vc(this.getRequestOptionsForCall(o),t,n,r,e,i)):Vc(this.getRequestOptionsForCall(o),t,n,r,e)}pssSubscribe(e,t){t=Ko.parse(t);const n=function(e,t,n){const r=e.replace(/^http/i,"ws");return"browser"===i.iQ.whereAmI()?new Sc(`${r}/${Dc}/subscribe/${t.toHex()}`):new Sc(`${r}/${Dc}/subscribe/${t.toHex()}`,{headers:n})}(this.url,e,this.requestOptions.headers);let r=!1;const o={topic:e,cancel:()=>{r||(r=!0,n.terminate?n.terminate():n.close())}};return n.onmessage=async e=>{const n=await ru(e.data);n.length&&t.onMessage(new Ji(n),o)},n.onerror=e=>{r||t.onError(new po(e.message),o)},n.onclose=()=>{t.onClose(o)},o}async pssReceive(e,t=0){if("number"!=typeof t)throw new TypeError("timeoutMsc parameter has to be a number!");return new Promise(((n,r)=>{let i;const o=this.pssSubscribe(e,{onError:e=>{clearTimeout(i),o.cancel(),r(e.message)},onMessage:e=>{clearTimeout(i),o.cancel(),n(e)},onClose:()=>{clearTimeout(i),o.cancel()}});t>0&&(i=setTimeout((()=>{o.cancel(),r(new po("pssReceive timeout"))}),t))}))}gsocMine(e,t,n=12){e=new ao(e),t=new ro(t);for(let r=0n;r<0xffffn;r++){const o=new eo(i.yI.numberToUint256(2867n+r,"BE")),s=_s(t,o.publicKey().address());if(256-i.yI.proximity(s.toUint8Array(),e.toUint8Array())<=256-n)return o}throw Error("Could not mine a valid signer")}async gsocSend(e,t,n,r,i,o){e=new co(e),t=new eo(t),n=new ro(n);const s=Us(r).toSingleOwnerChunk(n,t);return async function(e,t,n,r){return Vs(e,t,n,r)}(this.getRequestOptionsForCall(o),s,e,i)}gsocSubscribe(e,t,n){e=new no(e),t=new ro(t),n=Qo.parse(n);const r=_s(t,e),o=function(e,t,n){const r=e.replace(/^http/i,"ws");return"browser"===i.iQ.whereAmI()?new Sc(`${r}/${Ac}/subscribe/${t.toHex()}`):new Sc(`${r}/${Ac}/subscribe/${t.toHex()}`,{headers:n})}(this.url,r,this.requestOptions.headers);let s=!1;const a={address:e,cancel:()=>{s||(s=!0,o.terminate?o.terminate():o.close())}};return o.onmessage=async e=>{const t=await ru(e.data);t.length&&n.onMessage(new Ji(t),a)},o.onerror=e=>{s||n.onError(new po(e.message),a)},o.onclose=()=>{n.onClose(a)},a}async createFeedManifest(e,t,n,r,i){return e=new co(e),t=new lo(t),n=new no(n),r&&(r=Zo.parse(r)),async function(e,t,n,r,i){const o=await Es(e,{method:"post",responseType:"json",url:`${Zs}/${t}/${n}`,headers:vs(r,i)});return bo.parse(o.data).reference}(this.getRequestOptionsForCall(i),n,t,e,r)}makeFeedReader(e,t,n){return e=new lo(e),t=new no(t),ta(this.getRequestOptionsForCall(n),e,t)}makeFeedWriter(e,t,n){if(e=new lo(e),!(t=t?new eo(t):this.signer))throw Error("No signer provided");return na(this.getRequestOptionsForCall(n),e,t)}async fetchLatestFeedUpdate(e,t,n){return e=new lo(e),t=new no(t),Hs(this.getRequestOptionsForCall(n),t,e)}makeContentAddressedChunk(e,t){return Us(e,t)}unmarshalContentAddressedChunk(e){return Ms(e)}makeSingleOwnerChunk(e,t,n,r,i){return Ds(e,t,n,r,i)}calculateSingleOwnerChunkAddress(e,t){return _s(e,t)}unmarshalSingleOwnerChunk(e,t){return Os(e,t)}makeSOCReader(e,t){return{owner:e=new no(e),download:Cs.bind(null,this.getRequestOptionsForCall(t),e)}}makeSOCWriter(e,t){if(!(e=e?new eo(e):this.signer))throw Error("No signer provided");return{...this.makeSOCReader(e.publicKey().address(),t),upload:Ns.bind(null,this.getRequestOptionsForCall(t),e)}}async createEnvelope(e,t,n){return e=new co(e),t=new io(t),async function(e,t,n){const r=await Es(e,{method:"post",responseType:"json",url:`envelope/${n}`,headers:{"swarm-postage-batch-id":t.toHex()}}),i=Rc.parse(r.data);return{issuer:i.issuer,index:i.index,timestamp:i.timestamp,signature:i.signature,batchId:t}}(this.getRequestOptionsForCall(n),e,t)}async rchash(e,t,n,r){return async function(e,t,n,r){const i=await Es(e,{responseType:"json",url:`rchash/${t}/${n}/${r}`});return Nc.parse(i.data).durationSeconds}(this.getRequestOptionsForCall(r),e,t,n)}async checkConnection(e){return Cc(this.getRequestOptionsForCall(e))}async isConnected(e){try{await Cc(this.getRequestOptionsForCall(e))}catch(t){return!1}return!0}async isGateway(e){return async function(e){try{const t=await Es(e,{url:"/gateway"});return mc.parse(t.data).gateway}catch(t){return!1}}(this.getRequestOptionsForCall(e))}async getNodeAddresses(e){return async function(e){const t=await Es(e,{url:"addresses",responseType:"json"});return Oa.parse(t.data)}(this.getRequestOptionsForCall(e))}async getBlocklist(e){return async function(e){const t=await Es(e,{url:"blocklist",responseType:"json"});return Da.parse(t.data).peers}(this.getRequestOptionsForCall(e))}async getPeers(e){return async function(e){const t=await Es(e,{url:"peers",responseType:"json"});return _a.parse(t.data).peers}(this.getRequestOptionsForCall(e))}async removePeer(e,t){return e=new ao(e),async function(e,t){return(await Es(e,{url:`peers/${t}`,responseType:"json",method:"DELETE"})).data}(this.getRequestOptionsForCall(t),e)}async getTopology(e){return async function(e){const t=await Es(e,{url:"topology",responseType:"json"});return Va.parse(t.data)}(this.getRequestOptionsForCall(e))}async pingPeer(e,t){return e=new ao(e),async function(e,t){return(await Es(e,{url:`pingpong/${t}`,responseType:"json",method:"POST"})).data}(this.getRequestOptionsForCall(t),e)}async getAllBalances(e){return async function(e){const t=await Es(e,{url:wa,responseType:"json"});return ga.parse(t.data)}(this.getRequestOptionsForCall(e))}async getPeerBalance(e,t){return e=new ao(e),async function(e,t){const n=await Es(e,{url:`${wa}/${t}`,responseType:"json"});return ya.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getPastDueConsumptionBalances(e){return async function(e){const t=await Es(e,{url:ba,responseType:"json"});return ga.parse(t.data)}(this.getRequestOptionsForCall(e))}async getPastDueConsumptionPeerBalance(e,t){return e=new ao(e),async function(e,t){const n=await Es(e,{url:`${ba}/${t}`,responseType:"json"});return ya.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getChequebookAddress(e){return async function(e){const t=await Es(e,{url:$a+"/address",responseType:"json"});return Ba.parse(t.data)}(this.getRequestOptionsForCall(e))}async getChequebookBalance(e){return async function(e){const t=await Es(e,{url:$a+"/balance",responseType:"json"});return Ea.parse(t.data)}(this.getRequestOptionsForCall(e))}async getLastCheques(e){return async function(e){const t=await Es(e,{url:$a+"/cheque",responseType:"json"});return xa.parse(t.data)}(this.getRequestOptionsForCall(e))}async getLastChequesForPeer(e,t){return e=new ao(e),async function(e,t){const n=await Es(e,{url:$a+`/cheque/${t}`,responseType:"json"});return Ra.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getLastCashoutAction(e,t){return e=new ao(e),async function(e,t){const n=await Es(e,{url:$a+`/cashout/${t}`,responseType:"json"});return za.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async cashoutLastCheque(e,t,n){return e=new ao(e),t&&(t=es.parse(t)),async function(e,t,n){const r=await Es(e,{method:"post",url:$a+`/cashout/${t}`,responseType:"json",headers:vs(null,n)});return Ia.parse(r.data).transactionHash}(this.getRequestOptionsForCall(n),e,t)}async depositTokens(e,t,n){return this.depositBZZToChequebook(e,t,n)}async depositBZZToChequebook(e,t,n){const r=e instanceof Vo?e.toPLURString():rs(e,{min:1n,name:"amount"});let i;return t&&(i=rs(e,{min:0n,name:"gasPrice"})),async function(e,t,n){const r={};n&&(r["gas-price"]=n.toString());const i=await Es(e,{method:"post",url:$a+"/deposit",responseType:"json",params:{amount:t.toString(10)},headers:r});return Ia.parse(i.data).transactionHash}(this.getRequestOptionsForCall(n),r,i)}async withdrawTokens(e,t,n){return this.withdrawBZZFromChequebook(e,t,n)}async withdrawBZZFromChequebook(e,t,n){const r=e instanceof Vo?e.toPLURString():rs(e,{min:1n,name:"amount"});let i;return t&&(i=rs(e,{min:0n,name:"gasPrice"})),async function(e,t,n){const r={};n&&(r["gas-price"]=n.toString());const i=await Es(e,{method:"post",url:$a+"/withdraw",responseType:"json",params:{amount:t.toString(10)},headers:r});return Ia.parse(i.data).transactionHash}(this.getRequestOptionsForCall(n),r,i)}async withdrawBZZToExternalWallet(e,t,n){return e=e instanceof Vo?e:Vo.fromPLUR(e),t=new no(t),async function(e,t,n){const r=await Es(e,{method:"post",url:`${sc}/withdraw/bzz`,responseType:"json",params:{amount:t.toPLURString(),address:n.toHex()}});return oc.parse(r.data).transactionHash}(this.getRequestOptionsForCall(n),e,t)}async withdrawDAIToExternalWallet(e,t,n){return e=e instanceof No?e:No.fromWei(e),t=new no(t),async function(e,t,n){const r=await Es(e,{method:"post",url:`${sc}/withdraw/nativetoken`,responseType:"json",params:{amount:t.toWeiString(),address:n.toHex()}});return oc.parse(r.data).transactionHash}(this.getRequestOptionsForCall(n),e,t)}async getSettlements(e,t){return e=new ao(e),async function(e,t){const n=await Es(e,{url:`${Fa}/${t}`,responseType:"json"});return Ca.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getAllSettlements(e){return async function(e){const t=await Es(e,{url:Fa,responseType:"json"});return Pa.parse(t.data)}(this.getRequestOptionsForCall(e))}async getStatus(e){return async function(e){const t=await Es(e,{method:"get",url:"status",responseType:"json"});return uc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getHealth(e){return bc(this.getRequestOptionsForCall(e))}async getReadiness(e){return async function(e){const t=await Es(e,{method:"get",url:"readiness"});return pc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getNodeInfo(e){return async function(e){const t=await Es(e,{method:"get",url:"node",responseType:"json"});return dc.parse(t.data)}(this.getRequestOptionsForCall(e))}async isSupportedExactVersion(e){return async function(e){const{version:t}=await bc(e);return t===gc}(this.getRequestOptionsForCall(e))}async isSupportedApiVersion(e){return async function(e){const{apiVersion:t}=await bc(e);return cc()(t)===cc()(wc)}(this.getRequestOptionsForCall(e))}async getVersions(e){return async function(e){const{version:t,apiVersion:n}=await bc(e);return{supportedBeeVersion:gc,supportedBeeApiVersion:wc,beeVersion:t,beeApiVersion:n}}(this.getRequestOptionsForCall(e))}async getReserveState(e){return async function(e){const t=await Es(e,{method:"get",url:"reservestate",responseType:"json"});return nc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getChainState(e){return async function(e){const t=await Es(e,{method:"get",url:"chainstate",responseType:"json"});return rc.parse(t.data)}(this.getRequestOptionsForCall(e))}async getWalletBalance(e){return async function(e){const t=await Es(e,{method:"get",url:`${sc}`,responseType:"json"});return ic.parse(t.data)}(this.getRequestOptionsForCall(e))}async createPostageBatch(e,t,n,r){const i=rs(e,{min:0n,name:"amount"});if(n&&(n=Yo.parse(n)),t<xo||t>Io)throw new mo(`Depth has to be between ${xo}..${Io}`,t);const o=await this.getChainState(),s=17280n*BigInt(o.currentPrice)+1n;if(BigInt(i)<s)throw new mo(`Amount has to be at least ${s} (1 day at current price ${o.currentPrice})`,i);const a=await async function(e,t,n,r){const i={};r?.gasPrice&&(i["gas-price"]=r.gasPrice.toString()),void 0!==r?.immutableFlag&&(i.immutable=String(r.immutableFlag));const o=await Es(e,{method:"post",url:`${Qa}/${t}/${n}`,responseType:"json",params:{label:r?.label},headers:i});return Ka.parse(o.data).batchID}(this.getRequestOptionsForCall(r),i,t,n);return!1!==n?.waitForUsable&&await this.waitForUsablePostageStamp(a,n?.waitForUsableTimeout),a}async buyStorage(e,t,n,r,i,o){const s=ds(t,(await this.getChainState(r)).currentPrice,"gnosis"===this.network?5:15),a=ms(e,i,o);return n&&(n=Yo.parse(n)),this.createPostageBatch(s,a,n,r)}async getStorageCost(e,t,n,r,i){const o=ds(t,(await this.getChainState(n)).currentPrice,"gnosis"===this.network?5:15);return hs(ms(e,r,i),o)}async extendStorage(e,t,n,r,i,o){const s=await this.getPostageBatch(e,r),a=ms(t,i,o),c=await this.getChainState(r),u=a-s.depth,l=u<=0?1n:2n**BigInt(u),f="gnosis"===this.network?5:15,h=ds(n,c.currentPrice,f),p=ds(s.duration,c.currentPrice,f),d=(n.isZero()?p*l:(p+h)*l)-p;let m;if(d>0n&&(m=await this.topUpBatch(s.batchID,d,r)),u>0)return this.diluteBatch(s.batchID,a,r);if(!m)throw new Error("Nothing to extend, both size and duration are already sufficient");return m}async extendStorageSize(e,t,n,r,i){const o=await this.getChainState(n),s=await this.getPostageBatch(e,n),a=ms(t,r,i),c=a-s.depth;if(c<=0)throw new mo("New depth has to be greater than the original depth",a);const u=ds(s.duration,o.currentPrice,"gnosis"===this.network?5:15);return await this.topUpBatch(s.batchID,u*(2n**BigInt(c)-1n)+1n,n),this.diluteBatch(s.batchID,a,n)}async extendStorageDuration(e,t,n){const r=await this.getPostageBatch(e,n),i=ds(t,(await this.getChainState(n)).currentPrice,"gnosis"===this.network?5:15);return this.topUpBatch(r.batchID,i,n)}async getExtensionCost(e,t,n,r,i,o){const s=await this.getPostageBatch(e,r),a=await this.getChainState(r),c="gnosis"===this.network?5:15,u=n.isZero()?0n:ds(n,a.currentPrice,c),l=ms(t,i,o),f=ds(s.duration,a.currentPrice,c),h=hs(s.depth,f);return hs(Math.max(s.depth,l),f+u).minus(h)}async getSizeExtensionCost(e,t,n,r,i){const o=await this.getPostageBatch(e,n),s=await this.getChainState(n),a=ms(t,r,i);if(a-o.depth<=0)throw new mo("New depth has to be greater than the original depth",a);const c=ds(o.duration,s.currentPrice,"gnosis"===this.network?5:15),u=hs(o.depth,c);return hs(a,c).minus(u)}async getDurationExtensionCost(e,t,n){const r=await this.getPostageBatch(e,n),i=ds(t,(await this.getChainState(n)).currentPrice,"gnosis"===this.network?5:15);return hs(r.depth,i)}async updatePostageBatchLabel(e,t,n){return e=new co(e),async function(e,t,n){await Es(e,{method:"patch",url:`${Qa}/${t}`,responseType:"json",data:{label:n}})}(this.getRequestOptionsForCall(n),e,t)}async renameStorage(e,t,n){return this.updatePostageBatchLabel(e,t,n)}async calculateTopUpForBzz(e,t,n){const r=await this.getChainState(n),i="gnosis"===this.network?5:15,o=t.toPLURBigInt()/2n**BigInt(e);return{amount:o,duration:ps(o,r.currentPrice,i)}}async topUpBatch(e,t,n){e=new co(e);const r=rs(t,{min:1n,name:"amount"});return async function(e,t,n){const r=await Es(e,{method:"patch",url:`${Qa}/topup/${t}/${n}`,responseType:"json"});return Ka.parse(r.data).batchID}(this.getRequestOptionsForCall(n),e,r)}async diluteBatch(e,t,n){return e=new co(e),t=Qr().int().min(18).max(255).parse(t),async function(e,t,n){const r=await Es(e,{method:"patch",url:`${Qa}/dilute/${t}/${n}`,responseType:"json"});return Ka.parse(r.data).batchID}(this.getRequestOptionsForCall(n),e,t)}async getPostageBatch(e,t,n,r){return e=new co(e),async function(e,t,n,r){const i=await Es(e,{method:"get",url:`${Qa}/${t}`,responseType:"json"});return ys(Wa.parse(i.data),n,r)}(this.getRequestOptionsForCall(t),e,n,r)}async getGlobalPostageBatch(e,t){return e=new co(e),async function(e,t){const n=await Es(e,{method:"get",url:`${Ya}/${t}`,responseType:"json"});return qa.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getPostageBatchBuckets(e,t){return e=new co(e),async function(e,t){const n=await Es(e,{method:"get",url:`${Qa}/${t}/buckets`,responseType:"json"});return Xa.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async getAllPostageBatch(e){return tc(this.getRequestOptionsForCall(e))}async getAllGlobalPostageBatch(e){return ec(this.getRequestOptionsForCall(e))}async getPostageBatches(e){return tc(this.getRequestOptionsForCall(e))}async getGlobalPostageBatches(e){return ec(this.getRequestOptionsForCall(e))}async getAllPendingTransactions(e){return async function(e){const t=await Es(e,{url:zc,responseType:"json"});return Tc.parse(t.data).pendingTransactions}(this.getRequestOptionsForCall(e))}async getPendingTransaction(e,t){return e=new oo(e),async function(e,t){const n=await Es(e,{url:`${zc}/${t}`,responseType:"json"});return Bc.parse(n.data)}(this.getRequestOptionsForCall(t),e)}async rebroadcastPendingTransaction(e,t){return e=new oo(e),async function(e,t){const n=await Es(e,{method:"post",url:`${zc}/${t}`,responseType:"json"});return Ec.parse(n.data).transactionHash}(this.getRequestOptionsForCall(t),e)}async cancelPendingTransaction(e,t,n){let r;return e=new oo(e),t&&(r=rs(t,{min:0n,name:"gasPrice"})),async function(e,t,n){const r={};n&&(r["gas-price"]=n.toString());const i=await Es(e,{method:"delete",headers:r,url:`${zc}/${t}`,responseType:"json"});return Ec.parse(i.data).transactionHash}(this.getRequestOptionsForCall(n),e,r)}async getStake(e){return async function(e){const t=await Es(e,{method:"get",responseType:"json",url:`${Ga}`});return Ma.parse(t.data).stakedAmount}(this.getRequestOptionsForCall(e))}async getWithdrawableStake(e){return async function(e){const t=await Es(e,{method:"get",responseType:"json",url:`${Ga}/withdrawable`});return Ua.parse(t.data).withdrawableAmount}(this.getRequestOptionsForCall(e))}async withdrawSurplusStake(e){return async function(e){const t=await Es(e,{method:"delete",responseType:"json",url:`${Ga}/withdrawable`});return La.parse(t.data).txHash}(this.getRequestOptionsForCall(e))}async migrateStake(e){return async function(e){const t=await Es(e,{method:"delete",responseType:"json",url:Ga});return La.parse(t.data).txHash}(this.getRequestOptionsForCall(e))}async depositStake(e,t,n){const r=e instanceof Vo?e.toPLURString():rs(e,{min:1n,name:"amount"});return t&&(t=es.parse(t)),async function(e,t,n){const r=await Es(e,{method:"post",responseType:"json",url:`${Ga}/${t}`,headers:vs(null,n)});return La.parse(r.data).txHash}(this.getRequestOptionsForCall(n),r,t)}async getRedistributionState(e){return async function(e){const t=await Es(e,{method:"get",responseType:"json",url:"redistributionstate"});return ja.parse(t.data)}(this.getRequestOptionsForCall(e))}async waitForUsablePostageStamp(e,t=24e4){for(let r=0;r<t;r+=3e3){try{if((await this.getPostageBatch(e)).usable)return}catch(n){}await i.iQ.sleepMillis(3e3)}throw new po("Timeout on waiting for postage stamp to become usable")}getRequestOptionsForCall(e){return e&&(e=jo.parse(e)),e?i.Rb.deepMerge2(this.requestOptions,e):this.requestOptions}}class au{constructor(e,t,n,r){this.signer=new eo(e),this.batchId=new co(t),this.buckets=n,this.depth=r,this.maxSlot=2**(this.depth-16)}static fromBlank(e,t,n){return new au(e,t,new Uint32Array(65536),n)}static fromState(e,t,n,r){return new au(e,t,n,r)}stamp(e){const t=e.hash(),n=i.yI.uint16ToNumber(t,"BE"),r=this.buckets[n];if(r>=this.maxSlot)throw Error("Bucket is full");this.buckets[n]++;const o=i.yI.concatBytes(i.yI.numberToUint32(n,"BE"),i.yI.numberToUint32(r,"BE")),s=1000000n*BigInt(Date.now()),a=i.yI.numberToUint64(s,"BE"),c=this.signer.sign(i.yI.concatBytes(t,this.batchId.toUint8Array(),o,a));return{batchId:this.batchId,index:o,issuer:this.signer.publicKey().address().toUint8Array(),signature:c.toUint8Array(),timestamp:a}}getState(){return this.buckets}}const cu="https://api.gateway.ethswarm.org",uu=new co("0000000000000000000000000000000000000000000000000000000000000000"),lu=new lo("0000000000000000000000000000000000000000000000000000000000000000"),fu=new Uint8Array(32),hu=new Uint8Array(32),pu=new Uint8Array(20);function du(e){return(e=new ao(e)).toHex().slice(0,Ro)}const mu=[[94,68,46,28,14,5,1],[9,8,7,6,5,4,3]],gu=[[47,34,23,14,7,2],[9,8,7,6,5,4]],yu=[[104,95,86,77,69,61,53,46,39,32,26,20,15,10,6,3,1],[21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5]],wu=[[52,47,43,38,34,30,26,23,19,16,13,10,7,5,3,1],[21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6]],bu=[[92,87,82,77,73,68,63,59,54,50,45,41,37,33,29,26,22,19,16,13,10,8,5,3,2,1],[31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6]],vu=[[46,43,41,38,36,34,31,29,27,25,22,20,18,16,14,13,11,9,8,6,5,4,2,1],[31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,7]],Tu=[[37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1],[90,88,87,85,84,82,81,79,77,76,74,72,71,69,67,66,64,62,60,59,57,55,53,51,49,48,46,44,41,39,37,35,32,30,27,24,20]],Bu=[[18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1],[88,85,82,79,76,72,69,66,62,59,55,51,48,44,39,35,30,24]];function Eu(e,t,n){if(t===So.OFF)return 0;const r=function(e,t){switch(e){case So.MEDIUM:return t?gu:mu;case So.STRONG:return t?wu:yu;case So.INSANE:return t?vu:bu;case So.PARANOID:return t?Bu:Tu;default:throw new Error(`Unknown redundancy level ${e}`)}}(t,n),[i,o]=r;for(let s=0;s<i.length;s++)if(e>=i[s])return o[s]/i[s];return o[o.length-1]/i[i.length-1]}const zu={label:"medium",value:So.MEDIUM,errorTolerance:.01},Ru={label:"strong",value:So.STRONG,errorTolerance:.05},xu={label:"insane",value:So.INSANE,errorTolerance:.1},Iu={label:"paranoid",value:So.PARANOID,errorTolerance:.5};function $u(){return{medium:zu,strong:Ru,insane:xu,paranoid:Iu}}function ku(e){if("string"==typeof e)switch(e.toLowerCase()){case"medium":return zu;case"strong":return Ru;case"insane":return xu;case"paranoid":return Iu;default:throw new Error(`Unknown redundancy level '${e}'`)}switch(e){case So.MEDIUM:return zu;case So.STRONG:return Ru;case So.INSANE:return xu;case So.PARANOID:return Iu;default:throw new Error(`Unknown redundancy level '${e}'`)}}})(),r})()));
|
|
2
2
|
//# sourceMappingURL=index.browser.min.js.map
|