cafe-utility 33.11.0 → 35.0.0

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.
Files changed (4) hide show
  1. package/index.d.ts +34 -6
  2. package/index.js +345 -234
  3. package/module.mjs +1 -31
  4. package/package.json +2 -1
package/index.d.ts CHANGED
@@ -683,22 +683,50 @@ export declare class Chunk {
683
683
  static hashFunction: (bytes: Uint8Array) => Uint8Array
684
684
  span: bigint
685
685
  writer: Uint8ArrayWriter
686
- constructor(capacity: number, span?: bigint)
686
+ constructor(span?: bigint)
687
687
  build(): Uint8Array
688
688
  hash(): Uint8Array
689
+ encryptedHash(key?: Uint8Array): {
690
+ address: Uint8Array
691
+ key: Uint8Array
692
+ }
693
+ static encryptSpan(key: Uint8Array, spanBytes: Uint8Array): Uint8Array
694
+ static encryptData(key: Uint8Array, data: Uint8Array): Uint8Array
695
+ static decrypt(
696
+ encBytes: Uint8Array,
697
+ key: Uint8Array
698
+ ): {
699
+ span: bigint
700
+ data: Uint8Array
701
+ }
689
702
  }
690
- export declare class MerkleTree {
691
- static readonly NOOP: (_: Chunk) => Promise<void>
692
- private capacity
703
+ export declare class ChunkSplitter {
704
+ static readonly NOOP: (_: Chunk, _key?: Uint8Array) => Promise<void>
705
+ private refSize
706
+ private encrypted
693
707
  private chunks
694
708
  private counters
695
709
  private onChunk
696
- constructor(onChunk: (chunk: Chunk) => Promise<void>, capacity?: number)
697
- static root(data: Uint8Array, capacity?: number): Promise<Chunk>
710
+ constructor(onChunk: (chunk: Chunk, key?: Uint8Array) => Promise<void>, encrypted?: boolean)
711
+ static root(data: Uint8Array): Promise<Chunk>
712
+ static encryptedRoot(data: Uint8Array): Promise<{
713
+ address: Uint8Array
714
+ key: Uint8Array
715
+ }>
698
716
  append(data: Uint8Array, level?: number, spanIncrement?: bigint): Promise<void>
699
717
  private elevate
700
718
  finalize(level?: number): Promise<Chunk>
701
719
  }
720
+ export declare class ChunkJoiner {
721
+ private refSize
722
+ private encrypted
723
+ private fetch
724
+ private onData
725
+ constructor(fetch: (address: Uint8Array) => Promise<Uint8Array>, onData: (data: Uint8Array) => Promise<void>, encrypted?: boolean)
726
+ static collect(address: Uint8Array, fetch: (address: Uint8Array) => Promise<Uint8Array>): Promise<Uint8Array>
727
+ static collectEncrypted(address: Uint8Array, key: Uint8Array, fetch: (address: Uint8Array) => Promise<Uint8Array>): Promise<Uint8Array>
728
+ join(address: Uint8Array, key?: Uint8Array): Promise<void>
729
+ }
702
730
  export declare class FixedPointNumber {
703
731
  value: bigint
704
732
  scale: number
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
  var _a
3
- Object.defineProperty(exports, '__esModule', { value: !0 }), (exports.Vector = exports.Cache = exports.Assertions = exports.Strings = exports.Types = exports.Objects = exports.Dates = exports.Promises = exports.Numbers = exports.System = exports.Arrays = exports.Random = exports.Elliptic = exports.Binary = exports.Lock = exports.Solver = exports.RollingValueProvider = exports.TrieRouter = exports.AsyncQueue = exports.PubSubChannel = exports.FixedPointNumber = exports.MerkleTree = exports.Chunk = exports.Uint8ArrayWriter = exports.Uint8ArrayReader = exports.AsyncLazy = exports.Lazy = exports.Optional = void 0)
3
+ Object.defineProperty(exports, '__esModule', { value: !0 }), (exports.Vector = exports.Cache = exports.Assertions = exports.Strings = exports.Types = exports.Objects = exports.Dates = exports.Promises = exports.Numbers = exports.System = exports.Arrays = exports.Random = exports.Elliptic = exports.Binary = exports.Lock = exports.Solver = exports.RollingValueProvider = exports.TrieRouter = exports.AsyncQueue = exports.PubSubChannel = exports.FixedPointNumber = exports.ChunkJoiner = exports.ChunkSplitter = exports.Chunk = exports.Uint8ArrayWriter = exports.Uint8ArrayReader = exports.AsyncLazy = exports.Lazy = exports.Optional = void 0)
4
4
  async function invertPromise(n) {
5
5
  return new Promise((e, t) => n.then(t, e))
6
6
  }
@@ -11,7 +11,7 @@ async function runInParallelBatches(n, e = 1) {
11
11
  const t = splitByCount(n, e),
12
12
  r = [],
13
13
  i = t.map(async o => {
14
- for (const u of o) r.push(await u())
14
+ for (const c of o) r.push(await c())
15
15
  })
16
16
  return await Promise.all(i), r
17
17
  }
@@ -122,18 +122,18 @@ function pickManyUnique(n, e, t, r = Math.random) {
122
122
  const i = []
123
123
  for (; i.length < e; ) {
124
124
  const o = pick(n, r)
125
- i.some(u => t(u, o)) || i.push(o)
125
+ i.some(c => t(c, o)) || i.push(o)
126
126
  }
127
127
  return i
128
128
  }
129
129
  function pickGuaranteed(n, e, t, r, i, o = Math.random) {
130
- const u = n.filter(c => c !== e && c !== t),
131
- s = []
132
- for (e !== null && s.push(e); u.length && s.length < r; ) {
133
- const c = exports.Random.intBetween(0, u.length - 1, o)
134
- i(u[c], s) && s.push(u[c]), u.splice(c, 1)
130
+ const c = n.filter(s => s !== e && s !== t),
131
+ u = []
132
+ for (e !== null && u.push(e); c.length && u.length < r; ) {
133
+ const s = exports.Random.intBetween(0, c.length - 1, o)
134
+ i(c[s], u) && u.push(c[s]), c.splice(s, 1)
135
135
  }
136
- return shuffle(s, o), { values: s, indexOfGuaranteed: e !== null ? s.indexOf(e) : -1 }
136
+ return shuffle(u, o), { values: u, indexOfGuaranteed: e !== null ? u.indexOf(e) : -1 }
137
137
  }
138
138
  function last(n) {
139
139
  if (!n.length) throw Error('Received empty array')
@@ -147,7 +147,7 @@ function makePipe(n, e) {
147
147
  }
148
148
  function pickWeighted(n, e, t) {
149
149
  if ((t === void 0 && (t = Math.random()), n.length !== e.length)) throw new Error('Array length mismatch')
150
- let r = e.reduce((o, u) => o + u, 0)
150
+ let r = e.reduce((o, c) => o + c, 0)
151
151
  const i = t * r
152
152
  for (let o = 0; o < n.length - 1; o++) if (((r -= e[o]), i >= r)) return n[o]
153
153
  return last(n)
@@ -156,7 +156,7 @@ function sortWeighted(n, e, t = Math.random) {
156
156
  const r = e.map(o => t() * o),
157
157
  i = []
158
158
  for (let o = 0; o < n.length; o++) i.push([n[o], r[o]])
159
- return i.sort((o, u) => u[1] - o[1]).map(o => o[0])
159
+ return i.sort((o, c) => c[1] - o[1]).map(o => o[0])
160
160
  }
161
161
  function getDeep(n, e) {
162
162
  if (n == null) return null
@@ -172,11 +172,11 @@ function setDeep(n, e, t) {
172
172
  const r = e.split(/\.|\[/)
173
173
  let i = n
174
174
  for (let o = 0; o < r.length; o++) {
175
- const u = r[o],
176
- s = o < r.length - 1 && r[o + 1].includes(']'),
177
- f = u.includes(']') ? u.replace(/\[|\]/g, '') : u
175
+ const c = r[o],
176
+ u = o < r.length - 1 && r[o + 1].includes(']'),
177
+ f = c.includes(']') ? c.replace(/\[|\]/g, '') : c
178
178
  if (o === r.length - 1) return (i[f] = t), t
179
- isObject(i[f]) || (s ? (i[f] = []) : (i[f] = {})), (i = i[f])
179
+ isObject(i[f]) || (u ? (i[f] = []) : (i[f] = {})), (i = i[f])
180
180
  }
181
181
  return t
182
182
  }
@@ -232,16 +232,16 @@ function whereAmI() {
232
232
  return n ? (n.browser === !0 ? 'browser' : 'node') : 'browser'
233
233
  }
234
234
  async function withRetries(n, e, t, r, i, o) {
235
- let u = null
236
- for (let s = 0; s <= e; s++)
235
+ let c = null
236
+ for (let u = 0; u <= e; u++)
237
237
  try {
238
238
  return await n()
239
- } catch (c) {
240
- if (((u = c), s === e)) break
241
- const f = t + (r - t) * (s / (e - 1))
242
- i && i('Error in withRetries, retrying', { attempt: s + 1, allowedFailures: e, delayMillis: f, error: c }), o && o(), await sleepMillis(f)
239
+ } catch (s) {
240
+ if (((c = s), u === e)) break
241
+ const f = t + (r - t) * (u / (e - 1))
242
+ i && i('Error in withRetries, retrying', { attempt: u + 1, allowedFailures: e, delayMillis: f, error: s }), o && o(), await sleepMillis(f)
243
243
  }
244
- throw u
244
+ throw c
245
245
  }
246
246
  function asMegabytes(n) {
247
247
  return n / 1024 / 1024
@@ -259,10 +259,10 @@ function rgbToHex(n) {
259
259
  }
260
260
  function haversineDistanceToMeters(n, e, t, r) {
261
261
  const o = (n * Math.PI) / 180,
262
- u = (t * Math.PI) / 180,
263
- s = ((t - n) * Math.PI) / 180,
264
- c = ((r - e) * Math.PI) / 180,
265
- f = Math.sin(s / 2) * Math.sin(s / 2) + Math.cos(o) * Math.cos(u) * Math.sin(c / 2) * Math.sin(c / 2)
262
+ c = (t * Math.PI) / 180,
263
+ u = ((t - n) * Math.PI) / 180,
264
+ s = ((r - e) * Math.PI) / 180,
265
+ f = Math.sin(u / 2) * Math.sin(u / 2) + Math.cos(o) * Math.cos(c) * Math.sin(s / 2) * Math.sin(s / 2)
266
266
  return 6371e3 * (2 * Math.atan2(Math.sqrt(f), Math.sqrt(1 - f)))
267
267
  }
268
268
  function roundToNearest(n, e) {
@@ -282,9 +282,9 @@ function searchFloat(n) {
282
282
  function binomialSample(n, e, t = Math.random) {
283
283
  const r = n * e,
284
284
  i = Math.sqrt(n * e * (1 - e)),
285
- u = (t() + t() + t() + t() + t() + t() - 3) * Math.SQRT2,
286
- s = Math.round(r + i * u)
287
- return Math.max(0, Math.min(n, s))
285
+ c = (t() + t() + t() + t() + t() + t() - 3) * Math.SQRT2,
286
+ u = Math.round(r + i * c)
287
+ return Math.max(0, Math.min(n, u))
288
288
  }
289
289
  function toSignificantDigits(n, e) {
290
290
  if (!n.includes('.')) return n
@@ -298,9 +298,9 @@ function toSignificantDigits(n, e) {
298
298
  l = r.slice(0, f)
299
299
  return /[1-9]/.test(l) ? `${t}.${l.replace(/0+$/, '')}` : t
300
300
  }
301
- const s = r.match(/^0*/)?.[0].length ?? 0,
302
- c = e + s
303
- return `${t}.${r.slice(0, c)}`
301
+ const u = r.match(/^0*/)?.[0].length ?? 0,
302
+ s = e + u
303
+ return `${t}.${r.slice(0, s)}`
304
304
  }
305
305
  function isObject(n, e = !0) {
306
306
  return !n || (e && !isUndefined(n._readableState)) || (e && n.constructor && (n.constructor.isBuffer || n.constructor.name == 'AbortController' || n.constructor.name == 'AbortSignal' || n.constructor.name == 'Uint8Array' || n.constructor.name === 'ArrayBuffer' || n.constructor.name === 'ReadableStream')) ? !1 : typeof n == 'object'
@@ -783,12 +783,12 @@ function expand(n) {
783
783
  const r = t[1].split(','),
784
784
  i = n.slice(0, t.index),
785
785
  o = n.slice(t.index + t[0].length)
786
- let u = []
787
- for (const s of r) {
788
- const c = expand(i + s + o)
789
- u = u.concat(c)
786
+ let c = []
787
+ for (const u of r) {
788
+ const s = expand(i + u + o)
789
+ c = c.concat(s)
790
790
  }
791
- return u
791
+ return c
792
792
  }
793
793
  function shrinkTrim(n) {
794
794
  return n
@@ -1031,22 +1031,22 @@ function baseToUint8Array(n, e) {
1031
1031
  r = e.length
1032
1032
  let i = 0,
1033
1033
  o = 0
1034
- const u = []
1035
- for (let s = 0; s < n.length; s++) {
1036
- const c = n[s]
1037
- if (c === t) break
1038
- const f = e.indexOf(c)
1039
- if (f === -1) throw new Error(`Invalid character: ${c}`)
1040
- ;(o = (o << Math.log2(r)) | f), (i += Math.log2(r)), i >= 8 && ((i -= 8), u.push((o >> i) & 255))
1034
+ const c = []
1035
+ for (let u = 0; u < n.length; u++) {
1036
+ const s = n[u]
1037
+ if (s === t) break
1038
+ const f = e.indexOf(s)
1039
+ if (f === -1) throw new Error(`Invalid character: ${s}`)
1040
+ ;(o = (o << Math.log2(r)) | f), (i += Math.log2(r)), i >= 8 && ((i -= 8), c.push((o >> i) & 255))
1041
1041
  }
1042
- return new Uint8Array(u)
1042
+ return new Uint8Array(c)
1043
1043
  }
1044
1044
  function uint8ArrayToBase(n, e) {
1045
1045
  const t = e.length
1046
1046
  let r = 0,
1047
1047
  i = 0,
1048
1048
  o = ''
1049
- for (let u = 0; u < n.length; u++) for (i = (i << 8) | n[u], r += 8; r >= Math.log2(t); ) (r -= Math.log2(t)), (o += e[(i >> r) & (t - 1)])
1049
+ for (let c = 0; c < n.length; c++) for (i = (i << 8) | n[c], r += 8; r >= Math.log2(t); ) (r -= Math.log2(t)), (o += e[(i >> r) & (t - 1)])
1050
1050
  return r > 0 && (o += e[(i << (Math.log2(t) - r)) & (t - 1)]), o.length % 4 !== 0 && (o += '='.repeat(4 - (o.length % 4))), o
1051
1051
  }
1052
1052
  function hexToUint8Array(n) {
@@ -1084,9 +1084,9 @@ function route(n, e) {
1084
1084
  if (t.length !== r.length) return null
1085
1085
  const i = {}
1086
1086
  for (let o = 0; o < t.length; o++) {
1087
- const u = t[o]
1088
- if (u.startsWith(':')) i[u.slice(1)] = r[o]
1089
- else if (u !== r[o]) return null
1087
+ const c = t[o]
1088
+ if (c.startsWith(':')) i[c.slice(1)] = r[o]
1089
+ else if (c !== r[o]) return null
1090
1090
  }
1091
1091
  return i
1092
1092
  }
@@ -1097,25 +1097,25 @@ function explodeReplace(n, e, t) {
1097
1097
  }
1098
1098
  function generateVariants(n, e, t, r = Math.random) {
1099
1099
  const i = exports.Arrays.shuffle(
1100
- e.map(u => ({
1100
+ e.map(c => ({
1101
1101
  variants: exports.Arrays.shuffle(
1102
- u.variants.map(s => s),
1102
+ c.variants.map(u => u),
1103
1103
  r
1104
1104
  ),
1105
- avoid: u.avoid
1105
+ avoid: c.avoid
1106
1106
  })),
1107
1107
  r
1108
1108
  ),
1109
1109
  o = []
1110
- for (const u of i) {
1111
- const s = u.variants.filter(f => f !== u.avoid),
1112
- c = s.find(f => n.includes(f))
1113
- if (c && (pushAll(o, explodeReplace(n, c, s)), o.length >= t)) break
1110
+ for (const c of i) {
1111
+ const u = c.variants.filter(f => f !== c.avoid),
1112
+ s = u.find(f => n.includes(f))
1113
+ if (s && (pushAll(o, explodeReplace(n, s, u)), o.length >= t)) break
1114
1114
  }
1115
1115
  if (o.length < t)
1116
- for (const u of i) {
1117
- const s = u.variants.find(c => n.includes(c))
1118
- if (s && (pushAll(o, explodeReplace(n, s, u.variants)), o.length >= t)) break
1116
+ for (const c of i) {
1117
+ const u = c.variants.find(s => n.includes(s))
1118
+ if (u && (pushAll(o, explodeReplace(n, u, c.variants)), o.length >= t)) break
1119
1119
  }
1120
1120
  return o.slice(0, t)
1121
1121
  }
@@ -1144,10 +1144,10 @@ function toLines(n, e, t = {}) {
1144
1144
  const r = []
1145
1145
  let i = '',
1146
1146
  o = 0
1147
- for (let u = 0; u < n.length; u++) {
1148
- const s = n[u],
1149
- c = t[s] || 1
1150
- if (((i += s), (o += c), o > e)) {
1147
+ for (let c = 0; c < n.length; c++) {
1148
+ const u = n[c],
1149
+ s = t[u] || 1
1150
+ if (((i += u), (o += s), o > e)) {
1151
1151
  const { line: f, rest: l } = breakLine(i)
1152
1152
  r.push(f),
1153
1153
  (i = l),
@@ -1223,8 +1223,8 @@ function resolveVariableWithDefaultSyntax(n, e, t, r = '$', i = ':') {
1223
1223
  if (n[o + e.length + 1] === i)
1224
1224
  if (n[o + e.length + 2] === i) n = n.replace(`${r}${e}${i}${i}`, t)
1225
1225
  else {
1226
- const s = readNextWord(n, o + e.length + 2, ['_'])
1227
- n = n.replace(`${r}${e}${i}${s}`, t)
1226
+ const u = readNextWord(n, o + e.length + 2, ['_'])
1227
+ n = n.replace(`${r}${e}${i}${u}`, t)
1228
1228
  }
1229
1229
  else n = n.replace(`${r}${e}`, t)
1230
1230
  o = n.indexOf(`${r}${e}`, o + t.length)
@@ -1238,8 +1238,8 @@ function resolveRemainingVariablesWithDefaults(n, e = '$', t = ':') {
1238
1238
  if (n[r + i.length + 1] === t)
1239
1239
  if (n[r + i.length + 2] === t) n = n.replace(`${e}${i}${t}${t}`, '')
1240
1240
  else {
1241
- const u = readNextWord(n, r + i.length + 2)
1242
- n = n.replace(`${e}${i}${t}${u}`, u)
1241
+ const c = readNextWord(n, r + i.length + 2)
1242
+ n = n.replace(`${e}${i}${t}${c}`, c)
1243
1243
  }
1244
1244
  r = n.indexOf(e, r + 1)
1245
1245
  }
@@ -1251,9 +1251,9 @@ function resolveMarkdownLinks(n, e) {
1251
1251
  const r = lastIndexOfBefore(n, '[', t),
1252
1252
  i = n.indexOf(')', t)
1253
1253
  if (r !== -1 && i !== -1) {
1254
- const [o, u] = n.slice(r + 1, i).split(']('),
1255
- s = e(o, u)
1256
- n = n.slice(0, r) + s + n.slice(i + 1)
1254
+ const [o, c] = n.slice(r + 1, i).split(']('),
1255
+ u = e(o, c)
1256
+ n = n.slice(0, r) + u + n.slice(i + 1)
1257
1257
  }
1258
1258
  t = n.indexOf('](', t + 1)
1259
1259
  }
@@ -1282,15 +1282,15 @@ function selectMax(n, e) {
1282
1282
  let t = null,
1283
1283
  r = -1 / 0
1284
1284
  for (const [i, o] of Object.entries(n)) {
1285
- const u = e(o)
1286
- u > r && ((r = u), (t = i))
1285
+ const c = e(o)
1286
+ c > r && ((r = c), (t = i))
1287
1287
  }
1288
1288
  return t ? [t, n[t]] : null
1289
1289
  }
1290
1290
  function reposition(n, e, t, r) {
1291
- const i = n.find(u => u[e] === t),
1292
- o = n.find(u => u[e] === t + r)
1293
- i && o ? ((i[e] = t + r), (o[e] = t)) : i && (i[e] = t + r), n.sort((u, s) => asNumber(u[e]) - asNumber(s[e])), n.forEach((u, s) => (u[e] = s + 1))
1291
+ const i = n.find(c => c[e] === t),
1292
+ o = n.find(c => c[e] === t + r)
1293
+ i && o ? ((i[e] = t + r), (o[e] = t)) : i && (i[e] = t + r), n.sort((c, u) => asNumber(c[e]) - asNumber(u[e])), n.forEach((c, u) => (c[e] = u + 1))
1294
1294
  }
1295
1295
  function unwrapSingleKey(n) {
1296
1296
  const e = Object.keys(n)
@@ -1317,8 +1317,8 @@ function parseCsv(n, e = ',', t = '"') {
1317
1317
  const r = []
1318
1318
  let i = '',
1319
1319
  o = !1
1320
- const u = n.split('')
1321
- for (const s of u) s === e && !o ? (r.push(i), (i = '')) : s === t && ((!i && !o) || o) ? (o = !o) : (i += s)
1320
+ const c = n.split('')
1321
+ for (const u of c) u === e && !o ? (r.push(i), (i = '')) : u === t && ((!i && !o) || o) ? (o = !o) : (i += u)
1322
1322
  return r.push(i), r
1323
1323
  }
1324
1324
  function humanizeProgress(n) {
@@ -1408,8 +1408,8 @@ function secondsToHumanTime(n, e = DefaultTimeDeltaLabels) {
1408
1408
  function countCycles(n, e, t) {
1409
1409
  const i = (t?.now ?? Date.now()) - n,
1410
1410
  o = Math.floor(i / e),
1411
- u = e / (t?.precision ?? 1) - Math.ceil((i % e) / (t?.precision ?? 1))
1412
- return { cycles: o, remaining: u }
1411
+ c = e / (t?.precision ?? 1) - Math.ceil((i % e) / (t?.precision ?? 1))
1412
+ return { cycles: o, remaining: c }
1413
1413
  }
1414
1414
  const throttleTimers = {}
1415
1415
  function throttle(n, e) {
@@ -1423,10 +1423,10 @@ function getProgress(n, e, t, r) {
1423
1423
  r || (r = Date.now())
1424
1424
  const i = e / t,
1425
1425
  o = r - n,
1426
- u = o / e,
1427
- s = u * t,
1428
- c = s - o
1429
- return { deltaMs: o, progress: i, baseTimeMs: u, totalTimeMs: s, remainingTimeMs: c }
1426
+ c = o / e,
1427
+ u = c * t,
1428
+ s = u - o
1429
+ return { deltaMs: o, progress: i, baseTimeMs: c, totalTimeMs: u, remainingTimeMs: s }
1430
1430
  }
1431
1431
  const dayNumberIndex = { 0: 'sunday', 1: 'monday', 2: 'tuesday', 3: 'wednesday', 4: 'thursday', 5: 'friday', 6: 'saturday' }
1432
1432
  function mapDayNumber(n) {
@@ -1484,10 +1484,10 @@ async function getCached(n, e, t, r) {
1484
1484
  if (o && o.validUntil > i) return o.value
1485
1485
  r?.onMiss?.()
1486
1486
  try {
1487
- const u = await t()
1488
- return tinyCache.set(n, { value: u, validUntil: i + e }), u
1489
- } catch (u) {
1490
- throw (r?.onFailure?.(u), u)
1487
+ const c = await t()
1488
+ return tinyCache.set(n, { value: c, validUntil: i + e }), c
1489
+ } catch (c) {
1490
+ throw (r?.onFailure?.(c), c)
1491
1491
  }
1492
1492
  }
1493
1493
  function getCachedDeferred(n, e, t, r) {
@@ -1495,13 +1495,13 @@ function getCachedDeferred(n, e, t, r) {
1495
1495
  o = tinyCache.get(n)
1496
1496
  if (o && o.validUntil > i) return o.value
1497
1497
  r?.onMiss?.()
1498
- const u = t()
1498
+ const c = t()
1499
1499
  return (
1500
- tinyCache.set(n, { value: u, validUntil: i + e }),
1501
- u.catch(s => {
1502
- tinyCache.delete(n), r?.onFailure?.(s)
1500
+ tinyCache.set(n, { value: c, validUntil: i + e }),
1501
+ c.catch(u => {
1502
+ tinyCache.delete(n), r?.onFailure?.(u)
1503
1503
  }),
1504
- u
1504
+ c
1505
1505
  )
1506
1506
  }
1507
1507
  function deleteFromCache(n) {
@@ -1528,9 +1528,9 @@ function joinUrl(n, e = !1) {
1528
1528
  }
1529
1529
  function replaceBetweenStrings(n, e, t, r, i = !0) {
1530
1530
  const o = n.indexOf(e),
1531
- u = n.indexOf(t, o + e.length)
1532
- if (o === -1 || u === -1) throw Error('Start or end not found')
1533
- return i ? n.substring(0, o + e.length) + r + n.substring(u) : n.substring(0, o) + r + n.substring(u + t.length)
1531
+ c = n.indexOf(t, o + e.length)
1532
+ if (o === -1 || c === -1) throw Error('Start or end not found')
1533
+ return i ? n.substring(0, o + e.length) + r + n.substring(c) : n.substring(0, o) + r + n.substring(c + t.length)
1534
1534
  }
1535
1535
  function describeMarkdown(n) {
1536
1536
  let e = 'p'
@@ -1596,12 +1596,12 @@ function createStatefulToggle(n) {
1596
1596
  }
1597
1597
  function organiseWithLimits(n, e, t, r, i) {
1598
1598
  const o = {}
1599
- for (const u of Object.keys(e)) o[u] = []
1599
+ for (const c of Object.keys(e)) o[c] = []
1600
1600
  ;(o[r] = []), i && (n = n.sort(i))
1601
- for (const u of n) {
1602
- const s = u[t],
1603
- c = e[s] ? s : r
1604
- o[c].length >= e[c] ? o[r].push(u) : o[c].push(u)
1601
+ for (const c of n) {
1602
+ const u = c[t],
1603
+ s = e[u] ? u : r
1604
+ o[s].length >= e[s] ? o[r].push(c) : o[s].push(c)
1605
1605
  }
1606
1606
  return o
1607
1607
  }
@@ -1654,7 +1654,7 @@ function formatNumber(n, e) {
1654
1654
  i = t ? longNumberUnits : shortNumberUnits,
1655
1655
  o = e?.precision ?? 1
1656
1656
  if (n < thresholds[0]) return `${n}${r}`
1657
- for (let u = 0; u < thresholds.length - 1; u++) if (n < thresholds[u + 1]) return `${(n / thresholds[u]).toFixed(o)}${t ? ' ' : ''}${i[u]}${r}`
1657
+ for (let c = 0; c < thresholds.length - 1; c++) if (n < thresholds[c + 1]) return `${(n / thresholds[c]).toFixed(o)}${t ? ' ' : ''}${i[c]}${r}`
1658
1658
  return `${(n / thresholds[thresholds.length - 1]).toFixed(o)}${t ? ' ' : ''}${i[thresholds.length - 1]}${r}`
1659
1659
  }
1660
1660
  function makeNumber(n) {
@@ -1738,22 +1738,22 @@ function flip(n) {
1738
1738
  }
1739
1739
  function getAllPermutations(n) {
1740
1740
  const e = Object.keys(n),
1741
- t = e.map(s => n[s].length),
1742
- r = t.reduce((s, c) => (s *= c))
1741
+ t = e.map(u => n[u].length),
1742
+ r = t.reduce((u, s) => (u *= s))
1743
1743
  let i = 1
1744
1744
  const o = [1]
1745
- for (let s = 0; s < t.length - 1; s++) (i *= t[s]), o.push(i)
1746
- const u = []
1747
- for (let s = 0; s < r; s++) {
1748
- const c = {}
1745
+ for (let u = 0; u < t.length - 1; u++) (i *= t[u]), o.push(i)
1746
+ const c = []
1747
+ for (let u = 0; u < r; u++) {
1748
+ const s = {}
1749
1749
  for (let f = 0; f < e.length; f++) {
1750
1750
  const l = n[e[f]],
1751
- a = Math.floor(s / o[f]) % l.length
1752
- c[e[f]] = l[a]
1751
+ a = Math.floor(u / o[f]) % l.length
1752
+ s[e[f]] = l[a]
1753
1753
  }
1754
- u.push(c)
1754
+ c.push(s)
1755
1755
  }
1756
- return u
1756
+ return c
1757
1757
  }
1758
1758
  function countTruthyValues(n) {
1759
1759
  return Object.values(n).filter(e => e).length
@@ -1763,9 +1763,9 @@ function getFlatNotation(n, e, t) {
1763
1763
  }
1764
1764
  function flattenInner(n, e, t, r, i) {
1765
1765
  if (!isObject(e)) return e
1766
- for (const [o, u] of Object.entries(e)) {
1767
- const s = getFlatNotation(t, o, r)
1768
- Array.isArray(u) ? (i ? flattenInner(n, u, s, !0, i) : (n[s] = u.map(c => flattenInner(Array.isArray(c) ? [] : {}, c, '', !1, i)))) : isObject(u) ? flattenInner(n, u, s, !1, i) : (n[s] = u)
1766
+ for (const [o, c] of Object.entries(e)) {
1767
+ const u = getFlatNotation(t, o, r)
1768
+ Array.isArray(c) ? (i ? flattenInner(n, c, u, !0, i) : (n[u] = c.map(s => flattenInner(Array.isArray(s) ? [] : {}, s, '', !1, i)))) : isObject(c) ? flattenInner(n, c, u, !1, i) : (n[u] = c)
1769
1769
  }
1770
1770
  return n
1771
1771
  }
@@ -1830,10 +1830,10 @@ function makeUnique(n, e) {
1830
1830
  }
1831
1831
  function countUnique(n, e, t, r, i) {
1832
1832
  const o = e ? n.map(e) : n,
1833
- u = {}
1834
- for (const c of o) u[c] = (u[c] || 0) + 1
1835
- const s = r ? sortObjectValues(u, i ? (c, f) => c[1] - f[1] : (c, f) => f[1] - c[1]) : u
1836
- return t ? Object.keys(s) : s
1833
+ c = {}
1834
+ for (const s of o) c[s] = (c[s] || 0) + 1
1835
+ const u = r ? sortObjectValues(c, i ? (s, f) => s[1] - f[1] : (s, f) => f[1] - s[1]) : c
1836
+ return t ? Object.keys(u) : u
1837
1837
  }
1838
1838
  function sortObjectValues(n, e) {
1839
1839
  return Object.fromEntries(Object.entries(n).sort(e))
@@ -1844,7 +1844,7 @@ function transformToArray(n) {
1844
1844
  r = n[t[0]].length
1845
1845
  for (let i = 0; i < r; i++) {
1846
1846
  const o = {}
1847
- for (const u of t) o[u] = n[u][i]
1847
+ for (const c of t) o[c] = n[c][i]
1848
1848
  e.push(o)
1849
1849
  }
1850
1850
  return e
@@ -1997,29 +1997,29 @@ class Node {
1997
1997
  }
1998
1998
  function createHierarchy(n, e, t, r, i = !1) {
1999
1999
  const o = new Map(),
2000
- u = []
2001
- n.forEach(c => {
2002
- const f = new Node(c)
2003
- o.set(c[e], f)
2000
+ c = []
2001
+ n.forEach(s => {
2002
+ const f = new Node(s)
2003
+ o.set(s[e], f)
2004
2004
  }),
2005
- n.forEach(c => {
2006
- const f = o.get(c[e])
2005
+ n.forEach(s => {
2006
+ const f = o.get(s[e])
2007
2007
  if (!f) return
2008
- const l = c[t]
2008
+ const l = s[t]
2009
2009
  if (l) {
2010
2010
  const a = o.get(l)
2011
2011
  a && a.children.push(f)
2012
- } else u.push(f)
2012
+ } else c.push(f)
2013
2013
  })
2014
- const s = c => {
2015
- c.children.sort((f, l) => {
2014
+ const u = s => {
2015
+ s.children.sort((f, l) => {
2016
2016
  const a = f.value[r],
2017
2017
  h = l.value[r]
2018
2018
  return i ? h - a : a - h
2019
2019
  }),
2020
- c.children.forEach(s)
2020
+ s.children.forEach(u)
2021
2021
  }
2022
- return u.forEach(s), u
2022
+ return c.forEach(u), c
2023
2023
  }
2024
2024
  function log2Reduce(n, e) {
2025
2025
  if (Math.log2(n.length) % 1 !== 0) throw new Error('Array length must be a power of 2')
@@ -2121,9 +2121,9 @@ function keccakPermutate(n) {
2121
2121
  r = n[1] ^ n[11] ^ n[21] ^ n[31] ^ n[41],
2122
2122
  i = n[2] ^ n[12] ^ n[22] ^ n[32] ^ n[42],
2123
2123
  o = n[3] ^ n[13] ^ n[23] ^ n[33] ^ n[43],
2124
- u = n[4] ^ n[14] ^ n[24] ^ n[34] ^ n[44],
2125
- s = n[5] ^ n[15] ^ n[25] ^ n[35] ^ n[45],
2126
- c = n[6] ^ n[16] ^ n[26] ^ n[36] ^ n[46],
2124
+ c = n[4] ^ n[14] ^ n[24] ^ n[34] ^ n[44],
2125
+ u = n[5] ^ n[15] ^ n[25] ^ n[35] ^ n[45],
2126
+ s = n[6] ^ n[16] ^ n[26] ^ n[36] ^ n[46],
2127
2127
  f = n[7] ^ n[17] ^ n[27] ^ n[37] ^ n[47],
2128
2128
  l = n[8] ^ n[18] ^ n[28] ^ n[38] ^ n[48],
2129
2129
  a = n[9] ^ n[19] ^ n[29] ^ n[39] ^ n[49],
@@ -2131,40 +2131,40 @@ function keccakPermutate(n) {
2131
2131
  bn = (o << 1) | (i >>> 31),
2132
2132
  d = l ^ h,
2133
2133
  p = a ^ bn,
2134
- $n = (u << 1) | (s >>> 31),
2135
- En = (s << 1) | (u >>> 31),
2134
+ $n = (c << 1) | (u >>> 31),
2135
+ An = (u << 1) | (c >>> 31),
2136
2136
  m = t ^ $n,
2137
- g = r ^ En,
2138
- An = (c << 1) | (f >>> 31),
2139
- Mn = (f << 1) | (c >>> 31),
2140
- w = i ^ An,
2141
- x = o ^ Mn,
2142
- kn = (l << 1) | (a >>> 31),
2143
- Sn = (a << 1) | (l >>> 31),
2144
- y = u ^ kn,
2145
- b = s ^ Sn,
2137
+ g = r ^ An,
2138
+ En = (s << 1) | (f >>> 31),
2139
+ Sn = (f << 1) | (s >>> 31),
2140
+ w = i ^ En,
2141
+ x = o ^ Sn,
2142
+ Mn = (l << 1) | (a >>> 31),
2143
+ kn = (a << 1) | (l >>> 31),
2144
+ y = c ^ Mn,
2145
+ b = u ^ kn,
2146
2146
  On = (t << 1) | (r >>> 31),
2147
2147
  Tn = (r << 1) | (t >>> 31),
2148
- $ = c ^ On,
2149
- E = f ^ Tn
2150
- ;(n[0] ^= d), (n[1] ^= p), (n[2] ^= m), (n[3] ^= g), (n[4] ^= w), (n[5] ^= x), (n[6] ^= y), (n[7] ^= b), (n[8] ^= $), (n[9] ^= E), (n[10] ^= d), (n[11] ^= p), (n[12] ^= m), (n[13] ^= g), (n[14] ^= w), (n[15] ^= x), (n[16] ^= y), (n[17] ^= b), (n[18] ^= $), (n[19] ^= E), (n[20] ^= d), (n[21] ^= p), (n[22] ^= m), (n[23] ^= g), (n[24] ^= w), (n[25] ^= x), (n[26] ^= y), (n[27] ^= b), (n[28] ^= $), (n[29] ^= E), (n[30] ^= d), (n[31] ^= p), (n[32] ^= m), (n[33] ^= g), (n[34] ^= w), (n[35] ^= x), (n[36] ^= y), (n[37] ^= b), (n[38] ^= $), (n[39] ^= E), (n[40] ^= d), (n[41] ^= p), (n[42] ^= m), (n[43] ^= g), (n[44] ^= w), (n[45] ^= x), (n[46] ^= y), (n[47] ^= b), (n[48] ^= $), (n[49] ^= E)
2151
- const A = n[0],
2152
- M = n[1],
2153
- k = (n[2] << 1) | (n[3] >>> 31),
2154
- S = (n[3] << 1) | (n[2] >>> 31),
2148
+ $ = s ^ On,
2149
+ A = f ^ Tn
2150
+ ;(n[0] ^= d), (n[1] ^= p), (n[2] ^= m), (n[3] ^= g), (n[4] ^= w), (n[5] ^= x), (n[6] ^= y), (n[7] ^= b), (n[8] ^= $), (n[9] ^= A), (n[10] ^= d), (n[11] ^= p), (n[12] ^= m), (n[13] ^= g), (n[14] ^= w), (n[15] ^= x), (n[16] ^= y), (n[17] ^= b), (n[18] ^= $), (n[19] ^= A), (n[20] ^= d), (n[21] ^= p), (n[22] ^= m), (n[23] ^= g), (n[24] ^= w), (n[25] ^= x), (n[26] ^= y), (n[27] ^= b), (n[28] ^= $), (n[29] ^= A), (n[30] ^= d), (n[31] ^= p), (n[32] ^= m), (n[33] ^= g), (n[34] ^= w), (n[35] ^= x), (n[36] ^= y), (n[37] ^= b), (n[38] ^= $), (n[39] ^= A), (n[40] ^= d), (n[41] ^= p), (n[42] ^= m), (n[43] ^= g), (n[44] ^= w), (n[45] ^= x), (n[46] ^= y), (n[47] ^= b), (n[48] ^= $), (n[49] ^= A)
2151
+ const E = n[0],
2152
+ S = n[1],
2153
+ M = (n[2] << 1) | (n[3] >>> 31),
2154
+ k = (n[3] << 1) | (n[2] >>> 31),
2155
2155
  O = (n[5] << 30) | (n[4] >>> 2),
2156
2156
  T = (n[4] << 30) | (n[5] >>> 2),
2157
2157
  C = (n[6] << 28) | (n[7] >>> 4),
2158
2158
  R = (n[7] << 28) | (n[6] >>> 4),
2159
2159
  I = (n[8] << 27) | (n[9] >>> 5),
2160
2160
  D = (n[9] << 27) | (n[8] >>> 5),
2161
- B = (n[11] << 4) | (n[10] >>> 28),
2162
- P = (n[10] << 4) | (n[11] >>> 28),
2161
+ P = (n[11] << 4) | (n[10] >>> 28),
2162
+ B = (n[10] << 4) | (n[11] >>> 28),
2163
2163
  v = (n[13] << 12) | (n[12] >>> 20),
2164
2164
  U = (n[12] << 12) | (n[13] >>> 20),
2165
2165
  L = (n[14] << 6) | (n[15] >>> 26),
2166
- N = (n[15] << 6) | (n[14] >>> 26),
2167
- j = (n[17] << 23) | (n[16] >>> 9),
2166
+ j = (n[15] << 6) | (n[14] >>> 26),
2167
+ N = (n[17] << 23) | (n[16] >>> 9),
2168
2168
  F = (n[16] << 23) | (n[17] >>> 9),
2169
2169
  z = (n[18] << 20) | (n[19] >>> 12),
2170
2170
  q = (n[19] << 20) | (n[18] >>> 12),
@@ -2184,9 +2184,9 @@ function keccakPermutate(n) {
2184
2184
  tn = (n[32] << 13) | (n[33] >>> 19),
2185
2185
  rn = (n[34] << 15) | (n[35] >>> 17),
2186
2186
  on = (n[35] << 15) | (n[34] >>> 17),
2187
- un = (n[36] << 21) | (n[37] >>> 11),
2188
- cn = (n[37] << 21) | (n[36] >>> 11),
2189
- sn = (n[38] << 8) | (n[39] >>> 24),
2187
+ cn = (n[36] << 21) | (n[37] >>> 11),
2188
+ sn = (n[37] << 21) | (n[36] >>> 11),
2189
+ un = (n[38] << 8) | (n[39] >>> 24),
2190
2190
  fn = (n[39] << 8) | (n[38] >>> 24),
2191
2191
  ln = (n[40] << 18) | (n[41] >>> 14),
2192
2192
  an = (n[41] << 18) | (n[40] >>> 14),
@@ -2198,7 +2198,7 @@ function keccakPermutate(n) {
2198
2198
  wn = (n[46] << 24) | (n[47] >>> 8),
2199
2199
  xn = (n[48] << 14) | (n[49] >>> 18),
2200
2200
  yn = (n[49] << 14) | (n[48] >>> 18)
2201
- ;(n[0] = A ^ (~v & K)), (n[1] = M ^ (~U & Z)), (n[2] = v ^ (~K & un)), (n[3] = U ^ (~Z & cn)), (n[4] = K ^ (~un & xn)), (n[5] = Z ^ (~cn & yn)), (n[6] = un ^ (~xn & A)), (n[7] = cn ^ (~yn & M)), (n[8] = xn ^ (~A & v)), (n[9] = yn ^ (~M & U)), (n[10] = C ^ (~z & W)), (n[11] = R ^ (~q & H)), (n[12] = z ^ (~W & en)), (n[13] = q ^ (~H & tn)), (n[14] = W ^ (~en & pn)), (n[15] = H ^ (~tn & mn)), (n[16] = en ^ (~pn & C)), (n[17] = tn ^ (~mn & R)), (n[18] = pn ^ (~C & z)), (n[19] = mn ^ (~R & q)), (n[20] = k ^ (~L & Q)), (n[21] = S ^ (~N & G)), (n[22] = L ^ (~Q & sn)), (n[23] = N ^ (~G & fn)), (n[24] = Q ^ (~sn & ln)), (n[25] = G ^ (~fn & an)), (n[26] = sn ^ (~ln & k)), (n[27] = fn ^ (~an & S)), (n[28] = ln ^ (~k & L)), (n[29] = an ^ (~S & N)), (n[30] = I ^ (~B & V)), (n[31] = D ^ (~P & J)), (n[32] = B ^ (~V & rn)), (n[33] = P ^ (~J & on)), (n[34] = V ^ (~rn & gn)), (n[35] = J ^ (~on & wn)), (n[36] = rn ^ (~gn & I)), (n[37] = on ^ (~wn & D)), (n[38] = gn ^ (~I & B)), (n[39] = wn ^ (~D & P)), (n[40] = O ^ (~j & Y)), (n[41] = T ^ (~F & X)), (n[42] = j ^ (~Y & _)), (n[43] = F ^ (~X & nn)), (n[44] = Y ^ (~_ & hn)), (n[45] = X ^ (~nn & dn)), (n[46] = _ ^ (~hn & O)), (n[47] = nn ^ (~dn & T)), (n[48] = hn ^ (~O & j)), (n[49] = dn ^ (~T & F)), (n[0] ^= IOTA_CONSTANTS[e * 2]), (n[1] ^= IOTA_CONSTANTS[e * 2 + 1])
2201
+ ;(n[0] = E ^ (~v & K)), (n[1] = S ^ (~U & Z)), (n[2] = v ^ (~K & cn)), (n[3] = U ^ (~Z & sn)), (n[4] = K ^ (~cn & xn)), (n[5] = Z ^ (~sn & yn)), (n[6] = cn ^ (~xn & E)), (n[7] = sn ^ (~yn & S)), (n[8] = xn ^ (~E & v)), (n[9] = yn ^ (~S & U)), (n[10] = C ^ (~z & W)), (n[11] = R ^ (~q & H)), (n[12] = z ^ (~W & en)), (n[13] = q ^ (~H & tn)), (n[14] = W ^ (~en & pn)), (n[15] = H ^ (~tn & mn)), (n[16] = en ^ (~pn & C)), (n[17] = tn ^ (~mn & R)), (n[18] = pn ^ (~C & z)), (n[19] = mn ^ (~R & q)), (n[20] = M ^ (~L & Q)), (n[21] = k ^ (~j & G)), (n[22] = L ^ (~Q & un)), (n[23] = j ^ (~G & fn)), (n[24] = Q ^ (~un & ln)), (n[25] = G ^ (~fn & an)), (n[26] = un ^ (~ln & M)), (n[27] = fn ^ (~an & k)), (n[28] = ln ^ (~M & L)), (n[29] = an ^ (~k & j)), (n[30] = I ^ (~P & V)), (n[31] = D ^ (~B & J)), (n[32] = P ^ (~V & rn)), (n[33] = B ^ (~J & on)), (n[34] = V ^ (~rn & gn)), (n[35] = J ^ (~on & wn)), (n[36] = rn ^ (~gn & I)), (n[37] = on ^ (~wn & D)), (n[38] = gn ^ (~I & P)), (n[39] = wn ^ (~D & B)), (n[40] = O ^ (~N & Y)), (n[41] = T ^ (~F & X)), (n[42] = N ^ (~Y & _)), (n[43] = F ^ (~X & nn)), (n[44] = Y ^ (~_ & hn)), (n[45] = X ^ (~nn & dn)), (n[46] = _ ^ (~hn & O)), (n[47] = nn ^ (~dn & T)), (n[48] = hn ^ (~O & N)), (n[49] = dn ^ (~T & F)), (n[0] ^= IOTA_CONSTANTS[e * 2]), (n[1] ^= IOTA_CONSTANTS[e * 2 + 1])
2202
2202
  }
2203
2203
  }
2204
2204
  function bytesToNumbers(n) {
@@ -2233,9 +2233,52 @@ function absorb(n, e) {
2233
2233
  function squeeze(n) {
2234
2234
  return new Uint8Array([n[1], n[1] >> -24, n[1] >> -16, n[1] >> -8, n[0], n[0] >> 8, n[0] >> 16, n[0] >> 24, n[3], n[3] >> -24, n[3] >> -16, n[3] >> -8, n[2], n[2] >> 8, n[2] >> 16, n[2] >> 24, n[5], n[5] >> -24, n[5] >> -16, n[5] >> -8, n[4], n[4] >> 8, n[4] >> 16, n[4] >> 24, n[7], n[7] >> -24, n[7] >> -16, n[7] >> -8, n[6], n[6] >> 8, n[6] >> 16, n[6] >> 24])
2235
2235
  }
2236
+ function squeezeInto(n, e, t) {
2237
+ ;(e[t] = n[1]), (e[t + 1] = n[1] >> 8), (e[t + 2] = n[1] >> 16), (e[t + 3] = n[1] >> 24), (e[t + 4] = n[0]), (e[t + 5] = n[0] >> 8), (e[t + 6] = n[0] >> 16), (e[t + 7] = n[0] >> 24), (e[t + 8] = n[3]), (e[t + 9] = n[3] >> 8), (e[t + 10] = n[3] >> 16), (e[t + 11] = n[3] >> 24), (e[t + 12] = n[2]), (e[t + 13] = n[2] >> 8), (e[t + 14] = n[2] >> 16), (e[t + 15] = n[2] >> 24), (e[t + 16] = n[5]), (e[t + 17] = n[5] >> 8), (e[t + 18] = n[5] >> 16), (e[t + 19] = n[5] >> 24), (e[t + 20] = n[4]), (e[t + 21] = n[4] >> 8), (e[t + 22] = n[4] >> 16), (e[t + 23] = n[4] >> 24), (e[t + 24] = n[7]), (e[t + 25] = n[7] >> 8), (e[t + 26] = n[7] >> 16), (e[t + 27] = n[7] >> 24), (e[t + 28] = n[6]), (e[t + 29] = n[6] >> 8), (e[t + 30] = n[6] >> 16), (e[t + 31] = n[6] >> 24)
2238
+ }
2236
2239
  function keccak256(n) {
2237
2240
  return squeeze(absorb(new Array(50).fill(0), divideToBlocks(n, 1)))
2238
2241
  }
2242
+ function bmtRoot(n) {
2243
+ const e = new Uint8Array(n),
2244
+ t = new Array(50).fill(0),
2245
+ r = new Uint8Array(136)
2246
+ ;(r[64] = 1), (r[135] = 128)
2247
+ let i = e.length >>> 5
2248
+ for (; i > 1; ) {
2249
+ const o = i >>> 1
2250
+ for (let c = 0; c < o; c++) {
2251
+ r.set(e.subarray(c << 6, (c + 1) << 6)), t.fill(0)
2252
+ for (let u = 0, s = 0; u < 34; u += 2, s += 8) (t[u] ^= r[s + 4] | (r[s + 5] << 8) | (r[s + 6] << 16) | (r[s + 7] << 24)), (t[u + 1] ^= r[s] | (r[s + 1] << 8) | (r[s + 2] << 16) | (r[s + 3] << 24))
2253
+ keccakPermutate(t), squeezeInto(t, e, c << 5)
2254
+ }
2255
+ i = o
2256
+ }
2257
+ return e.subarray(0, 32)
2258
+ }
2259
+ const SPAN_ENCRYPT_INIT_CTR = 128
2260
+ function encryptSegments(n, e, t) {
2261
+ const r = new Uint8Array(t.length),
2262
+ i = new Uint8Array(36)
2263
+ i.set(n)
2264
+ for (let o = 0, c = 0; c < t.length; o++, c += 32) {
2265
+ const u = (e + o) >>> 0
2266
+ ;(i[32] = u & 255), (i[33] = (u >>> 8) & 255), (i[34] = (u >>> 16) & 255), (i[35] = (u >>> 24) & 255)
2267
+ const s = keccak256(keccak256(i)),
2268
+ f = Math.min(c + 32, t.length)
2269
+ for (let l = c; l < f; l++) r[l] = t[l] ^ s[l - c]
2270
+ }
2271
+ return r
2272
+ }
2273
+ function encryptSpan(n, e) {
2274
+ return encryptSegments(n, SPAN_ENCRYPT_INIT_CTR, e)
2275
+ }
2276
+ function encryptData(n, e) {
2277
+ return encryptSegments(n, 0, e)
2278
+ }
2279
+ function decryptChunk(n, e) {
2280
+ return { span: uint64ToNumber(encryptSpan(e, n.subarray(0, 8)), 'LE'), data: encryptData(e, n.subarray(8, 4104)) }
2281
+ }
2239
2282
  function sha3_256(n) {
2240
2283
  return squeeze(absorb(new Array(50).fill(0), divideToBlocks(n, 6)))
2241
2284
  }
@@ -2319,8 +2362,8 @@ function modInverse(n, e) {
2319
2362
  let [t, r] = [0n, 1n],
2320
2363
  [i, o] = [e, n]
2321
2364
  for (; o !== 0n; ) {
2322
- const u = i / o
2323
- ;([t, r] = [r, t - u * r]), ([i, o] = [o, i - u * o])
2365
+ const c = i / o
2366
+ ;([t, r] = [r, t - c * r]), ([i, o] = [o, i - c * o])
2324
2367
  }
2325
2368
  if (i > 1n) throw new Error('a is not invertible')
2326
2369
  return t < 0n && (t += e), t
@@ -2350,9 +2393,9 @@ function ellipticAdd(n, e, t, r, i) {
2350
2393
  if (n === t && e === mod(-r, i)) return [0n, 0n]
2351
2394
  if (n === t && e === r) return ellipticDouble(n, e, i)
2352
2395
  const o = mod((r - e) * modInverse(t - n, i), i),
2353
- u = mod(o * o - n - t, i),
2354
- s = mod(o * (n - u) - e, i)
2355
- return [u, s]
2396
+ c = mod(o * o - n - t, i),
2397
+ u = mod(o * (n - c) - e, i)
2398
+ return [c, u]
2356
2399
  }
2357
2400
  function privateKeyToPublicKey(n) {
2358
2401
  if (n <= 0n || n >= SECP256K1_N) throw new Error('Invalid private key')
@@ -2386,8 +2429,8 @@ function checksumEncode(n) {
2386
2429
  function doubleAndAdd(n, e, t, r) {
2387
2430
  let i = [0n, 0n],
2388
2431
  o = [n, e]
2389
- const u = t.toString(2)
2390
- for (const s of u) s === '0' ? ((o = ellipticAdd(i[0], i[1], o[0], o[1], r)), (i = ellipticDouble(i[0], i[1], r))) : ((i = ellipticAdd(i[0], i[1], o[0], o[1], r)), (o = ellipticDouble(o[0], o[1], r)))
2432
+ const c = t.toString(2)
2433
+ for (const u of c) u === '0' ? ((o = ellipticAdd(i[0], i[1], o[0], o[1], r)), (i = ellipticDouble(i[0], i[1], r))) : ((i = ellipticAdd(i[0], i[1], o[0], o[1], r)), (o = ellipticDouble(o[0], o[1], r)))
2391
2434
  return i
2392
2435
  }
2393
2436
  function signMessage(n, e, t) {
@@ -2399,30 +2442,30 @@ function signHash(n, e, t) {
2399
2442
  const r = mod(n, SECP256K1_N),
2400
2443
  i = doubleAndAdd(SECP256K1_X, SECP256K1_Y, t, SECP256K1_P),
2401
2444
  o = mod(i[0], SECP256K1_N)
2402
- let u = mod((r + mod(o, SECP256K1_N) * e) * modInverse(t, SECP256K1_N), SECP256K1_N)
2403
- if (o === 0n || u === 0n) throw new Error('Invalid r or s value')
2404
- let s = i[1] % 2n === 0n ? 27n : 28n
2405
- return u > SECP256K1_N / 2n && ((u = SECP256K1_N - u), (s = s === 27n ? 28n : 27n)), [o, u, s]
2445
+ let c = mod((r + mod(o, SECP256K1_N) * e) * modInverse(t, SECP256K1_N), SECP256K1_N)
2446
+ if (o === 0n || c === 0n) throw new Error('Invalid r or s value')
2447
+ let u = i[1] % 2n === 0n ? 27n : 28n
2448
+ return c > SECP256K1_N / 2n && ((c = SECP256K1_N - c), (u = u === 27n ? 28n : 27n)), [o, c, u]
2406
2449
  }
2407
2450
  function recoverPublicKey(n, e, t, r) {
2408
2451
  const i = modSqrt(mod(e ** 3n + 7n, SECP256K1_P), SECP256K1_P)
2409
2452
  if (!i) throw new Error('Invalid r: does not correspond to a valid curve point')
2410
2453
  const o = r === 27n ? 0n : 1n,
2411
- u = i % 2n === o ? i : SECP256K1_P - i,
2412
- s = mod(uint256ToNumber(keccak256(n), 'BE'), SECP256K1_N),
2413
- c = doubleAndAdd(e, u, t, SECP256K1_P),
2414
- f = doubleAndAdd(SECP256K1_X, SECP256K1_Y, s, SECP256K1_P),
2415
- l = ellipticAdd(c[0], c[1], f[0], mod(-f[1], SECP256K1_P), SECP256K1_P)
2454
+ c = i % 2n === o ? i : SECP256K1_P - i,
2455
+ u = mod(uint256ToNumber(keccak256(n), 'BE'), SECP256K1_N),
2456
+ s = doubleAndAdd(e, c, t, SECP256K1_P),
2457
+ f = doubleAndAdd(SECP256K1_X, SECP256K1_Y, u, SECP256K1_P),
2458
+ l = ellipticAdd(s[0], s[1], f[0], mod(-f[1], SECP256K1_P), SECP256K1_P)
2416
2459
  return doubleAndAdd(l[0], l[1], modInverse(e, SECP256K1_N), SECP256K1_P)
2417
2460
  }
2418
2461
  function verifySignature(n, e, t, r) {
2419
2462
  const i = mod(uint256ToNumber(keccak256(n), 'BE'), SECP256K1_N),
2420
2463
  o = modInverse(r, SECP256K1_N),
2421
- u = mod(i * o, SECP256K1_N),
2422
- s = mod(t * o, SECP256K1_N),
2423
- c = doubleAndAdd(SECP256K1_X, SECP256K1_Y, u, SECP256K1_P),
2424
- f = doubleAndAdd(e[0], e[1], s, SECP256K1_P),
2425
- l = ellipticAdd(c[0], c[1], f[0], f[1], SECP256K1_P)
2464
+ c = mod(i * o, SECP256K1_N),
2465
+ u = mod(t * o, SECP256K1_N),
2466
+ s = doubleAndAdd(SECP256K1_X, SECP256K1_Y, c, SECP256K1_P),
2467
+ f = doubleAndAdd(e[0], e[1], u, SECP256K1_P),
2468
+ l = ellipticAdd(s[0], s[1], f[0], f[1], SECP256K1_P)
2426
2469
  return t === mod(l[0], SECP256K1_N)
2427
2470
  }
2428
2471
  class Uint8ArrayReader {
@@ -2452,25 +2495,44 @@ class Uint8ArrayWriter {
2452
2495
  }
2453
2496
  exports.Uint8ArrayWriter = Uint8ArrayWriter
2454
2497
  class Chunk {
2455
- constructor(e, t = 0n) {
2456
- ;(this.span = t), (this.writer = new Uint8ArrayWriter(new Uint8Array(e)))
2498
+ constructor(e = 0n) {
2499
+ ;(this.span = e), (this.writer = new Uint8ArrayWriter(new Uint8Array(4096)))
2457
2500
  }
2458
2501
  build() {
2459
2502
  return concatBytes(numberToUint64(this.span, 'LE'), this.writer.buffer)
2460
2503
  }
2461
2504
  hash() {
2462
- const e = log2Reduce(partition(this.writer.buffer, 32), (t, r) => Chunk.hashFunction(concatBytes(t, r)))
2463
- return Chunk.hashFunction(concatBytes(numberToUint64(this.span, 'LE'), e))
2505
+ const e = new Uint8Array(40)
2506
+ return e.set(numberToUint64(this.span, 'LE')), e.set(bmtRoot(this.writer.buffer), 8), Chunk.hashFunction(e)
2507
+ }
2508
+ encryptedHash(e) {
2509
+ e || ((e = new Uint8Array(32)), crypto.getRandomValues(e))
2510
+ const t = encryptSpan(e, numberToUint64(this.span, 'LE')),
2511
+ r = new Uint8Array(40)
2512
+ return r.set(t), r.set(bmtRoot(encryptData(e, this.writer.buffer)), 8), { address: Chunk.hashFunction(r), key: e }
2513
+ }
2514
+ static encryptSpan(e, t) {
2515
+ return encryptSpan(e, t)
2516
+ }
2517
+ static encryptData(e, t) {
2518
+ return encryptData(e, t)
2519
+ }
2520
+ static decrypt(e, t) {
2521
+ return decryptChunk(e, t)
2464
2522
  }
2465
2523
  }
2466
2524
  ;(exports.Chunk = Chunk), (Chunk.hashFunction = keccak256)
2467
- class MerkleTree {
2468
- constructor(e, t = 4096) {
2469
- ;(this.counters = [1]), (this.capacity = t), (this.chunks = [new Chunk(t)]), (this.onChunk = e)
2525
+ class ChunkSplitter {
2526
+ constructor(e, t = !1) {
2527
+ ;(this.counters = [1]), (this.encrypted = t), (this.refSize = t ? 64 : 32), (this.chunks = [new Chunk()]), (this.onChunk = e)
2528
+ }
2529
+ static async root(e) {
2530
+ const t = new _a(_a.NOOP)
2531
+ return await t.append(e), t.finalize()
2470
2532
  }
2471
- static async root(e, t = 4096) {
2472
- const r = new _a(_a.NOOP, t)
2473
- return await r.append(e), r.finalize()
2533
+ static async encryptedRoot(e) {
2534
+ const t = new _a(_a.NOOP, !0)
2535
+ return await t.append(e), (await t.finalize()).encryptedHash()
2474
2536
  }
2475
2537
  async append(e, t = 0, r = 0n) {
2476
2538
  const i = new Uint8ArrayReader(e)
@@ -2481,13 +2543,62 @@ class MerkleTree {
2481
2543
  }
2482
2544
  }
2483
2545
  async elevate(e) {
2484
- ;(this.counters[e] = ++this.counters[e] % (this.capacity / 32)), this.chunks[e + 1] || (this.chunks.push(new Chunk(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 Chunk(this.capacity))
2546
+ if (((this.counters[e] = ++this.counters[e] % (4096 / this.refSize)), this.chunks[e + 1] || (this.chunks.push(new Chunk()), this.counters.push(1)), this.encrypted)) {
2547
+ const { address: t, key: r } = this.chunks[e].encryptedHash(),
2548
+ i = new Uint8Array(64)
2549
+ i.set(t), i.set(r, 32), await this.append(i, e + 1, this.chunks[e].span), await this.onChunk(this.chunks[e], r)
2550
+ } else await this.append(this.chunks[e].hash(), e + 1, this.chunks[e].span), await this.onChunk(this.chunks[e])
2551
+ this.chunks[e] = new Chunk()
2485
2552
  }
2486
2553
  async finalize(e = 0) {
2487
2554
  return this.chunks[e + 1] ? (this.counters[e] === 1 ? (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])
2488
2555
  }
2489
2556
  }
2490
- ;(exports.MerkleTree = MerkleTree), (_a = MerkleTree), (MerkleTree.NOOP = async n => {})
2557
+ ;(exports.ChunkSplitter = ChunkSplitter), (_a = ChunkSplitter), (ChunkSplitter.NOOP = async (n, e) => {})
2558
+ function isAllZero(n) {
2559
+ for (let e = 0; e < n.length; e++) if (n[e] !== 0) return !1
2560
+ return !0
2561
+ }
2562
+ class ChunkJoiner {
2563
+ constructor(e, t, r = !1) {
2564
+ ;(this.fetch = e), (this.onData = t), (this.encrypted = r), (this.refSize = r ? 64 : 32)
2565
+ }
2566
+ static async collect(e, t) {
2567
+ const r = []
2568
+ return (
2569
+ await new ChunkJoiner(t, async i => {
2570
+ r.push(i)
2571
+ }).join(e),
2572
+ concatBytes(...r)
2573
+ )
2574
+ }
2575
+ static async collectEncrypted(e, t, r) {
2576
+ const i = []
2577
+ return (
2578
+ await new ChunkJoiner(
2579
+ r,
2580
+ async o => {
2581
+ i.push(o)
2582
+ },
2583
+ !0
2584
+ ).join(e, t),
2585
+ concatBytes(...i)
2586
+ )
2587
+ }
2588
+ async join(e, t) {
2589
+ const r = await this.fetch(e)
2590
+ let i, o
2591
+ if ((this.encrypted && t ? ({ span: i, data: o } = decryptChunk(r, t)) : ((i = uint64ToNumber(r.subarray(0, 8), 'LE')), (o = r.subarray(8, 4104))), i <= 4096n)) await this.onData(o.subarray(0, Number(i)))
2592
+ else
2593
+ for (let c = 0; c < 4096 / this.refSize; c++) {
2594
+ const u = o.subarray(c * this.refSize, (c + 1) * this.refSize),
2595
+ s = u.subarray(0, 32)
2596
+ if (isAllZero(s)) break
2597
+ await this.join(s, this.encrypted ? u.subarray(32, 64) : void 0)
2598
+ }
2599
+ }
2600
+ }
2601
+ exports.ChunkJoiner = ChunkJoiner
2491
2602
  class FixedPointNumber {
2492
2603
  constructor(e, t) {
2493
2604
  if (t < 0) throw Error('Scale must be non-negative')
@@ -2562,12 +2673,12 @@ function tickPlaybook(n) {
2562
2673
  return e.ttlMax ? --e.ttl <= 0 && n.shift() : (e.ttlMax = e.ttl), { progress: (e.ttlMax - e.ttl) / e.ttlMax, data: e.data }
2563
2674
  }
2564
2675
  function getArgument(n, e, t, r) {
2565
- const i = n.findIndex(s => s === `--${e}` || s.startsWith(`--${e}=`)),
2676
+ const i = n.findIndex(u => u === `--${e}` || u.startsWith(`--${e}=`)),
2566
2677
  o = n[i]
2567
2678
  if (!o) return (t || {})[r || e || ''] || null
2568
2679
  if (o.includes('=')) return o.split('=')[1]
2569
- const u = n[i + 1]
2570
- return u && !u.startsWith('-') ? u : (t || {})[r || e || ''] || null
2680
+ const c = n[i + 1]
2681
+ return c && !c.startsWith('-') ? c : (t || {})[r || e || ''] || null
2571
2682
  }
2572
2683
  function getNumberArgument(n, e, t, r) {
2573
2684
  const i = getArgument(n, e, t, r)
@@ -2579,14 +2690,14 @@ function getNumberArgument(n, e, t, r) {
2579
2690
  }
2580
2691
  }
2581
2692
  function getBooleanArgument(n, e, t, r) {
2582
- const i = n.some(c => c.endsWith('-' + e)),
2693
+ const i = n.some(s => s.endsWith('-' + e)),
2583
2694
  o = getArgument(n, e, t, r)
2584
2695
  if (!o && i) return !0
2585
2696
  if (!o && !i) return null
2586
- const u = ['true', '1', 'yes', 'y', 'on'],
2587
- s = ['false', '0', 'no', 'n', 'off']
2588
- if (u.includes(o.toLowerCase())) return !0
2589
- if (s.includes(o.toLowerCase())) return !1
2697
+ const c = ['true', '1', 'yes', 'y', 'on'],
2698
+ u = ['false', '0', 'no', 'n', 'off']
2699
+ if (c.includes(o.toLowerCase())) return !0
2700
+ if (u.includes(o.toLowerCase())) return !1
2590
2701
  throw Error(`Invalid boolean argument ${e}: ${o}`)
2591
2702
  }
2592
2703
  function requireStringArgument(n, e, t, r) {
@@ -2665,21 +2776,21 @@ function findCorners(n, e, t, r) {
2665
2776
  { x: t, y: r }
2666
2777
  ]
2667
2778
  for (let o = 0; o < n.length; o++)
2668
- for (let u = 0; u < n[0].length; u++) {
2669
- const s = getCorners(n, o, u)
2670
- for (const c of s) i.some(f => f.x === c.x && f.y === c.y) || i.push(c)
2779
+ for (let c = 0; c < n[0].length; c++) {
2780
+ const u = getCorners(n, o, c)
2781
+ for (const s of u) i.some(f => f.x === s.x && f.y === s.y) || i.push(s)
2671
2782
  }
2672
2783
  return i.map(o => ({ x: o.x * e, y: o.y * e }))
2673
2784
  }
2674
2785
  function findLines(n, e) {
2675
- const t = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c][f + 1] !== 0, 'row-first').map(c => ({ ...c, dx: 1, dy: 0 })),
2676
- r = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c][f - 1] !== 0, 'row-first').map(c => ({ ...c, dx: 1, dy: 0 })),
2677
- i = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c - 1]?.[f] !== 0, 'column-first').map(c => ({ ...c, dx: 0, dy: 1 })),
2678
- o = filterCoordinates(n, (c, f) => n[c][f] === 0 && n[c + 1]?.[f] !== 0, 'column-first').map(c => ({ ...c, dx: 0, dy: 1 }))
2679
- t.forEach(c => c.y++), o.forEach(c => c.x++)
2680
- const u = group([...i, ...o], (c, f) => c.x === f.x && c.y - 1 === f.y),
2681
- s = group([...r, ...t], (c, f) => c.y === f.y && c.x - 1 === f.x)
2682
- return [...u, ...s].map(c => ({ start: c[0], end: last(c) })).map(c => ({ start: multiplyPoint(c.start, e), end: multiplyPoint(addPoint(c.end, { x: c.start.dx, y: c.start.dy }), e) }))
2786
+ const t = filterCoordinates(n, (s, f) => n[s][f] === 0 && n[s][f + 1] !== 0, 'row-first').map(s => ({ ...s, dx: 1, dy: 0 })),
2787
+ r = filterCoordinates(n, (s, f) => n[s][f] === 0 && n[s][f - 1] !== 0, 'row-first').map(s => ({ ...s, dx: 1, dy: 0 })),
2788
+ i = filterCoordinates(n, (s, f) => n[s][f] === 0 && n[s - 1]?.[f] !== 0, 'column-first').map(s => ({ ...s, dx: 0, dy: 1 })),
2789
+ o = filterCoordinates(n, (s, f) => n[s][f] === 0 && n[s + 1]?.[f] !== 0, 'column-first').map(s => ({ ...s, dx: 0, dy: 1 }))
2790
+ t.forEach(s => s.y++), o.forEach(s => s.x++)
2791
+ const c = group([...i, ...o], (s, f) => s.x === f.x && s.y - 1 === f.y),
2792
+ u = group([...r, ...t], (s, f) => s.y === f.y && s.x - 1 === f.x)
2793
+ return [...c, ...u].map(s => ({ start: s[0], end: last(s) })).map(s => ({ start: multiplyPoint(s.start, e), end: multiplyPoint(addPoint(s.end, { x: s.start.dx, y: s.start.dy }), e) }))
2683
2794
  }
2684
2795
  function getAngleInRadians(n, e) {
2685
2796
  return Math.atan2(e.y - n.y, e.x - n.x)
@@ -2691,33 +2802,33 @@ function getLineIntersectionPoint(n, e, t, r) {
2691
2802
  const i = (r.y - t.y) * (e.x - n.x) - (r.x - t.x) * (e.y - n.y)
2692
2803
  if (i === 0) return null
2693
2804
  let o = n.y - t.y,
2694
- u = n.x - t.x
2695
- const s = (r.x - t.x) * o - (r.y - t.y) * u,
2696
- c = (e.x - n.x) * o - (e.y - n.y) * u
2697
- return (o = s / i), (u = c / i), o > 0 && o < 1 && u > 0 && u < 1 ? { x: n.x + o * (e.x - n.x), y: n.y + o * (e.y - n.y) } : null
2805
+ c = n.x - t.x
2806
+ const u = (r.x - t.x) * o - (r.y - t.y) * c,
2807
+ s = (e.x - n.x) * o - (e.y - n.y) * c
2808
+ return (o = u / i), (c = s / i), o > 0 && o < 1 && c > 0 && c < 1 ? { x: n.x + o * (e.x - n.x), y: n.y + o * (e.y - n.y) } : null
2698
2809
  }
2699
2810
  function raycast(n, e, t) {
2700
2811
  const r = [],
2701
2812
  i = pushPoint(n, t, 1e4)
2702
2813
  for (const o of e) {
2703
- const u = getLineIntersectionPoint(n, i, o.start, o.end)
2704
- u && r.push(u)
2814
+ const c = getLineIntersectionPoint(n, i, o.start, o.end)
2815
+ c && r.push(c)
2705
2816
  }
2706
2817
  return r.length
2707
- ? r.reduce((o, u) => {
2708
- const s = getDistanceBetweenPoints(n, u),
2709
- c = getDistanceBetweenPoints(n, o)
2710
- return s < c ? u : o
2818
+ ? r.reduce((o, c) => {
2819
+ const u = getDistanceBetweenPoints(n, c),
2820
+ s = getDistanceBetweenPoints(n, o)
2821
+ return u < s ? c : o
2711
2822
  })
2712
2823
  : null
2713
2824
  }
2714
2825
  function raycastCircle(n, e, t) {
2715
2826
  const i = getSortedRayAngles(n, t),
2716
2827
  o = []
2717
- for (const u of i) {
2718
- const s = raycast(n, e, u - 0.001),
2719
- c = raycast(n, e, u + 0.001)
2720
- s && o.push(s), c && o.push(c)
2828
+ for (const c of i) {
2829
+ const u = raycast(n, e, c - 0.001),
2830
+ s = raycast(n, e, c + 0.001)
2831
+ u && o.push(u), s && o.push(s)
2721
2832
  }
2722
2833
  return o
2723
2834
  }
@@ -2790,20 +2901,20 @@ class TrieRouter {
2790
2901
  let i = r,
2791
2902
  o
2792
2903
  if ((r.startsWith(':') && ((i = ':'), (o = r.slice(1))), !this.forks.has(i))) {
2793
- const u = new TrieRouter()
2794
- o && (u.variableName = o), this.forks.set(i, u)
2904
+ const c = new TrieRouter()
2905
+ o && (c.variableName = o), this.forks.set(i, c)
2795
2906
  }
2796
2907
  this.forks.get(i).insert(e.slice(1), t)
2797
2908
  }
2798
2909
  async handle(e, t, r, i) {
2799
2910
  if (e.length === 0) return this.handler ? (await this.handler(t, r, i), !0) : !1
2800
2911
  const o = e[0],
2801
- u = this.forks.get(o)
2802
- if (u) return u.handle(e.slice(1), t, r, i)
2803
- const s = this.forks.get(':')
2804
- if (s) return s.variableName && i.set(s.variableName, decodeURIComponent(o)), s.handle(e.slice(1), t, r, i)
2805
- const c = this.forks.get('*')
2806
- return c ? (i.set('wildcard', e.join('/')), c.handler ? (await c.handler(t, r, i), !0) : !1) : !1
2912
+ c = this.forks.get(o)
2913
+ if (c) return c.handle(e.slice(1), t, r, i)
2914
+ const u = this.forks.get(':')
2915
+ if (u) return u.variableName && i.set(u.variableName, decodeURIComponent(o)), u.handle(e.slice(1), t, r, i)
2916
+ const s = this.forks.get('*')
2917
+ return s ? (i.set('wildcard', e.join('/')), s.handler ? (await s.handler(t, r, i), !0) : !1) : !1
2807
2918
  }
2808
2919
  }
2809
2920
  exports.TrieRouter = TrieRouter
package/module.mjs CHANGED
@@ -1,31 +1 @@
1
- import utility from './index.js'
2
-
3
- export const Arrays = utility.Arrays
4
- export const Assertions = utility.Assertions
5
- export const Binary = utility.Binary
6
- export const Cache = utility.Cache
7
- export const Dates = utility.Dates
8
- export const Elliptic = utility.Elliptic
9
- export const Numbers = utility.Numbers
10
- export const Objects = utility.Objects
11
- export const Pagination = utility.Pagination
12
- export const Promises = utility.Promises
13
- export const Random = utility.Random
14
- export const Strings = utility.Strings
15
- export const System = utility.System
16
- export const Types = utility.Types
17
- export const Optional = utility.Optional
18
- export const Vector = utility.Vector
19
- export const PubSubChannel = utility.PubSubChannel
20
- export const Chunk = utility.Chunk
21
- export const MerkleTree = utility.MerkleTree
22
- export const FixedPointNumber = utility.FixedPointNumber
23
- export const Lazy = utility.Lazy
24
- export const AsyncLazy = utility.AsyncLazy
25
- export const AsyncQueue = utility.AsyncQueue
26
- export const Uint8ArrayReader = utility.Uint8ArrayReader
27
- export const Uint8ArrayWriter = utility.Uint8ArrayWriter
28
- export const TrieRouter = utility.TrieRouter
29
- export const RollingValueProvider = utility.RollingValueProvider
30
- export const Solver = utility.Solver
31
- export const Lock = utility.Lock
1
+ export { Arrays, Assertions, AsyncLazy, AsyncQueue, Binary, Cache, Chunk, ChunkJoiner, ChunkSplitter, Dates, Elliptic, FixedPointNumber, Lazy, Lock, Numbers, Objects, Optional, Promises, PubSubChannel, Random, RollingValueProvider, Solver, Strings, System, TrieRouter, Types, Uint8ArrayReader, Uint8ArrayWriter, Vector } from './index.js'
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "33.11.0",
3
+ "version": "35.0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": {
8
8
  "require": "./index.js",
9
+ "react-native": "./index.js",
9
10
  "types": "./index.d.ts",
10
11
  "default": "./module.mjs"
11
12
  },