@esposter/shared 2.18.2 → 2.20.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 (3) hide show
  1. package/dist/index.d.ts +1553 -162
  2. package/dist/index.js +1115 -1129
  3. package/package.json +19 -17
package/dist/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { z } from "zod";
2
- import { HTMLElement } from "node-html-parser";
3
2
 
3
+ //#region src/test/constants.d.ts
4
+ declare const AllSpecialValues: {
5
+ isPlainObject: boolean;
6
+ value: unknown;
7
+ }[];
8
+ //#endregion
4
9
  //#region src/models/shared/Operation.d.ts
5
10
  declare enum Operation {
6
11
  Create = "Create",
@@ -8,7 +13,7 @@ declare enum Operation {
8
13
  Push = "Push",
9
14
  Read = "Read",
10
15
  Unshift = "Unshift",
11
- Update = "Update",
16
+ Update = "Update"
12
17
  }
13
18
  //#endregion
14
19
  //#region src/models/error/InvalidOperationError.d.ts
@@ -17,13 +22,13 @@ declare class InvalidOperationError extends Error {
17
22
  }
18
23
  //#endregion
19
24
  //#region src/models/error/NotFoundError.d.ts
20
- declare class NotFoundError<T$1 extends string = string> extends Error {
21
- constructor(name: T$1, id: string);
25
+ declare class NotFoundError<T extends string = string> extends Error {
26
+ constructor(name: T, id: string);
22
27
  }
23
28
  //#endregion
24
29
  //#region src/models/error/NotInitializedError.d.ts
25
- declare class NotInitializedError<T$1 extends string = string> extends Error {
26
- constructor(name: T$1);
30
+ declare class NotInitializedError<T extends string = string> extends Error {
31
+ constructor(name: T);
27
32
  }
28
33
  //#endregion
29
34
  //#region src/models/router/RoutePath.d.ts
@@ -39,6 +44,7 @@ declare const RoutePath: {
39
44
  readonly Dungeons: "/dungeons";
40
45
  readonly EmailEditor: "/email-editor";
41
46
  readonly FlowchartEditor: "/flowchart-editor";
47
+ readonly FluidSimulator: "/fluid-simulator";
42
48
  readonly Github: "https://github.com/Esposter/Esposter";
43
49
  readonly Index: "/";
44
50
  readonly Login: "/login";
@@ -58,7 +64,67 @@ declare const RoutePath: {
58
64
  };
59
65
  type RoutePath = typeof RoutePath;
60
66
  //#endregion
61
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/primitive.d.ts
67
+ //#region src/util/types/GetProperties.d.ts
68
+ type GetProperties<T, P extends string = "", D extends unknown[] = [unknown, unknown, unknown, unknown, unknown], R extends boolean = true> = [T] extends [never] ? never : D extends [] ? never : NonNullable<T> extends infer O ? O extends unknown[] ? GetArrayProps<O, P, D, R> : O extends object ? GetObjectProps<O, P, D, R> : GetPrimitiveProps<O, P, D, R> : never;
69
+ type GetArrayProps<T extends unknown[], P extends string, D extends unknown[], R extends boolean> = (D extends [unknown, ...infer Rest] ? GetProperties<T[number], R extends true ? `${P}[number]` : `${P}.[number]`, Rest, false> : never) | {
70
+ path: R extends true ? "length" : `${P}.length`;
71
+ value: T["length"];
72
+ };
73
+ type GetObjectProps<T, P extends string, D extends unknown[], R extends boolean> = { [K in keyof KnownKeys<T> & (number | string)]: K extends `${number}` ? never : NonNullable<T[K]> extends Function ? never : (D extends [unknown, ...infer Rest] ? GetProperties<T[K], R extends true ? `${K}` : `${P}.${K}`, Rest, false> : never) | {
74
+ path: R extends true ? `${K}` : `${P}.${K}`;
75
+ value: T[K];
76
+ } }[keyof KnownKeys<T> & (number | string)];
77
+ type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
78
+ path: R extends true ? "length" : `${P}.length`;
79
+ value: number;
80
+ } : T extends symbol ? (D extends [unknown, ...infer Rest] ? GetProperties<string | undefined, R extends true ? "description" : `${P}.description`, Rest, false> : never) | {
81
+ path: R extends true ? "description" : `${P}.description`;
82
+ value: string | undefined;
83
+ } : never;
84
+ type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K] };
85
+ //#endregion
86
+ //#region src/util/types/GetPaths.d.ts
87
+ type GetPaths<T> = GetProperties<T> extends infer U ? (U extends {
88
+ path: infer Path;
89
+ } ? Path : never) : never;
90
+ //#endregion
91
+ //#region src/util/types/PropertyNames.d.ts
92
+ type PropertyNames<T> = { [P in GetPaths<T>]: P };
93
+ //#endregion
94
+ //#region src/models/shared/ItemEntityType.d.ts
95
+ interface ItemEntityType<T extends string> {
96
+ type: T;
97
+ }
98
+ declare const ItemEntityTypePropertyNames: PropertyNames<ItemEntityType<string>>;
99
+ declare const createItemEntityTypeSchema: <T extends z.ZodType<string>>(schema: T) => z.ZodObject<{
100
+ type: T;
101
+ }>;
102
+ //#endregion
103
+ //#region src/models/shared/ItemMetadata.d.ts
104
+ declare class ItemMetadata {
105
+ createdAt: Date;
106
+ deletedAt: Date | null;
107
+ updatedAt: Date;
108
+ }
109
+ declare const ItemMetadataPropertyNames: PropertyNames<ItemMetadata>;
110
+ declare const itemMetadataSchema: z.ZodObject<{
111
+ createdAt: z.ZodDate;
112
+ deletedAt: z.ZodNullable<z.ZodDate>;
113
+ updatedAt: z.ZodDate;
114
+ }>;
115
+ //#endregion
116
+ //#region src/models/shared/Serializable.d.ts
117
+ declare abstract class Serializable {
118
+ toJSON(): this;
119
+ }
120
+ //#endregion
121
+ //#region src/models/shared/TakeOne.d.ts
122
+ interface TakeOne {
123
+ <T extends readonly unknown[]>(values: T, index?: number): T[number];
124
+ <T extends Record<PropertyKey, unknown>>(values: T, index: keyof T): T[keyof T];
125
+ }
126
+ //#endregion
127
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/primitive.d.ts
62
128
  /**
63
129
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
64
130
 
@@ -66,18 +132,18 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
66
132
  */
67
133
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
68
134
  //#endregion
69
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/basic.d.ts
135
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/basic.d.ts
70
136
  /**
71
137
  Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
72
138
 
73
139
  @category Class
74
140
  */
75
- type Class<T$1, Arguments extends unknown[] = any[]> = {
76
- prototype: Pick<T$1, keyof T$1>;
77
- new (...arguments_: Arguments): T$1;
141
+ type Class<T, Arguments extends unknown[] = any[]> = {
142
+ prototype: Pick<T, keyof T>;
143
+ new (...arguments_: Arguments): T;
78
144
  };
79
145
  //#endregion
80
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-any.d.ts
146
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-any.d.ts
81
147
  /**
82
148
  Returns a boolean for whether the given type is `any`.
83
149
 
@@ -106,9 +172,9 @@ const anyA = get(anyObject, 'a');
106
172
  @category Type Guard
107
173
  @category Utilities
108
174
  */
109
- type IsAny<T$1> = 0 extends 1 & NoInfer<T$1> ? true : false;
175
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
110
176
  //#endregion
111
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-optional-key-of.d.ts
177
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-optional-key-of.d.ts
112
178
  /**
113
179
  Returns a boolean for whether the given key is an optional key of type.
114
180
 
@@ -149,9 +215,9 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
149
215
  @category Type Guard
150
216
  @category Utilities
151
217
  */
152
- type IsOptionalKeyOf<Type extends object, Key$1 extends keyof Type> = IsAny<Type | Key$1> extends true ? never : Key$1 extends keyof Type ? Type extends Record<Key$1, Type[Key$1]> ? false : true : false;
218
+ type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
153
219
  //#endregion
154
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/optional-keys-of.d.ts
220
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/optional-keys-of.d.ts
155
221
  /**
156
222
  Extract all optional keys from the given type.
157
223
 
@@ -189,7 +255,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
189
255
  ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
190
256
  : never;
191
257
  //#endregion
192
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/required-keys-of.d.ts
258
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/required-keys-of.d.ts
193
259
  /**
194
260
  Extract all required keys from the given type.
195
261
 
@@ -223,7 +289,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
223
289
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
224
290
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
225
291
  //#endregion
226
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-never.d.ts
292
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-never.d.ts
227
293
  /**
228
294
  Returns a boolean for whether the given type is `never`.
229
295
 
@@ -264,22 +330,22 @@ type IsTrue<T> = T extends true ? true : false;
264
330
 
265
331
  // When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
266
332
  type A = IsTrue<never>;
267
- // ^? type A = never
333
+ //=> never
268
334
 
269
335
  // If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
270
336
  type IsTrueFixed<T> =
271
337
  IsNever<T> extends true ? false : T extends true ? true : false;
272
338
 
273
339
  type B = IsTrueFixed<never>;
274
- // ^? type B = false
340
+ //=> false
275
341
  ```
276
342
 
277
343
  @category Type Guard
278
344
  @category Utilities
279
345
  */
280
- type IsNever<T$1> = [T$1] extends [never] ? true : false;
346
+ type IsNever<T> = [T] extends [never] ? true : false;
281
347
  //#endregion
282
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/if.d.ts
348
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/if.d.ts
283
349
  /**
284
350
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
285
351
 
@@ -374,25 +440,445 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
374
440
  */
375
441
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
376
442
  //#endregion
377
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/internal/type.d.ts
443
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/unknown-array.d.ts
444
+ /**
445
+ Represents an array with `unknown` value.
446
+
447
+ Use case: You want a type that all arrays can be assigned to, but you don't care about the value.
448
+
449
+ @example
450
+ ```
451
+ import type {UnknownArray} from 'type-fest';
452
+
453
+ type IsArray<T> = T extends UnknownArray ? true : false;
454
+
455
+ type A = IsArray<['foo']>;
456
+ //=> true
457
+
458
+ type B = IsArray<readonly number[]>;
459
+ //=> true
460
+
461
+ type C = IsArray<string>;
462
+ //=> false
463
+ ```
464
+
465
+ @category Type
466
+ @category Array
467
+ */
468
+ type UnknownArray = readonly unknown[];
469
+ //#endregion
470
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/type.d.ts
471
+ /**
472
+ Returns a boolean for whether A is false.
473
+
474
+ @example
475
+ ```
476
+ type A = Not<true>;
477
+ //=> false
478
+
479
+ type B = Not<false>;
480
+ //=> true
481
+ ```
482
+ */
483
+ type Not<A extends boolean> = A extends true ? false : A extends false ? true : never;
484
+ /**
485
+ An if-else-like type that resolves depending on whether the given type is `any` or `never`.
486
+
487
+ @example
488
+ ```
489
+ // When `T` is a NOT `any` or `never` (like `string`) => Returns `IfNotAnyOrNever` branch
490
+ type A = IfNotAnyOrNever<string, 'VALID', 'IS_ANY', 'IS_NEVER'>;
491
+ //=> 'VALID'
492
+
493
+ // When `T` is `any` => Returns `IfAny` branch
494
+ type B = IfNotAnyOrNever<any, 'VALID', 'IS_ANY', 'IS_NEVER'>;
495
+ //=> 'IS_ANY'
496
+
497
+ // When `T` is `never` => Returns `IfNever` branch
498
+ type C = IfNotAnyOrNever<never, 'VALID', 'IS_ANY', 'IS_NEVER'>;
499
+ //=> 'IS_NEVER'
500
+ ```
501
+
502
+ Note: Wrapping a tail-recursive type with `IfNotAnyOrNever` makes the implementation non-tail-recursive. To fix this, move the recursion into a helper type. Refer to the following example:
503
+
504
+ @example
505
+ ```ts
506
+ import type {StringRepeat} from 'type-fest';
507
+
508
+ type NineHundredNinetyNineSpaces = StringRepeat<' ', 999>;
509
+
510
+ // The following implementation is not tail recursive
511
+ type TrimLeft<S extends string> = IfNotAnyOrNever<S, S extends ` ${infer R}` ? TrimLeft<R> : S>;
512
+
513
+ // Hence, instantiations with long strings will fail
514
+ // @ts-expect-error
515
+ type T1 = TrimLeft<NineHundredNinetyNineSpaces>;
516
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
517
+ // Error: Type instantiation is excessively deep and possibly infinite.
518
+
519
+ // To fix this, move the recursion into a helper type
520
+ type TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, _TrimLeftOptimised<S>>;
521
+
522
+ type _TrimLeftOptimised<S extends string> = S extends ` ${infer R}` ? _TrimLeftOptimised<R> : S;
523
+
524
+ type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
525
+ //=> ''
526
+ ```
527
+ */
528
+ type IfNotAnyOrNever<T, IfNotAnyOrNever, IfAny = any, IfNever = never> = If<IsAny<T>, IfAny, If<IsNever<T>, IfNever, IfNotAnyOrNever>>;
529
+ /**
530
+ Indicates the value of `exactOptionalPropertyTypes` compiler option.
531
+ */
532
+ type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?] ? false : true;
533
+ //#endregion
534
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/array.d.ts
535
+ /**
536
+ Transforms a tuple type by replacing it's rest element with a single element that has the same type as the rest element, while keeping all the non-rest elements intact.
537
+
538
+ @example
539
+ ```
540
+ type A = CollapseRestElement<[string, string, ...number[]]>;
541
+ //=> [string, string, number]
542
+
543
+ type B = CollapseRestElement<[...string[], number, number]>;
544
+ //=> [string, number, number]
545
+
546
+ type C = CollapseRestElement<[string, string, ...Array<number | bigint>]>;
547
+ //=> [string, string, number | bigint]
548
+
549
+ type D = CollapseRestElement<[string, number]>;
550
+ //=> [string, number]
551
+ ```
552
+
553
+ Note: Optional modifiers (`?`) are removed from elements unless the `exactOptionalPropertyTypes` compiler option is disabled. When disabled, there's an additional `| undefined` for optional elements.
554
+
555
+ @example
556
+ ```
557
+ // `exactOptionalPropertyTypes` enabled
558
+ type A = CollapseRestElement<[string?, string?, ...number[]]>;
559
+ //=> [string, string, number]
560
+
561
+ // `exactOptionalPropertyTypes` disabled
562
+ type B = CollapseRestElement<[string?, string?, ...number[]]>;
563
+ //=> [string | undefined, string | undefined, number]
564
+ ```
565
+ */
566
+ type CollapseRestElement<TArray extends UnknownArray> = IfNotAnyOrNever<TArray, _CollapseRestElement<TArray>>;
567
+ type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extends UnknownArray = [], BackwardAccumulator extends UnknownArray = []> = TArray extends UnknownArray // For distributing `TArray`
568
+ ? keyof TArray & `${number}` extends never // Enters this branch, if `TArray` is empty (e.g., []),
569
+ // or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
570
+ ? TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.
571
+ : TArray extends readonly [] ? [...ForwardAccumulator, ...BackwardAccumulator] : [...ForwardAccumulator, TArray[number], ...BackwardAccumulator] // Add the rest element between the accumulated elements.
572
+ : TArray extends readonly [(infer First)?, ...infer Rest] ? _CollapseRestElement<Rest, [...ForwardAccumulator, '0' extends OptionalKeysOf<TArray> ? If<IsExactOptionalPropertyTypesEnabled, First, First | undefined> // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.
573
+ : First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
574
+ : never; // Should never happen
575
+ //#endregion
576
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/characters.d.ts
577
+ type Whitespace = '\u{9}' // '\t'
578
+ | '\u{A}' // '\n'
579
+ | '\u{B}' // '\v'
580
+ | '\u{C}' // '\f'
581
+ | '\u{D}' // '\r'
582
+ | '\u{20}' // ' '
583
+ | '\u{85}' | '\u{A0}' | '\u{1680}' | '\u{2000}' | '\u{2001}' | '\u{2002}' | '\u{2003}' | '\u{2004}' | '\u{2005}' | '\u{2006}' | '\u{2007}' | '\u{2008}' | '\u{2009}' | '\u{200A}' | '\u{2028}' | '\u{2029}' | '\u{202F}' | '\u{205F}' | '\u{3000}' | '\u{FEFF}';
584
+ type WordSeparators = '-' | '_' | Whitespace;
585
+ type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~';
586
+ //#endregion
587
+ //#region ../../node_modules/.pnpm/tagged-tag@1.0.0/node_modules/tagged-tag/index.d.ts
588
+ declare const tag: unique symbol;
589
+ //#endregion
590
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/tagged.d.ts
591
+ // eslint-disable-next-line type-fest/require-exported-types
592
+ type TagContainer<Token> = {
593
+ readonly [tag]: Token;
594
+ };
595
+ type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{ [K in Token]: TagMetadata }>;
596
+ /**
597
+ Attach a "tag" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for distinct concepts in your program that should not be interchangeable, even if their runtime values have the same type. (See examples.)
598
+
599
+ A type returned by `Tagged` can be passed to `Tagged` again, to create a type with multiple tags.
600
+
601
+ [Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)
602
+
603
+ A tag's name is usually a string (and must be a string, number, or symbol), but each application of a tag can also contain an arbitrary type as its "metadata". See {@link GetTagMetadata} for examples and explanation.
604
+
605
+ A type `A` returned by `Tagged` is assignable to another type `B` returned by `Tagged` if and only if:
606
+ - the underlying (untagged) type of `A` is assignable to the underlying type of `B`;
607
+ - `A` contains at least all the tags `B` has;
608
+ - and the metadata type for each of `A`'s tags is assignable to the metadata type of `B`'s corresponding tag.
609
+
610
+ There have been several discussions about adding similar features to TypeScript. Unfortunately, nothing has (yet) moved forward:
611
+ - [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)
612
+ - [Microsoft/TypeScript#4895](https://github.com/microsoft/TypeScript/issues/4895)
613
+ - [Microsoft/TypeScript#33290](https://github.com/microsoft/TypeScript/pull/33290)
614
+
615
+ @example
616
+ ```
617
+ import type {Tagged} from 'type-fest';
618
+
619
+ type AccountNumber = Tagged<number, 'AccountNumber'>;
620
+ type AccountBalance = Tagged<number, 'AccountBalance'>;
621
+
622
+ function createAccountNumber(): AccountNumber {
623
+ // As you can see, casting from a `number` (the underlying type being tagged) is allowed.
624
+ return 2 as AccountNumber;
625
+ }
626
+
627
+ declare function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance;
628
+
629
+ // This will compile successfully.
630
+ getMoneyForAccount(createAccountNumber());
631
+
632
+ // But this won't, because it has to be explicitly passed as an `AccountNumber` type!
633
+ // Critically, you could not accidentally use an `AccountBalance` as an `AccountNumber`.
634
+ // @ts-expect-error
635
+ getMoneyForAccount(2);
636
+
637
+ // You can also use tagged values like their underlying, untagged type.
638
+ // I.e., this will compile successfully because an `AccountNumber` can be used as a regular `number`.
639
+ // In this sense, the underlying base type is not hidden, which differentiates tagged types from opaque types in other languages.
640
+ const accountNumber = createAccountNumber() + 2;
641
+ ```
642
+
643
+ @example
644
+ ```
645
+ import type {Tagged} from 'type-fest';
646
+
647
+ // You can apply multiple tags to a type by using `Tagged` repeatedly.
648
+ type Url = Tagged<string, 'URL'>;
649
+ type SpecialCacheKey = Tagged<Url, 'SpecialCacheKey'>;
650
+
651
+ // You can also pass a union of tag names, so this is equivalent to the above, although it doesn't give you the ability to assign distinct metadata to each tag.
652
+ type SpecialCacheKey2 = Tagged<string, 'URL' | 'SpecialCacheKey'>;
653
+ ```
654
+
655
+ @category Type
656
+ */
657
+ type Tagged<Type, TagName extends PropertyKey, TagMetadata = never> = Type & Tag<TagName, TagMetadata>;
658
+ /**
659
+ Revert a tagged type back to its original type by removing all tags.
660
+
661
+ Why is this necessary?
662
+
663
+ 1. Use a `Tagged` type as object keys
664
+ 2. Prevent TS4058 error: "Return type of exported function has or is using name X from external module Y but cannot be named"
665
+
666
+ @example
667
+ ```
668
+ import type {Tagged, UnwrapTagged} from 'type-fest';
669
+
670
+ type AccountType = Tagged<'SAVINGS' | 'CHECKING', 'AccountType'>;
671
+
672
+ const moneyByAccountType: Record<UnwrapTagged<AccountType>, number> = {
673
+ SAVINGS: 99,
674
+ CHECKING: 0.1,
675
+ };
676
+
677
+ // Without UnwrapTagged, the following expression would throw a type error.
678
+ const money = moneyByAccountType.SAVINGS; // TS error: Property 'SAVINGS' does not exist
679
+
680
+ // Attempting to pass a non-Tagged type to UnwrapTagged will raise a type error.
681
+ // @ts-expect-error
682
+ type WontWork = UnwrapTagged<string>;
683
+ ```
684
+
685
+ @category Type
686
+ */
687
+ type UnwrapTagged<TaggedType extends Tag<PropertyKey, any>> = RemoveAllTags<TaggedType>;
688
+ type RemoveAllTags<T> = T extends Tag<PropertyKey, any> ? { [ThisTag in keyof T[typeof tag]]: T extends Tagged<infer Type, ThisTag, T[typeof tag][ThisTag]> ? RemoveAllTags<Type> : never }[keyof T[typeof tag]] : T;
689
+ /**
690
+ Note: The `Opaque` type is deprecated in favor of `Tagged`.
691
+
692
+ Attach a "tag" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for runtime values that would otherwise have the same type. (See examples.)
693
+
694
+ The generic type parameters can be anything.
695
+
696
+ Note that `Opaque` is somewhat of a misnomer here, in that, unlike [some alternative implementations](https://github.com/microsoft/TypeScript/issues/4895#issuecomment-425132582), the original, untagged type is not actually hidden. (E.g., functions that accept the untagged type can still be called with the "opaque" version -- but not vice-versa.)
697
+
698
+ Also note that this implementation is limited to a single tag. If you want to allow multiple tags, use `Tagged` instead.
699
+
700
+ [Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)
701
+
702
+ There have been several discussions about adding similar features to TypeScript. Unfortunately, nothing has (yet) moved forward:
703
+ - [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)
704
+ - [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408)
705
+ - [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807)
706
+
707
+ @example
708
+ ```
709
+ import type {Opaque} from 'type-fest';
710
+
711
+ type AccountNumber = Opaque<number, 'AccountNumber'>;
712
+ type AccountBalance = Opaque<number, 'AccountBalance'>;
713
+
714
+ // The `Token` parameter allows the compiler to differentiate between types, whereas "unknown" will not. For example, consider the following structures:
715
+ type ThingOne = Opaque<string>;
716
+ type ThingTwo = Opaque<string>;
717
+
718
+ // To the compiler, these types are allowed to be cast to each other as they have the same underlying type. They are both `string & { __opaque__: unknown }`.
719
+ // To avoid this behaviour, you would instead pass the "Token" parameter, like so.
720
+ type NewThingOne = Opaque<string, 'ThingOne'>;
721
+ type NewThingTwo = Opaque<string, 'ThingTwo'>;
722
+
723
+ // Now they're completely separate types, so the following will fail to compile.
724
+ function createNewThingOne(): NewThingOne {
725
+ // As you can see, casting from a string is still allowed. However, you may not cast NewThingOne to NewThingTwo, and vice versa.
726
+ return 'new thing one' as NewThingOne;
727
+ }
728
+
729
+ // This will fail to compile, as they are fundamentally different types.
730
+ // @ts-expect-error
731
+ const thingTwo = createNewThingOne() as NewThingTwo;
732
+
733
+ // Here's another example of opaque typing.
734
+ function createAccountNumber(): AccountNumber {
735
+ return 2 as AccountNumber;
736
+ }
737
+
738
+ declare function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance;
739
+
740
+ // This will compile successfully.
741
+ getMoneyForAccount(createAccountNumber());
742
+
743
+ // But this won't, because it has to be explicitly passed as an `AccountNumber` type.
744
+ // @ts-expect-error
745
+ getMoneyForAccount(2);
746
+
747
+ // You can use opaque values like they aren't opaque too.
748
+ const accountNumber = createAccountNumber();
749
+
750
+ // This will compile successfully.
751
+ const newAccountNumber = accountNumber + 2;
752
+
753
+ // As a side note, you can (and should) use recursive types for your opaque types to make them stronger and hopefully easier to type.
754
+ type Person = {
755
+ id: Opaque<number, Person>;
756
+ name: string;
757
+ };
758
+ ```
759
+
760
+ @category Type
761
+ @deprecated Use {@link Tagged} instead
762
+ */
763
+ //#endregion
764
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-literal.d.ts
765
+ /**
766
+ Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
767
+
768
+ Useful for:
769
+ - providing strongly-typed string manipulation functions
770
+ - constraining strings to be a string literal
771
+ - type utilities, such as when constructing parsers and ASTs
772
+
773
+ The implementation of this type is inspired by the trick mentioned in this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
774
+
775
+ @example
776
+ ```
777
+ import type {IsStringLiteral} from 'type-fest';
778
+
779
+ type CapitalizedString<T extends string> = IsStringLiteral<T> extends true ? Capitalize<T> : string;
780
+
781
+ // https://github.com/yankeeinlondon/native-dash/blob/master/src/capitalize.ts
782
+ function capitalize<T extends Readonly<string>>(input: T): CapitalizedString<T> {
783
+ return (input.slice(0, 1).toUpperCase() + input.slice(1)) as CapitalizedString<T>;
784
+ }
785
+
786
+ const output = capitalize('hello, world!');
787
+ //=> 'Hello, world!'
788
+ ```
789
+
790
+ @example
791
+ ```
792
+ // String types with infinite set of possible values return `false`.
793
+
794
+ import type {IsStringLiteral} from 'type-fest';
795
+
796
+ type AllUppercaseStrings = IsStringLiteral<Uppercase<string>>;
797
+ //=> false
798
+
799
+ type StringsStartingWithOn = IsStringLiteral<`on${string}`>;
800
+ //=> false
801
+
802
+ // This behaviour is particularly useful in string manipulation utilities, as infinite string types often require separate handling.
803
+
804
+ type Length<S extends string, Counter extends never[] = []> =
805
+ IsStringLiteral<S> extends false
806
+ ? number // return `number` for infinite string types
807
+ : S extends `${string}${infer Tail}`
808
+ ? Length<Tail, [...Counter, never]>
809
+ : Counter['length'];
810
+
811
+ type L1 = Length<Lowercase<string>>;
812
+ //=> number
813
+
814
+ type L2 = Length<`${number}`>;
815
+ //=> number
816
+ ```
817
+
818
+ @category Type Guard
819
+ @category Utilities
820
+ */
821
+ type IsStringLiteral<S> = IfNotAnyOrNever<S, _IsStringLiteral<CollapseLiterals<S extends TagContainer<any> ? UnwrapTagged<S> : S>>, false, false>;
822
+ type _IsStringLiteral<S> = // If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
823
+ // and since `{}` extends index signatures, the result becomes `false`.
824
+ S extends string ? {} extends Record<S, never> ? false : true : false;
825
+ //#endregion
826
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/trim.d.ts
827
+ /**
828
+ Remove spaces from the left side.
829
+ */
830
+ type TrimLeft<V extends string> = V extends `${Whitespace}${infer R}` ? TrimLeft<R> : V;
831
+ /**
832
+ Remove spaces from the right side.
833
+ */
834
+ type TrimRight<V extends string> = V extends `${infer R}${Whitespace}` ? TrimRight<R> : V;
378
835
  /**
379
- Matches any primitive, `void`, `Date`, or `RegExp` value.
836
+ Remove leading and trailing spaces from a string.
837
+
838
+ @example
839
+ ```
840
+ import type {Trim} from 'type-fest';
841
+
842
+ type Example = Trim<' foo '>;
843
+ //=> 'foo'
844
+ ```
845
+
846
+ @category String
847
+ @category Template literal
380
848
  */
381
- type BuiltIns = Primitive | void | Date | RegExp;
849
+ type Trim<V extends string> = TrimLeft<TrimRight<V>>;
850
+ //#endregion
851
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/string.d.ts
382
852
  /**
383
- Test if the given function has multiple call signatures.
853
+ Returns a boolean for whether the given string `S` starts with the given string `SearchString`.
854
+
855
+ @example
856
+ ```
857
+ type A = StartsWith<'abcde', 'abc'>;
858
+ //=> true
859
+
860
+ type B = StartsWith<'abcde', 'bc'>;
861
+ //=> false
862
+
863
+ type C = StartsWith<string, 'bc'>;
864
+ //=> never
865
+
866
+ type D = StartsWith<'abcde', string>;
867
+ //=> never
868
+ ```
384
869
 
385
- Needed to handle the case of a single call signature with properties.
870
+ @category String
871
+ @category Template literal
872
+ */
873
+ type StartsWith<S extends string, SearchString extends string> = string extends S | SearchString ? never : S extends `${SearchString}${infer T}` ? true : false;
874
+ /**
875
+ Returns a boolean for whether the string is numeric.
386
876
 
387
- Multiple call signatures cannot currently be supported due to a TypeScript limitation.
388
- @see https://github.com/microsoft/TypeScript/issues/29732
877
+ This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/microsoft/TypeScript/issues/46109#issuecomment-930307987).
389
878
  */
390
- type HasMultipleCallSignatures<T$1 extends (...arguments_: any[]) => unknown> = T$1 extends {
391
- (...arguments_: infer A): unknown;
392
- (...arguments_: infer B): unknown;
393
- } ? B extends A ? A extends B ? false : true : true : false;
879
+ type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? true : false : false;
394
880
  //#endregion
395
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/simplify.d.ts
881
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/simplify.d.ts
396
882
  /**
397
883
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
398
884
 
@@ -451,9 +937,9 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
451
937
  @see {@link SimplifyDeep}
452
938
  @category Object
453
939
  */
454
- type Simplify<T$1> = { [KeyType in keyof T$1]: T$1[KeyType] } & {};
940
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
455
941
  //#endregion
456
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-equal.d.ts
942
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-equal.d.ts
457
943
  /**
458
944
  Returns a boolean for whether the two given types are equal.
459
945
 
@@ -484,7 +970,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
484
970
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
485
971
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
486
972
  //#endregion
487
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/omit-index-signature.d.ts
973
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/omit-index-signature.d.ts
488
974
  /**
489
975
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
490
976
 
@@ -504,7 +990,7 @@ const indexed: Record<string, unknown> = {}; // Allowed
504
990
 
505
991
  // @ts-expect-error
506
992
  const keyed: Record<'foo', unknown> = {}; // Error
507
- // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
993
+ // TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
508
994
  ```
509
995
 
510
996
  Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
@@ -513,12 +999,16 @@ Instead of causing a type error like the above, you can also use a [conditional
513
999
  type Indexed = {} extends Record<string, unknown>
514
1000
  ? '✅ `{}` is assignable to `Record<string, unknown>`'
515
1001
  : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
516
- // => '✅ `{}` is assignable to `Record<string, unknown>`'
1002
+
1003
+ type IndexedResult = Indexed;
1004
+ //=> '✅ `{}` is assignable to `Record<string, unknown>`'
517
1005
 
518
1006
  type Keyed = {} extends Record<'foo' | 'bar', unknown>
519
1007
  ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
520
1008
  : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
521
- // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
1009
+
1010
+ type KeyedResult = Keyed;
1011
+ //=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
522
1012
  ```
523
1013
 
524
1014
  Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
@@ -566,7 +1056,7 @@ type Example = {
566
1056
  };
567
1057
 
568
1058
  type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
569
- // => { foo: 'bar'; qux?: 'baz' | undefined; }
1059
+ //=> {foo: 'bar'; qux?: 'baz'}
570
1060
  ```
571
1061
 
572
1062
  @see {@link PickIndexSignature}
@@ -574,7 +1064,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
574
1064
  */
575
1065
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
576
1066
  //#endregion
577
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/pick-index-signature.d.ts
1067
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/pick-index-signature.d.ts
578
1068
  /**
579
1069
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
580
1070
 
@@ -622,13 +1112,37 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
622
1112
  */
623
1113
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
624
1114
  //#endregion
625
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/merge.d.ts
1115
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/merge.d.ts
626
1116
  // Merges two objects without worrying about index signatures.
627
- type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
628
-
1117
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
629
1118
  /**
630
1119
  Merge two types into a new type. Keys of the second type overrides keys of the first type.
631
1120
 
1121
+ This is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`.
1122
+
1123
+ @example
1124
+ ```
1125
+ import type {Merge} from 'type-fest';
1126
+
1127
+ type Foo = {
1128
+ a: string;
1129
+ b: number;
1130
+ };
1131
+
1132
+ type Bar = {
1133
+ a: number; // Conflicts with Foo['a']
1134
+ c: boolean;
1135
+ };
1136
+
1137
+ // With `&`, `a` becomes `string & number` which is `never`. Not what you want.
1138
+ type WithIntersection = (Foo & Bar)['a'];
1139
+ //=> never
1140
+
1141
+ // With `Merge`, `a` is cleanly overridden to `number`.
1142
+ type WithMerge = Merge<Foo, Bar>['a'];
1143
+ //=> number
1144
+ ```
1145
+
632
1146
  @example
633
1147
  ```
634
1148
  import type {Merge} from 'type-fest';
@@ -648,7 +1162,7 @@ type Bar = {
648
1162
  };
649
1163
 
650
1164
  export type FooBar = Merge<Foo, Bar>;
651
- // => {
1165
+ //=> {
652
1166
  // [x: string]: unknown;
653
1167
  // [x: number]: number;
654
1168
  // [x: symbol]: unknown;
@@ -658,11 +1172,19 @@ export type FooBar = Merge<Foo, Bar>;
658
1172
  // }
659
1173
  ```
660
1174
 
1175
+ Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
1176
+
1177
+ @see {@link ObjectMerge}
661
1178
  @category Object
662
1179
  */
663
- type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
1180
+ type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
1181
+ ? Source extends unknown // For distributing `Source`
1182
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
1183
+ : never;
1184
+ // Should never happen
1185
+ type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
664
1186
  //#endregion
665
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/internal/object.d.ts
1187
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/object.d.ts
666
1188
  /**
667
1189
  Merges user specified options with default options.
668
1190
 
@@ -716,18 +1238,366 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
716
1238
  ```
717
1239
  */
718
1240
  type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
719
- //#endregion
720
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/except.d.ts
1241
+ // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
721
1242
  /**
722
- Filter out keys from an object.
1243
+ Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
723
1244
 
724
- Returns `never` if `Exclude` is strictly equal to `Key`.
725
- Returns `never` if `Key` extends `Exclude`.
726
- Returns `Key` otherwise.
1245
+ Note: This doesn't collapse literals within tagged types. For example, `CollapseLiterals<Tagged<'foo' | (string & {}), 'Tag'>>` returns `("foo" & Tag<"Tag", never>) | (string & Tag<"Tag", never>)` and not `string & Tag<"Tag", never>`.
1246
+
1247
+ Use-case: For collapsing unions created using {@link LiteralUnion}.
727
1248
 
728
1249
  @example
729
1250
  ```
730
- type Filtered = Filter<'foo', 'foo'>;
1251
+ import type {LiteralUnion} from 'type-fest';
1252
+
1253
+ type A = CollapseLiterals<'foo' | 'bar' | (string & {})>;
1254
+ //=> string
1255
+
1256
+ type B = CollapseLiterals<LiteralUnion<1 | 2 | 3, number>>;
1257
+ //=> number
1258
+
1259
+ type C = CollapseLiterals<LiteralUnion<'onClick' | 'onChange', `on${string}`>>;
1260
+ //=> `on${string}`
1261
+
1262
+ type D = CollapseLiterals<'click' | 'change' | (`on${string}` & {})>;
1263
+ //=> 'click' | 'change' | `on${string}`
1264
+
1265
+ type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined>;
1266
+ //=> string | null | undefined
1267
+ ```
1268
+ */
1269
+ type CollapseLiterals<T> = {} extends T ? T : T extends infer U & {} ? U : T;
1270
+ //#endregion
1271
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/some-extend.d.ts
1272
+ /**
1273
+ @see {@link SomeExtend}
1274
+ */
1275
+ type SomeExtendOptions = {
1276
+ /**
1277
+ Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1278
+ - When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
1279
+ - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1280
+ @default true
1281
+ @example
1282
+ ```
1283
+ import type {SomeExtend} from 'type-fest';
1284
+ type A = SomeExtend<[1, 2, never], string, {strictNever: true}>;
1285
+ //=> false
1286
+ type B = SomeExtend<[1, 2, never], string, {strictNever: false}>;
1287
+ //=> true
1288
+ type C = SomeExtend<[1, never], never, {strictNever: true}>;
1289
+ //=> true
1290
+ type D = SomeExtend<[1, never], never, {strictNever: false}>;
1291
+ //=> true
1292
+ type E = SomeExtend<[never], any, {strictNever: true}>;
1293
+ //=> true
1294
+ type F = SomeExtend<[never], any, {strictNever: false}>;
1295
+ //=> true
1296
+ ```
1297
+ */
1298
+ strictNever?: boolean;
1299
+ };
1300
+ type DefaultSomeExtendOptions = {
1301
+ strictNever: true;
1302
+ };
1303
+ /**
1304
+ Returns a boolean for whether some element in an array type extends another type.
1305
+
1306
+ @example
1307
+ ```
1308
+ import type {SomeExtend} from 'type-fest';
1309
+
1310
+ type A = SomeExtend<['1', '2', 3], number>;
1311
+ //=> true
1312
+
1313
+ type B = SomeExtend<[1, 2, 3], string>;
1314
+ //=> false
1315
+
1316
+ type C = SomeExtend<[string, number | string], number>;
1317
+ //=> boolean
1318
+
1319
+ type D = SomeExtend<[true, boolean, true], false>;
1320
+ //=> boolean
1321
+ ```
1322
+
1323
+ Note: Behaviour of optional elements depend on the `exactOptionalPropertyTypes` compiler option. When the option is disabled, the target type must include `undefined` for a successful match.
1324
+
1325
+ ```
1326
+ // @exactOptionalPropertyTypes: true
1327
+ import type {SomeExtend} from 'type-fest';
1328
+
1329
+ type A = SomeExtend<[1?, 2?, '3'?], string>;
1330
+ //=> true
1331
+ ```
1332
+
1333
+ ```
1334
+ // @exactOptionalPropertyTypes: false
1335
+ import type {SomeExtend} from 'type-fest';
1336
+
1337
+ type A = SomeExtend<[1?, 2?, '3'?], string>;
1338
+ //=> boolean
1339
+
1340
+ type B = SomeExtend<[1?, 2?, '3'?], string | undefined>;
1341
+ //=> true
1342
+ ```
1343
+
1344
+ @see {@link SomeExtendOptions}
1345
+
1346
+ @category Utilities
1347
+ @category Array
1348
+ */
1349
+ type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> = _SomeExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<SomeExtendOptions, DefaultSomeExtendOptions, Options>>;
1350
+ type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
1351
+ ? true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false, false, false>;
1352
+ //#endregion
1353
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/or-all.d.ts
1354
+ /**
1355
+ Returns a boolean for whether any of the given elements is `true`.
1356
+
1357
+ Use-cases:
1358
+ - Check if at least one condition in a list of booleans is met.
1359
+
1360
+ @example
1361
+ ```
1362
+ import type {OrAll} from 'type-fest';
1363
+
1364
+ type FFT = OrAll<[false, false, true]>;
1365
+ //=> true
1366
+
1367
+ type FFF = OrAll<[false, false, false]>;
1368
+ //=> false
1369
+ ```
1370
+
1371
+ Note: When `boolean` is passed as an element, it is distributed into separate cases, and the final result is a union of those cases.
1372
+ For example, `OrAll<[false, boolean]>` expands to `OrAll<[false, true]> | OrAll<[false, false]>`, which simplifies to `true | false` (i.e., `boolean`).
1373
+
1374
+ @example
1375
+ ```
1376
+ import type {OrAll} from 'type-fest';
1377
+
1378
+ type A = OrAll<[false, boolean]>;
1379
+ //=> boolean
1380
+
1381
+ type B = OrAll<[true, boolean]>;
1382
+ //=> true
1383
+ ```
1384
+
1385
+ Note: If `never` is passed as an element, it is treated as `false` and the result is computed accordingly.
1386
+
1387
+ @example
1388
+ ```
1389
+ import type {OrAll} from 'type-fest';
1390
+
1391
+ type A = OrAll<[never, never, true]>;
1392
+ //=> true
1393
+
1394
+ type B = OrAll<[never, never, false]>;
1395
+ //=> false
1396
+
1397
+ type C = OrAll<[never, never, never]>;
1398
+ //=> false
1399
+
1400
+ type D = OrAll<[never, never, boolean]>;
1401
+ //=> boolean
1402
+ ```
1403
+
1404
+ Note: If `any` is passed as an element, it is treated as `boolean` and the result is computed accordingly.
1405
+
1406
+ @example
1407
+ ```
1408
+ import type {OrAll} from 'type-fest';
1409
+
1410
+ type A = OrAll<[false, any]>;
1411
+ //=> boolean
1412
+
1413
+ type B = OrAll<[true, any]>;
1414
+ //=> true
1415
+ ```
1416
+
1417
+ Note: `OrAll<[]>` evaluates to `false` because there are no `true` elements in an empty tuple. See [Wikipedia: Clause (logic) > Empty clauses](https://en.wikipedia.org/wiki/Clause_(logic)#Empty_clauses:~:text=The%20truth%20evaluation%20of%20an%20empty%20disjunctive%20clause%20is%20always%20false.).
1418
+
1419
+ @see {@link Or}
1420
+ @see {@link AndAll}
1421
+ */
1422
+ type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;
1423
+ //#endregion
1424
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/or.d.ts
1425
+ /**
1426
+ Returns a boolean for whether either of two given types is true.
1427
+
1428
+ Use-case: Constructing complex conditional types where at least one condition must be satisfied.
1429
+
1430
+ @example
1431
+ ```
1432
+ import type {Or} from 'type-fest';
1433
+
1434
+ type TT = Or<true, true>;
1435
+ //=> true
1436
+
1437
+ type TF = Or<true, false>;
1438
+ //=> true
1439
+
1440
+ type FT = Or<false, true>;
1441
+ //=> true
1442
+
1443
+ type FF = Or<false, false>;
1444
+ //=> false
1445
+ ```
1446
+
1447
+ Note: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.
1448
+ For example, `Or<false, boolean>` expands to `Or<false, true> | Or<false, false>`, which simplifies to `true | false` (i.e., `boolean`).
1449
+
1450
+ @example
1451
+ ```
1452
+ import type {Or} from 'type-fest';
1453
+
1454
+ type A = Or<false, boolean>;
1455
+ //=> boolean
1456
+
1457
+ type B = Or<boolean, false>;
1458
+ //=> boolean
1459
+
1460
+ type C = Or<true, boolean>;
1461
+ //=> true
1462
+
1463
+ type D = Or<boolean, true>;
1464
+ //=> true
1465
+
1466
+ type E = Or<boolean, boolean>;
1467
+ //=> boolean
1468
+ ```
1469
+
1470
+ Note: If `never` is passed as an argument, it is treated as `false` and the result is computed accordingly.
1471
+
1472
+ @example
1473
+ ```
1474
+ import type {Or} from 'type-fest';
1475
+
1476
+ type A = Or<true, never>;
1477
+ //=> true
1478
+
1479
+ type B = Or<never, true>;
1480
+ //=> true
1481
+
1482
+ type C = Or<false, never>;
1483
+ //=> false
1484
+
1485
+ type D = Or<never, false>;
1486
+ //=> false
1487
+
1488
+ type E = Or<boolean, never>;
1489
+ //=> boolean
1490
+
1491
+ type F = Or<never, boolean>;
1492
+ //=> boolean
1493
+
1494
+ type G = Or<never, never>;
1495
+ //=> false
1496
+ ```
1497
+
1498
+ @see {@link OrAll}
1499
+ @see {@link And}
1500
+ @see {@link Xor}
1501
+ */
1502
+ type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;
1503
+ //#endregion
1504
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/all-extend.d.ts
1505
+ /**
1506
+ @see {@link AllExtend}
1507
+ */
1508
+ type AllExtendOptions = {
1509
+ /**
1510
+ Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1511
+ - When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
1512
+ - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1513
+ @default true
1514
+ @example
1515
+ ```
1516
+ import type {AllExtend} from 'type-fest';
1517
+ type A = AllExtend<[1, 2, never], number, {strictNever: true}>;
1518
+ //=> false
1519
+ type B = AllExtend<[1, 2, never], number, {strictNever: false}>;
1520
+ //=> true
1521
+ type C = AllExtend<[never, never], never, {strictNever: true}>;
1522
+ //=> true
1523
+ type D = AllExtend<[never, never], never, {strictNever: false}>;
1524
+ //=> true
1525
+ type E = AllExtend<['a', 'b', never], any, {strictNever: true}>;
1526
+ //=> true
1527
+ type F = AllExtend<['a', 'b', never], any, {strictNever: false}>;
1528
+ //=> true
1529
+ type G = AllExtend<[never, 1], never, {strictNever: true}>;
1530
+ //=> false
1531
+ type H = AllExtend<[never, 1], never, {strictNever: false}>;
1532
+ //=> false
1533
+ ```
1534
+ */
1535
+ strictNever?: boolean;
1536
+ };
1537
+ type DefaultAllExtendOptions = {
1538
+ strictNever: true;
1539
+ };
1540
+ /**
1541
+ Returns a boolean for whether every element in an array type extends another type.
1542
+
1543
+ @example
1544
+ ```
1545
+ import type {AllExtend} from 'type-fest';
1546
+
1547
+ type A = AllExtend<[1, 2, 3], number>;
1548
+ //=> true
1549
+
1550
+ type B = AllExtend<[1, 2, '3'], number>;
1551
+ //=> false
1552
+
1553
+ type C = AllExtend<[number, number | string], number>;
1554
+ //=> boolean
1555
+
1556
+ type D = AllExtend<[true, boolean, true], true>;
1557
+ //=> boolean
1558
+ ```
1559
+
1560
+ Note: Behaviour of optional elements depend on the `exactOptionalPropertyTypes` compiler option. When the option is disabled, the target type must include `undefined` for a successful match.
1561
+
1562
+ ```
1563
+ // @exactOptionalPropertyTypes: true
1564
+ import type {AllExtend} from 'type-fest';
1565
+
1566
+ type A = AllExtend<[1?, 2?, 3?], number>;
1567
+ //=> true
1568
+ ```
1569
+
1570
+ ```
1571
+ // @exactOptionalPropertyTypes: false
1572
+ import type {AllExtend} from 'type-fest';
1573
+
1574
+ type A = AllExtend<[1?, 2?, 3?], number>;
1575
+ //=> boolean
1576
+
1577
+ type B = AllExtend<[1?, 2?, 3?], number | undefined>;
1578
+ //=> true
1579
+ ```
1580
+
1581
+ @see {@link AllExtendOptions}
1582
+
1583
+ @category Utilities
1584
+ @category Array
1585
+ */
1586
+ type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> = _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
1587
+ type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
1588
+ ? _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true, false, false>;
1589
+ //#endregion
1590
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/except.d.ts
1591
+ /**
1592
+ Filter out keys from an object.
1593
+
1594
+ Returns `never` if `Exclude` is strictly equal to `Key`.
1595
+ Returns `never` if `Key` extends `Exclude`.
1596
+ Returns `Key` otherwise.
1597
+
1598
+ @example
1599
+ ```
1600
+ type Filtered = Filter<'foo', 'foo'>;
731
1601
  //=> never
732
1602
  ```
733
1603
 
@@ -745,7 +1615,7 @@ type Filtered = Filter<'bar', 'foo'>;
745
1615
 
746
1616
  @see {Except}
747
1617
  */
748
- type Filter<KeyType$1, ExcludeType> = IsEqual<KeyType$1, ExcludeType> extends true ? never : (KeyType$1 extends ExcludeType ? never : KeyType$1);
1618
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
749
1619
  type ExceptOptions = {
750
1620
  /**
751
1621
  Disallow assigning non-specified properties.
@@ -757,7 +1627,6 @@ type ExceptOptions = {
757
1627
  type DefaultExceptOptions = {
758
1628
  requireExactProps: false;
759
1629
  };
760
-
761
1630
  /**
762
1631
  Create a type from an object type without certain keys.
763
1632
 
@@ -781,14 +1650,14 @@ type FooWithoutA = Except<Foo, 'a'>;
781
1650
 
782
1651
  // @ts-expect-error
783
1652
  const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
784
- //=> errors: 'a' does not exist in type '{ b: string; }'
1653
+ // errors: 'a' does not exist in type '{ b: string; }'
785
1654
 
786
1655
  type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
787
- //=> {a: number} & Partial<Record<"b", never>>
1656
+ //=> {a: number} & Partial<Record<'b', never>>
788
1657
 
789
1658
  // @ts-expect-error
790
1659
  const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
791
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1660
+ // errors at 'b': Type 'string' is not assignable to type 'undefined'.
792
1661
 
793
1662
  // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
794
1663
 
@@ -803,12 +1672,12 @@ type UserData = {
803
1672
 
804
1673
  // `Omit` clearly doesn't behave as expected in this case:
805
1674
  type PostPayload = Omit<UserData, 'email'>;
806
- //=> { [x: string]: string; [x: number]: string; }
1675
+ //=> {[x: string]: string; [x: number]: string}
807
1676
 
808
1677
  // In situations like this, `Except` works better.
809
1678
  // It simply removes the `email` key while preserving all the other keys.
810
1679
  type PostPayloadFixed = Except<UserData, 'email'>;
811
- //=> { [x: string]: string; name: string; role: 'admin' | 'user'; }
1680
+ //=> {[x: string]: string; name: string; role: 'admin' | 'user'}
812
1681
  ```
813
1682
 
814
1683
  @category Object
@@ -816,98 +1685,324 @@ type PostPayloadFixed = Except<UserData, 'email'>;
816
1685
  type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
817
1686
  type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
818
1687
  //#endregion
819
- //#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/required-deep.d.ts
1688
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-lowercase.d.ts
820
1689
  /**
821
- Create a type from another type with all keys and nested keys set to required.
1690
+ Returns a boolean for whether the given string literal is lowercase.
822
1691
 
823
- Use-cases:
824
- - Creating optional configuration interfaces where the underlying implementation still requires all options to be fully specified.
825
- - Modeling the resulting type after a deep merge with a set of defaults.
1692
+ @example
1693
+ ```
1694
+ import type {IsLowercase} from 'type-fest';
1695
+
1696
+ type A = IsLowercase<'abc'>;
1697
+ //=> true
1698
+
1699
+ type B = IsLowercase<'Abc'>;
1700
+ //=> false
1701
+
1702
+ type C = IsLowercase<string>;
1703
+ //=> boolean
1704
+ ```
1705
+ */
1706
+ type IsLowercase<S extends string> = AllExtend<_IsLowercase<S>, true>;
1707
+ /**
1708
+ Loops through each part in the string and returns a boolean array indicating whether each part is lowercase.
1709
+ */
1710
+ type _IsLowercase<S extends string, Accumulator extends boolean[] = []> = S extends `${infer First}${infer Rest}` ? _IsLowercase<Rest, [...Accumulator, IsLowercaseHelper<First>]> : [...Accumulator, IsLowercaseHelper<S>];
1711
+ /**
1712
+ Returns a boolean for whether an individual part of the string is lowercase.
1713
+ */
1714
+ type IsLowercaseHelper<S extends string> = S extends Lowercase<string> ? true : S extends Uppercase<string> | Capitalize<string> | `${string}${Uppercase<string>}${string}` ? false : boolean;
1715
+ //#endregion
1716
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-uppercase.d.ts
1717
+ /**
1718
+ Returns a boolean for whether the given string literal is uppercase.
826
1719
 
827
1720
  @example
828
1721
  ```
829
- import type {RequiredDeep} from 'type-fest';
1722
+ import type {IsUppercase} from 'type-fest';
1723
+
1724
+ type A = IsUppercase<'ABC'>;
1725
+ //=> true
1726
+
1727
+ type B = IsUppercase<'Abc'>;
1728
+ //=> false
1729
+
1730
+ type C = IsUppercase<string>;
1731
+ //=> boolean
1732
+ ```
1733
+ */
1734
+ type IsUppercase<S extends string> = AllExtend<_IsUppercase<S>, true>;
1735
+ /**
1736
+ Loops through each part in the string and returns a boolean array indicating whether each part is uppercase.
1737
+ */
1738
+ type _IsUppercase<S extends string, Accumulator extends boolean[] = []> = S extends `${infer First}${infer Rest}` ? _IsUppercase<Rest, [...Accumulator, IsUppercaseHelper<First>]> : [...Accumulator, IsUppercaseHelper<S>];
1739
+ /**
1740
+ Returns a boolean for whether an individual part of the string is uppercase.
1741
+ */
1742
+ type IsUppercaseHelper<S extends string> = S extends Uppercase<string> ? true : S extends Lowercase<string> | Uncapitalize<string> | `${string}${Lowercase<string>}${string}` ? false : boolean;
1743
+ //#endregion
1744
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/words.d.ts
1745
+ type SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];
1746
+ type RemoveLastCharacter<Sentence extends string, Character extends string> = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord<LeftSide> : never;
1747
+ /**
1748
+ Words options.
830
1749
 
831
- type Settings = {
832
- textEditor?: {
833
- fontSize?: number;
834
- fontColor?: string;
835
- fontWeight?: number | undefined;
836
- };
837
- autocomplete?: boolean;
838
- autosave?: boolean | undefined;
1750
+ @see {@link Words}
1751
+ */
1752
+ type WordsOptions = {
1753
+ /**
1754
+ Split on numeric sequence.
1755
+ @default true
1756
+ @example
1757
+ ```
1758
+ import type {Words} from 'type-fest';
1759
+ type Example1 = Words<'p2pNetwork', {splitOnNumbers: true}>;
1760
+ //=> ['p', '2', 'p', 'Network']
1761
+ type Example2 = Words<'p2pNetwork', {splitOnNumbers: false}>;
1762
+ //=> ['p2p', 'Network']
1763
+ ```
1764
+ */
1765
+ splitOnNumbers?: boolean;
839
1766
  };
1767
+ type _DefaultWordsOptions = {
1768
+ splitOnNumbers: true;
1769
+ };
1770
+ /**
1771
+ Split a string (almost) like Lodash's `_.words()` function.
840
1772
 
841
- type RequiredSettings = RequiredDeep<Settings>;
842
- //=> {
843
- // textEditor: {
844
- // fontSize: number;
845
- // fontColor: string;
846
- // fontWeight: number | undefined;
847
- // };
848
- // autocomplete: boolean;
849
- // autosave: boolean | undefined;
850
- // }
1773
+ - Split on each word that begins with a capital letter.
1774
+ - Split on each {@link WordSeparators}.
1775
+ - Split on numeric sequence.
1776
+
1777
+ @example
851
1778
  ```
1779
+ import type {Words} from 'type-fest';
852
1780
 
853
- Note that types containing overloaded functions are not made deeply required due to a [TypeScript limitation](https://github.com/microsoft/TypeScript/issues/29732).
1781
+ type Words0 = Words<'helloWorld'>;
1782
+ //=> ['hello', 'World']
854
1783
 
855
- @category Utilities
856
- @category Object
857
- @category Array
858
- @category Set
859
- @category Map
1784
+ type Words1 = Words<'helloWORLD'>;
1785
+ //=> ['hello', 'WORLD']
1786
+
1787
+ type Words2 = Words<'hello-world'>;
1788
+ //=> ['hello', 'world']
1789
+
1790
+ type Words3 = Words<'--hello the_world'>;
1791
+ //=> ['hello', 'the', 'world']
1792
+
1793
+ type Words4 = Words<'lifeIs42'>;
1794
+ //=> ['life', 'Is', '42']
1795
+
1796
+ type Words5 = Words<'p2pNetwork', {splitOnNumbers: false}>;
1797
+ //=> ['p2p', 'Network']
1798
+ ```
1799
+
1800
+ @category Change case
1801
+ @category Template literal
860
1802
  */
861
- type RequiredDeep<T$1> = T$1 extends BuiltIns ? T$1 : T$1 extends Map<infer KeyType, infer ValueType> ? Map<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T$1 extends Set<infer ItemType> ? Set<RequiredDeep<ItemType>> : T$1 extends ReadonlyMap<infer KeyType, infer ValueType> ? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T$1 extends ReadonlySet<infer ItemType> ? ReadonlySet<RequiredDeep<ItemType>> : T$1 extends WeakMap<infer KeyType, infer ValueType> ? WeakMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T$1 extends WeakSet<infer ItemType> ? WeakSet<RequiredDeep<ItemType>> : T$1 extends Promise<infer ValueType> ? Promise<RequiredDeep<ValueType>> : T$1 extends ((...arguments_: any[]) => unknown) ? IsNever<keyof T$1> extends true ? T$1 : HasMultipleCallSignatures<T$1> extends true ? T$1 : ((...arguments_: Parameters<T$1>) => ReturnType<T$1>) & RequiredObjectDeep<T$1> : T$1 extends object ? RequiredObjectDeep<T$1> : unknown;
862
- type RequiredObjectDeep<ObjectType extends object> = { [KeyType in keyof ObjectType]-?: RequiredDeep<ObjectType[KeyType]> };
863
- //#endregion
864
- //#region src/util/types/PropertyNames.d.ts
865
- type PropertyNames<T$1> = RequiredDeep<{ [P in keyof T$1]: P }>;
866
- //#endregion
867
- //#region src/models/shared/ItemEntityType.d.ts
868
- interface ItemEntityType<T$1 extends string> {
869
- type: T$1;
870
- }
871
- declare const ItemEntityTypePropertyNames: PropertyNames<ItemEntityType<string>>;
872
- declare const createItemEntityTypeSchema: <T$1 extends z.ZodType<string>>(schema: T$1) => z.ZodObject<{
873
- type: T$1;
874
- }>;
1803
+ type Words<Sentence extends string, Options extends WordsOptions = {}> = WordsImplementation<Sentence, ApplyDefaultOptions<WordsOptions, _DefaultWordsOptions, Options>>;
1804
+ type WordsImplementation<Sentence extends string, Options extends Required<WordsOptions>, LastCharacter extends string = '', CurrentWord extends string = ''> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}` ? FirstCharacter extends WordSeparators // Skip word separator
1805
+ ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options>] : LastCharacter extends '' // Fist char of word
1806
+ ? WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter> // Case change: non-numeric to numeric
1807
+ : [false, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true // Split on number: push word
1808
+ ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] // No split on number: concat word
1809
+ : WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> // Case change: numeric to non-numeric
1810
+ : [true, false] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true // Split on number: push word
1811
+ ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] // No split on number: concat word
1812
+ : WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> // No case change: concat word
1813
+ : [true, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> // Case change: lower to upper, push word
1814
+ : [true, true] extends [IsLowercase<LastCharacter>, IsUppercase<FirstCharacter>] ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] // Case change: upper to lower, brings back the last character, push word
1815
+ : [true, true] extends [IsUppercase<LastCharacter>, IsLowercase<FirstCharacter>] ? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${LastCharacter}${FirstCharacter}`>] // No case change: concat word
1816
+ : WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
1817
+ //#endregion
1818
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/remove-prefix.d.ts
1819
+ /**
1820
+ @see {@link RemovePrefix}
1821
+ */
1822
+ type RemovePrefixOptions = {
1823
+ /**
1824
+ When enabled, instantiations with non-literal prefixes (e.g., `string`, `Uppercase<string>`, `` `on${string}` ``) simply return `string`, since their precise structure cannot be statically determined.
1825
+ Note: Disabling this option can produce misleading results that might not reflect the actual runtime behavior.
1826
+ For example, ``RemovePrefix<'on-change', `${string}-`, {strict: false}>`` returns `'change'`, but at runtime, prefix could be `'handle-'` (which satisfies `` `${string}-` ``) and removing `'handle-'` from `'on-change'` would not result in `'change'`.
1827
+ So, it is recommended to not disable this option unless you are aware of the implications.
1828
+ @default true
1829
+ @example
1830
+ ```
1831
+ import type {RemovePrefix} from 'type-fest';
1832
+ type A = RemovePrefix<'on-change', `${string}-`, {strict: true}>;
1833
+ //=> string
1834
+ type B = RemovePrefix<'on-change', `${string}-`, {strict: false}>;
1835
+ //=> 'change'
1836
+ type C = RemovePrefix<'on-change', string, {strict: true}>;
1837
+ //=> string
1838
+ type D = RemovePrefix<'on-change', string, {strict: false}>;
1839
+ //=> 'n-change'
1840
+ type E = RemovePrefix<`${string}/${number}`, `${string}/`, {strict: true}>;
1841
+ //=> string
1842
+ type F = RemovePrefix<`${string}/${number}`, `${string}/`, {strict: false}>;
1843
+ //=> `${number}`
1844
+ ```
1845
+ Note: This option has no effect when only the input string type is non-literal. For example, ``RemovePrefix<`on-${string}`, 'on-'>`` will always return `string`.
1846
+ @example
1847
+ ```
1848
+ import type {RemovePrefix} from 'type-fest';
1849
+ type A = RemovePrefix<`on-${string}`, 'on-', {strict: true}>;
1850
+ //=> string
1851
+ type B = RemovePrefix<`on-${string}`, 'on-', {strict: false}>;
1852
+ //=> string
1853
+ type C = RemovePrefix<`id-${number}`, 'id-', {strict: true}>;
1854
+ //=> `${number}`
1855
+ type D = RemovePrefix<`id-${number}`, 'id-', {strict: false}>;
1856
+ //=> `${number}`
1857
+ ```
1858
+ Note: If it can be statically determined that the input string can never start with the specified non-literal prefix, then the input string is returned as-is, regardless of the value of this option.
1859
+ For example, ``RemovePrefix<`${string}/${number}`, `${string}:`>`` returns `` `${string}/${number}` ``, since a string of type `` `${string}/${number}` `` can never start with a prefix of type `` `${string}:` ``.
1860
+ ```
1861
+ import type {RemovePrefix} from 'type-fest';
1862
+ type A = RemovePrefix<`${string}/${number}`, `${string}:`, {strict: true}>;
1863
+ //=> `${string}/${number}`
1864
+ type B = RemovePrefix<`${string}/${number}`, `${string}:`, {strict: false}>;
1865
+ //=> `${string}/${number}`
1866
+ type C = RemovePrefix<'on-change', `${number}-`, {strict: true}>;
1867
+ //=> 'on-change'
1868
+ type D = RemovePrefix<'on-change', `${number}-`, {strict: false}>;
1869
+ //=> 'on-change'
1870
+ ```
1871
+ */
1872
+ strict?: boolean;
1873
+ };
1874
+ type DefaultRemovePrefixOptions = {
1875
+ strict: true;
1876
+ };
1877
+ /**
1878
+ Remove the specified prefix from the start of a string.
1879
+
1880
+ @example
1881
+ ```
1882
+ import type {RemovePrefix} from 'type-fest';
1883
+
1884
+ type A = RemovePrefix<'on-change', 'on-'>;
1885
+ //=> 'change'
1886
+
1887
+ type B = RemovePrefix<'sm:flex' | 'sm:p-4' | 'sm:gap-2', 'sm:'>;
1888
+ //=> 'flex' | 'p-4' | 'gap-2'
1889
+
1890
+ type C = RemovePrefix<'on-change', 'off-'>;
1891
+ //=> 'on-change'
1892
+
1893
+ type D = RemovePrefix<`handle${Capitalize<string>}`, 'handle'>;
1894
+ //=> Capitalize<string>
1895
+ ```
1896
+
1897
+ @see {@link RemovePrefixOptions}
1898
+
1899
+ @category String
1900
+ @category Template literal
1901
+ */
1902
+ type RemovePrefix<S extends string, Prefix extends string, Options extends RemovePrefixOptions = {}> = IfNotAnyOrNever<S, IfNotAnyOrNever<Prefix, _RemovePrefix<S, Prefix, ApplyDefaultOptions<RemovePrefixOptions, DefaultRemovePrefixOptions, Options>>, string, S>>;
1903
+ type _RemovePrefix<S extends string, Prefix extends string, Options extends Required<RemovePrefixOptions>> = Prefix extends string // For distributing `Prefix`
1904
+ ? S extends `${Prefix}${infer Rest}` ? Or<IsStringLiteral<Prefix>, Not<Options['strict']>> extends true ? Rest : string // Fallback to `string` when `Prefix` is non-literal and `strict` is disabled
1905
+ : S // Return back `S` when `Prefix` is not present at the start of `S`
1906
+ : never;
875
1907
  //#endregion
