@esposter/shared 2.22.0 → 2.24.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.
package/dist/index.js CHANGED
@@ -27,6 +27,9 @@ var __copyProps = (to, from, except, desc) => {
27
27
  };
28
28
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  //#endregion
30
+ //#region src/util/function/noop.ts
31
+ const noop = () => {};
32
+ //#endregion
30
33
  //#region src/test/constants.ts
31
34
  const AllSpecialValues = [
32
35
  {
@@ -67,11 +70,11 @@ const AllSpecialValues = [
67
70
  },
68
71
  {
69
72
  isPlainObject: false,
70
- value: () => {}
73
+ value: noop
71
74
  },
72
75
  {
73
76
  isPlainObject: false,
74
- value: /* @__PURE__ */ new RegExp("")
77
+ value: /(?:)/u
75
78
  }
76
79
  ];
77
80
  //#endregion
@@ -122,6 +125,8 @@ const RoutePath = {
122
125
  Achievements: "/achievements",
123
126
  Anime: "/anime",
124
127
  Calendar: "/calendar",
128
+ Calls: (id) => `/calls/${id}`,
129
+ CallsIndex: "/calls",
125
130
  Clicker: "/clicker",
126
131
  Dashboard: "/dashboard",
127
132
  DashboardEditor: "/dashboard/editor",
@@ -180,9 +185,9 @@ let Operation = /* @__PURE__ */ function(Operation) {
180
185
  return Operation;
181
186
  }({});
182
187
  //#endregion
183
- //#region ../../node_modules/.pnpm/@vue+shared@3.5.33/node_modules/@vue/shared/dist/shared.esm-bundler.js
188
+ //#region ../../node_modules/.pnpm/@vue+shared@3.5.34/node_modules/@vue/shared/dist/shared.esm-bundler.js
184
189
  /**
185
- * @vue/shared v3.5.33
190
+ * @vue/shared v3.5.34
186
191
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
187
192
  * @license MIT
188
193
  **/
@@ -195,7 +200,6 @@ function makeMap(str) {
195
200
  const EMPTY_OBJ = Object.freeze({});
196
201
  Object.freeze([]);
197
202
  const NOOP = () => {};
198
- const NO = () => false;
199
203
  const extend = Object.assign;
200
204
  const remove = (arr, el) => {
201
205
  const i = arr.indexOf(el);
@@ -226,18 +230,9 @@ const cacheStringFunction$1 = (fn) => {
226
230
  return cache[str] || (cache[str] = fn(str));
227
231
  });
228
232
  };
229
- const camelizeRE$1 = /-\w/g;
230
- cacheStringFunction$1((str) => {
231
- return str.replace(camelizeRE$1, (c) => c.slice(1).toUpperCase());
232
- });
233
- const hyphenateRE$1 = /\B([A-Z])/g;
234
- cacheStringFunction$1((str) => str.replace(hyphenateRE$1, "-$1").toLowerCase());
235
233
  const capitalize$1 = cacheStringFunction$1((str) => {
236
234
  return str.charAt(0).toUpperCase() + str.slice(1);
237
235
  });
238
- const toHandlerKey = cacheStringFunction$1((str) => {
239
- return str ? `on${capitalize$1(str)}` : ``;
240
- });
241
236
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
242
237
  const def = (obj, key, value, writable = false) => {
243
238
  Object.defineProperty(obj, key, {
@@ -252,9 +247,9 @@ const getGlobalThis = () => {
252
247
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
253
248
  };
254
249
  //#endregion
255
- //#region ../../node_modules/.pnpm/@vue+reactivity@3.5.33/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
250
+ //#region ../../node_modules/.pnpm/@vue+reactivity@3.5.34/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
256
251
  /**
257
- * @vue/reactivity v3.5.33
252
+ * @vue/reactivity v3.5.34
258
253
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
259
254
  * @license MIT
260
255
  **/
@@ -1354,9 +1349,9 @@ function traverse(value, depth = Infinity, seen) {
1354
1349
  return value;
1355
1350
  }
1356
1351
  //#endregion
1357
- //#region ../../node_modules/.pnpm/@vue+runtime-core@3.5.33/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
1352
+ //#region ../../node_modules/.pnpm/@vue+runtime-core@3.5.34/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
1358
1353
  /**
1359
- * @vue/runtime-core v3.5.33
1354
+ * @vue/runtime-core v3.5.34
1360
1355
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
1361
1356
  * @license MIT
1362
1357
  **/
@@ -1828,34 +1823,6 @@ function createPathGetter(ctx, path) {
1828
1823
  }
1829
1824
  getGlobalThis().requestIdleCallback;
1830
1825
  getGlobalThis().cancelIdleCallback;
1831
- function injectHook(type, hook, target = currentInstance, prepend = false) {
1832
- if (target) {
1833
- const hooks = target[type] || (target[type] = []);
1834
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
1835
- pauseTracking();
1836
- const reset = setCurrentInstance(target);
1837
- const res = callWithAsyncErrorHandling(hook, target, type, args);
1838
- reset();
1839
- resetTracking();
1840
- return res;
1841
- });
1842
- if (prepend) hooks.unshift(wrappedHook);
1843
- else hooks.push(wrappedHook);
1844
- return wrappedHook;
1845
- } else warn$1(`${toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""))} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`);
1846
- }
1847
- const createHook = (lifecycle) => (hook, target = currentInstance) => {
1848
- if (!isInSSRComponentSetup || lifecycle === "sp") injectHook(lifecycle, (...args) => hook(...args), target);
1849
- };
1850
- createHook("bm");
1851
- createHook("m");
1852
- createHook("bu");
1853
- createHook("u");
1854
- createHook("bum");
1855
- createHook("um");
1856
- createHook("sp");
1857
- createHook("rtg");
1858
- createHook("rtc");
1859
1826
  const getPublicInstance = (i) => {
1860
1827
  if (!i) return null;
1861
1828
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
@@ -1911,10 +1878,8 @@ const PublicInstanceProxyHandlers = {
1911
1878
  const publicGetter = publicPropertiesMap[key];
1912
1879
  let cssModule, globalProperties;
1913
1880
  if (publicGetter) {
1914
- if (key === "$attrs") {
1915
- track(instance.attrs, "get", "");
1916
- markAttrsAccessed();
1917
- } else if (key === "$slots") track(instance, "get", key);
1881
+ if (key === "$attrs") track(instance.attrs, "get", "");
1882
+ else if (key === "$slots") track(instance, "get", key);
1918
1883
  return publicGetter(instance);
1919
1884
  } else if ((cssModule = type.__cssModules) && (cssModule = cssModule[key])) return cssModule;
1920
1885
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
@@ -2056,36 +2021,13 @@ function mergeWatchOptions(to, from) {
2056
2021
  for (const key in from) merged[key] = mergeAsArray(to[key], from[key]);
2057
2022
  return merged;
2058
2023
  }
2059
- function createAppContext() {
2060
- return {
2061
- app: null,
2062
- config: {
2063
- isNativeTag: NO,
2064
- performance: false,
2065
- globalProperties: {},
2066
- optionMergeStrategies: {},
2067
- errorHandler: void 0,
2068
- warnHandler: void 0,
2069
- compilerOptions: {}
2070
- },
2071
- mixins: [],
2072
- components: {},
2073
- directives: {},
2074
- provides: /* @__PURE__ */ Object.create(null),
2075
- optionsCache: /* @__PURE__ */ new WeakMap(),
2076
- propsCache: /* @__PURE__ */ new WeakMap(),
2077
- emitsCache: /* @__PURE__ */ new WeakMap()
2078
- };
2079
- }
2080
2024
  let currentApp = null;
2081
- function markAttrsAccessed() {}
2082
2025
  const queuePostRenderEffect = queueEffectWithSuspense;
2083
2026
  function queueEffectWithSuspense(fn, suspense) {
2084
2027
  if (suspense && suspense.pendingBranch) if (isArray(fn)) suspense.effects.push(...fn);
2085
2028
  else suspense.effects.push(fn);
2086
2029
  else queuePostFlushCb(fn);
2087
2030
  }
2088
- createAppContext();
2089
2031
  let currentInstance = null;
2090
2032
  const getCurrentInstance = () => currentInstance || currentRenderingInstance;
2091
2033
  let internalSetCurrentInstance;
@@ -2313,9 +2255,9 @@ function initCustomFormatter() {
2313
2255
  else window.devtoolsFormatters = [formatter];
2314
2256
  }
2315
2257
  //#endregion
2316
- //#region ../../node_modules/.pnpm/vue@3.5.33_typescript@5.9.3/node_modules/vue/dist/vue.runtime.esm-bundler.js
2258
+ //#region ../../node_modules/.pnpm/vue@3.5.34_typescript@5.9.3/node_modules/vue/dist/vue.runtime.esm-bundler.js
2317
2259
  /**
2318
- * vue v3.5.33
2260
+ * vue v3.5.34
2319
2261
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
2320
2262
  * @license MIT
2321
2263
  **/
@@ -2329,18 +2271,6 @@ const getRawData = (data) => /* @__PURE__ */ isReactive(data) ? /* @__PURE__ */
2329
2271
  typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
2330
2272
  const toString = Object.prototype.toString;
2331
2273
  const isObject = (val) => toString.call(val) === "[object Object]";
2332
- function cacheStringFunction(fn) {
2333
- const cache = Object.create(null);
2334
- return ((str) => {
2335
- return cache[str] || (cache[str] = fn(str));
2336
- });
2337
- }
2338
- const hyphenateRE = /\B([A-Z])/g;
2339
- cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
2340
- const camelizeRE = /-(\w)/g;
2341
- cacheStringFunction((str) => {
2342
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
2343
- });
2344
2274
  //#endregion
2345
2275
  //#region src/util/reactivity/toRawDeep.ts
2346
2276
  const toRawDeep = (data) => {
@@ -2360,6 +2290,507 @@ var Serializable = class {
2360
2290
  }
2361
2291
  };
2362
2292
  //#endregion
2293
+ //#region src/services/error/toAppError.ts
2294
+ const toAppError = (error) => {
2295
+ if (error instanceof Error) return error;
2296
+ if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") return new Error(error.message, { cause: error });
2297
+ return new Error(String(error), { cause: error });
2298
+ };
2299
+ //#endregion
2300
+ //#region ../../node_modules/.pnpm/neverthrow@8.2.0/node_modules/neverthrow/dist/index.es.js
2301
+ const defaultErrorConfig = { withStackTrace: false };
2302
+ const createNeverThrowError = (message, result, config = defaultErrorConfig) => {
2303
+ return {
2304
+ data: result.isOk() ? {
2305
+ type: "Ok",
2306
+ value: result.value
2307
+ } : {
2308
+ type: "Err",
2309
+ value: result.error
2310
+ },
2311
+ message,
2312
+ stack: config.withStackTrace ? (/* @__PURE__ */ new Error()).stack : void 0
2313
+ };
2314
+ };
2315
+ /******************************************************************************
2316
+ Copyright (c) Microsoft Corporation.
2317
+
2318
+ Permission to use, copy, modify, and/or distribute this software for any
2319
+ purpose with or without fee is hereby granted.
2320
+
2321
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2322
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2323
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2324
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2325
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2326
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2327
+ PERFORMANCE OF THIS SOFTWARE.
2328
+ ***************************************************************************** */
2329
+ function __awaiter(thisArg, _arguments, P, generator) {
2330
+ function adopt(value) {
2331
+ return value instanceof P ? value : new P(function(resolve) {
2332
+ resolve(value);
2333
+ });
2334
+ }
2335
+ return new (P || (P = Promise))(function(resolve, reject) {
2336
+ function fulfilled(value) {
2337
+ try {
2338
+ step(generator.next(value));
2339
+ } catch (e) {
2340
+ reject(e);
2341
+ }
2342
+ }
2343
+ function rejected(value) {
2344
+ try {
2345
+ step(generator["throw"](value));
2346
+ } catch (e) {
2347
+ reject(e);
2348
+ }
2349
+ }
2350
+ function step(result) {
2351
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2352
+ }
2353
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2354
+ });
2355
+ }
2356
+ function __values(o) {
2357
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
2358
+ if (m) return m.call(o);
2359
+ if (o && typeof o.length === "number") return { next: function() {
2360
+ if (o && i >= o.length) o = void 0;
2361
+ return {
2362
+ value: o && o[i++],
2363
+ done: !o
2364
+ };
2365
+ } };
2366
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
2367
+ }
2368
+ function __await(v) {
2369
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
2370
+ }
2371
+ function __asyncGenerator(thisArg, _arguments, generator) {
2372
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
2373
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
2374
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
2375
+ return this;
2376
+ }, i;
2377
+ function awaitReturn(f) {
2378
+ return function(v) {
2379
+ return Promise.resolve(v).then(f, reject);
2380
+ };
2381
+ }
2382
+ function verb(n, f) {
2383
+ if (g[n]) {
2384
+ i[n] = function(v) {
2385
+ return new Promise(function(a, b) {
2386
+ q.push([
2387
+ n,
2388
+ v,
2389
+ a,
2390
+ b
2391
+ ]) > 1 || resume(n, v);
2392
+ });
2393
+ };
2394
+ if (f) i[n] = f(i[n]);
2395
+ }
2396
+ }
2397
+ function resume(n, v) {
2398
+ try {
2399
+ step(g[n](v));
2400
+ } catch (e) {
2401
+ settle(q[0][3], e);
2402
+ }
2403
+ }
2404
+ function step(r) {
2405
+ r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
2406
+ }
2407
+ function fulfill(value) {
2408
+ resume("next", value);
2409
+ }
2410
+ function reject(value) {
2411
+ resume("throw", value);
2412
+ }
2413
+ function settle(f, v) {
2414
+ if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
2415
+ }
2416
+ }
2417
+ function __asyncDelegator(o) {
2418
+ var i, p;
2419
+ return i = {}, verb("next"), verb("throw", function(e) {
2420
+ throw e;
2421
+ }), verb("return"), i[Symbol.iterator] = function() {
2422
+ return this;
2423
+ }, i;
2424
+ function verb(n, f) {
2425
+ i[n] = o[n] ? function(v) {
2426
+ return (p = !p) ? {
2427
+ value: __await(o[n](v)),
2428
+ done: false
2429
+ } : f ? f(v) : v;
2430
+ } : f;
2431
+ }
2432
+ }
2433
+ function __asyncValues(o) {
2434
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
2435
+ var m = o[Symbol.asyncIterator], i;
2436
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
2437
+ return this;
2438
+ }, i);
2439
+ function verb(n) {
2440
+ i[n] = o[n] && function(v) {
2441
+ return new Promise(function(resolve, reject) {
2442
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
2443
+ });
2444
+ };
2445
+ }
2446
+ function settle(resolve, reject, d, v) {
2447
+ Promise.resolve(v).then(function(v) {
2448
+ resolve({
2449
+ value: v,
2450
+ done: d
2451
+ });
2452
+ }, reject);
2453
+ }
2454
+ }
2455
+ var ResultAsync = class ResultAsync {
2456
+ constructor(res) {
2457
+ this._promise = res;
2458
+ }
2459
+ static fromSafePromise(promise) {
2460
+ return new ResultAsync(promise.then((value) => new Ok(value)));
2461
+ }
2462
+ static fromPromise(promise, errorFn) {
2463
+ return new ResultAsync(promise.then((value) => new Ok(value)).catch((e) => new Err(errorFn(e))));
2464
+ }
2465
+ static fromThrowable(fn, errorFn) {
2466
+ return (...args) => {
2467
+ return new ResultAsync(__awaiter(this, void 0, void 0, function* () {
2468
+ try {
2469
+ return new Ok(yield fn(...args));
2470
+ } catch (error) {
2471
+ return new Err(errorFn ? errorFn(error) : error);
2472
+ }
2473
+ }));
2474
+ };
2475
+ }
2476
+ static combine(asyncResultList) {
2477
+ return combineResultAsyncList(asyncResultList);
2478
+ }
2479
+ static combineWithAllErrors(asyncResultList) {
2480
+ return combineResultAsyncListWithAllErrors(asyncResultList);
2481
+ }
2482
+ map(f) {
2483
+ return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
2484
+ if (res.isErr()) return new Err(res.error);
2485
+ return new Ok(yield f(res.value));
2486
+ })));
2487
+ }
2488
+ andThrough(f) {
2489
+ return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
2490
+ if (res.isErr()) return new Err(res.error);
2491
+ const newRes = yield f(res.value);
2492
+ if (newRes.isErr()) return new Err(newRes.error);
2493
+ return new Ok(res.value);
2494
+ })));
2495
+ }
2496
+ andTee(f) {
2497
+ return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
2498
+ if (res.isErr()) return new Err(res.error);
2499
+ try {
2500
+ yield f(res.value);
2501
+ } catch (e) {}
2502
+ return new Ok(res.value);
2503
+ })));
2504
+ }
2505
+ orTee(f) {
2506
+ return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
2507
+ if (res.isOk()) return new Ok(res.value);
2508
+ try {
2509
+ yield f(res.error);
2510
+ } catch (e) {}
2511
+ return new Err(res.error);
2512
+ })));
2513
+ }
2514
+ mapErr(f) {
2515
+ return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
2516
+ if (res.isOk()) return new Ok(res.value);
2517
+ return new Err(yield f(res.error));
2518
+ })));
2519
+ }
2520
+ andThen(f) {
2521
+ return new ResultAsync(this._promise.then((res) => {
2522
+ if (res.isErr()) return new Err(res.error);
2523
+ const newValue = f(res.value);
2524
+ return newValue instanceof ResultAsync ? newValue._promise : newValue;
2525
+ }));
2526
+ }
2527
+ orElse(f) {
2528
+ return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
2529
+ if (res.isErr()) return f(res.error);
2530
+ return new Ok(res.value);
2531
+ })));
2532
+ }
2533
+ match(ok, _err) {
2534
+ return this._promise.then((res) => res.match(ok, _err));
2535
+ }
2536
+ unwrapOr(t) {
2537
+ return this._promise.then((res) => res.unwrapOr(t));
2538
+ }
2539
+ /**
2540
+ * @deprecated will be removed in 9.0.0.
2541
+ *
2542
+ * You can use `safeTry` without this method.
2543
+ * @example
2544
+ * ```typescript
2545
+ * safeTry(async function* () {
2546
+ * const okValue = yield* yourResult
2547
+ * })
2548
+ * ```
2549
+ * Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
2550
+ */
2551
+ safeUnwrap() {
2552
+ return __asyncGenerator(this, arguments, function* safeUnwrap_1() {
2553
+ return yield __await(yield __await(yield* __asyncDelegator(__asyncValues(yield __await(this._promise.then((res) => res.safeUnwrap()))))));
2554
+ });
2555
+ }
2556
+ then(successCallback, failureCallback) {
2557
+ return this._promise.then(successCallback, failureCallback);
2558
+ }
2559
+ [Symbol.asyncIterator]() {
2560
+ return __asyncGenerator(this, arguments, function* _a() {
2561
+ const result = yield __await(this._promise);
2562
+ if (result.isErr()) yield yield __await(errAsync(result.error));
2563
+ return yield __await(result.value);
2564
+ });
2565
+ }
2566
+ };
2567
+ function errAsync(err) {
2568
+ return new ResultAsync(Promise.resolve(new Err(err)));
2569
+ }
2570
+ ResultAsync.fromPromise;
2571
+ ResultAsync.fromSafePromise;
2572
+ ResultAsync.fromThrowable;
2573
+ /**
2574
+ * Short circuits on the FIRST Err value that we find
2575
+ */
2576
+ const combineResultList = (resultList) => {
2577
+ let acc = ok([]);
2578
+ for (const result of resultList) if (result.isErr()) {
2579
+ acc = err(result.error);
2580
+ break;
2581
+ } else acc.map((list) => list.push(result.value));
2582
+ return acc;
2583
+ };
2584
+ const combineResultAsyncList = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList);
2585
+ /**
2586
+ * Give a list of all the errors we find
2587
+ */
2588
+ const combineResultListWithAllErrors = (resultList) => {
2589
+ let acc = ok([]);
2590
+ for (const result of resultList) if (result.isErr() && acc.isErr()) acc.error.push(result.error);
2591
+ else if (result.isErr() && acc.isOk()) acc = err([result.error]);
2592
+ else if (result.isOk() && acc.isOk()) acc.value.push(result.value);
2593
+ return acc;
2594
+ };
2595
+ const combineResultAsyncListWithAllErrors = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors);
2596
+ var Result;
2597
+ (function(Result) {
2598
+ /**
2599
+ * Wraps a function with a try catch, creating a new function with the same
2600
+ * arguments but returning `Ok` if successful, `Err` if the function throws
2601
+ *
2602
+ * @param fn function to wrap with ok on success or err on failure
2603
+ * @param errorFn when an error is thrown, this will wrap the error result if provided
2604
+ */
2605
+ function fromThrowable(fn, errorFn) {
2606
+ return (...args) => {
2607
+ try {
2608
+ return ok(fn(...args));
2609
+ } catch (e) {
2610
+ return err(errorFn ? errorFn(e) : e);
2611
+ }
2612
+ };
2613
+ }
2614
+ Result.fromThrowable = fromThrowable;
2615
+ function combine(resultList) {
2616
+ return combineResultList(resultList);
2617
+ }
2618
+ Result.combine = combine;
2619
+ function combineWithAllErrors(resultList) {
2620
+ return combineResultListWithAllErrors(resultList);
2621
+ }
2622
+ Result.combineWithAllErrors = combineWithAllErrors;
2623
+ })(Result || (Result = {}));
2624
+ function ok(value) {
2625
+ return new Ok(value);
2626
+ }
2627
+ function err(err) {
2628
+ return new Err(err);
2629
+ }
2630
+ var Ok = class {
2631
+ constructor(value) {
2632
+ this.value = value;
2633
+ }
2634
+ isOk() {
2635
+ return true;
2636
+ }
2637
+ isErr() {
2638
+ return !this.isOk();
2639
+ }
2640
+ map(f) {
2641
+ return ok(f(this.value));
2642
+ }
2643
+ mapErr(_f) {
2644
+ return ok(this.value);
2645
+ }
2646
+ andThen(f) {
2647
+ return f(this.value);
2648
+ }
2649
+ andThrough(f) {
2650
+ return f(this.value).map((_value) => this.value);
2651
+ }
2652
+ andTee(f) {
2653
+ try {
2654
+ f(this.value);
2655
+ } catch (e) {}
2656
+ return ok(this.value);
2657
+ }
2658
+ orTee(_f) {
2659
+ return ok(this.value);
2660
+ }
2661
+ orElse(_f) {
2662
+ return ok(this.value);
2663
+ }
2664
+ asyncAndThen(f) {
2665
+ return f(this.value);
2666
+ }
2667
+ asyncAndThrough(f) {
2668
+ return f(this.value).map(() => this.value);
2669
+ }
2670
+ asyncMap(f) {
2671
+ return ResultAsync.fromSafePromise(f(this.value));
2672
+ }
2673
+ unwrapOr(_v) {
2674
+ return this.value;
2675
+ }
2676
+ match(ok, _err) {
2677
+ return ok(this.value);
2678
+ }
2679
+ safeUnwrap() {
2680
+ const value = this.value;
2681
+ return (function* () {
2682
+ return value;
2683
+ })();
2684
+ }
2685
+ _unsafeUnwrap(_) {
2686
+ return this.value;
2687
+ }
2688
+ _unsafeUnwrapErr(config) {
2689
+ throw createNeverThrowError("Called `_unsafeUnwrapErr` on an Ok", this, config);
2690
+ }
2691
+ *[Symbol.iterator]() {
2692
+ return this.value;
2693
+ }
2694
+ };
2695
+ var Err = class {
2696
+ constructor(error) {
2697
+ this.error = error;
2698
+ }
2699
+ isOk() {
2700
+ return false;
2701
+ }
2702
+ isErr() {
2703
+ return !this.isOk();
2704
+ }
2705
+ map(_f) {
2706
+ return err(this.error);
2707
+ }
2708
+ mapErr(f) {
2709
+ return err(f(this.error));
2710
+ }
2711
+ andThrough(_f) {
2712
+ return err(this.error);
2713
+ }
2714
+ andTee(_f) {
2715
+ return err(this.error);
2716
+ }
2717
+ orTee(f) {
2718
+ try {
2719
+ f(this.error);
2720
+ } catch (e) {}
2721
+ return err(this.error);
2722
+ }
2723
+ andThen(_f) {
2724
+ return err(this.error);
2725
+ }
2726
+ orElse(f) {
2727
+ return f(this.error);
2728
+ }
2729
+ asyncAndThen(_f) {
2730
+ return errAsync(this.error);
2731
+ }
2732
+ asyncAndThrough(_f) {
2733
+ return errAsync(this.error);
2734
+ }
2735
+ asyncMap(_f) {
2736
+ return errAsync(this.error);
2737
+ }
2738
+ unwrapOr(v) {
2739
+ return v;
2740
+ }
2741
+ match(_ok, err) {
2742
+ return err(this.error);
2743
+ }
2744
+ safeUnwrap() {
2745
+ const error = this.error;
2746
+ return (function* () {
2747
+ yield err(error);
2748
+ throw new Error("Do not use this generator out of `safeTry`");
2749
+ })();
2750
+ }
2751
+ _unsafeUnwrap(config) {
2752
+ throw createNeverThrowError("Called `_unsafeUnwrap` on an Err", this, config);
2753
+ }
2754
+ _unsafeUnwrapErr(_) {
2755
+ return this.error;
2756
+ }
2757
+ *[Symbol.iterator]() {
2758
+ const self = this;
2759
+ yield self;
2760
+ return self;
2761
+ }
2762
+ };
2763
+ const fromThrowable = Result.fromThrowable;
2764
+ //#endregion
2765
+ //#region src/services/error/getResult.ts
2766
+ const getResult = (fn) => fromThrowable(fn, toAppError)();
2767
+ //#endregion
2768
+ //#region src/services/error/getResultAsync.ts
2769
+ const getResultAsync = (fn) => ResultAsync.fromPromise(Promise.resolve().then(fn), toAppError);
2770
+ //#endregion
2771
+ //#region src/services/error/withFinalizer.ts
2772
+ const withFinalizer = (fn, finalizer) => {
2773
+ const result = getResult(fn);
2774
+ (finalizer ? getResult(finalizer) : void 0)?.match(noop, (error) => {
2775
+ throw error;
2776
+ });
2777
+ return result.match((value) => value, (error) => {
2778
+ throw error;
2779
+ });
2780
+ };
2781
+ //#endregion
2782
+ //#region src/services/error/withFinalizerAsync.ts
2783
+ const withFinalizerAsync = async (fn, finalizer) => {
2784
+ const result = await getResultAsync(async () => fn());
2785
+ if (finalizer) await getResultAsync(async () => finalizer()).match(noop, (error) => {
2786
+ if (result.isOk()) throw error;
2787
+ console.error(error);
2788
+ });
2789
+ return result.match((value) => value, (error) => {
2790
+ throw error;
2791
+ });
2792
+ };
2793
+ //#endregion
2363
2794
  //#region src/services/message/constants.ts
