zeed 0.7.113 → 0.7.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- export { bZ as ArgumentsType, c4 as AsyncMutex, M as BinInput, by as Channel, bx as ChannelMessageEvent, bM as CryptoEncoder, ai as Currency, ag as CurrencyInput, au as DAY_MS, aw as Day, av as DayInput, bE as DefaultListener, bi as Disposable, bh as Disposer, bg as DisposerFunction, bF as Emitter, bC as EmitterAllHandler, bB as EmitterHandler, bJ as Encoder, cF as Json, bL as JsonEncoder, bD as ListenerSignature, bz as LocalChannel, bt as LoggerConsoleHandler, cz as MemStorage, cy as MemStorageOptions, bP as Message, bN as MessageAction, bT as MessageDefinitions, bU as MessageHub, bO as MessageResult, bR as MessagesDefaultMethods, bS as MessagesMethods, bQ as MessagesOptions, c3 as Mutex, cH as NestedArray, bK as NoopEncoder, cG as ObjectStorage, cl as Pool, aE as Primitive, bX as PubSub, cw as QueueTask, c0 as RPCFn, b$ as RPCOptions, c1 as RPCReturn, ac as RenderMessagesOptions, b_ as ReturnType, aj as RoundingMode, cx as SerialQueue, b0 as SortableItem, X as Uint8ArrayToJson, U as Uint8ArrayToString, bn as UseDefer, bk as UseDispose, N as _decodeUtf8Polyfill, _ as _encodeUtf8Polyfill, p as arrayEmptyInPlace, n as arrayFilterInPlace, i as arrayFlatten, j as arrayIntersection, t as arrayIsEqual, y as arrayMax, z as arrayMin, g as arrayMinus, x as arrayRandomElement, l as arrayRemoveElement, m as arraySetElement, v as arrayShuffle, w as arrayShuffleForce, u as arrayShuffleInPlace, q as arraySorted, s as arraySortedNumbers, k as arraySymmetricDifference, o as arrayToggleInPlace, h as arrayUnion, f as arrayUnique, aV as between, bf as cloneJsonObject, be as cloneObject, aY as cmp, aX as composeOrderby, A as createArray, bV as createPromiseProxy, c as csv, ah as currency, az as day, cB as debounce, D as decodeBase16, F as decodeBase32, H as decodeBase58, J as decodeBase62, L as decodeBase64, b as decrypt, aA as deepEqual, aB as deepMerge, a as deriveKeyPbkdf2, cg as detect, d as digest, bd as empty, C as encodeBase16, E as encodeBase32, G as encodeBase58, I as encodeBase62, K as encodeBase64, b7 as encodeQuery, e as encrypt, b2 as endSortWeight, b9 as ensureKey, ba as ensureKeyAsync, V as equalBinary, aC as escapeHTML, a$ as escapeRegExp, bA as fakeWorkerPair, c8 as fetchBasic, c9 as fetchJson, ca as fetchOptionsFormURLEncoded, cb as fetchOptionsJson, cc as fetchText, af as fixBrokenUth8String, ax as forEachDay, ad as formatMessages, cD as formatMilliseconds, T as fromBase64, a0 as fromCamelCase, cf as getGlobal, br as getGlobalContext, bG as getGlobalEmitter, bu as getNamespaceFilterString, ce as getNavigator, aQ as getSecureRandom, aR as getSecureRandomIfPossible, cC as getTimestamp, cd as getWindow, c7 as httpMethod, cn as immediate, aH as isArray, aN as isBoolean, ch as isBrowser, al as isEven, ak as isHalf, aL as isInteger, bs as isLocalHost, aO as isNullOrUndefined, aK as isNumber, aF as isObject, aG as isPrimitive, cu as isPromise, aI as isRecord, aM as isSafeInteger, aJ as isString, cr as isTimeout, aP as jsonStringify, W as jsonToUint8Array, bc as last, bI as lazyListener, b5 as linkifyPlainText, bH as messages, b3 as moveSortWeight, cE as parseDate, aW as parseOrderby, b8 as parseQuery, ci as platform, cv as promisify, cP as qid, aS as randomBoolean, aU as randomFloat, aT as randomInt, r as randomUint8Array, ae as renderMessages, an as roundDown, aq as roundHalfAwayFromZero, ar as roundHalfDown, as as roundHalfEven, ap as roundHalfOdd, at as roundHalfTowardsZero, ao as roundHalfUp, am as roundUp, bb as size, cm as sleep, b4 as sortedItems, aZ as sortedOrderby, b1 as startSortWeight, a1 as stringToBoolean, a3 as stringToFloat, a2 as stringToInteger, O as stringToUInt8Array, cS as suid, cR as suidBytes, cU as suidBytesDate, cT as suidDate, cA as throttle, cp as timeout, co as timeoutReached, cq as timoutError, R as toBase64, S as toBase64Url, ab as toBool, Y as toCamelCase, Z as toCapitalize, $ as toCapitalizeWords, a8 as toFloat, Q as toHex, b6 as toHumanReadableUrl, a9 as toInt, aa as toString, P as toUint8Array, a_ as toValidFilename, ay as today, cs as tryTimeout, cO as uname, aD as unescapeHTML, c6 as useAsyncMutex, B as useBase, bm as useDefer, bj as useDispose, bl as useDisposer, bq as useEventListener, cj as useExitHandler, bp as useInterval, bw as useLevelFilter, bW as useMessageHub, c5 as useMutex, bv as useNamespaceFilter, ck as usePool, bY as usePubSub, c2 as useRPC, bo as useTimeout, cK as uuid, cJ as uuid32bit, cN as uuidB32, cI as uuidBytes, cM as uuidDecode, cL as uuidEncode, cQ as uuidv4, a4 as valueToBoolean, a6 as valueToFloat, a5 as valueToInteger, a7 as valueToString, ct as waitOn } from './uuid-7c205442';
1
+ export { c6 as ArgumentsType, cd as AsyncMutex, P as BinInput, bH as Channel, bG as ChannelMessageEvent, bV as CryptoEncoder, al as Currency, aj as CurrencyInput, ax as DAY_MS, az as Day, ay as DayInput, bN as DefaultListener, br as Disposable, bq as Disposer, bp as DisposerFunction, bO as Emitter, bL as EmitterAllHandler, bK as EmitterHandler, bS as Encoder, cO as Json, bU as JsonEncoder, bM as ListenerSignature, bI as LocalChannel, bC as LoggerConsoleHandler, cI as MemStorage, cH as MemStorageOptions, bY as Message, bW as MessageAction, c0 as MessageDefinitions, c1 as MessageHub, bX as MessageResult, b_ as MessagesDefaultMethods, b$ as MessagesMethods, bZ as MessagesOptions, cc as Mutex, cQ as NestedArray, bT as NoopEncoder, cP as ObjectStorage, cu as Pool, aH as Primitive, c4 as PubSub, cF as QueueTask, c9 as RPCFn, c8 as RPCOptions, ca as RPCReturn, af as RenderMessagesOptions, c7 as ReturnType, am as RoundingMode, cG as SerialQueue, b5 as SortableItem, $ as Uint8ArrayToJson, U as Uint8ArrayToString, bw as UseDefer, bt as UseDispose, bo as XRX, Q as _decodeUtf8Polyfill, _ as _encodeUtf8Polyfill, B as arrayAvg, C as arrayBatches, p as arrayEmptyInPlace, n as arrayFilterInPlace, i as arrayFlatten, j as arrayIntersection, t as arrayIsEqual, y as arrayMax, z as arrayMin, g as arrayMinus, x as arrayRandomElement, l as arrayRemoveElement, m as arraySetElement, v as arrayShuffle, w as arrayShuffleForce, u as arrayShuffleInPlace, q as arraySorted, s as arraySortedNumbers, A as arraySum, k as arraySymmetricDifference, o as arrayToggleInPlace, h as arrayUnion, f as arrayUnique, a_ as avg, aY as between, bk as cloneJsonObject, bj as cloneObject, b1 as cmp, b0 as composeOrderby, D as createArray, c2 as createPromiseProxy, c as csv, ak as currency, aC as day, cK as debounce, G as decodeBase16, I as decodeBase32, K as decodeBase58, M as decodeBase62, O as decodeBase64, b as decrypt, aD as deepEqual, aE as deepMerge, a as deriveKeyPbkdf2, cp as detect, d as digest, bi as empty, F as encodeBase16, H as encodeBase32, J as encodeBase58, L as encodeBase62, N as encodeBase64, bc as encodeQuery, e as encrypt, b7 as endSortWeight, be as ensureKey, bf as ensureKeyAsync, Y as equalBinary, aF as escapeHTML, b4 as escapeRegExp, bJ as fakeWorkerPair, ch as fetchBasic, ci as fetchJson, cj as fetchOptionsFormURLEncoded, ck as fetchOptionsJson, cl as fetchText, ai as fixBrokenUth8String, aA as forEachDay, ag as formatMessages, cM as formatMilliseconds, X as fromBase64, a3 as fromCamelCase, co as getGlobal, bA as getGlobalContext, bP as getGlobalEmitter, bD as getNamespaceFilterString, cn as getNavigator, aT as getSecureRandom, aU as getSecureRandomIfPossible, cL as getTimestamp, cm as getWindow, cg as httpMethod, cw as immediate, aK as isArray, aQ as isBoolean, cq as isBrowser, ao as isEven, an as isHalf, aO as isInteger, bB as isLocalHost, aR as isNullOrUndefined, aN as isNumber, aI as isObject, aJ as isPrimitive, cD as isPromise, aL as isRecord, aP as isSafeInteger, aM as isString, cA as isTimeout, aS as jsonStringify, Z as jsonToUint8Array, bh as last, bR as lazyListener, ba as linkifyPlainText, bl as memoize, bQ as messages, b8 as moveSortWeight, cN as parseDate, a$ as parseOrderby, bd as parseQuery, cr as platform, cE as promisify, cY as qid, aV as randomBoolean, aX as randomFloat, aW as randomInt, r as randomUint8Array, bn as regExpEscape, bm as regExpString, ah as renderMessages, aq as roundDown, at as roundHalfAwayFromZero, au as roundHalfDown, av as roundHalfEven, as as roundHalfOdd, aw as roundHalfTowardsZero, ar as roundHalfUp, ap as roundUp, bg as size, cv as sleep, b9 as sortedItems, b2 as sortedOrderby, b6 as startSortWeight, a4 as stringToBoolean, a6 as stringToFloat, a5 as stringToInteger, R as stringToUInt8Array, c$ as suid, c_ as suidBytes, d1 as suidBytesDate, d0 as suidDate, aZ as sum, cJ as throttle, cy as timeout, cx as timeoutReached, cz as timoutError, V as toBase64, W as toBase64Url, ae as toBool, a0 as toCamelCase, a1 as toCapitalize, a2 as toCapitalizeWords, ab as toFloat, T as toHex, bb as toHumanReadableUrl, ac as toInt, ad as toString, S as toUint8Array, b3 as toValidFilename, aB as today, cB as tryTimeout, cX as uname, aG as unescapeHTML, cf as useAsyncMutex, E as useBase, bv as useDefer, bs as useDispose, bu as useDisposer, bz as useEventListener, cs as useExitHandler, by as useInterval, bF as useLevelFilter, c3 as useMessageHub, ce as useMutex, bE as useNamespaceFilter, ct as usePool, c5 as usePubSub, cb as useRPC, bx as useTimeout, cT as uuid, cS as uuid32bit, cW as uuidB32, cR as uuidBytes, cV as uuidDecode, cU as uuidEncode, cZ as uuidv4, a7 as valueToBoolean, a9 as valueToFloat, a8 as valueToInteger, aa as valueToString, cC as waitOn } from './uuid-c834ecf8';
2
2
  export { d as LogHandler, g as LogHandlerOptions, a as LogLevel, b as LogLevelAlias, c as LogMessage, L as Logger, h as LoggerContext, f as LoggerContextInterface, e as LoggerInterface } from './log-b80164f3';