876
- //#region src/models/shared/ItemMetadata.d.ts
877
- declare class ItemMetadata {
878
- createdAt: Date;
879
- deletedAt: Date | null;
880
- updatedAt: Date;
881
- }
882
- declare const ItemMetadataPropertyNames: PropertyNames<ItemMetadata>;
883
- declare const itemMetadataSchema: z.ZodObject<{
884
- createdAt: z.ZodDate;
885
- deletedAt: z.ZodNullable<z.ZodDate>;
886
- updatedAt: z.ZodDate;
1908
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/delimiter-case.d.ts
1909
+ type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {
1910
+ splitOnNumbers: false;
887
1911
  }>;
1912
+ /**
1913
+ Convert an array of words to delimiter case starting with a delimiter with input capitalization.
1914
+ */
1915
+ type DelimiterCaseFromArray<Words extends string[], Delimiter extends string, OutputString extends string = ''> = Words extends [infer FirstWord extends string, ...infer RemainingWords extends string[]] ? DelimiterCaseFromArray<RemainingWords, Delimiter, `${OutputString}${StartsWith<FirstWord, AsciiPunctuation> extends true ? '' : Delimiter}${FirstWord}`> : OutputString;
1916
+ /**
1917
+ Convert a string literal to a custom string delimiter casing.
1918
+
1919
+ This can be useful when, for example, converting a camel-cased object property to an oddly cased one.
1920
+
1921
+ @see {@link KebabCase}
1922
+ @see {@link SnakeCase}
1923
+
1924
+ @example
1925
+ ```
1926
+ import type {DelimiterCase} from 'type-fest';
1927
+
1928
+ // Simple
1929
+
1930
+ const someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar';
1931
+ const someVariableNoSplitOnNumbers: DelimiterCase<'p2pNetwork', '#', {splitOnNumbers: false}> = 'p2p#network';
1932
+
1933
+ // Advanced
1934
+
1935
+ type OddlyCasedProperties<T> = {
1936
+ [K in keyof T as DelimiterCase<K, '#'>]: T[K]
1937
+ };
1938
+
1939
+ type SomeOptions = {
1940
+ dryRun: boolean;
1941
+ includeFile: string;
1942
+ foo: number;
1943
+ };
1944
+
1945
+ const rawCliOptions: OddlyCasedProperties<SomeOptions> = {
1946
+ 'dry#run': true,
1947
+ 'include#file': 'bar.js',
1948
+ foo: 123,
1949
+ };
1950
+ ```
1951
+
1952
+ @category Change case
1953
+ @category Template literal
1954
+ */
1955
+ type DelimiterCase<Value, Delimiter extends string, Options extends WordsOptions = {}> = Value extends string ? IsStringLiteral<Value> extends false ? Value : Lowercase<RemovePrefix<DelimiterCaseFromArray<Words<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>, Delimiter>, string, {
1956
+ strict: false;
1957
+ }>> : Value;
888
1958
  //#endregion
889
- //#region src/models/shared/Serializable.d.ts
890
- declare abstract class Serializable {
891
- toJSON(): string;
892
- }
893
- //#endregion
894
- //#region src/util/types/DeepOmitArray.d.ts
895
- type DeepOmitArray<TArray extends unknown[], TKey> = { [P in keyof TArray]: DeepOmit<TArray[P], TKey> };
1959
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/kebab-case.d.ts
1960
+ /**
1961
+ Convert a string literal to kebab-case.
1962
+
1963
+ This can be useful when, for example, converting a camel-cased object property to a kebab-cased CSS class name or a command-line flag.
1964
+
1965
+ @example
1966
+ ```
1967
+ import type {KebabCase} from 'type-fest';
1968
+
1969
+ // Simple
1970
+
1971
+ const someVariable: KebabCase<'fooBar'> = 'foo-bar';
1972
+ const someVariableNoSplitOnNumbers: KebabCase<'p2pNetwork', {splitOnNumbers: false}> = 'p2p-network';
1973
+
1974
+ // Advanced
1975
+
1976
+ type KebabCasedProperties<T> = {
1977
+ [K in keyof T as KebabCase<K>]: T[K]
1978
+ };
1979
+
1980
+ type CliOptions = {
1981
+ dryRun: boolean;
1982
+ includeFile: string;
1983
+ foo: number;
1984
+ };
1985
+
1986
+ const rawCliOptions: KebabCasedProperties<CliOptions> = {
1987
+ 'dry-run': true,
1988
+ 'include-file': 'bar.js',
1989
+ foo: 123,
1990
+ };
1991
+ ```
1992
+
1993
+ @category Change case
1994
+ @category Template literal
1995
+ */
1996
+ type KebabCase<Value, Options extends WordsOptions = {}> = DelimiterCase<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;
896
1997
  //#endregion
897
1998
  //#region src/util/types/DeepOmit.d.ts
898
- type DeepOmit<T$1, TKey> = T$1 extends Primitive ? T$1 : { [P in Exclude<keyof T$1, TKey>]: T$1[P] extends infer TP ? TP extends Date | Function | Primitive ? TP : TP extends unknown[] ? DeepOmitArray<TP, TKey> : Record<string, unknown> extends TP ? TP : DeepOmit<TP, TKey> : never };
899
- //#endregion
900
- //#region src/util/types/DeepOptionalProperties.d.ts
901
- type DeepOptionalProperties<T$1> = { [K in keyof T$1 as undefined extends T$1[K] ? K : never]?: DeepOptionalProperties<T$1[K]> };
902
- //#endregion
903
- //#region src/util/types/DeepRequiredProperties.d.ts
904
- type DeepRequiredProperties<T$1> = { [K in keyof T$1 as undefined extends T$1[K] ? never : K]: DeepRequiredProperties<T$1[K]> };
1999
+ type DeepOmit<T, TKey extends PropertyKey> = [T] extends [Date | Function | Primitive] ? T : [Record<string, unknown>] extends [T] ? T : T extends object ? T extends unknown[] ? T extends readonly unknown[] ? { [K in keyof T]: DeepOmit<T[K], TKey> } : DeepOmit<T[number], TKey>[] : { [P in keyof T as P extends TKey ? never : P]: DeepOmit<T[P], TKey> } : T;
905
2000
  //#endregion
906
2001
  //#region src/util/types/DeepOptionalUndefined.d.ts
907
- type DeepOptionalUndefined<T$1> = T$1 extends ((...args: unknown[]) => unknown) ? T$1 : T$1 extends (infer U)[] ? DeepOptionalUndefined<U>[] : T$1 extends readonly (infer U)[] ? readonly DeepOptionalUndefined<U>[] : T$1 extends Date ? T$1 : T$1 extends object ? keyof T$1 extends never ? never : DeepOptionalProperties<T$1> extends Record<never, unknown> ? DeepRequiredProperties<T$1> : DeepRequiredProperties<T$1> extends Record<never, unknown> ? DeepOptionalProperties<T$1> : DeepOptionalProperties<T$1> & DeepRequiredProperties<T$1> : T$1;
2002
+ type DeepOptionalUndefined<T> = T extends Date | Function | Primitive ? T : T extends unknown[] ? { [K in keyof T]: DeepOptionalUndefined<T[K]> } : T extends object ? { [K in keyof T as undefined extends T[K] ? K : never]?: DeepOptionalUndefined<T[K]> } & { [K in keyof T as undefined extends T[K] ? never : K]: DeepOptionalUndefined<T[K]> } extends infer O ? { [K in keyof O]: O[K] } : never : T;
908
2003
  //#endregion
909
2004
  //#region src/models/shared/ToData.d.ts
910
- type ToData<T$1 extends Serializable> = DeepOptionalUndefined<DeepOmit<T$1, "toJSON">>;
2005
+ type ToData<T> = DeepOptionalUndefined<DeepOmit<T, "toJSON">>;
911
2006
  //#endregion
912
2007
  //#region src/models/shared/WithMetadata.d.ts
913
2008
  interface WithMetadata<TBase extends Class<NonNullable<unknown>>> {
@@ -924,6 +2019,305 @@ declare const MENTION_LABEL_ATTRIBUTE = "data-label";
924
2019
  declare const MENTION_TYPE_ATTRIBUTE = "data-type";
925
2020
  declare const MENTION_TYPE = "mention";
926
2021
  //#endregion
2022
+ //#region ../../node_modules/.pnpm/node-html-parser@7.1.0/node_modules/node-html-parser/dist/void-tag.d.ts
2023
+ declare class VoidTag {
2024
+ addClosingSlash: boolean;
2025
+ private voidTags;
2026
+ constructor(addClosingSlash?: boolean, tags?: string[]);
2027
+ formatNode(tag: string, attrs: string, innerHTML: string): string;
2028
+ isVoidElement(tag: string): boolean;
2029
+ }
2030
+ //#endregion
2031
+ //#region ../../node_modules/.pnpm/node-html-parser@7.1.0/node_modules/node-html-parser/dist/nodes/type.d.ts
2032
+ declare enum NodeType {
2033
+ ELEMENT_NODE = 1,
2034
+ TEXT_NODE = 3,
2035
+ COMMENT_NODE = 8
2036
+ }
2037
+ //#endregion
2038
+ //#region ../../node_modules/.pnpm/node-html-parser@7.1.0/node_modules/node-html-parser/dist/nodes/node.d.ts
2039
+ /**
2040
+ * Node Class as base class for TextNode and HTMLElement.
2041
+ */
2042
+ declare abstract class Node {
2043
+ parentNode: HTMLElement;
2044
+ abstract rawTagName: string;
2045
+ abstract nodeType: NodeType;
2046
+ childNodes: Node[];
2047
+ range: readonly [number, number];
2048
+ abstract text: string;
2049
+ abstract rawText: string;
2050
+ abstract toString(): string;
2051
+ abstract clone(): Node;
2052
+ constructor(parentNode?: HTMLElement, range?: [number, number]);
2053
+ /**
2054
+ * Remove current node
2055
+ */
2056
+ remove(): this;
2057
+ get innerText(): string;
2058
+ get textContent(): string;
2059
+ set textContent(val: string);
2060
+ }
2061
+ //#endregion
2062
+ //#region ../../node_modules/.pnpm/node-html-parser@7.1.0/node_modules/node-html-parser/dist/nodes/html.d.ts
2063
+ interface KeyAttributes {
2064
+ id?: string;
2065
+ class?: string;
2066
+ }
2067
+ interface Attributes {
2068
+ [key: string]: string;
2069
+ }
2070
+ interface RawAttributes {
2071
+ [key: string]: string;
2072
+ }
2073
+ type InsertPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
2074
+ type NodeInsertable = Node | string;
2075
+ declare class DOMTokenList {
2076
+ private _set;
2077
+ private _afterUpdate;
2078
+ private _validate;
2079
+ constructor(valuesInit?: string[], afterUpdate?: (t: DOMTokenList) => void);
2080
+ add(c: string): void;
2081
+ replace(c1: string, c2: string): void;
2082
+ remove(c: string): void;
2083
+ toggle(c: string): void;
2084
+ contains(c: string): boolean;
2085
+ get length(): number;
2086
+ values(): IterableIterator<string>;
2087
+ get value(): string[];
2088
+ toString(): string;
2089
+ }
2090
+ /**
2091
+ * HTMLElement, which contains a set of children.
2092
+ *
2093
+ * Note: this is a minimalist implementation, no complete tree
2094
+ * structure provided (no parentNode, nextSibling,
2095
+ * previousSibling etc).
2096
+ * @class HTMLElement
2097
+ * @extends {Node}
2098
+ */
2099
+ declare class HTMLElement extends Node {
2100
+ rawAttrs: string;
2101
+ private voidTag;
2102
+ private _attrs;
2103
+ private _rawAttrs;
2104
+ private _parseOptions;
2105
+ private _id;
2106
+ rawTagName: string;
2107
+ classList: DOMTokenList;
2108
+ /**
2109
+ * Node Type declaration.
2110
+ */
2111
+ nodeType: NodeType;
2112
+ /**
2113
+ * Quote attribute values
2114
+ * @param attr attribute value
2115
+ * @returns {string} quoted value
2116
+ */
2117
+ private quoteAttribute;
2118
+ /**
2119
+ * Creates an instance of HTMLElement.
2120
+ * @param keyAttrs id and class attribute
2121
+ * @param [rawAttrs] attributes in string
2122
+ *
2123
+ * @memberof HTMLElement
2124
+ */
2125
+ constructor(tagName: string, keyAttrs: KeyAttributes, rawAttrs?: string, parentNode?: HTMLElement, range?: [number, number], voidTag?: VoidTag, _parseOptions?: Partial<Options>);
2126
+ /**
2127
+ * Remove Child element from childNodes array
2128
+ * @param {HTMLElement} node node to remove
2129
+ */
2130
+ removeChild(node: Node): this;
2131
+ /**
2132
+ * Exchanges given child with new child
2133
+ * @param {HTMLElement} oldNode node to exchange
2134
+ * @param {HTMLElement} newNode new node
2135
+ */
2136
+ exchangeChild(oldNode: Node, newNode: Node): this;
2137
+ get tagName(): string;
2138
+ set tagName(newname: string);
2139
+ get localName(): string;
2140
+ get isVoidElement(): boolean;
2141
+ get id(): string;
2142
+ set id(newid: string);
2143
+ /**
2144
+ * Get escpaed (as-it) text value of current node and its children.
2145
+ * @return {string} text content
2146
+ */
2147
+ get rawText(): string;
2148
+ get textContent(): string;
2149
+ set textContent(val: string);
2150
+ /**
2151
+ * Get unescaped text value of current node and its children.
2152
+ * @return {string} text content
2153
+ */
2154
+ get text(): string;
2155
+ /**
2156
+ * Get structured Text (with '\n' etc.)
2157
+ * @return {string} structured text
2158
+ */
2159
+ get structuredText(): string;
2160
+ toString(): string;
2161
+ get innerHTML(): string;
2162
+ set innerHTML(content: string);
2163
+ set_content(content: string | Node | Node[], options?: Partial<Options>): this;
2164
+ replaceWith(...nodes: (string | Node)[]): this;
2165
+ get outerHTML(): string;
2166
+ /**
2167
+ * Trim element from right (in block) after seeing pattern in a TextNode.
2168
+ * @param {RegExp} pattern pattern to find
2169
+ * @return {HTMLElement} reference to current node
2170
+ */
2171
+ trimRight(pattern: RegExp): this;
2172
+ /**
2173
+ * Get DOM structure
2174
+ * @return {string} structure
2175
+ */
2176
+ get structure(): string;
2177
+ /**
2178
+ * Remove whitespaces in this sub tree.
2179
+ * @return {HTMLElement} pointer to this
2180
+ */
2181
+ removeWhitespace(): this;
2182
+ /**
2183
+ * Query CSS selector to find matching nodes.
2184
+ * @param {string} selector Simplified CSS selector
2185
+ * @return {HTMLElement[]} matching elements
2186
+ */
2187
+ querySelectorAll(selector: string): HTMLElement[];
2188
+ /**
2189
+ * Query CSS Selector to find matching node.
2190
+ * @param {string} selector Simplified CSS selector
2191
+ * @return {(HTMLElement|null)} matching node
2192
+ */
2193
+ querySelector(selector: string): HTMLElement | null;
2194
+ /**
2195
+ * Tests whether the node matches a given CSS selector.
2196
+ * @param {string} selector Simplified CSS selector
2197
+ * @return {boolean}
2198
+ */
2199
+ matches(selector: string): boolean;
2200
+ /**
2201
+ * find elements by their tagName
2202
+ * @param {string} tagName the tagName of the elements to select
2203
+ */
2204
+ getElementsByTagName(tagName: string): Array<HTMLElement>;
2205
+ /**
2206
+ * find element by it's id
2207
+ * @param {string} id the id of the element to select
2208
+ * @returns {HTMLElement | null} the element with the given id or null if not found
2209
+ */
2210
+ getElementById(id: string): HTMLElement | null;
2211
+ /**
2212
+ * traverses the Element and its parents (heading toward the document root) until it finds a node that matches the provided selector string. Will return itself or the matching ancestor. If no such element exists, it returns null.
2213
+ * @param selector a DOMString containing a selector list
2214
+ * @returns {HTMLElement | null} the element with the given id or null if not found
2215
+ */
2216
+ closest(selector: string): HTMLElement | null;
2217
+ /**
2218
+ * Append a child node to childNodes
2219
+ * @param {Node} node node to append
2220
+ * @return {Node} node appended
2221
+ */
2222
+ appendChild<T extends Node = Node>(node: T): T;
2223
+ /**
2224
+ * Get attributes
2225
+ * @access private
2226
+ * @return {Object} parsed and unescaped attributes
2227
+ */
2228
+ get attrs(): Attributes;
2229
+ get attributes(): Record<string, string>;
2230
+ /**
2231
+ * Get escaped (as-is) attributes
2232
+ * @return {Object} parsed attributes
2233
+ */
2234
+ get rawAttributes(): RawAttributes;
2235
+ removeAttribute(key: string): this;
2236
+ hasAttribute(key: string): boolean;
2237
+ /**
2238
+ * Get an attribute
2239
+ * @return {string | undefined} value of the attribute; or undefined if not exist
2240
+ */
2241
+ getAttribute(key: string): string | undefined;
2242
+ /**
2243
+ * Set an attribute value to the HTMLElement
2244
+ * @param {string} key The attribute name
2245
+ * @param {string} value The value to set, or null / undefined to remove an attribute
2246
+ */
2247
+ setAttribute(key: string, value: string): this;
2248
+ /**
2249
+ * Replace all the attributes of the HTMLElement by the provided attributes
2250
+ * @param {Attributes} attributes the new attribute set
2251
+ */
2252
+ setAttributes(attributes: Attributes): this;
2253
+ insertAdjacentHTML(where: InsertPosition, html: string): this;
2254
+ /** Prepend nodes or strings to this node's children. */
2255
+ prepend(...insertable: NodeInsertable[]): void;
2256
+ /** Append nodes or strings to this node's children. */
2257
+ append(...insertable: NodeInsertable[]): void;
2258
+ /** Insert nodes or strings before this node. */
2259
+ before(...insertable: NodeInsertable[]): void;
2260
+ /** Insert nodes or strings after this node. */
2261
+ after(...insertable: NodeInsertable[]): void;
2262
+ get nextSibling(): Node | null;
2263
+ get nextElementSibling(): HTMLElement | null;
2264
+ get previousSibling(): Node | null;
2265
+ get previousElementSibling(): HTMLElement | null;
2266
+ /** Get all childNodes of type {@link HTMLElement}. */
2267
+ get children(): HTMLElement[];
2268
+ /**
2269
+ * Get the first child node.
2270
+ * @return The first child or undefined if none exists.
2271
+ */
2272
+ get firstChild(): Node | undefined;
2273
+ /**
2274
+ * Get the first child node of type {@link HTMLElement}.
2275
+ * @return The first child element or undefined if none exists.
2276
+ */
2277
+ get firstElementChild(): HTMLElement | undefined;
2278
+ /**
2279
+ * Get the last child node.
2280
+ * @return The last child or undefined if none exists.
2281
+ */
2282
+ get lastChild(): Node | undefined;
2283
+ /**
2284
+ * Get the last child node of type {@link HTMLElement}.
2285
+ * @return The last child element or undefined if none exists.
2286
+ */
2287
+ get lastElementChild(): HTMLElement | undefined;
2288
+ get childElementCount(): number;
2289
+ get classNames(): string;
2290
+ /** Clone this Node */
2291
+ clone(): Node;
2292
+ }
2293
+ interface Options {
2294
+ lowerCaseTagName?: boolean;
2295
+ comment?: boolean;
2296
+ /**
2297
+ * @see PR #215 for explanation
2298
+ */
2299
+ fixNestedATags?: boolean;
2300
+ parseNoneClosedTags?: boolean;
2301
+ /**
2302
+ * When true, preserves invalid HTML nesting (e.g., <p><p>bar</p></p>) instead of auto-closing tags
2303
+ */
2304
+ preserveTagNesting?: boolean;
2305
+ blockTextElements: {
2306
+ [tag: string]: boolean;
2307
+ };
2308
+ voidTag?: {
2309
+ /**
2310
+ * options, default value is ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr']
2311
+ */
2312
+ tags?: string[];
2313
+ /**
2314
+ * void tag serialisation, add a final slash <br/>
2315
+ */
2316
+ closingSlash?: boolean;
2317
+ };
2318
+ closeAllByClosing?: boolean;
2319
+ }
2320
+ //#endregion
927
2321
  //#region src/services/message/getMentions.d.ts
928
2322
  declare const getMentions: (message: string) => HTMLElement[];
929
2323
  //#endregion
@@ -939,6 +2333,9 @@ declare const applyItemMetadataMixin: <TBase extends Class<NonNullable<unknown>>
939
2333
  //#region src/services/survey/constants.d.ts
940
2334
  declare const SURVEY_DISPLAY_NAME = "Surveyer";
941
2335
  //#endregion
2336
+ //#region src/util/array/takeOne.d.ts
2337
+ declare const takeOne: TakeOne;
2338
+ //#endregion
942
2339
  //#region src/util/environment/getIsServer.d.ts
943
2340
  declare const getIsServer: () => boolean;
944
2341
  //#endregion
@@ -946,7 +2343,7 @@ declare const getIsServer: () => boolean;
946
2343
  declare const ID_SEPARATOR = "|";
947
2344
  //#endregion
948
2345
  //#region src/util/object/getPropertyNames.d.ts
949
- declare const getPropertyNames: <T$1>() => PropertyNames<T$1>;
2346
+ declare const getPropertyNames: <T>() => PropertyNames<T>;
950
2347
  //#endregion
951
2348
  //#region src/util/object/isPlainObject.d.ts
952
2349
  declare const isPlainObject: (data: unknown) => data is object;
@@ -955,16 +2352,16 @@ declare const isPlainObject: (data: unknown) => data is object;
955
2352
  declare const jsonDateParse: (text: string) => any;
956
2353
  //#endregion
957
2354
  //#region src/util/types/MergeObjectsStrict.d.ts
958
- type MergeObjectsStrict<T$1 extends object[]> = T$1 extends [infer TFirst, infer TSecond, ...infer TRemaining] ? TSecond extends { [K in keyof TSecond]: K extends keyof TFirst ? never : TSecond[K] } ? TRemaining extends object[] ? MergeObjectsStrict<[TSecond, ...TRemaining]> & TFirst : TFirst & TSecond : never : T$1 extends [infer TFirst] ? TFirst : never;
2355
+ type MergeObjectsStrict<T extends object[]> = T extends [infer TFirst, infer TSecond, ...infer TRemaining] ? TSecond extends { [K in keyof TSecond]: K extends keyof TFirst ? never : TSecond[K] } ? TRemaining extends object[] ? MergeObjectsStrict<[TSecond, ...TRemaining]> & TFirst : TFirst & TSecond : never : T extends [infer TFirst] ? TFirst : never;
959
2356
  //#endregion
960
2357
  //#region src/util/object/mergeObjectsStrict.d.ts
961
- declare const mergeObjectsStrict: <T$1 extends object[]>(...objects: T$1) => MergeObjectsStrict<T$1>;
2358
+ declare const mergeObjectsStrict: <T extends object[]>(...objects: T) => MergeObjectsStrict<T>;
962
2359
  //#endregion
963
2360
  //#region src/util/reactivity/getRawData.d.ts
964
- declare const getRawData: <T$1>(data: T$1) => T$1;
2361
+ declare const getRawData: <T>(data: T) => T;
965
2362
  //#endregion
966
2363
  //#region src/util/reactivity/toRawDeep.d.ts
967
- declare const toRawDeep: <T$1 extends object>(data: T$1) => T$1;
2364
+ declare const toRawDeep: <T extends object>(data: T) => T;
968
2365
  //#endregion
969
2366
  //#region src/util/regex/escapeRegExp.d.ts
970
2367
  declare const escapeRegExp: (string: string) => string;
@@ -975,17 +2372,14 @@ declare const capitalize: (string: string) => string;
975
2372
  //#region src/util/text/streamToText.d.ts
976
2373
  declare const streamToText: (readable: NodeJS.ReadableStream) => Promise<string>;
977
2374
  //#endregion
978
- //#region src/util/types/CamelToKebab.d.ts
979
- type CamelToKebab<S extends string> = S extends `${infer T}${infer U}` ? U extends Uncapitalize<U> ? `${Uncapitalize<T>}${CamelToKebab<U>}` : `${Uncapitalize<T>}-${CamelToKebab<U>}` : S;
980
- //#endregion
981
2375
  //#region src/util/text/toKebabCase.d.ts
982
- declare const toKebabCase: <T$1 extends string>(string: T$1) => CamelToKebab<T$1>;
2376
+ declare const toKebabCase: <T extends string>(string: T) => KebabCase<T>;
983
2377
  //#endregion
984
2378
  //#region src/util/text/truncate.d.ts
985
2379
  declare const truncate: (string: string, length: number) => string;
986
2380
  //#endregion
987
2381
  //#region src/util/text/uncapitalize.d.ts
988
- declare const uncapitalize: <T$1 extends string>(string: T$1) => Uncapitalize<T$1>;
2382
+ declare const uncapitalize: <T extends string>(string: T) => Uncapitalize<T>;
989
2383
  //#endregion
990
2384
  //#region src/util/time/hrtime.d.ts
991
2385
  declare const hrtime: (previousHrTime?: [number, number]) => [number, number];
@@ -993,38 +2387,35 @@ declare const hrtime: (previousHrTime?: [number, number]) => [number, number];
993
2387
  //#region src/util/time/now.d.ts
994
2388
  declare const now: () => string;
995
2389
  //#endregion
2390
+ //#region src/util/types/BuildTuple.d.ts
2391
+ type BuildTuple<N extends number, T = unknown, R extends unknown[] = []> = R["length"] extends N ? R : BuildTuple<N, T, [...R, T]>;
2392
+ //#endregion
996
2393
  //#region src/util/types/FunctionProperties.d.ts
997
- type FunctionProperties<T$1> = { [K in keyof T$1]: T$1[K] extends Function ? K : never };
2394
+ type FunctionProperties<T> = { [K in keyof T]: T[K] extends Function ? K : never };
998
2395
  //#endregion
999
2396
  //#region src/util/types/ExcludeFunctionProperties.d.ts
1000
- type ExcludeFunctionProperties<T$1> = Except<T$1, FunctionProperties<T$1>[keyof T$1]>;
1001
- //#endregion
1002
- //#region src/util/types/KebabToCamel.d.ts
1003
- type KebabToCamel<S extends string> = S extends `${infer T}-${infer U}` ? `${T}${Capitalize<KebabToCamel<U>>}` : S;
2397
+ type ExcludeFunctionProperties<T> = Except<T, FunctionProperties<T>[keyof T]>;
1004
2398
  //#endregion
1005
2399
  //#region src/util/types/MapValue.d.ts
1006
2400
  type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
1007
2401
  //#endregion
1008
- //#region src/util/types/PartialByKeys.d.ts
1009
- type PartialByKeys<T$1, K$1 extends keyof T$1 = keyof T$1> = Except<T$1, K$1> & Partial<Pick<T$1, Extract<keyof T$1, K$1>>>;
1010
- //#endregion
1011
- //#region src/util/types/TupleSplitHead.d.ts
1012
- type TupleSplitHead<T$1 extends unknown[], N extends number> = T$1["length"] extends N ? T$1 : T$1 extends [...infer R, unknown] ? TupleSplitHead<R, N> : never;
1013
- //#endregion
1014
- //#region src/util/types/TupleSplitTail.d.ts
1015
- type TupleSplitTail<T$1, N extends number, O extends unknown[] = []> = O["length"] extends N ? T$1 : T$1 extends [infer F, ...infer R] ? TupleSplitTail<[...R], N, [...O, F]> : never;
1016
- //#endregion
1017
2402
  //#region src/util/types/TupleSplit.d.ts
1018
- type TupleSplit<T$1 extends unknown[], N extends number> = [TupleSplitHead<T$1, N>, TupleSplitTail<T$1, N>];
2403
+ type TupleSplit<T extends unknown[], N extends number> = T extends [...BuildTuple<N>, ...infer R] ? [T extends [...infer H, ...R] ? H : BuildTuple<N, T[number]>, R] : [T, []];
1019
2404
  //#endregion
1020
2405
  //#region src/util/types/SkipFirst.d.ts
1021
- type SkipFirst<T$1 extends unknown[], N extends number> = TupleSplit<T$1, N>[1];
2406
+ type SkipFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[1];
1022
2407
  //#endregion
1023
2408
  //#region src/util/types/TakeFirst.d.ts
1024
- type TakeFirst<T$1 extends unknown[], N extends number> = TupleSplit<T$1, N>[0];
2409
+ type TakeFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[0];
1025
2410
  //#endregion
1026
2411
  //#region src/util/types/TupleSlice.d.ts
1027
- type TupleSlice<T$1 extends unknown[], S extends number, E extends number = T$1["length"]> = SkipFirst<TakeFirst<T$1, E>, S>;
2412
+ type TupleSlice<T extends unknown[], S extends number, E extends number = T["length"]> = E extends T["length"] ? SkipFirst<T, S> : SkipFirst<TakeFirst<T, E>, S>;
2413
+ //#endregion
2414
+ //#region src/util/types/TupleSplitHead.d.ts
2415
+ type TupleSplitHead<T extends unknown[], N extends number> = TupleSplit<T, N>[0];
2416
+ //#endregion
2417
+ //#region src/util/types/TupleSplitTail.d.ts
2418
+ type TupleSplitTail<T extends unknown[], N extends number> = TupleSplit<T, N>[1];
1028
2419
  //#endregion
1029
2420
  //#region src/util/validation/exhaustiveGuard.d.ts
1030
2421
  declare const exhaustiveGuard: (value: never) => never;
@@ -1036,4 +2427,4 @@ declare const UUIDV4_REGEX: RegExp;
1036
2427
  //#region src/util/id/uuid/uuidValidateV4.d.ts
1037
2428
  declare const uuidValidateV4: (uuid: string) => boolean;
1038
2429
  //#endregion
1039
- export { CamelToKebab, DeepOmit, DeepOmitArray, DeepOptionalProperties, DeepOptionalUndefined, DeepRequiredProperties, ExcludeFunctionProperties, FunctionProperties, ID_SEPARATOR, InvalidOperationError, ItemEntityType, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, KebabToCamel, MENTION_ID_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MapValue, MergeObjectsStrict, NIL, NotFoundError, NotInitializedError, Operation, PartialByKeys, PropertyNames, RoutePath, SITE_NAME, SURVEY_DISPLAY_NAME, Serializable, SkipFirst, TakeFirst, ToData, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, WithMetadata, applyItemMetadataMixin, capitalize, createItemEntityTypeSchema, css, escapeRegExp, exhaustiveGuard, getIsServer, getMentions, getPropertyNames, getRawData, hrtime, html, isPlainObject, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, now, streamToText, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4 };
2430
+ export { AllSpecialValues, BuildTuple, DeepOmit, DeepOptionalUndefined, ExcludeFunctionProperties, FunctionProperties, GetPaths, GetProperties, ID_SEPARATOR, InvalidOperationError, ItemEntityType, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, MENTION_ID_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MapValue, MergeObjectsStrict, NIL, NotFoundError, NotInitializedError, Operation, PropertyNames, RoutePath, SITE_NAME, SURVEY_DISPLAY_NAME, Serializable, SkipFirst, TakeFirst, TakeOne, ToData, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, WithMetadata, applyItemMetadataMixin, capitalize, createItemEntityTypeSchema, css, escapeRegExp, exhaustiveGuard, getIsServer, getMentions, getPropertyNames, getRawData, hrtime, html, isPlainObject, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, now, streamToText, takeOne, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4 };