UNPKG

@solarpunkltd/comment-system

Version:

A library for writing and reading comments from the Swarm network.

10 lines 81 kB
(function(E,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@ethersphere/bee-js")):typeof define=="function"&&define.amd?define(["exports","@ethersphere/bee-js"],w):(E=typeof globalThis<"u"?globalThis:E||self,w(E["swarm-comment-system"]={},E.BeeJS))})(this,(function(E,w){"use strict";function si(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var qt={},Er;function ai(){return Er||(Er=1,(function(s){var l;Object.defineProperty(s,"__esModule",{value:!0}),s.Vector=s.Cache=s.Assertions=s.Strings=s.Types=s.Objects=s.Dates=s.Promises=s.Numbers=s.System=s.Arrays=s.Random=s.Elliptic=s.Binary=s.Lock=s.Solver=s.RollingValueProvider=s.TrieRouter=s.AsyncQueue=s.PubSubChannel=s.FixedPointNumber=s.MerkleTree=s.Chunk=s.Uint8ArrayWriter=s.Uint8ArrayReader=s.AsyncLazy=s.Lazy=s.Optional=void 0;async function d(t){return new Promise((e,r)=>t.then(r,e))}async function h(t){return d(Promise.all(t.map(d)))}async function b(t,e=1){const r=Cn(t,e),n=[],i=r.map(async o=>{for(const a of o)n.push(await a())});return await Promise.all(i),n}async function g(t){return new Promise(e=>setTimeout(()=>{e(!0)},t))}function p(t,e=Math.random){for(let r=t.length-1;r>0;r--){const n=Math.floor(e()*(r+1)),i=t[r];t[r]=t[n],t[n]=i}return t}function y(t){if(t.length===1)return t[0];throw Error(`Expected exactly one element, actual: ${t.length}`)}function m(t){return t.length===1?t[0]:null}function S(t){return t.length>0?t[0]:null}function B(t){if(!t.length)throw Error("Received empty array");return t[0]}function F(t,e){const r=[];for(let n=0;n<t;n++)r.push(e(n));return r}function j(t){const e=[];for(let r=0;r<t[0].length;r++){e.push([]);for(let n=0;n<t.length;n++)e[r].push(t[n][r])}return e}function P(t,e,r){const n=[];for(let i=0;i<t;i++){n.push([]);for(let o=0;o<e;o++)n[i].push(r)}return n}function $(t,e,r,n){if(r<0||n<0||n+e[0].length>t[0].length||r+e.length>t.length)return!1;for(let i=0;i<e.length;i++)for(let o=0;o<e[i].length;o++)if(e[i][o]!==void 0&&t[r+i][n+o]!==e[i][o])return!1;return!0}function M(t,e,r=Math.random){return p(Yr(0,t.length-1),r).slice(0,e)}function K(t,e){return t.map(r=>r[e])}function _t(t){let e=t,r=3405648695,n=3735928559;return function(){return e+=r,r^=e<<7,e*=n,n^=e<<13,e^=r^n,(e>>>0)/4294967296}}function Jt(t,e,r=Math.random){return Math.floor(r()*(e-t+1))+t}function ki(t,e,r=Math.random){return r()*(e-t)+t}function Ii(){return Math.random()*2-1}function Ci(t,e,r){return e>=t.x&&e<t.x+t.width&&r>=t.y&&r<t.y+t.height}function Ui(t,e,r,n=Math.random){let i,o;do i=Jt(0,t-1,n),o=Jt(0,e-1,n);while(r&&Ci(r,i,o));return[i,o]}function Bi(t,e=Math.random){const r=Math.floor(t),n=t-r;return Fr(n,e)?r+1:r}function Fr(t,e=Math.random){return e()<t}function te(t,e=Math.random){return t[Math.floor(t.length*e())]}function Di(t,e,r=Math.random){if(e>t.length)throw new Error(`Count (${e}) is greater than array length (${t.length})`);return M(t,e,r).map(n=>t[n])}function Fi(t,e,r,n=Math.random){if(e>t.length)throw new Error(`Count (${e}) is greater than array length (${t.length})`);const i=[];for(;i.length<e;){const o=te(t,n);i.some(a=>r(a,o))||i.push(o)}return i}function ji(t,e,r,n,i,o=Math.random){const a=t.filter(u=>u!==e&&u!==r),c=[];for(e!==null&&c.push(e);a.length&&c.length<n;){const u=s.Random.intBetween(0,a.length-1,o);i(a[u],c)&&c.push(a[u]),a.splice(u,1)}return p(c,o),{values:c,indexOfGuaranteed:e!==null?c.indexOf(e):-1}}function ct(t){if(!t.length)throw Error("Received empty array");return t[t.length-1]}function jr(t,e,r){return r(e.reduce((n,i)=>i(n),t))}function Ni(t,e){return r=>jr(r,t,e)}function Ri(t,e,r){if(r===void 0&&(r=Math.random()),t.length!==e.length)throw new Error("Array length mismatch");let n=e.reduce((o,a)=>o+a,0);const i=r*n;for(let o=0;o<t.length-1;o++)if(n-=e[o],i>=n)return t[o];return ct(t)}function Pi(t,e,r=Math.random){const n=e.map(o=>r()*o),i=[];for(let o=0;o<t.length;o++)i.push([t[o],n[o]]);return i.sort((o,a)=>a[1]-o[1]).map(o=>o[0])}function Z(t,e){if(t==null)return null;const r=e.split(".");let n=t;for(const i of r){if(n[i]===null||n[i]===void 0)return null;n=n[i]}return n}function Q(t,e,r){const n=e.split(/\.|\[/);let i=t;for(let o=0;o<n.length;o++){const a=n[o],c=o<n.length-1&&n[o+1].includes("]"),u=a.includes("]")?a.replace(/\[|\]/g,""):a;if(o===n.length-1)return i[u]=r,r;L(i[u])||(c?i[u]=[]:i[u]={}),i=i[u]}return r}function Li(t,e,r=1){const n=Z(t,e)||0;return Q(t,e,n+r),n}function zi(t,e,r){return Z(t,e)||Q(t,e,r)}function Wi(t,e){const r=ae(e,"."),n=_r(e,".");if(!r||!n)return;const i=Z(t,r);i&&delete i[n]}function Vi(t,e,r){const n=Z(t,e);if(!n)throw new Error("Key '"+e+"' does not exist.");return Q(t,e,r),n}function qi(t,e,r){for(const n of e){const i=Z(t,n);if(i)return i}if(r){const n=Object.values(t);if(n.length)return n[0]}return null}async function Hi(t,e,r){for(;;){try{await t()}catch(n){r&&r("Error in forever",n)}await g(e)}}function Ki(t,e){t();const r=setInterval(()=>{t()},e);return()=>clearInterval(r)}function Zi(){const t=globalThis.process;return t?t.browser===!0?"browser":"node":"browser"}async function Qi(t,e,r,n,i,o){let a=null;for(let c=0;c<=e;c++)try{return await t()}catch(u){if(a=u,c===e)break;const f=r+(n-r)*(c/(e-1));i&&i("Error in withRetries, retrying",{attempt:c+1,allowedFailures:e,delayMillis:f,error:u}),o&&o(),await g(f)}throw a}function Xi(t){return t/1024/1024}function Gi(t,e=1024){return t>=e*e*e*e?(t/e/e/e/e).toFixed(3)+" TB":t>=e*e*e?(t/e/e/e).toFixed(3)+" GB":t>=e*e?(t/e/e).toFixed(3)+" MB":t>=e?(t/e).toFixed(3)+" KB":t+" B"}function Yi(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t.toLowerCase());if(!e)throw new Error("Invalid hex color: "+t);return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}function _i(t){return"#"+t.map(e=>e.toString(16).padStart(2,"0")).join("")}function Ji(t,e,r,n){const i=t*Math.PI/180,o=r*Math.PI/180,a=(r-t)*Math.PI/180,c=(n-e)*Math.PI/180,u=Math.sin(a/2)*Math.sin(a/2)+Math.cos(i)*Math.cos(o)*Math.sin(c/2)*Math.sin(c/2);return 6371e3*(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)))}function kt(t,e){return Math.round(t/e)*e}function to(t){return t>1e3?(t/1e3).toFixed(0)+" km":t>=500?kt(t,100)+" m":t>=100?kt(t,50)+" m":kt(t,10)+" m"}function eo(t){return t*(t+1)/2}function ro(t){const e=t.match(/-?\d+(\.\d+)?/);if(!e)throw Error("No float found in "+t);return parseFloat(e[0])}function no(t,e,r=Math.random){const n=t*e,i=Math.sqrt(t*e*(1-e)),o=(r()+r()+r()+r()+r()+r()-3)*Math.SQRT2,a=Math.round(n+i*o);return Math.max(0,Math.min(t,a))}function io(t,e){if(!t.includes("."))return t;if(parseFloat(t)===0)return"0";const[r,n]=t.split("."),i=r.replace("-",""),o=i.length;if(o>=e)return r;if(i!=="0"){const u=e-o,f=n.slice(0,u);return/[1-9]/.test(f)?`${r}.${f.replace(/0+$/,"")}`:r}const a=n.match(/^0*/)?.[0].length??0,c=e+a;return`${r}.${n.slice(0,c)}`}function L(t,e=!0){return!t||e&&!ee(t._readableState)||e&&t.constructor&&(t.constructor.isBuffer||t.constructor.name=="AbortController"||t.constructor.name=="AbortSignal"||t.constructor.name=="Uint8Array"||t.constructor.name==="ArrayBuffer"||t.constructor.name==="ReadableStream")?!1:typeof t=="object"}function et(t){return L(t)&&!Array.isArray(t)}function Nr(t){return Array.isArray(t)&&t.length===0}function oo(t){return et(t)&&Object.keys(t).length===0}function ee(t){return t===void 0}function It(t){return Object.prototype.toString.call(t)==="[object Function]"||Object.prototype.toString.call(t)==="[object AsyncFunction]"}function C(t){return Object.prototype.toString.call(t)==="[object String]"}function z(t){return typeof t=="number"&&isFinite(t)}function Rr(t){return t===!0||t===!1}function rt(t){return Object.prototype.toString.call(t)==="[object Date]"}function Ct(t){return!C(t)||t.trim().length===0}function re(t){return z(t)&&Number.isInteger(t)&&t>=1}function Pr(t){return C(t)&&t.match(/^-?\d+$/)!==null}function Lr(t){return C(t)&&t.match(/^(0x)?[0-9a-f]+$/i)!==null}const so="!@#$%^&*()_+-=[]{}|;:<>?,./",ao="!@#$%^&*()_+-=[]{}|;:<>?,./".split(""),ne="abcdefghijklmnopqrstuvwxyz",uo="ABCDEFGHIJKLMNOPQRSTUVWXYZ",co="1234567890",ie=ne+uo+co,zr=ie+so,Wr=["—","\\","東","京","都","𝖆","𝖇","𝖈","👾","🙇","💁","🙅","ᚠ","ᛇ","ᚻ","ᛦ"],Vr="0123456789abcdef";function lo(t,e=Math.random){let r="";for(let n=0;n<t;n++)r+=ne[Math.floor(e()*ne.length)];return r}function fo(t,e=Math.random){let r="";for(let n=0;n<t;n++)r+=ie[Math.floor(e()*ie.length)];return r}function ho(t,e=Math.random){let r="";for(let n=0;n<t;n++)r+=zr[Math.floor(e()*zr.length)];return r}function go(t,e=Math.random){let r="";for(let n=0;n<t;n++)r+=Wr[Math.floor(e()*Wr.length)];return r}function mo(t,e){const r=new RegExp(`[0-9a-f]{${e}}`,"i"),n=t.match(r);return n?n[0]:null}function po(t,e,r=ao){const n=Jr(t,r);for(const i of n)if(e(i))return i;return null}function yo(t,e=Math.random){let r="";for(let n=0;n<t;n++)r+=Vr[Math.floor(e()*Vr.length)];return r}function wo(t,e){if(!Pr(t))throw new TypeError(`Expected integer string${e?.name?` for ${e.name}`:""}, got: `+t);const r=BigInt(t);if(e&&(e.min&&r<e.min||e.max&&r>e.max))throw RangeError(`Expected integer string${e?.name?` for ${e.name}`:""} in range: ${e.min??"-inf"}..${e.max??"inf"}; got: `+r);return t}function qr(t,e){if(Ct(t))throw new TypeError(`Expected string${e?.name?` for ${e.name}`:""}, got: `+t);if(e&&(e.min!==void 0&&t.length<e.min||e.max!==void 0&&t.length>e.max))throw RangeError(`Expected string${e?.name?` for ${e.name}`:""} length in range: ${e.min??"-inf"}..${e.max??"inf"}; got: ${t.length}`);return t}function bo(t,e){if(!Lr(t))throw new TypeError(`Expected hex string${e?.name?` for ${e.name}`:""}, got: `+t);if(e?.strictPrefix&&!t.startsWith("0x")&&!t.startsWith("0X"))throw new TypeError(`Expected hex string with 0x prefix${e?.name?` for ${e.name}`:""}, got: `+t);const r=t.replace(/^0x/i,"");if(r.length%2!==0&&!e?.uneven)throw RangeError(`Expected even number of hex digits${e?.name?` for ${e.name}`:""}; got: `+t);if(e&&e.byteLength&&r.length!==e.byteLength*2)throw RangeError(`Expected hex string${e?.name?` for ${e.name}`:""} of byte length ${e.byteLength}; got: `+r);return`0x${r}`}function xo(t,e){if(!qr(t,e).split("").every(r=>r==="_"||dt(r)))throw new TypeError(`Expected safe string${e?.name?` for ${e.name}`:""}, got: `+t);return t}function Hr(t,e){if(e.min!==void 0&&t<e.min||e.max!==void 0&&t>e.max)throw RangeError(`Expected value${e?.name?` for ${e.name}`:""} in range: ${e.min??"-inf"}..${e.max??"inf"}; got: ${t}`)}function So(t,e){if(!It(t))throw new TypeError(`Expected function${e?.name?` for ${e.name}`:""}, got: `+t);return t}function lt(t,e){if(z(t))return e&&Hr(t,e),t;if(!C(t)||!t.match(/^-?\d+(\.\d+)?$/))throw new TypeError(`Expected number${e?.name?` for ${e.name}`:""}, got: `+t);const r=parseFloat(t);return e&&Hr(r,e),r}function Ut(t,e){return Math.trunc(lt(t,e))}function Eo(t,e){if(t==="true")return!0;if(t==="false")return!1;if(!Rr(t))throw new TypeError(`Expected boolean${e?.name?` for ${e.name}`:""}, got: `+t);return t}function vo(t,e){if(!rt(t))throw new TypeError(`Expected date${e?.name?` for ${e.name}`:""}, got: `+t);return t}function Ao(t){return Ct(t)?null:t}function $o(t,e){if(!C(t))throw new TypeError(`Expected string${e?.name?` for ${e.name}`:""}, got: `+t);return t}function Mo(t,e){if(re(t))return t;const r=parseInt(t,10);if(!re(r))throw new TypeError(`Expected id${e?.name?` for ${e.name}`:""}, got: `+t);return r}function To(t,e){if(!C(t))throw new TypeError(`Expected time${e?.name?` for ${e.name}`:""}, got: `+t);const r=t.split(":");if(r.length!==2)throw new TypeError(`Expected time${e?.name?` for ${e.name}`:""}, got: `+t);const n=parseInt(r[0],10),i=parseInt(r[1],10);if(!z(n)||!z(i)||n<0||n>23||i<0||i>59)throw new TypeError(`Expected time, got${e?.name?` for ${e.name}`:""}: `+t);return`${String(n).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function Oo(t,e){if(!Array.isArray(t))throw new TypeError(`Expected array${e?.name?` for ${e.name}`:""}, got: `+t);return t}function Bt(t,e){if(!et(t))throw new TypeError(`Expected object${e?.name?` for ${e.name}`:""}, got: `+t);return t}function ko(t,e){return t===null?null:Bt(t,e)}function Io(t,e){const r=Bt(t,e);for(const n of Object.keys(r))if(!C(r[n]))throw new TypeError(`Expected string map${e?.name?` for ${e.name}`:""}, got: `+t);return r}function Co(t,e){const r=Bt(t),n=Object.keys(r),i=Object.values(r);if(!n.every(C)||!i.every(z))throw new TypeError(`Expected numeric dictionary${e?.name?` for ${e.name}`:""}, got: `+t);return r}function Kr(t){return C(t)&&t.match(/^https?:\/\/.+/)!==null}function Uo(t,e){if(!Kr(t))throw new TypeError(`Expected url${e?.name?` for ${e.name}`:""}, got: `+t);return t}function Zr(t){return typeof t=="bigint"}function Qr(t,e){if(!Zr(t))throw new TypeError(`Expected bigint${e?.name?` for ${e.name}`:""}, got: `+t);if(e?.min!==void 0&&t<e?.min||e?.max!==void 0&&t>e?.max)throw RangeError(`Expected value${e?.name?` for ${e.name}`:""} in range: ${e.min??"-inf"}..${e.max??"inf"}; got: ${t}`);return t}function Bo(t,e){return e==null?!0:t(e)}function Do(t,e){return e==null?null:t(e)}function Fo(t,e){return e===""?void 0:t(e)}function jo(t,e){return e==null?void 0:t(e)}function Xr(t,e){for(const[r,n]of Object.entries(e))if(!n(t[r]))throw TypeError(`${r} in value does not exist or match shape`);for(const r of Object.keys(t))if(!e[r])throw TypeError(`${r} exists in value but not in shape`);return!0}function No(t,e){return t.every(r=>Xr(r,e))}function ft(t,e="json",r=0){if(t&&It(t.represent)){const n=t.represent();if(C(n))return e==="json"&&r===0?JSON.stringify(n):n}if(L(t,!1)){if(r>1)return"[object Object]";if(e==="json"){if(Array.isArray(t)){const i=t.map(o=>ft(o,"json",r+1));return r===0?JSON.stringify(i):i}const n={};t.message&&(n.message=ft(t.message,"json",r+1));for(const[i,o]of Object.entries(t))n[i]=ft(o,"json",r+1);return r===0?JSON.stringify(n):n}else if(e==="key-value"){const n=Object.keys(t);return t.message&&!n.includes("message")&&n.unshift("message"),n.map(i=>`${i}=${JSON.stringify(ft(t[i],"json",r+1))}`).join(" ")}}return ee(t)&&(t="undefined"),r===0?JSON.stringify(t):t}function Ro(t,e){if(C(t))return t;const r=Object.keys(t);t.message&&!r.includes("message")&&r.push("message");const n=r.map(i=>`${i}: ${t[i]}`).join("; ");return e&&t.stack?n+` `+t.stack:n}function X(t,e){if(et(t)&&et(e))for(const r in e)et(e[r])?(t[r]||(t[r]={}),X(t[r],e[r])):Array.isArray(e[r])?t[r]=[...e[r]]:(e[r]!==null&&e[r]!==void 0||t[r]===null||t[r]===void 0)&&(t[r]=e[r]);return t}function Po(t,e){const r={};return X(r,t),X(r,e),r}function Lo(t,e,r){const n={};return X(n,t),X(n,e),X(n,r),n}function Gr(t,e){const r={};for(const n of t)for(const i of Object.keys(n))r[i]?r[i]=e(r[i],n[i]):r[i]=n[i];return r}function zo(t){return Gr(t,(e,r)=>e+r)}function Wo(t,e,r){t[e]||(t[e]=[]),t[e].push(r)}function Vo(t,e,r){for(t.unshift(e);t.length>r;)t.pop()}function qo(t,e){let r=e%t.length;return r<0&&(r+=t.length),t[r]}function Dt(t,e){Array.prototype.push.apply(t,e)}function Ho(t,e){Array.prototype.unshift.apply(t,e)}async function Ko(t,e){const r=[];for(const n of t)r.push(await e(n));return r}function Zo(t,e){const r=[];for(let n=0;n<t.length;n++)r.push(t[n]),n<t.length-1&&(It(e)?r.push(e()):r.push(e));return r}function Qo(t,e){if(t!==e)throw Error(`Expected [${t}] to equal [${e}]`);return[t,e]}function Xo(t){if(t!==!0)throw Error(`Expected [true], got: [${t}]`);return t}function Go(t){if(!t)throw Error(`Expected truthy value, got: [${t}]`);return t}function Yo(t){if(t!==!1)throw Error(`Expected [false], got: [${t}]`);return t}function _o(t){if(t)throw Error(`Expected falsy value, got: [${t}]`);return t}function Jo(t,e){if(!e.includes(t))throw Error(`Expected any of [${e.join(", ")}], got: [${t}]`);return t}function ts(t,e){for(let r=0;r<t.length;r++){const n=t[r],i=e[r],o=Math.max(0,i.getTime()-Date.now());setTimeout(n,o)}}function es(t,e,r){return t+(e-t)*r}function rs(t){return t.reduce((e,r)=>e+r,0)}function ns(t){return t.reduce((e,r)=>e+r,0)/t.length}function is(t){const e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2===0?(e[r]+e[r-1])/2:e[r]}function os(t,e){return t-(e-1)/2}function Yr(t,e){const r=[];for(let n=t;n<=e;n++)r.push(n);return r}function ss(t,e){return e.some(r=>t.includes(r))}function as(t){return/^[\u4E00-\u9FA5]+$/.test(t)}function oe(t,e=()=>!1){return t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").split("").map(r=>/[a-z0-9]/.test(r)||e(r)?r:"-").join("").replace(/-+/g,"-").replace(/^-|-$/g,"")}function us(t){return oe(t).replaceAll("-","")}function cs(t){return Nt(t.replace(/([A-Z])/g," $1"))}function ls(t){return t.split("-").map(Nt).join(" ")}function fs(t){return en(t.split("-").map(Nt).join(""))}function hs(t,e=", ",r=" and "){return!t||!t.length?"":t.length===1?t[0]:t.length===2?`${t[0]}${r}${t[1]}`:`${t.slice(0,t.length-1).join(e)}${r}${t[t.length-1]}`}function ds(t,e){return e+t.split("").join(e)+e}function gs(t){return oe(t).replace(/-/g,"_").toUpperCase()}function Ft(t,e){if(e.length===0)return 0;const r=t.toLowerCase(),n=e.toLowerCase();return t===e?1e4:r.startsWith(n)?1e4-t.length:r.includes(n)?5e3-t.length:new RegExp(".*"+n.split("").join(".*")+".*").test(r)?1e3-t.length:0}function ms(t,e){return t.filter(r=>Ft(r,e)).sort((r,n)=>Ft(n,e)-Ft(r,e))}function ps(t){return t.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const ys={"&amp;":"&","&quot;":'"',"&apos;":"'","&gt;":">","&lt;":"<"};function ws(t){let e=t.replace(/&#(\d+);/g,(r,n)=>String.fromCharCode(n)).replace(/&#x(\d+);/g,(r,n)=>String.fromCharCode(parseInt(n,16)));for(const[r,n]of Object.entries(ys))e=e.replaceAll(r,n);return e}function se(t,e){const r=t.indexOf(e);return r===-1?null:t.slice(0,r)}function jt(t,e){const r=t.indexOf(e);return r===-1?null:t.slice(r+e.length)}function ae(t,e){const r=t.lastIndexOf(e);return r===-1?null:t.slice(0,r)}function _r(t,e){const r=t.lastIndexOf(e);return r===-1?null:t.slice(r+e.length)}function bs(t,e,r){const n=ae(t,r);return n?jt(n,e):null}function xs(t,e,r){const n=jt(t,e);return n?se(n,r):null}function ue(t,e,r=!1){const n=r?t.lastIndexOf(e):t.indexOf(e);return n===-1?r?[null,t]:[t,null]:[t.slice(0,n),t.slice(n+e.length)]}function Jr(t,e){let r=[t];for(const n of e)r=r.flatMap(i=>i.split(n));return r.filter(n=>n)}function ce(t){const e=ct(t.split(/\\|\//g)),r=e.lastIndexOf(".",e.length-1);return r<=0?"":e.slice(r+1)}function le(t){const e=ct(t.split(/\\|\//g)),r=e.lastIndexOf(".",e.length-1);return r<=0?e:e.slice(0,r)}function Ss(t){let[e,r]=t.split("@");e=ht(e.replaceAll(".","").toLowerCase()).replaceAll(" ","");const[n]=e.split("+");if(!n||!r||r.indexOf(".")===-1||r.indexOf(".")===r.length-1)throw new Error("Invalid email");return r=ht(r.toLowerCase()).replaceAll(" ",""),`${n}@${r}`}function Es(t){const e=le(t),r=ce(t);return r?`${e}.${r}`:e}function vs(t){const e=le(t),r=ce(t);return{basename:e,extension:r,filename:r?`${e}.${r}`:e}}function As(t,e=Math.random){return t.replace(/\{(.+?)\}/g,(r,n)=>te(n.split("|"),e))}function tn(t){const e=/\{(.+?)\}/,r=t.match(e);if(!r||!r.index)return[t];const n=r[1].split(","),i=t.slice(0,r.index),o=t.slice(r.index+r[0].length);let a=[];for(const c of n){const u=tn(i+c+o);a=a.concat(u)}return a}function ht(t){return t.split(` `).map(e=>e.trim().replace(/\s+/g," ")).filter(e=>e.length>0).join(` `)}function Nt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function en(t){return t.charAt(0).toLowerCase()+t.slice(1)}function rn(t){if(!t)return!1;const e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122}function nn(t){if(!t)return!1;const e=t.charCodeAt(0);return e>=48&&e<=57}function dt(t){return rn(t)||nn(t)}const $s=` \r.,?!:;"'\`(){}[]~@#$%^&*-+=|<>/\\`.split("");function Ms(t){return $s.includes(t)}function Ts(t){return dt(t)||t==="."||t==="["||t==="]"||t==="_"}function Os(t,e,r,n,i){return t.slice(0,e)+n+t.slice(e,e+r)+i+t.slice(e+r)}function on(t,e,r=0){const n=e.exec(t.slice(r));return n?{index:n.index,match:n[0]}:null}function sn(t,e,r=!0){if(!r)return e.every(i=>i instanceof RegExp?i.test(t):t.indexOf(i,0)!==-1);let n=0;for(const i of e)if(i instanceof RegExp){const o=on(t,i,n);if(!o)return!1;n=o.index+o.match.length}else{const o=t.indexOf(i,n);if(o===-1)return!1;n=o+i.length}return!0}function ks(t,e,r=!0){let n=0;for(const i of e){let o=!1;for(;!o&&n<t.length;)sn(t[n],i,r)&&(o=!0),n++;if(!o)return!1}return!0}function Is(t){return t.match(/"|,/)?`"${t.replace(/"/g,'""')}"`:t}function an(t,e,r=0){const n=[];let i=t.indexOf(e,r);for(;i!==-1;)n.push(i),i=t.indexOf(e,i+e.length);return n}function nt(t,e,r=0){let n=-1;for(const i of e){const o=t.indexOf(i,r);o!==-1&&(n===-1||o<n)&&(n=o)}return n}function Cs(t,e=0){for(let r=e;r<t.length;r++)if(Ms(t[r]))return r;return-1}function Us(t,e=0){for(let r=e;r<t.length;r++)if(t[r]==="#"&&dt(t[r+1]))return r;return-1}function un(t,e,r=0){return t.slice(0,r).lastIndexOf(e)}function cn(t,e=0,r="{",n="}"){let i=1;for(let o=e;o<t.length;o++)if(t.slice(o,o+n.length)===n){if(--i===0)return o}else t.slice(o,o+r.length)===r&&i++;return-1}function ln(t,e){const r=e.wordBoundary?nt(t,[`${e.opening} `,`${e.opening} `],e.start||0):t.indexOf(e.opening,e.start||0);if(r===-1)return null;const n=cn(t,r+e.opening.length,e.opening,e.closing);return n===-1?null:e.exclusive?t.slice(r+e.opening.length,n):t.slice(r,n+e.closing.length)}function Bs(t,e){const r=[];let n=e.wordBoundary?nt(t,[`${e.opening} `,`${e.opening} `],e.start||0):t.indexOf(e.opening,e.start||0);for(;;){if(n===-1)return r;const i=ln(t,{...e,start:n});if(!i)return r;r.push(i),n=e.wordBoundary?nt(t,[`${e.opening} `,`${e.opening} `],n+i.length):t.indexOf(e.opening,n+i.length)}}function Ds(t,e,r){let n=0;for(;;){const i=s.Strings.extractBlock(t,{...r,start:n});if(!i)return t;const o=e(i);n=t.indexOf(i,n)+o.length,t=t.replace(i,o)}}function Fs(t,e){const r=[];let n=0;for(;n<t.length;){const i=t.indexOf(e,n);if(i===-1){r.push({string:t.slice(n),symbol:null});break}const o=t.indexOf(e,i+e.length);if(i>n&&o!==-1&&r.push({string:t.slice(n,i),symbol:null}),o===-1){r.push({string:t.slice(n),symbol:null});break}r.push({string:t.slice(i+e.length,o),symbol:e}),n=o+e.length}return r}function js(t){const e=[];let r=0;for(;r<t.length;){const n=Us(t,r);if(n===-1){e.push({string:t.slice(r),symbol:null});break}const i=Cs(t,n+1);if(i===-1){e.push({string:t.slice(r,n),symbol:null}),e.push({string:t.slice(n+1),symbol:"#"});break}n>r&&e.push({string:t.slice(r,n),symbol:null}),e.push({string:t.slice(n+1,i),symbol:"#"}),r=i}return e}function Ns(t){const e=[];let r=0;for(;r<t.length;){const n=nt(t,["http://","https://"],r);if(n===-1){e.push({string:t.slice(r),symbol:null});break}const i=nt(t,[" ",` `],n);if(i===-1){n>r&&e.push({string:t.slice(r,n),symbol:null}),e.push({string:t.slice(n),symbol:"http"});break}n>r&&e.push({string:t.slice(r,n),symbol:null}),e.push({string:t.slice(n,i),symbol:"http"}),r=i}return e}const fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hn="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Rs(t){return dn(t,fn)}function Ps(t){return gn(t,fn)}function Ls(t){return dn(t,hn)}function zs(t){return gn(t,hn)}function dn(t,e){const n=e.length;let i=0,o=0;const a=[];for(let c=0;c<t.length;c++){const u=t[c];if(u==="=")break;const f=e.indexOf(u);if(f===-1)throw new Error(`Invalid character: ${u}`);o=o<<Math.log2(n)|f,i+=Math.log2(n),i>=8&&(i-=8,a.push(o>>i&255))}return new Uint8Array(a)}function gn(t,e){const r=e.length;let n=0,i=0,o="";for(let a=0;a<t.length;a++)for(i=i<<8|t[a],n+=8;n>=Math.log2(r);)n-=Math.log2(r),o+=e[i>>n&r-1];return n>0&&(o+=e[i<<Math.log2(r)-n&r-1]),o.length%4!==0&&(o+="=".repeat(4-o.length%4)),o}function Ws(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));const e=t.length/2,r=new Uint8Array(e);for(let n=0;n<e;n++){const i=parseInt(t.slice(n*2,n*2+2),16);r[n]=i}return r}function Vs(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function qs(t){return Array.from(t).map(e=>e.toString(2).padStart(8,"0")).join("")}function Hs(t){const e=Math.ceil(t.length/8),r=new Uint8Array(e);for(let n=0;n<e;n++){const i=parseInt(t.slice(n*8,n*8+8),2);r[n]=i}return r}function Ks(t,e){const r=t.split("/").filter(o=>o),n=e.split("/").filter(o=>o);if(r.length!==n.length)return null;const i={};for(let o=0;o<r.length;o++){const a=r[o];if(a.startsWith(":"))i[a.slice(1)]=n[o];else if(a!==n[o])return null}return i}function fe(t,e,r){const n=[];for(const i of r)i!==e&&n.push(t.replace(e,i));return n}function Zs(t,e,r,n=Math.random){const i=s.Arrays.shuffle(e.map(a=>({variants:s.Arrays.shuffle(a.variants.map(c=>c),n),avoid:a.avoid})),n),o=[];for(const a of i){const c=a.variants.filter(f=>f!==a.avoid),u=c.find(f=>t.includes(f));if(u&&(Dt(o,fe(t,u,c)),o.length>=r))break}if(o.length<r)for(const a of i){const c=a.variants.find(u=>t.includes(u));if(c&&(Dt(o,fe(t,c,a.variants)),o.length>=r))break}return o.slice(0,r)}function Qs(t,e,r,n=!1){const i=new RegExp(n?`(?<=\\s|^)${e}(?=\\s|$)`:`\\b${e}\\b`,"g");return t.replace(i,r)}function Xs(t,e){const r=/\b[A-Z][a-zA-Z0-9]*\b/g;return t.replace(r,n=>n.toUpperCase()===n?n:e(n))}function Gs(t){return t.replace(/<[^>]*>/g,"")}function mn(t){const e=t.lastIndexOf(" ");if(e===-1)return{line:t,rest:""};const r=t.slice(0,e),n=t.slice(e+1);return{line:r,rest:n}}function Ys(t,e={}){return[...t].reduce((r,n)=>r+(e[n]||1),0)}function _s(t,e,r={}){const n=[];let i="",o=0;for(let a=0;a<t.length;a++){const c=t[a],u=r[c]||1;if(i+=c,o+=u,o>e){const{line:f,rest:T}=mn(i);n.push(f),i=T,o=T.split("").map(U=>r[U]||1).reduce((U,at)=>U+at,0)}}return i&&n.push(i),n}function Js(t,e){const r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let i=1;i<=e.length;i++){const o=t[n-1]===e[i-1]?0:1;r[n][i]=Math.min(r[n-1][i]+1,r[n][i-1]+1,r[n-1][i-1]+o)}return r[t.length][e.length]}function pn(t){const e=t.reduce((n,i)=>n.length<i.length?n:i);let r="";for(let n=0;n<e.length;n++){const i=e[n];if(t.every(o=>o[n]===i))r+=i;else break}return r}function ta(t){const e=pn(t),r=e.lastIndexOf("/");return r===-1?"":e.slice(0,r+1)}function he(t,e){return new RegExp(`\\b${e}\\b`).test(t)}function ea(t,e,r){return r==="any"?e.some(n=>he(t,n)):e.every(n=>he(t,n))}function ra(t){const e={},r=t.match(/([a-z\-]+)="([^"]+)"/g);if(r)for(const n of r){const[i,o]=ue(n,"=");e[i]=o.slice(1,o.length-1)}return e}function gt(t,e,r=[]){let n="";for(;e<t.length&&(dt(t[e])||r.includes(t[e]));)n+=t[e++];return n}function na(t,e,r=[]){const n=an(t,e),i=[];for(const o of n)i.push(gt(t,o+e.length,r));return i}function ia(t,e,r="$",n=":"){for(const i in e)t=yn(t,i,e[i],r,n);return t=wn(t),t}function yn(t,e,r,n="$",i=":"){if(r==="")return t;let o=t.indexOf(`${n}${e}`);for(;o!==-1;){if(t[o+e.length+1]===i)if(t[o+e.length+2]===i)t=t.replace(`${n}${e}${i}${i}`,r);else{const a=gt(t,o+e.length+2,["_"]);t=t.replace(`${n}${e}${i}${a}`,r)}else t=t.replace(`${n}${e}`,r);o=t.indexOf(`${n}${e}`,o+r.length)}return t}function wn(t,e="$",r=":"){let n=t.indexOf(e);for(;n!==-1;){const i=gt(t,n+1);if(t[n+i.length+1]===r)if(t[n+i.length+2]===r)t=t.replace(`${e}${i}${r}${r}`,"");else{const o=gt(t,n+i.length+2);t=t.replace(`${e}${i}${r}${o}`,o)}n=t.indexOf(e,n+1)}return t}function oa(t,e){let r=t.indexOf("](");for(;r!==-1;){const n=un(t,"[",r),i=t.indexOf(")",r);if(n!==-1&&i!==-1){const[o,a]=t.slice(n+1,i).split("]("),c=e(o,a);t=t.slice(0,n)+c+t.slice(i+1)}r=t.indexOf("](",r+1)}return t}function bn(t,e=!0){const r=Object.entries(t).filter(([n,i])=>i!=null).map(([n,i])=>`${n}=${encodeURIComponent(i)}`).join("&");return r?(e?"?":"")+r:""}function sa(t){const e={},r=t.split("&");for(const n of r){const[i,o]=n.split("=");i&&o&&(e[i]=decodeURIComponent(o))}return e}function aa(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ua(t,e){let r=null,n=-1/0;for(const[i,o]of Object.entries(t)){const a=e(o);a>n&&(n=a,r=i)}return r?[r,t[r]]:null}function ca(t,e,r,n){const i=t.find(a=>a[e]===r),o=t.find(a=>a[e]===r+n);i&&o?(i[e]=r+n,o[e]=r):i&&(i[e]=r+n),t.sort((a,c)=>lt(a[e])-lt(c[e])),t.forEach((a,c)=>a[e]=c+1)}function la(t){const e=Object.keys(t);if(e.length===1)return t[e[0]];throw new Error("Expected object to have a single key")}function fa(t,e=":"){return Object.fromEntries(t.map(r=>ue(r,e)).map(r=>r[0]&&r[1]?[ht(r[0]),ht(r[1])]:null).filter(r=>r))}function ha(t,e){if(!t)return!1;const r=t.message;return typeof r=="string"&&r.includes(e)}function da(t,e,r){return vn([t,e])+bn(r||{})}function ga(t,e=",",r='"'){const n=[];let i="",o=!1;const a=t.split("");for(const c of a)c===e&&!o?(n.push(i),i=""):c===r&&(!i&&!o||o)?o=!o:i+=c;return n.push(i),n}function ma(t){return`[${Math.floor(t.progress*100)}%] ${Rt(t.deltaMs)} out of ${Rt(t.totalTimeMs)} (${Rt(t.remainingTimeMs)} left) [${Math.round(t.baseTimeMs)} ms each]`}async function pa(t,e){let r=e.requiredConsecutivePasses||1,n=0;for(let i=0;i<e.attempts;i++){try{if(await t()){if(n++,n>=r)return}else n=0}catch{n=0}i<e.attempts-1&&await g(e.waitMillis)}throw Error("Timed out waiting for predicate")}function ya(t,e){const r=[];for(let n=t.length-1;n>=0;n--)e(t[n])&&r.push(t.splice(n,1)[0]);return r}function wa(t){return JSON.parse(JSON.stringify(t))}function ba(t){return Math.ceil((t||Date.now())/1e3)}function xa(t){return(t||new Date).toISOString().slice(0,10)}function Sa(t){return(t||new Date).toISOString().slice(0,19).replace(/T|:/g,"-")}function Ea(t){const e=new Date(t);return new Date(e.getTime()-e.getTimezoneOffset()*6e4)}function va(t){return new Date(t)}function N(t){return String(Math.floor(t)).padStart(2,"0")}function Aa(t){let[e,r]=t.split(":");z(parseInt(e,10))||(e="0"),z(parseInt(r,10))||(r="0");let n=pe(Ut(e),0,23),i=pe(Ut(r),0,59);return`${N(n)}:${N(i)}`}function Rt(t){const e=Math.floor(t/36e5);t=t%36e5;const r=Math.floor(t/6e4);t=t%6e4;const n=Math.floor(t/1e3);return e?`${N(e)}:${N(r)}:${N(n)}`:`${N(r)}:${N(n)}`}function G(t){return Math.floor((rt(t)?t.getTime():t)/864e5)}const $a={today:(t,e)=>N(t)+":"+N(e),yesterday:()=>"Yesterday",monday:()=>"Mon",tuesday:()=>"Tue",wednesday:()=>"Wed",thursday:()=>"Thu",friday:()=>"Fri",saturday:()=>"Sat",sunday:()=>"Sun",weeks:t=>`${t}w`};function Ma(t,e){const r=new Date(e?.now||Date.now()),n=e?.labels||$a,i=rt(t)?t:new Date(t);if(G(r)===G(i))return n.today(i.getUTCHours(),i.getUTCMinutes(),i.getUTCHours()>12);if(G(r)-G(i)===1)return n.yesterday();const o=ge(i);return G(r)-G(i)<7?n[o.day]():n.weeks(Math.round((r.getTime()-i.getTime())/6048e5))}const xn={now:()=>"A few seconds",seconds:t=>`${t} seconds`,minutes:t=>`${t} minutes`,hours:t=>`${t} hours`,days:t=>`${t} days`,weeks:t=>`${t} weeks`};function Sn(t,e){const r=e?.now??Date.now(),n=e?.labels||xn,i=s.Types.isDate(t)?t.getTime():t;let o=(r-i)/1e3;return o<10?n.now():o<120?n.seconds(Math.floor(o)):(o/=60,o<120?n.minutes(Math.floor(o)):(o/=60,o<48?n.hours(Math.floor(o)):(o/=24,o<14?n.days(Math.floor(o)):(o/=7,n.weeks(Math.floor(o))))))}function Ta(t,e=xn){return Sn(0,{now:t*1e3,labels:e})}function Oa(t,e,r){const n=(r?.now??Date.now())-t,i=Math.floor(n/e),o=e/(r?.precision??1)-Math.ceil(n%e/(r?.precision??1));return{cycles:i,remaining:o}}const de={};function ka(t,e){return!de[t]||Date.now()>de[t]?(de[t]=Date.now()+e,!0):!1}const Ia={s:1e3,m:6e4,h:36e5,d:864e5};function Ca(t,e,r){return e=rt(e)?e.getTime():e,r=r?rt(r)?r.getTime():r:Date.now(),(r-e)/Ia[t]}function Ua(t,e,r,n){n||(n=Date.now());const i=e/r,o=n-t,a=o/e,c=a*r,u=c-o;return{deltaMs:o,progress:i,baseTimeMs:a,totalTimeMs:c,remainingTimeMs:u}}const Ba={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"};function En(t){return{zeroBasedIndex:t,day:Ba[t]}}function ge(t){return En(t.getDay())}function Da(t){return ge(new Date(t))}function Fa(t){return t*1e3}function ja(t){return t*6e4}function Na(t){return t*36e5}function Ra(t){return t*864e5}const Pa={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};function La(t){const e=parseFloat(t);if(isNaN(e))throw Error("makeDate got NaN for input");const r=t.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),n=r===""?1:Pa[r];if(!n)throw Error(`Unknown unit: "${r}"`);return Math.ceil(e*n)}const za={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};function Wa(t,e=1024){const r=parseFloat(t);if(isNaN(r))throw Error("makeStorage got NaN for input");const n=t.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),i=n===""?0:za[n];if(i==null)throw Error(`Unknown unit: "${n}"`);return Math.ceil(r*e**i)}function Va(t){return t.replace(/ +/g," ").replace(/^ /gm,"")}const R=new Map;async function qa(t,e,r,n){const i=Date.now(),o=R.get(t);if(o&&o.validUntil>i)return o.value;n?.onMiss?.();try{const a=await r();return R.set(t,{value:a,validUntil:i+e}),a}catch(a){throw n?.onFailure?.(a),a}}function Ha(t,e,r,n){const i=Date.now(),o=R.get(t);if(o&&o.validUntil>i)return o.value;n?.onMiss?.();const a=r();return R.set(t,{value:a,validUntil:i+e}),a.catch(c=>{R.delete(t),n?.onFailure?.(c)}),a}function Ka(t){R.delete(t)}function Za(){R.clear()}function Qa(){const t=Date.now();for(const[e,r]of R.entries())r.validUntil<=t&&R.delete(e)}function Xa(){return R.size}function vn(t,e=!1){t=t.filter(o=>o),e&&C(t[1])&&(t[1]="../"+t[1]);let r="";C(t[0])&&t[0].includes("://")&&(r=se(t[0],"://")??"",t[0]=jt(t[0],"://")??"");const n=t.map(o=>String(o)).flatMap(o=>o.split("/")),i=[];for(let o=0;o<n.length;o++)n[o]!=="."&&(n[o]===".."?(!r||i.length>1)&&i.pop():i.push(n[o]));return(r?r+"://":"")+i.join("/").replaceAll(/\/{2,}/g,"/")}function Ga(t,e,r,n,i=!0){const o=t.indexOf(e),a=t.indexOf(r,o+e.length);if(o===-1||a===-1)throw Error("Start or end not found");return i?t.substring(0,o+e.length)+n+t.substring(a):t.substring(0,o)+n+t.substring(a+r.length)}function Ya(t){let e="p";t.startsWith("#")?(e="h1",t=t.slice(1).trim()):t.startsWith("-")&&(e="li",t=t.slice(1).trim());const r=t[0]===t[0].toUpperCase(),n=/[.?!]$/.test(t),i=/:$/.test(t);return{type:e,isCapitalized:r,hasPunctuation:n,endsWithColon:i}}function _a(t,e="(",r=")"){let n=0,i=0;for(;i<t.length;)if(t.startsWith(e,i)?(n++,i+=e.length):t.startsWith(r,i)?(n--,i+=r.length):i++,n<0)return!1;return e===r?n%2===0:n===0}function Ja(t){t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"");let e=t.length;for(;t=t.replace(/(\w+)[\s,']+\w+/g,"$1"),t.length!==e;)e=t.length;return t=t.replaceAll(/[A-Z][a-zA-Z0-9]*/g,"A"),t=t.replaceAll(/[a-z][a-zA-Z0-9]*/g,"a"),t=t.replaceAll(/[\u4E00-\u9FA5]+/g,"Z"),t}function An(t){const e=Object.keys(t).sort((n,i)=>n.localeCompare(i)),r={};for(const n of e)r[n]=Y(t[n]);return r}function $n(t){const e=[];return t.sort((r,n)=>JSON.stringify(Y(r)).localeCompare(JSON.stringify(Y(n)))).forEach(r=>e.push(Y(r))),e}function Y(t){return Array.isArray(t)?$n(t):L(t)?An(t):t}function Mn(t,e){return JSON.stringify(Y(t))===JSON.stringify(Y(e))}function tu(...t){for(let e=1;e<t.length;e++)if(!Mn(t[e-1],t[e]))return!1;return!0}function eu(t){try{return JSON.parse(t)}catch{return null}}function ru(){let t=0;return{next:()=>t++}}function nu(t){let e=0;return{next:()=>t[e++%t.length]}}function iu(t){let e;return r=>{const n=r===t&&e!==t;return e=r,n}}function ou(t,e,r,n,i){const o={};for(const a of Object.keys(e))o[a]=[];o[n]=[],i&&(t=t.sort(i));for(const a of t){const c=a[r],u=e[c]?c:n;o[u].length>=e[u]?o[n].push(a):o[u].push(a)}return o}function su(t,e){const r=Object.keys(t),n=Object.keys(e);return{uniqueToA:r.filter(i=>!n.includes(i)),uniqueToB:n.filter(i=>!r.includes(i))}}function Tn(t){const e=Object.keys(t);return e[Math.floor(Math.random()*e.length)]}function au(t,e){const r=Tn(t);return t[r]=e(t[r]),r}function uu(t){return t=t.replace(/\r\n/g,` `),t=t.replace(/(\w+)\((.+)\)/g,(e,r,n)=>`${r}(${n.replaceAll(",","&comma;")})`),t=t.replace(/(,)(\s+})/g,"$2"),t=t.replace(/\.\.\..+?,/g,""),t=t.replace(/({\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),t=t.replace(/(,\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),t=t.replace(/:(.+)\?(.+):/g,(e,r,n)=>`: (${r.trim()} && ${n.trim()}) ||`),t=t.replace(/([a-zA-Z0-9]+)( ?: ?{)/g,'"$1"$2'),t=t.replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g,(e,r,n,i)=>`"${r}":"${n.trim()}"${i}`),t=t.replace(/("'|'")/g,'"'),t=t.replaceAll("&comma;",","),JSON.parse(t)}const W=[1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24,1e27,1e30,1e9,1e16,1e18,1e18,1e18,1e33],cu=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","gwei","bzz","btc","eth","dai","decillion"],On=["K","M","B","T","Qa","Qi","Sx","Sp","O","N","gwei","bzz","eth","btc","dai","D"];function lu(t,e,r){let n=t.length-e;if(n<=0)return"0."+"0".repeat(-n)+t+(r?" "+r:"");let i=t.substring(0,n),o=t.substring(n);return i===""&&(i="0"),i+"."+o+(r?" "+r:"")}function fu(t,e){const r=e?.longForm??!1,n=e?.unit?` ${e.unit}`:"",i=r?cu:On,o=e?.precision??1;if(t<W[0])return`${t}${n}`;for(let a=0;a<W.length-1;a++)if(t<W[a+1])return`${(t/W[a]).toFixed(o)}${r?" ":""}${i[a]}${n}`;return`${(t/W[W.length-1]).toFixed(o)}${r?" ":""}${i[W.length-1]}${n}`}function me(t){const e=parseFloat(t);if(isNaN(e))throw Error("makeNumber got NaN for input");const r=t.replace(/^-?[0-9.]+/,"").trim(),n=On.findIndex(i=>i.toLowerCase()===r.toLowerCase());return n===-1?e:e*W[n]}function pe(t,e,r){return t<e?e:t>r?r:t}function hu(t,e,r){const n=t+e;return n>r?r:n}function du(t,e,r){const n=t-e;return n<r?r:n}function gu(t,e){return e(t),t}function mu(t,e){t&&e(t)}function pu(t,e){const r=Object.keys(e);for(const n of r)Array.isArray(e[n])&&Array.isArray(t[n])&&Dt(t[n],e[n])}function yu(t){return t.splice(0,t.length),t}function wu(t){for(const e of Object.keys(t))(Nr(t[e])||Array.isArray(t[e])&&t[e].every(r=>r==null))&&delete t[e];return t}function bu(t){for(const e of Object.entries(t))(e[1]===null||e[1]===void 0||C(e[1])&&Ct(e[1]))&&delete t[e[0]];return t}function xu(t,e){const r={};for(const[n,i]of Object.entries(t))e(n)&&(r[n]=i);return r}function Su(t,e){const r={};for(const[n,i]of Object.entries(t))e(i)&&(r[n]=i);return r}function Eu(t,e){const r={};for(const n of Object.entries(t))r[n[0]]=e(n[1]);return r}function vu(t,e){const r=[];let n=0;for(const i of t)r.push(e(i,n++));return r}async function Au(t,e){try{return await t()}catch{throw e}}function $u(t,e,r){r!=null&&(t[e]=r)}function Mu(t,e,r,n){const i=Z(r,n);i!=null&&Q(t,e,i)}function Tu(t){const e={};for(const[r,n]of Object.entries(t))e[n]=r;return e}function Ou(t){const e=Object.keys(t),r=e.map(c=>t[c].length),n=r.reduce((c,u)=>c*=u);let i=1;const o=[1];for(let c=0;c<r.length-1;c++)i*=r[c],o.push(i);const a=[];for(let c=0;c<n;c++){const u={};for(let f=0;f<e.length;f++){const T=t[e[f]],U=Math.floor(c/o[f])%T.length;u[e[f]]=T[U]}a.push(u)}return a}function ku(t){return Object.values(t).filter(e=>e).length}function Iu(t,e,r){return t+(r?"["+e+"]":(t.length?".":"")+e)}function Pt(t,e,r,n,i){if(!L(e))return e;for(const[o,a]of Object.entries(e)){const c=Iu(r,o,n);Array.isArray(a)?i?Pt(t,a,c,!0,i):t[c]=a.map(u=>Pt(Array.isArray(u)?[]:{},u,"",!1,i)):L(a)?Pt(t,a,c,!1,i):t[c]=a}return t}function Cu(t,e=!1,r){return Pt({},t,r||"",!1,e)}function kn(t){if(!L(t))return t;const e=Array.isArray(t)?[]:{};for(const[r,n]of Object.entries(t))Array.isArray(n)?Q(e,r,n.map(i=>kn(i))):Q(e,r,n);return e}function Uu(t,e,r){return e[t]?e[t]:r}function In(t,e){const r={};for(const n of t){const i=e(n);r[i]=n}return r}function Bu(t,e){const r={};for(const n of t){const i=e(n);r[i]||(r[i]=[]),r[i].push(n)}return r}function Du(t,e){const r=[];for(let n=0;n<t.length;n+=e)r.push(t.slice(n,n+e));return r}function Cn(t,e){const r=Math.ceil(t.length/e),n=[];for(let i=0;i<t.length;i+=r)n.push(t.slice(i,i+r));return n}function Un(t,e){const r=[],n=Math.ceil(t.length/e);for(let i=0;i<n;i++)r.push(t.slice(i*e,i*e+e));return r}function Fu(t,e){const r=Math.ceil(t.length/e);return Un(t,r)}function ju(t,e){return Object.values(In(t,e))}function Nu(t,e,r,n,i){const o=e?t.map(e):t,a={};for(const u of o)a[u]=(a[u]||0)+1;const c=n?Bn(a,i?(u,f)=>u[1]-f[1]:(u,f)=>f[1]-u[1]):a;return r?Object.keys(c):c}function Bn(t,e){return Object.fromEntries(Object.entries(t).sort(e))}function Ru(t){const e=[],r=Object.keys(t),n=t[r[0]].length;for(let i=0;i<n;i++){const o={};for(const a of r)o[a]=t[a][i];e.push(o)}return e}function Pu(t,e,r=1){for(const n of t)n[e]+=r}function Lu(t,e,r){for(const n of t)n[e]=r}function ye(t,e){const r=[];let n=[];return t.forEach((i,o)=>{(o===0||!e(i,t[o-1]))&&(n=[],r.push(n)),n.push(i)}),r}function zu(){return{map:new Map,keys:[]}}function Wu(){return{map:new Map,keys:[]}}function Dn(t,e,r,n=100){if(t.map.has(e)){const i=t.keys.indexOf(e);t.keys.splice(i,1)}if(t.map.set(e,r),t.keys.push(e),t.keys.length>n){const i=t.keys.shift();i&&t.map.delete(i)}}function Vu(t,e,r,n=100){if(t.map.has(e)){const i=t.keys.indexOf(e);t.keys.splice(i,1)}if(t.map.set(e,r),t.keys.unshift(e),t.keys.length>n){const i=t.keys.shift();i&&t.map.delete(i)}}function qu(t,e,r,n,i=100){Dn(t,e,{validUntil:Date.now()+n,data:r},i)}function Hu(t,e){const r=t.map.get(e);return r&&r.validUntil>Date.now()?r.data:null}class V{constructor(e){this.value=e}static of(e){return new V(e)}static empty(){return new V(null)}map(e){return new V(this.value!==null&&this.value!==void 0?e(this.value):null)}mapAsync(e){return this.value!==null&&this.value!==void 0?e(this.value).then(r=>V.of(r)):Promise.resolve(V.empty())}ifPresent(e){return this.value!==null&&this.value!==void 0&&e(this.value),this}ifPresentAsync(e){return this.value!==null&&this.value!==void 0?e(this.value).then(()=>this):Promise.resolve(this)}ifAbsent(e){return(this.value===null||this.value===void 0)&&e(),this}ifAbsentAsync(e){return this.value===null||this.value===void 0?e().then(()=>this):Promise.resolve(this)}getOrFallback(e){return this.value??e()}getOrFallbackAsync(e){return this.value!==null&&this.value!==void 0?Promise.resolve(this.value):e()}getOrThrow(){if(this.value===null||this.value===void 0)throw Error("Optional.value is empty");return this.value}}s.Optional=V;class Ku{constructor(e){this.supplier=e,this.value=null}get(){return this.value||(this.value=this.supplier()),this.value}}s.Lazy=Ku;class Zu{constructor(e){this.supplier=e,this.value=null}async get(){return this.value||(this.value=await this.supplier()),this.value}}s.AsyncLazy=Zu;function Qu(t){return()=>t.forEach(e=>e())}function Xu(t,e){return t.reduce((r,n)=>e(r)>e(n)?r:n)}function Gu(t,e){return t.reduce((r,n)=>e(r)<e(n)?r:n)}function Yu(t,e){const r=[];return t.forEach((n,i)=>{e(n)&&r.push(i)}),r}function _u(t,e){const r=t.find(n=>n instanceof e);return V.of(r)}function Ju(t,e){return t.filter(r=>r instanceof e)}function tc(t,e){const r=[],n=Math.max(t.length,e.length);for(let i=0;i<n;i++)t[i]&&r.push(t[i]),e[i]&&r.push(e[i]);return r}function ec(t,e){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}class rc{constructor(e){this.value=e,this.children=[]}}function nc(t,e,r,n,i=!1){const o=new Map,a=[];t.forEach(u=>{const f=new rc(u);o.set(u[e],f)}),t.forEach(u=>{const f=o.get(u[e]);if(!f)return;const T=u[r];if(T){const U=o.get(T);U&&U.children.push(f)}else a.push(f)});const c=u=>{u.children.sort((f,T)=>{const U=f.value[n],at=T.value[n];return i?at-U:U-at}),u.children.forEach(c)};return a.forEach(c),a}function Fn(t,e){if(Math.log2(t.length)%1!==0)throw new Error("Array length must be a power of 2");let r=[...t];for(;r.length>1;){const n=[];for(let i=0;i<r.length;i+=2){const o=r[i+1];n.push(e(r[i],o))}r=n}return r[0]}function it(...t){const e=t.reduce((i,o)=>i+o.length,0),r=new Uint8Array(e);let n=0;return t.forEach(i=>{r.set(i,n),n+=i.length}),r}function jn(t){return t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71}function Nn(t){return t[0]===255&&t[1]===216}function Rn(t){return t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80}function ic(t){return jn(t)||Nn(t)||Rn(t)}function oc(t){return new Uint8Array([t])}function sc(t){return t[0]}function ac(t,e){const r=new ArrayBuffer(2);return new DataView(r).setUint16(0,t,e==="LE"),new Uint8Array(r)}function uc(t,e){return new DataView(t.buffer).getUint16(t.byteOffset,e==="LE")}function cc(t,e){const r=new ArrayBuffer(4);return new DataView(r).setUint32(0,t,e==="LE"),new Uint8Array(r)}function lc(t,e){return new DataView(t.buffer).getUint32(t.byteOffset,e==="LE")}function we(t,e){const r=new ArrayBuffer(8);return new DataView(r).setBigUint64(0,BigInt(t),e==="LE"),new Uint8Array(r)}function fc(t,e){return new DataView(t.buffer).getBigUint64(t.byteOffset,e==="LE")}function ot(t,e){const r=new Uint8Array(32);let n=t;if(e==="LE"){for(let i=0;i<32;i++)r[i]=Number(n&0xffn),n>>=8n;return r}for(let i=31;i>=0;i--)r[i]=Number(n&0xffn),n>>=8n;return r}function st(t,e){let r=0n;if(e==="LE"){for(let n=31;n>=0;n--)r=r<<8n|BigInt(t[n]);return r}for(let n=0;n<32;n++)r=r<<8n|BigInt(t[n]);return r}function hc(t,e){const r=[];let n=0;for(const i of e)r.push(t.subarray(n,n+i)),n+=i;return r}function be(t,e){const r=[];for(let n=0;n<t.length;n+=e)r.push(t.subarray(n,n+e));return r}const Pn=[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 dc(t){for(let e=0;e<24;e++){const r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],o=t[3]^t[13]^t[23]^t[33]^t[43],a=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],T=t[8]^t[18]^t[28]^t[38]^t[48],U=t[9]^t[19]^t[29]^t[39]^t[49],at=i<<1|o>>>31,Jc=o<<1|i>>>31,yt=T^at,wt=U^Jc,tl=a<<1|c>>>31,el=c<<1|a>>>31,bt=r^tl,xt=n^el,rl=u<<1|f>>>31,nl=f<<1|u>>>31,St=i^rl,Et=o^nl,il=T<<1|U>>>31,ol=U<<1|T>>>31,vt=a^il,At=c^ol,sl=r<<1|n>>>31,al=n<<1|r>>>31,$t=u^sl,Mt=f^al;t[0]^=yt,t[1]^=wt,t[2]^=bt,t[3]^=xt,t[4]^=St,t[5]^=Et,t[6]^=vt,t[7]^=At,t[8]^=$t,t[9]^=Mt,t[10]^=yt,t[11]^=wt,t[12]^=bt,t[13]^=xt,t[14]^=St,t[15]^=Et,t[16]^=vt,t[17]^=At,t[18]^=$t,t[19]^=Mt,t[20]^=yt,t[21]^=wt,t[22]^=bt,t[23]^=xt,t[24]^=St,t[25]^=Et,t[26]^=vt,t[27]^=At,t[28]^=$t,t[29]^=Mt,t[30]^=yt,t[31]^=wt,t[32]^=bt,t[33]^=xt,t[34]^=St,t[35]^=Et,t[36]^=vt,t[37]^=At,t[38]^=$t,t[39]^=Mt,t[40]^=yt,t[41]^=wt,t[42]^=bt,t[43]^=xt,t[44]^=St,t[45]^=Et,t[46]^=vt,t[47]^=At,t[48]^=$t,t[49]^=Mt;const Me=t[0],Te=t[1],Oe=t[2]<<1|t[3]>>>31,ke=t[3]<<1|t[2]>>>31,Ie=t[5]<<30|t[4]>>>2,Ce=t[4]<<30|t[5]>>>2,Ue=t[6]<<28|t[7]>>>4,Be=t[7]<<28|t[6]>>>4,De=t[8]<<27|t[9]>>>5,Fe=t[9]<<27|t[8]>>>5,je=t[11]<<4|t[10]>>>28,Ne=t[10]<<4|t[11]>>>28,Re=t[13]<<12|t[12]>>>20,Pe=t[12]<<12|t[13]>>>20,Le=t[14]<<6|t[15]>>>26,ze=t[15]<<6|t[14]>>>26,We=t[17]<<23|t[16]>>>9,Ve=t[16]<<23|t[17]>>>9,qe=t[18]<<20|t[19]>>>12,He=t[19]<<20|t[18]>>>12,Ke=t[20]<<3|t[21]>>>29,Ze=t[21]<<3|t[20]>>>29,Qe=t[22]<<10|t[23]>>>22,Xe=t[23]<<10|t[22]>>>22,Ge=t[25]<<11|t[24]>>>21,Ye=t[24]<<11|t[25]>>>21,_e=t[26]<<25|t[27]>>>7,Je=t[27]<<25|t[26]>>>7,tr=t[29]<<7|t[28]>>>25,er=t[28]<<7|t[29]>>>25,rr=t[31]<<9|t[30]>>>23,nr=t[30]<<9|t[31]>>>23,ir=t[33]<<13|t[32]>>>19,or=t[32]<<13|t[33]>>>19,sr=t[34]<<15|t[35]>>>17,ar=t[35]<<15|t[34]>>>17,ur=t[36]<<21|t[37]>>>11,cr=t[37]<<21|t[36]>>>11,lr=t[38]<<8|t[39]>>>24,fr=t[39]<<8|t[38]>>>24,hr=t[40]<<18|t[41]>>>14,dr=t[41]<<18|t[40]>>>14,gr=t[42]<<2|t[43]>>>30,mr=t[43]<<2|t[42]>>>30,pr=t[45]<<29|t[44]>>>3,yr=t[44]<<29|t[45]>>>3,wr=t[47]<<24|t[46]>>>8,br=t[46]<<24|t[47]>>>8,xr=t[48]<<14|t[49]>>>18,Sr=t[49]<<14|t[48]>>>18;t[0]=Me^~Re&Ge,t[1]=Te^~Pe&Ye,t[2]=Re^~Ge&ur,t[3]=Pe^~Ye&cr,t[4]=Ge^~ur&xr,t[5]=Ye^~cr&Sr,t[6]=ur^~xr&Me,t[7]=cr^~Sr&Te,t[8]=xr^~Me&Re,t[9]=Sr^~Te&Pe,t[10]=Ue^~qe&Ke,t[11]=Be^~He&Ze,t[12]=qe^~Ke&ir,t[13]=He^~Ze&or,t[14]=Ke^~ir&pr,t[15]=Ze^~or&yr,t[16]=ir^~pr&Ue,t[17]=or^~yr&Be,t[18]=pr^~Ue&qe,t[19]=yr^~Be&He,t[20]=Oe^~Le&_e,t[21]=ke^~ze&Je,t[22]=Le^~_e&lr,t[23]=ze^~Je&fr,t[24]=_e^~lr&hr,t[25]=Je^~fr&dr,t[26]=lr^~hr&Oe,t[27]=fr^~dr&ke,t[28]=hr^~Oe&Le,t[29]=dr^~ke&ze,t[30]=De^~je&Qe,t[31]=Fe^~Ne&Xe,t[32]=je^~Qe&sr,t[33]=Ne^~Xe&ar,t[34]=Qe^~sr&wr,t[35]=Xe^~ar&br,t[36]=sr^~wr&De,t[37]=ar^~br&Fe,t[38]=wr^~De&je,t[39]=br^~Fe&Ne,t[40]=Ie^~We&tr,t[41]=Ce^~Ve&er,t[42]=We^~tr&rr,t[43]=Ve^~er&nr,t[44]=tr^~rr&gr,t[45]=er^~nr&mr,t[46]=rr^~gr&Ie,t[47]=nr^~mr&Ce,t[48]=gr^~Ie&We,t[49]=mr^~Ce&Ve,t[0]^=Pn[e*2],t[1]^=Pn[e*2+1]}}function Ln(t){const e=[];for(let r=0;r<t.length;r+=4)e.push(t[r]|t[r+1]<<8|t[r+2]<<16|t[r+3]<<24);return e}function zn(t,e){if(!t.length){const i=new Uint8Array(136);return i[0]=e,i[135]=128,[Ln(i)]}const r=be(t,136),n=r[r.length-1];if(n.length<136){const i=new Uint8Array(136);i.set(n),i[n.length]=e,i[135]|=128,r[r.length-1]=i}if(n.length===136){const i=new Uint8Array(136);i[0]=e,i[135]=128,r.push(i)}return r.map(Ln)}function Wn(t,e){for(const r of e){for(let n=0;n<34;n+=2)t[n]^=r[n+1],t[n+1]^=r[n];dc(t)}return t}function Vn(t){return new Uint8Array([t[1],t[1]>>-24,t[1]>>-16,t[1]>>-8,t[0],t[0]>>8,t[0]>>16,t[0]>>24,t[3],t[3]>>-24,t[3]>>-16,t[3]>>-8,t[2],t[2]>>8,t[2]>>16,t[2]>>24,t[5],t[5]>>-24,t[5]>>-16,t[5]>>-8,t[4],t[4]>>8,t[4]>>16,t[4]>>24,t[7],t[7]>>-24,t[7]>>-16,t[7]>>-8,t[6],t[6]>>8,t[6]>>16,t[6]>>24])}function q(t){return Vn(Wn(new Array(50).fill(0),zn(t,1)))}function gc(t){return Vn(Wn(new Array(50).fill(0),zn(t,6)))}function mc(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){const i=t[n]^e[n];for(let o=0;o<8;o++)if(i>>7-o&1)return n*8+o}return Math.min(t.length,e.length)*8}function pc(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++)if(t[n]!==e[n])return t.subarray(0,n);return t.subarray(0,r)}function yc(t,e,r,n){const i=Math.floor(e/8),o=e%8;r===1?t[i]|=1<<(n==="BE"?7-o:o):t[i]&=~(1<<(n==="BE"?7-o:o))}function wc(t,e,r){const n=Math.floor(e/8),i=e%8;return t[n]>>(r==="BE"?7-i:i)&1}function bc(t,e,r=0){for(let n=r;n<t.length;n++)for(let i=0;i<e.length&&t[n+i]===e[i];i++)if(i===e.length-1)return n;return-1}function qn(t,e,r=0){if(t.length>=e)return t