3
- export { b as FileStorage, F as FileStorageOptions, L as LoggerFileHandler, e as LoggerNodeHandler, c as colorString, d as colorStringList, f as getSourceLocation, j as getSourceLocationByPrecedingPattern, h as getStack, g as getStackLlocationList, i as isTTY, l as loggerStackTraceDebug, a as setupEnv, s as stringToPath, t as toPath, v as valueToPath } from './log-util-baebadc8';
4
- export { a as LocalStorage, L as LocalStorageOptions, b as LoggerBrowserClassicHandler, g as gravatarURLByEmail, c as selectColor, s as supportsColors, u as urlBase64ToUint8Array } from './log-colors-8f1ba30e';
3
+ export { b as FileStorage, F as FileStorageOptions, L as LoggerFileHandler, e as LoggerNodeHandler, c as colorString, d as colorStringList, f as getSourceLocation, j as getSourceLocationByPrecedingPattern, h as getStack, g as getStackLlocationList, i as isTTY, l as loggerStackTraceDebug, p as pbcopy, a as setupEnv, s as stringToPath, t as toPath, v as valueToPath } from './log-util-42a95b2b';
4
+ export { a as LocalStorage, L as LocalStorageOptions, b as LoggerBrowserClassicHandler, g as gravatarURLByEmail, c as selectColor, s as supportsColors, u as urlBase64ToUint8Array } from './log-colors-7ad2cdf2';
5
5
  export { L as LoggerBrowserHandler, a as LoggerBrowserSetupDebugFactory, b as activateConsoleDebug } from './log-browser-d263ebe0';