2364
2795
  const MENTION_ID_ATTRIBUTE = "data-id";
2365
2796
  const MENTION_LABEL_ATTRIBUTE = "data-label";
@@ -2370,6 +2801,7 @@ const MENTION_EVERYONE_ID = "@everyone";
2370
2801
  //#endregion
2371
2802
  //#region ../../node_modules/.pnpm/he@1.2.0/node_modules/he/he.js
2372
2803
  var require_he = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2804
+ /*! https://mths.be/he v1.2.0 by @mathias | MIT license */
2373
2805
  (function(root) {
2374
2806
  var freeExports = typeof exports == "object" && exports;
2375
2807
  var freeModule = typeof module == "object" && module && module.exports == freeExports && module;
@@ -14385,17 +14817,17 @@ const isPlainObject = (data) => {
14385
14817
  };
14386
14818
  //#endregion
14387
14819
  //#region src/util/object/jsonDateParse.ts
14388
- const reISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.{0,1}\d*))(?:Z|(\+|-)([\d|:]*))?$/;
14389
- const reMsAjax = /^\/Date\((d|-|.*)\)[/|\\]$/;
14820
+ const ISO_DATE_REGEX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.{0,1}\d*))(?:Z|(\+|-)([\d|:]*))?$/u;
14821
+ const MS_AJAX_DATE_REGEX = /^\/Date\((-?\d+(?:[-+]\d+)?)\)[/\\]$/u;
14390
14822
  const jsonDateParse = (text) => JSON.parse(text, (_key, value) => {
14391
14823
  let parsedValue = value;
14392
14824
  if (typeof value === "string") {
14393
- let a = reISO.exec(value);
14825
+ let a = ISO_DATE_REGEX.exec(value);
14394
14826
  if (a) parsedValue = new Date(value);
14395
14827
  else {
14396
- a = reMsAjax.exec(value);
14828
+ a = MS_AJAX_DATE_REGEX.exec(value);
14397
14829
  if (a) {
14398
- const b = takeOne(a, 1).split(/[-+,.]/);
14830
+ const b = takeOne(a, 1).split(/[-+,.]/u);
14399
14831
  parsedValue = new Date(b[0] ? Number(b[0]) : 0 - Number(b[1]));
14400
14832
  }
14401
14833
  }
@@ -14407,11 +14839,14 @@ const jsonDateParse = (text) => JSON.parse(text, (_key, value) => {
14407
14839
  const mergeObjectsStrict = (...objects) => Object.assign({}, ...objects);
14408
14840
  //#endregion
14409
14841
  //#region src/util/regex/escapeRegExp.ts
14410
- const escapeRegExp = (string) => string.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
14842
+ const escapeRegExp = (string) => string.replaceAll(/[.*+?^${}()|[\]\\]/gu, String.raw`\$&`);
14411
14843
  //#endregion
14412
14844
  //#region src/util/text/capitalize.ts
14413
14845
  const capitalize = (string) => `${string.charAt(0).toUpperCase()}${string.slice(1)}`;
14414
14846
  //#endregion
14847
+ //#region src/util/text/normalizeString.ts
14848
+ const normalizeString = (value) => value?.trim() ?? "";
14849
+ //#endregion
14415
14850
  //#region src/util/text/streamToText.ts
14416
14851
  const streamToText = async (readable) => {
14417
14852
  readable.setEncoding("utf8");
@@ -14421,7 +14856,7 @@ const streamToText = async (readable) => {
14421
14856
  };
14422
14857
  //#endregion
14423
14858
  //#region src/util/text/toKebabCase.ts
14424
- const toKebabCase = (string) => string.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map((x) => x.toLowerCase()).join("-") ?? "";
14859
+ const toKebabCase = (string) => string.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/gu)?.map((x) => x.toLowerCase()).join("-") ?? "";
14425
14860
  //#endregion
14426
14861
  //#region src/util/text/truncate.ts
14427
14862
  const truncate = (string, length) => string.length > length ? `${string.slice(0, length)}..."` : string;
@@ -14458,9 +14893,9 @@ const exhaustiveGuard = (value) => {
14458
14893
  //#endregion
14459
14894
  //#region src/util/id/uuid/constants.ts
14460
14895
  const NIL = "00000000-0000-0000-0000-000000000000";
14461
- const UUIDV4_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
14896
+ const UUIDV4_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/iu;
14462
14897
  //#endregion
14463
14898
  //#region src/util/id/uuid/uuidValidateV4.ts
14464
14899
  const uuidValidateV4 = (uuid) => UUIDV4_REGEX.test(uuid);
14465
14900
  //#endregion
14466
- export { AllSpecialValues, ForbiddenError, ID_SEPARATOR, InvalidOperationError, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, NIL, NotFoundError, NotInitializedError, Operation, RoutePath, SITE_NAME, SURVEY_DISPLAY_NAME, Serializable, UUIDV4_REGEX, applyItemMetadataMixin, capitalize, createItemEntityTypeSchema, css, escapeRegExp, exhaustiveGuard, getIsServer, getMentions, getPropertyNames, getRawData, hrtime, html, isPlainObject, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, now, streamToText, takeOne, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4 };
14901
+ export { AllSpecialValues, ForbiddenError, ID_SEPARATOR, InvalidOperationError, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, NIL, NotFoundError, NotInitializedError, Operation, RoutePath, SITE_NAME, SURVEY_DISPLAY_NAME, Serializable, UUIDV4_REGEX, applyItemMetadataMixin, capitalize, createItemEntityTypeSchema, css, escapeRegExp, exhaustiveGuard, getIsServer, getMentions, getPropertyNames, getRawData, getResult, getResultAsync, hrtime, html, isPlainObject, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4, withFinalizer, withFinalizerAsync };