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,4 +1,4 @@
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 { 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 { 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';
4
4
  export { L as LoggerBrowserHandler, a as LoggerBrowserSetupDebugFactory, b as activateConsoleDebug } from './log-browser-d263ebe0';
@@ -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
  Channel,
16
16
  CryptoEncoder,
@@ -26,8 +26,11 @@ import {
26
26
  SerialQueue,
27
27
  Uint8ArrayToJson,
28
28
  Uint8ArrayToString,
29
+ XRX,
29
30
  _decodeUtf8Polyfill,
30
31
  _encodeUtf8Polyfill,
32
+ arrayAvg,
33
+ arrayBatches,
31
34
  arrayEmptyInPlace,
32
35
  arrayFilterInPlace,
33
36
  arrayFlatten,
@@ -44,10 +47,12 @@ import {
44
47
  arrayShuffleInPlace,
45
48
  arraySorted,
46
49
  arraySortedNumbers,
50
+ arraySum,
47
51
  arraySymmetricDifference,
48
52
  arrayToggleInPlace,
49
53
  arrayUnion,
50
54
  arrayUnique,
55
+ avg,
51
56
  between,
52
57
  cloneJsonObject,
53
58
  cloneObject,
@@ -111,6 +116,7 @@ import {
111
116
  last,
112
117
  lazyListener,
113
118
  linkifyPlainText,
119
+ memoize,
114
120
  messages,
115
121
  moveSortWeight,
116
122
  parseOrderby,
@@ -122,6 +128,8 @@ import {
122
128
  randomFloat,
123
129
  randomInt,
124
130
  randomUint8Array,
131
+ regExpEscape,
132
+ regExpString,
125
133
  renderMessages,
126
134
  roundDown,
127
135
  roundHalfAwayFromZero,
@@ -144,6 +152,7 @@ import {
144
152
  suidBytes,
145
153
  suidBytesDate,
146
154
  suidDate,
155
+ sum,
147
156
  throttle,
148
157
  timeout,
149
158
  timeoutReached,
@@ -191,7 +200,7 @@ import {
191
200
  valueToInteger,
192
201
  valueToString,
193
202
  waitOn
194
- } from "./chunk-MN2DIK4K.js";
203
+ } from "./chunk-AYKBI7RN.js";
195
204
  import {
196
205
  LogLevel,
197
206
  LogLevelAlias,
@@ -217,7 +226,7 @@ import {
217
226
  parseDate,
218
227
  useLevelFilter,
219
228
  useNamespaceFilter
220
- } from "./chunk-DUGVRMRT.js";
229
+ } from "./chunk-G3LBBVZT.js";
221
230
  export {
222
231
  Channel,
223
232
  CryptoEncoder,
@@ -242,9 +251,12 @@ export {
242
251
  SerialQueue,
243
252
  Uint8ArrayToJson,
244
253
  Uint8ArrayToString,
254
+ XRX,
245
255
  _decodeUtf8Polyfill,
246
256
  _encodeUtf8Polyfill,
247
257
  activateConsoleDebug,
258
+ arrayAvg,
259
+ arrayBatches,
248
260
  arrayEmptyInPlace,
249
261
  arrayFilterInPlace,
250
262
  arrayFlatten,
@@ -261,10 +273,12 @@ export {
261
273
  arrayShuffleInPlace,
262
274
  arraySorted,
263
275
  arraySortedNumbers,
276
+ arraySum,
264
277
  arraySymmetricDifference,
265
278
  arrayToggleInPlace,
266
279
  arrayUnion,
267
280
  arrayUnique,
281
+ avg,
268
282
  between,
269
283
  cloneJsonObject,
270
284
  cloneObject,
@@ -345,6 +359,7 @@ export {
345
359
  last,
346
360
  lazyListener,
347
361
  linkifyPlainText,
362
+ memoize,
348
363
  messages,
349
364
  moveSortWeight,
350
365
  parseDate,
@@ -357,6 +372,8 @@ export {
357
372
  randomFloat,
358
373
  randomInt,
359
374
  randomUint8Array,
375
+ regExpEscape,
376
+ regExpString,
360
377
  renderMessages,
361
378
  roundDown,
362
379
  roundHalfAwayFromZero,
@@ -380,6 +397,7 @@ export {
380
397
  suidBytes,
381
398
  suidBytesDate,
382
399
  suidDate,
400
+ sum,
383
401
  supportsColors,
384
402
  throttle,
385
403
  timeout,
package/dist/index.log.js CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  LoggerBrowserHandler,
3
3
  LoggerBrowserSetupDebugFactory,
4
4
  activateConsoleDebug
5
- } from "./chunk-MYUIYPZU.js";
5
+ } from "./chunk-QCK7R55W.js";
6
6
  import {
7
7
  Logger
8
- } from "./chunk-DUGVRMRT.js";
8
+ } from "./chunk-G3LBBVZT.js";
9
9
  export {
10
10
  Logger,
11
11
  LoggerBrowserHandler,
@@ -69,8 +69,11 @@ __export(index_node_exports, {
69
69
  SerialQueue: () => SerialQueue,
70
70
  Uint8ArrayToJson: () => Uint8ArrayToJson,
71
71
  Uint8ArrayToString: () => Uint8ArrayToString,
72
+ XRX: () => XRX,
72
73
  _decodeUtf8Polyfill: () => _decodeUtf8Polyfill,
73
74
  _encodeUtf8Polyfill: () => _encodeUtf8Polyfill,
75
+ arrayAvg: () => arrayAvg,
76
+ arrayBatches: () => arrayBatches,
74
77
  arrayEmptyInPlace: () => arrayEmptyInPlace,
75
78
  arrayFilterInPlace: () => arrayFilterInPlace,
76
79
  arrayFlatten: () => arrayFlatten,
@@ -87,10 +90,12 @@ __export(index_node_exports, {
87
90
  arrayShuffleInPlace: () => arrayShuffleInPlace,
88
91
  arraySorted: () => arraySorted,
89
92
  arraySortedNumbers: () => arraySortedNumbers,
93
+ arraySum: () => arraySum,
90
94
  arraySymmetricDifference: () => arraySymmetricDifference,
91
95
  arrayToggleInPlace: () => arrayToggleInPlace,
92
96
  arrayUnion: () => arrayUnion,
93
97
  arrayUnique: () => arrayUnique,
98
+ avg: () => avg,
94
99
  between: () => between,
95
100
  cloneJsonObject: () => cloneJsonObject,
96
101
  cloneObject: () => cloneObject,
@@ -178,11 +183,13 @@ __export(index_node_exports, {
178
183
  lazyListener: () => lazyListener,
179
184
  linkifyPlainText: () => linkifyPlainText,
180
185
  loggerStackTraceDebug: () => loggerStackTraceDebug,
186
+ memoize: () => memoize,
181
187
  messages: () => messages,
182
188
  moveSortWeight: () => moveSortWeight,
183
189
  parseDate: () => parseDate,
184
190
  parseOrderby: () => parseOrderby,
185
191
  parseQuery: () => parseQuery,
192
+ pbcopy: () => pbcopy,
186
193
  platform: () => platform,
187
194
  promisify: () => promisify,
188
195
  qid: () => qid,
@@ -190,6 +197,8 @@ __export(index_node_exports, {
190
197
  randomFloat: () => randomFloat,
191
198
  randomInt: () => randomInt,
192
199
  randomUint8Array: () => randomUint8Array,
200
+ regExpEscape: () => regExpEscape,
201
+ regExpString: () => regExpString,
193
202
  renderMessages: () => renderMessages,
194
203
  roundDown: () => roundDown,
195
204
  roundHalfAwayFromZero: () => roundHalfAwayFromZero,
@@ -214,6 +223,7 @@ __export(index_node_exports, {
214
223
  suidBytes: () => suidBytes,
215
224
  suidBytesDate: () => suidBytesDate,
216
225
  suidDate: () => suidDate,
226
+ sum: () => sum,
217
227
  throttle: () => throttle,
218
228
  timeout: () => timeout,
219
229
  timeoutReached: () => timeoutReached,
@@ -958,6 +968,14 @@ function between(min, value, max) {
958
968
  return Math.max(min, Math.min(max, value));
959
969
  }
960
970
  __name(between, "between");
971
+ function sum(array) {
972
+ return array.reduce((acc, value) => acc + value, 0);
973
+ }
974
+ __name(sum, "sum");
975
+ function avg(array) {
976
+ return sum(array) / array.length;
977
+ }
978
+ __name(avg, "avg");
961
979
 
962
980
  // src/common/data/orderby.ts
963
981
  function parseOrderby(value = "") {
@@ -1103,6 +1121,25 @@ function arrayMin(...array) {
1103
1121
  return arrayFlatten(array).reduce((acc, value) => acc != null ? value < acc ? value : acc : value, void 0);
1104
1122
  }
1105
1123
  __name(arrayMin, "arrayMin");
1124
+ function arraySum(...array) {
1125
+ return arrayFlatten(array).reduce((acc, value) => acc + value, 0);
1126
+ }
1127
+ __name(arraySum, "arraySum");
1128
+ function arrayAvg(...array) {
1129
+ let flatArray = arrayFlatten(array);
1130
+ return flatArray.reduce((acc, value) => acc + value, 0) / flatArray.length;
1131
+ }
1132
+ __name(arrayAvg, "arrayAvg");
1133
+ function arrayBatches(array, chunckLength) {
1134
+ let chunks = [];
1135
+ let i = 0;
1136
+ const n = array.length;
1137
+ while (i < n) {
1138
+ chunks.push(array.slice(i, i += chunckLength));
1139
+ }
1140
+ return chunks;
1141
+ }
1142
+ __name(arrayBatches, "arrayBatches");
1106
1143
  function createArray(size2 = 0, item) {
1107
1144
  if (size2 <= 0)
1108
1145
  return [];
@@ -1494,6 +1531,7 @@ var Currency = _Currency;
1494
1531
  __name(Currency, "Currency");
1495
1532
  Currency.zero = new _Currency(0);
1496
1533
  Currency.one = new _Currency(1);
1534
+ Currency.hundred = new _Currency(100);
1497
1535
  function parse(value, opts, useRounding = true) {
1498
1536
  let v = 0, { decimal, errorOnInvalid, precision: decimals, fromCents } = opts, precision = pow(decimals), isNumber2 = typeof value === "number";
1499
1537
  if (value instanceof Currency && fromCents) {
@@ -1732,7 +1770,6 @@ var Day = class {
1732
1770
  if (mm === 0)
1733
1771
  mm = 12;
1734
1772
  let yy = Math.floor((m - 1) / 12);
1735
- console.log("calc", m, mm, yy, [this.year + yy, mm, this.day]);
1736
1773
  return Day.from([this.year + yy, mm, this.day]);
1737
1774
  }
1738
1775
  daysUntil(otherDay) {
@@ -1968,6 +2005,128 @@ function cloneJsonObject(obj) {
1968
2005
  return JSON.parse(JSON.stringify(obj));
1969
2006
  }
1970
2007
  __name(cloneJsonObject, "cloneJsonObject");
2008
+ function memoize(fn) {
2009
+ let cache = /* @__PURE__ */ new Map();
2010
+ return (n) => {
2011
+ if (cache.has(n)) {
2012
+ return cache.get(n);
2013
+ }
2014
+ let result = fn(n);
2015
+ cache.set(n, result);
2016
+ return result;
2017
+ };
2018
+ }
2019
+ __name(memoize, "memoize");
2020
+
2021
+ // src/common/data/xrx.ts
2022
+ var RX_WHITESPACE = /\\\s|\s+|#[^\n]*\n?/gm;
2023
+ var RX_REAL_GROUPS = /\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm;
2024
+ var RX_LOOK_BEHIND = /^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm;
2025
+ function regExpString(rx) {
2026
+ return typeof rx === "string" ? rx : rx.source || "";
2027
+ }
2028
+ __name(regExpString, "regExpString");
2029
+ function regExpEscape(str) {
2030
+ return str.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
2031
+ }
2032
+ __name(regExpEscape, "regExpEscape");
2033
+ var XRX = class {
2034
+ constructor(pattern2, flags) {
2035
+ this.namedGroups = {};
2036
+ this.names = [];
2037
+ let _flags = flags != null ? flags : "";
2038
+ let _rx;
2039
+ if (pattern2 instanceof RegExp) {
2040
+ if (flags == null) {
2041
+ _flags = pattern2.flags;
2042
+ }
2043
+ _rx = pattern2.source;
2044
+ } else {
2045
+ _rx = pattern2;
2046
+ }
2047
+ const extended = _flags && _flags.indexOf("x") !== -1;
2048
+ if (extended) {
2049
+ _flags = _flags.replace("x", "");
2050
+ _rx = _rx.replace(RX_WHITESPACE, (r) => {
2051
+ return r[0] === "\\" ? r : "";
2052
+ });
2053
+ }
2054
+ if (!(pattern2 instanceof RegExp)) {
2055
+ let index = 0;
2056
+ _rx = _rx.replace(RX_REAL_GROUPS, (str, name) => {
2057
+ index += 1;
2058
+ if (name) {
2059
+ if (name !== "index" && name !== "length" && !this.namedGroups[name]) {
2060
+ this.namedGroups[name] = index;
2061
+ } else {
2062
+ console.error(`Unallowed or duplicate group name: ${name}`);
2063
+ }
2064
+ return "(";
2065
+ }
2066
+ return str;
2067
+ });
2068
+ this.names = Object.keys(this.namedGroups);
2069
+ }
2070
+ _rx = regExpString(_rx);
2071
+ RX_LOOK_BEHIND.lastIndex = 0;
2072
+ let parts = RX_LOOK_BEHIND.exec(_rx);
2073
+ if (parts) {
2074
+ this.lookBehind = {
2075
+ rx: new RegExp(`${parts[3]}$(?!\\s)`),
2076
+ expect: parts ? parts[2] === "=" : !parts
2077
+ };
2078
+ _rx = _rx.substr(parts[0].length);
2079
+ }
2080
+ this.rx = new RegExp(_rx, _flags);
2081
+ }
2082
+ get lastIndex() {
2083
+ return this.rx.lastIndex;
2084
+ }
2085
+ set lastIndex(index) {
2086
+ this.rx.lastIndex = index;
2087
+ }
2088
+ _handleMatch(m) {
2089
+ if (this.lookBehind) {
2090
+ let leftContext = m.input.slice(0, m.index);
2091
+ if (this.lookBehind.expect !== this.lookBehind.rx.test(leftContext)) {
2092
+ return null;
2093
+ }
2094
+ }
2095
+ for (let name of this.names) {
2096
+ m[name] = m[this.namedGroups[name]];
2097
+ }
2098
+ return m;
2099
+ }
2100
+ exec(str) {
2101
+ let m;
2102
+ while (m = this.rx.exec(str)) {
2103
+ if (this.rx.lastIndex === m.index) {
2104
+ this.rx.lastIndex++;
2105
+ }
2106
+ m = this._handleMatch(m);
2107
+ if (m != null) {
2108
+ return m;
2109
+ }
2110
+ }
2111
+ }
2112
+ execAll(str) {
2113
+ let matches = [];
2114
+ let m;
2115
+ this.rx.lastIndex = 0;
2116
+ while (m = this.exec(str)) {
2117
+ matches.push(m);
2118
+ }
2119
+ this.rx.lastIndex = 0;
2120
+ return matches;
2121
+ }
2122
+ replace(str, replacement) {
2123
+ let fn = typeof replacement === "function" ? replacement : () => replacement;
2124
+ return str.replace(this.rx, (m) => {
2125
+ return fn(m);
2126
+ });
2127
+ }
2128
+ };
2129
+ __name(XRX, "XRX");
1971
2130
 
1972
2131
  // src/common/dispose-defer.ts
1973
2132
  var log3 = Logger("dispose");
@@ -2935,11 +3094,14 @@ __name(usePool, "usePool");
2935
3094
 
2936
3095
  // src/common/queue.ts
2937
3096
  var log6 = Logger("zeed:queue");
2938
- var SerialQueue = class {
3097
+ var SerialQueue = class extends Emitter {
2939
3098
  constructor(opt = {}) {
3099
+ super();
2940
3100
  this.queue = [];
2941
3101
  this.isPaused = false;
2942
3102
  this.waitToFinish = [];
3103
+ this.max = 0;
3104
+ this.resolved = 0;
2943
3105
  const { name = uname("queue"), logLevel } = opt;
2944
3106
  this.name = name;
2945
3107
  this.log = Logger(`zeed:queue:${name}`);
@@ -2961,6 +3123,10 @@ var SerialQueue = class {
2961
3123
  if (info == null) {
2962
3124
  break;
2963
3125
  }
3126
+ if (this.resolved === 0) {
3127
+ this.emit("didStart", this.max);
3128
+ this.emit("didUpdate", this.max, 0);
3129
+ }
2964
3130
  const { name, task, resolve: resolve5 } = info;
2965
3131
  this.currentTask = task();
2966
3132
  let result = void 0;
@@ -2973,6 +3139,13 @@ var SerialQueue = class {
2973
3139
  }
2974
3140
  resolve5(result);
2975
3141
  this.currentTask = void 0;
3142
+ this.resolved += 1;
3143
+ this.emit("didUpdate", this.max, this.resolved);
3144
+ }
3145
+ if (this.queue.length === 0) {
3146
+ this.emit("didFinish", this.max);
3147
+ this.max = 0;
3148
+ this.resolved = 0;
2976
3149
  }
2977
3150
  while (this.waitToFinish.length > 0) {
2978
3151
  this.waitToFinish.shift()();
@@ -2984,6 +3157,7 @@ var SerialQueue = class {
2984
3157
  this.log.info(`immediate execution ${name}`);
2985
3158
  return await task();
2986
3159
  }
3160
+ this.max += 1;
2987
3161
  this.log(`enqueue ${name}`);
2988
3162
  return new Promise((resolve5) => {
2989
3163
  this.queue.push({
@@ -3002,6 +3176,7 @@ var SerialQueue = class {
3002
3176
  }
3003
3177
  async cancelAll(unblock = true) {
3004
3178
  this.log(`cancelAll`);
3179
+ this.emit("didCancel", this.queue.length);
3005
3180
  let resolver = this.queue.map((task) => task.resolve);
3006
3181
  this.queue = [];
3007
3182
  resolver.forEach((r) => r(void 0));
@@ -3145,6 +3320,18 @@ function debounce(callback, opt = {}) {
3145
3320
  }
3146
3321
  __name(debounce, "debounce");
3147
3322
 
3323
+ // src/node/clipboard.ts
3324
+ function pbcopy(data) {
3325
+ return new Promise(function(resolve5, reject) {
3326
+ const proc = require("child_process").spawn("pbcopy");
3327
+ proc.on("error", (err) => reject(err));
3328
+ proc.on("close", (err) => resolve5(data));
3329
+ proc.stdin.write(data);
3330
+ proc.stdin.end();
3331
+ });
3332
+ }
3333
+ __name(pbcopy, "pbcopy");
3334
+
3148
3335
  // src/node/crypto.ts
3149
3336
  var import_crypto3 = __toESM(require("crypto"), 1);
3150
3337
  try {
@@ -3665,8 +3852,11 @@ module.exports = __toCommonJS(index_node_exports);
3665
3852
  SerialQueue,
3666
3853
  Uint8ArrayToJson,
3667
3854
  Uint8ArrayToString,
3855
+ XRX,
3668
3856
  _decodeUtf8Polyfill,
3669
3857
  _encodeUtf8Polyfill,
3858
+ arrayAvg,
3859
+ arrayBatches,
3670
3860
  arrayEmptyInPlace,
3671
3861
  arrayFilterInPlace,
3672
3862
  arrayFlatten,
@@ -3683,10 +3873,12 @@ module.exports = __toCommonJS(index_node_exports);
3683
3873
  arrayShuffleInPlace,
3684
3874
  arraySorted,
3685
3875
  arraySortedNumbers,
3876
+ arraySum,
3686
3877
  arraySymmetricDifference,
3687
3878
  arrayToggleInPlace,
3688
3879
  arrayUnion,
3689
3880
  arrayUnique,
3881
+ avg,
3690
3882
  between,
3691
3883
  cloneJsonObject,
3692
3884
  cloneObject,
@@ -3774,11 +3966,13 @@ module.exports = __toCommonJS(index_node_exports);
3774
3966
  lazyListener,
3775
3967
  linkifyPlainText,
3776
3968
  loggerStackTraceDebug,
3969
+ memoize,
3777
3970
  messages,
3778
3971
  moveSortWeight,
3779
3972
  parseDate,
3780
3973
  parseOrderby,
3781
3974
  parseQuery,
3975
+ pbcopy,
3782
3976
  platform,
3783
3977
  promisify,
3784
3978
  qid,
@@ -3786,6 +3980,8 @@ module.exports = __toCommonJS(index_node_exports);
3786
3980
  randomFloat,
3787
3981
  randomInt,
3788
3982
  randomUint8Array,
3983
+ regExpEscape,
3984
+ regExpString,
3789
3985
  renderMessages,
3790
3986
  roundDown,
3791
3987
  roundHalfAwayFromZero,
@@ -3810,6 +4006,7 @@ module.exports = __toCommonJS(index_node_exports);
3810
4006
  suidBytes,
3811
4007
  suidBytesDate,
3812
4008
  suidDate,
4009
+ sum,
3813
4010
  throttle,
3814
4011
  timeout,
3815
4012
  timeoutReached,