package/dist/index.all.js CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  LoggerBrowserClassicHandler,
4
4
  gravatarURLByEmail,
5
5
  urlBase64ToUint8Array
6
- } from "./chunk-RR25VKTJ.js";
6
+ } from "./chunk-BGJHXJ4O.js";
7
7
  import {
8
8
  LoggerBrowserHandler,
9
9
  LoggerBrowserSetupDebugFactory,
10
10
  activateConsoleDebug,
11
11
  selectColor,
12
12
  supportsColors
13
- } from "./chunk-MYUIYPZU.js";
13
+ } from "./chunk-QCK7R55W.js";
14
14
  import {
15
15
  FileStorage,
16
16
  LoggerFileHandler,
@@ -23,11 +23,12 @@ import {
23
23
  getStackLlocationList,
24
24
  isTTY,
25
25
  loggerStackTraceDebug,
26
+ pbcopy,
26
27
  setupEnv,
27
28
  stringToPath,
28
29
  toPath,
29
30
  valueToPath
30
- } from "./chunk-HERPZYOG.js";
31
+ } from "./chunk-C3WHNRRT.js";
31
32
  import {
32
33
  Channel,
33
34
  CryptoEncoder,
@@ -43,8 +44,11 @@ import {
43
44
  SerialQueue,
44
45
  Uint8ArrayToJson,
45
46
  Uint8ArrayToString,
47
+ XRX,
46
48
  _decodeUtf8Polyfill,
47
49
  _encodeUtf8Polyfill,
50
+ arrayAvg,
51
+ arrayBatches,
48
52
  arrayEmptyInPlace,
49
53
  arrayFilterInPlace,
50
54
  arrayFlatten,
@@ -61,10 +65,12 @@ import {
61
65
  arrayShuffleInPlace,
62
66
  arraySorted,
63
67
  arraySortedNumbers,
68
+ arraySum,
64
69
  arraySymmetricDifference,
65
70
  arrayToggleInPlace,
66
71
  arrayUnion,
67
72
  arrayUnique,
73
+ avg,
68
74
  between,
69
75
  cloneJsonObject,
70
76
  cloneObject,
@@ -128,6 +134,7 @@ import {
128
134
  last,
129
135
  lazyListener,
130
136
  linkifyPlainText,
137
+ memoize,
131
138
  messages,
132
139
  moveSortWeight,
133
140
  parseOrderby,
@@ -139,6 +146,8 @@ import {
139
146
  randomFloat,
140
147
  randomInt,
141
148
  randomUint8Array,
149
+ regExpEscape,
150
+ regExpString,
142
151
  renderMessages,
143
152
  roundDown,
144
153
  roundHalfAwayFromZero,
@@ -161,6 +170,7 @@ import {
161
170
  suidBytes,
162
171
  suidBytesDate,
163
172
  suidDate,
173
+ sum,
164
174
  throttle,
165
175
  timeout,
166
176
  timeoutReached,
@@ -208,7 +218,7 @@ import {
208
218
  valueToInteger,
209
219
  valueToString,
210
220
  waitOn
211
- } from "./chunk-MN2DIK4K.js";
221
+ } from "./chunk-AYKBI7RN.js";
212
222
  import {
213
223
  LogLevel,
214
224
  LogLevelAlias,
@@ -234,7 +244,7 @@ import {
234
244
  parseDate,
235
245
  useLevelFilter,
236
246
  useNamespaceFilter
237
- } from "./chunk-DUGVRMRT.js";
247
+ } from "./chunk-G3LBBVZT.js";
238
248
  export {
239
249
  Channel,
240
250
  CryptoEncoder,
@@ -262,9 +272,12 @@ export {
262
272
  SerialQueue,
263
273
  Uint8ArrayToJson,
264
274
  Uint8ArrayToString,
275
+ XRX,
265
276
  _decodeUtf8Polyfill,
266
277
  _encodeUtf8Polyfill,
267
278
  activateConsoleDebug,
279
+ arrayAvg,
280
+ arrayBatches,
268
281
  arrayEmptyInPlace,
269
282
  arrayFilterInPlace,
270
283
  arrayFlatten,
@@ -281,10 +294,12 @@ export {
281
294
  arrayShuffleInPlace,
282
295
  arraySorted,
283
296
  arraySortedNumbers,
297
+ arraySum,
284
298
  arraySymmetricDifference,
285
299
  arrayToggleInPlace,
286
300
  arrayUnion,
287
301
  arrayUnique,
302
+ avg,
288
303
  between,
289
304
  cloneJsonObject,
290
305
  cloneObject,
@@ -373,11 +388,13 @@ export {
373
388
  lazyListener,
374
389
  linkifyPlainText,
375
390
  loggerStackTraceDebug,
391
+ memoize,
376
392
  messages,
377
393
  moveSortWeight,
378
394
  parseDate,
379
395
  parseOrderby,
380
396
  parseQuery,
397
+ pbcopy,
381
398
  platform,
382
399
  promisify,
383
400
  qid,
@@ -385,6 +402,8 @@ export {
385
402
  randomFloat,
386
403
  randomInt,
387
404
  randomUint8Array,
405
+ regExpEscape,
406
+ regExpString,
388
407
  renderMessages,
389
408
  roundDown,
390
409
  roundHalfAwayFromZero,
@@ -410,6 +429,7 @@ export {
410
429
  suidBytes,
411
430
  suidBytesDate,
412
431
  suidDate,
432
+ sum,
413
433
  supportsColors,
414
434
  throttle,
415
435
  timeout,
@@ -65,9 +65,12 @@ __export(index_browser_exports, {
65
65
  SerialQueue: () => SerialQueue,
66
66
  Uint8ArrayToJson: () => Uint8ArrayToJson,
67
67
  Uint8ArrayToString: () => Uint8ArrayToString,
68
+ XRX: () => XRX,
68
69
  _decodeUtf8Polyfill: () => _decodeUtf8Polyfill,
69
70
  _encodeUtf8Polyfill: () => _encodeUtf8Polyfill,
70
71
  activateConsoleDebug: () => activateConsoleDebug,
72
+ arrayAvg: () => arrayAvg,
73
+ arrayBatches: () => arrayBatches,
71
74
  arrayEmptyInPlace: () => arrayEmptyInPlace,
72
75
  arrayFilterInPlace: () => arrayFilterInPlace,
73
76
  arrayFlatten: () => arrayFlatten,
@@ -84,10 +87,12 @@ __export(index_browser_exports, {
84
87
  arrayShuffleInPlace: () => arrayShuffleInPlace,
85
88
  arraySorted: () => arraySorted,
86
89
  arraySortedNumbers: () => arraySortedNumbers,
90
+ arraySum: () => arraySum,
87
91
  arraySymmetricDifference: () => arraySymmetricDifference,
88
92
  arrayToggleInPlace: () => arrayToggleInPlace,
89
93
  arrayUnion: () => arrayUnion,
90
94
  arrayUnique: () => arrayUnique,
95
+ avg: () => avg,
91
96
  between: () => between,
92
97
  cloneJsonObject: () => cloneJsonObject,
93
98
  cloneObject: () => cloneObject,
@@ -168,6 +173,7 @@ __export(index_browser_exports, {
168
173
  last: () => last,
169
174
  lazyListener: () => lazyListener,
170
175
  linkifyPlainText: () => linkifyPlainText,
176
+ memoize: () => memoize,
171
177
  messages: () => messages,
172
178
  moveSortWeight: () => moveSortWeight,
173
179
  parseDate: () => parseDate,
@@ -180,6 +186,8 @@ __export(index_browser_exports, {
180
186
  randomFloat: () => randomFloat,
181
187
  randomInt: () => randomInt,
182
188
  randomUint8Array: () => randomUint8Array,
189
+ regExpEscape: () => regExpEscape,
190
+ regExpString: () => regExpString,
183
191
  renderMessages: () => renderMessages,
184
192
  roundDown: () => roundDown,
185
193
  roundHalfAwayFromZero: () => roundHalfAwayFromZero,
@@ -203,6 +211,7 @@ __export(index_browser_exports, {
203
211
  suidBytes: () => suidBytes,
204
212
  suidBytesDate: () => suidBytesDate,
205
213
  suidDate: () => suidDate,
214
+ sum: () => sum,
206
215
  supportsColors: () => supportsColors,
207
216
  throttle: () => throttle,
208
217
  timeout: () => timeout,
@@ -947,6 +956,14 @@ function between(min, value, max) {
947
956
  return Math.max(min, Math.min(max, value));
948
957
  }
949
958
  __name(between, "between");
959
+ function sum(array) {
960
+ return array.reduce((acc, value) => acc + value, 0);
961
+ }
962
+ __name(sum, "sum");
963
+ function avg(array) {
964
+ return sum(array) / array.length;
965
+ }
966
+ __name(avg, "avg");
950
967
 
951
968
  // src/common/data/orderby.ts
952
969
  function parseOrderby(value = "") {
@@ -1092,6 +1109,25 @@ function arrayMin(...array) {
1092
1109
  return arrayFlatten(array).reduce((acc, value) => acc != null ? value < acc ? value : acc : value, void 0);
1093
1110
  }
1094
1111
  __name(arrayMin, "arrayMin");
1112
+ function arraySum(...array) {
1113
+ return arrayFlatten(array).reduce((acc, value) => acc + value, 0);
1114
+ }
1115
+ __name(arraySum, "arraySum");
1116
+ function arrayAvg(...array) {
1117
+ let flatArray = arrayFlatten(array);
1118
+ return flatArray.reduce((acc, value) => acc + value, 0) / flatArray.length;
1119
+ }
1120
+ __name(arrayAvg, "arrayAvg");
1121
+ function arrayBatches(array, chunckLength) {
1122
+ let chunks = [];
1123
+ let i = 0;
1124
+ const n = array.length;
1125
+ while (i < n) {
1126
+ chunks.push(array.slice(i, i += chunckLength));
1127
+ }
1128
+ return chunks;
1129
+ }
1130
+ __name(arrayBatches, "arrayBatches");
1095
1131
  function createArray(size2 = 0, item) {
1096
1132
  if (size2 <= 0)
1097
1133
  return [];
@@ -1483,6 +1519,7 @@ var Currency = _Currency;
1483
1519
  __name(Currency, "Currency");
1484
1520
  Currency.zero = new _Currency(0);
1485
1521
  Currency.one = new _Currency(1);
1522
+ Currency.hundred = new _Currency(100);
1486
1523
  function parse(value, opts, useRounding = true) {
1487
1524
  let v = 0, { decimal, errorOnInvalid, precision: decimals, fromCents } = opts, precision = pow(decimals), isNumber2 = typeof value === "number";
1488
1525
  if (value instanceof Currency && fromCents) {
@@ -1721,7 +1758,6 @@ var Day = class {
1721
1758
  if (mm === 0)
1722
1759
  mm = 12;
1723
1760
  let yy = Math.floor((m - 1) / 12);
1724
- console.log("calc", m, mm, yy, [this.year + yy, mm, this.day]);
1725
1761
  return Day.from([this.year + yy, mm, this.day]);
1726
1762
  }
1727
1763
  daysUntil(otherDay) {
@@ -1957,6 +1993,128 @@ function cloneJsonObject(obj) {
1957
1993
  return JSON.parse(JSON.stringify(obj));
1958
1994
  }
1959
1995
  __name(cloneJsonObject, "cloneJsonObject");
1996
+ function memoize(fn) {
1997
+ let cache = /* @__PURE__ */ new Map();
1998
+ return (n) => {
1999
+ if (cache.has(n)) {
2000
+ return cache.get(n);
2001
+ }
2002
+ let result = fn(n);
2003
+ cache.set(n, result);
2004
+ return result;
2005
+ };
2006
+ }
2007
+ __name(memoize, "memoize");
2008
+
2009
+ // src/common/data/xrx.ts
2010
+ var RX_WHITESPACE = /\\\s|\s+|#[^\n]*\n?/gm;
2011
+ var RX_REAL_GROUPS = /\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm;
2012
+ var RX_LOOK_BEHIND = /^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm;
2013
+ function regExpString(rx) {
2014
+ return typeof rx === "string" ? rx : rx.source || "";
2015
+ }
2016
+ __name(regExpString, "regExpString");
2017
+ function regExpEscape(str) {
2018
+ return str.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
2019
+ }
2020
+ __name(regExpEscape, "regExpEscape");
2021
+ var XRX = class {
2022
+ constructor(pattern2, flags) {
2023
+ this.namedGroups = {};
2024
+ this.names = [];
2025
+ let _flags = flags != null ? flags : "";
2026
+ let _rx;
2027
+ if (pattern2 instanceof RegExp) {
2028
+ if (flags == null) {
2029
+ _flags = pattern2.flags;
2030
+ }
2031
+ _rx = pattern2.source;
2032
+ } else {
2033
+ _rx = pattern2;
2034
+ }
2035
+ const extended = _flags && _flags.indexOf("x") !== -1;
2036
+ if (extended) {
2037
+ _flags = _flags.replace("x", "");
2038
+ _rx = _rx.replace(RX_WHITESPACE, (r) => {
2039
+ return r[0] === "\\" ? r : "";
2040
+ });
2041
+ }
2042
+ if (!(pattern2 instanceof RegExp)) {
2043
+ let index = 0;
2044
+ _rx = _rx.replace(RX_REAL_GROUPS, (str, name) => {
2045
+ index += 1;
2046
+ if (name) {
2047
+ if (name !== "index" && name !== "length" && !this.namedGroups[name]) {
2048
+ this.namedGroups[name] = index;
2049
+ } else {
2050
+ console.error(`Unallowed or duplicate group name: ${name}`);
2051
+ }
2052
+ return "(";
2053
+ }
2054
+ return str;
2055
+ });
2056
+ this.names = Object.keys(this.namedGroups);
2057
+ }
2058
+ _rx = regExpString(_rx);
2059
+ RX_LOOK_BEHIND.lastIndex = 0;
2060
+ let parts = RX_LOOK_BEHIND.exec(_rx);
2061
+ if (parts) {
2062
+ this.lookBehind = {
2063
+ rx: new RegExp(`${parts[3]}$(?!\\s)`),
2064
+ expect: parts ? parts[2] === "=" : !parts
2065
+ };
2066
+ _rx = _rx.substr(parts[0].length);
2067
+ }
2068
+ this.rx = new RegExp(_rx, _flags);
2069
+ }
2070
+ get lastIndex() {
2071
+ return this.rx.lastIndex;
2072
+ }
2073
+ set lastIndex(index) {
2074
+ this.rx.lastIndex = index;
2075
+ }
2076
+ _handleMatch(m) {
2077
+ if (this.lookBehind) {
2078
+ let leftContext = m.input.slice(0, m.index);
2079
+ if (this.lookBehind.expect !== this.lookBehind.rx.test(leftContext)) {
2080
+ return null;
2081
+ }
2082
+ }
2083
+ for (let name of this.names) {
2084
+ m[name] = m[this.namedGroups[name]];
2085
+ }
2086
+ return m;
2087
+ }
2088
+ exec(str) {
2089
+ let m;
2090
+ while (m = this.rx.exec(str)) {
2091
+ if (this.rx.lastIndex === m.index) {
2092
+ this.rx.lastIndex++;
2093
+ }
2094
+ m = this._handleMatch(m);
2095
+ if (m != null) {
2096
+ return m;
2097
+ }
2098
+ }
2099
+ }
2100
+ execAll(str) {
2101
+ let matches = [];
2102
+ let m;
2103
+ this.rx.lastIndex = 0;
2104
+ while (m = this.exec(str)) {
2105
+ matches.push(m);
2106
+ }
2107
+ this.rx.lastIndex = 0;
2108
+ return matches;
2109
+ }
2110
+ replace(str, replacement) {
2111
+ let fn = typeof replacement === "function" ? replacement : () => replacement;
2112
+ return str.replace(this.rx, (m) => {
2113
+ return fn(m);
2114
+ });
2115
+ }
2116
+ };
2117
+ __name(XRX, "XRX");
1960
2118
 
1961
2119
  // src/common/dispose-defer.ts
1962
2120
  var log3 = Logger("dispose");
@@ -2924,11 +3082,14 @@ __name(usePool, "usePool");
2924
3082
 
2925
3083
  // src/common/queue.ts
2926
3084
  var log6 = Logger("zeed:queue");
2927
- var SerialQueue = class {
3085
+ var SerialQueue = class extends Emitter {
2928
3086
  constructor(opt = {}) {
3087
+ super();
2929
3088
  this.queue = [];
2930
3089
  this.isPaused = false;
2931
3090
  this.waitToFinish = [];
3091
+ this.max = 0;
3092
+ this.resolved = 0;
2932
3093
  const { name = uname("queue"), logLevel } = opt;
2933
3094
  this.name = name;
2934
3095
  this.log = Logger(`zeed:queue:${name}`);
@@ -2950,6 +3111,10 @@ var SerialQueue = class {
2950
3111
  if (info == null) {
2951
3112
  break;
2952
3113
  }
3114
+ if (this.resolved === 0) {
3115
+ this.emit("didStart", this.max);
3116
+ this.emit("didUpdate", this.max, 0);
3117
+ }
2953
3118
  const { name, task, resolve } = info;
2954
3119
  this.currentTask = task();
2955
3120
  let result = void 0;
@@ -2962,6 +3127,13 @@ var SerialQueue = class {
2962
3127
  }
2963
3128
  resolve(result);
2964
3129
  this.currentTask = void 0;
3130
+ this.resolved += 1;
3131
+ this.emit("didUpdate", this.max, this.resolved);
3132
+ }
3133
+ if (this.queue.length === 0) {
3134
+ this.emit("didFinish", this.max);
3135
+ this.max = 0;
3136
+ this.resolved = 0;
2965
3137
  }
2966
3138
  while (this.waitToFinish.length > 0) {
2967
3139
  this.waitToFinish.shift()();
@@ -2973,6 +3145,7 @@ var SerialQueue = class {
2973
3145
  this.log.info(`immediate execution ${name}`);
2974
3146
  return await task();
2975
3147
  }
3148
+ this.max += 1;
2976
3149
  this.log(`enqueue ${name}`);
2977
3150
  return new Promise((resolve) => {
2978
3151
  this.queue.push({
@@ -2991,6 +3164,7 @@ var SerialQueue = class {
2991
3164
  }
2992
3165
  async cancelAll(unblock = true) {
2993
3166
  this.log(`cancelAll`);
3167
+ this.emit("didCancel", this.queue.length);
2994
3168
  let resolver = this.queue.map((task) => task.resolve);
2995
3169
  this.queue = [];
2996
3170
  resolver.forEach((r) => r(void 0));
@@ -3698,9 +3872,12 @@ module.exports = __toCommonJS(index_browser_exports);
3698
3872
  SerialQueue,
3699
3873
  Uint8ArrayToJson,
3700
3874
  Uint8ArrayToString,
3875
+ XRX,
3701
3876
  _decodeUtf8Polyfill,
3702
3877
  _encodeUtf8Polyfill,
3703
3878
  activateConsoleDebug,
3879
+ arrayAvg,
3880
+ arrayBatches,
3704
3881
  arrayEmptyInPlace,
3705
3882
  arrayFilterInPlace,
3706
3883
  arrayFlatten,
@@ -3717,10 +3894,12 @@ module.exports = __toCommonJS(index_browser_exports);
3717
3894
  arrayShuffleInPlace,
3718
3895
  arraySorted,
3719
3896
  arraySortedNumbers,
3897
+ arraySum,
3720
3898
  arraySymmetricDifference,
3721
3899
  arrayToggleInPlace,
3722
3900
  arrayUnion,
3723
3901
  arrayUnique,
3902
+ avg,
3724
3903
  between,
3725
3904
  cloneJsonObject,
3726
3905
  cloneObject,
@@ -3801,6 +3980,7 @@ module.exports = __toCommonJS(index_browser_exports);
3801
3980
  last,
3802
3981
  lazyListener,
3803
3982
  linkifyPlainText,
3983
+ memoize,
3804
3984
  messages,
3805
3985
  moveSortWeight,
3806
3986
  parseDate,
@@ -3813,6 +3993,8 @@ module.exports = __toCommonJS(index_browser_exports);
3813
3993
  randomFloat,
3814
3994
  randomInt,
3815
3995
  randomUint8Array,
3996
+ regExpEscape,
3997
+ regExpString,
3816
3998
  renderMessages,
3817
3999
  roundDown,
3818
4000
  roundHalfAwayFromZero,
@@ -3836,6 +4018,7 @@ module.exports = __toCommonJS(index_browser_exports);
3836
4018
  suidBytes,
3837
4019
  suidBytesDate,
3838
4020
  suidDate,
4021
+ sum,
3839
4022
  supportsColors,
3840
4023
  throttle,
3841
4024
  timeout,