feat: Reinitialize frontend with SvelteKit and TypeScript

- Delete old Vite+Svelte frontend
- Initialize new SvelteKit project with TypeScript
- Configure Tailwind CSS v4 + DaisyUI
- Implement JWT authentication with auto-refresh
- Create login page with form validation (Zod)
- Add protected route guards
- Update Docker configuration for single-stage build
- Add E2E tests with Playwright (6/11 passing)
- Fix Svelte 5 reactivity with $state() runes

Known issues:
- 5 E2E tests failing (timing/async issues)
- Token refresh implementation needs debugging
- Validation error display timing
This commit is contained in:
2026-02-17 16:19:59 -05:00
parent 54df6018f5
commit de2d83092e
28274 changed files with 3816354 additions and 90 deletions

7
frontend/node_modules/@ark/util/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,7 @@
Copyright 2025 ArkType
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

166
frontend/node_modules/@ark/util/out/arrays.d.ts generated vendored Normal file
View File

@@ -0,0 +1,166 @@
import type { GuardablePredicate } from "./functions.ts";
import type { anyOrNever, conform } from "./generics.ts";
import type { isDisjoint } from "./intersections.ts";
import type { parseNonNegativeInteger } from "./numbers.ts";
type DuplicateData<val = unknown> = {
element: val;
indices: number[];
};
/**
* Extracts duplicated elements and their indices from an array, returning them.
*
* Note that given `a === b && b === c`, then `c === a` must be `true` for this to give accurate results.
*
* @param arr The array to extract duplicate elements from.
*/ export declare const getDuplicatesOf: <const arr extends array>(arr: arr, opts?: ComparisonOptions<arr[number]>) => DuplicateData<arr[number]>[];
export type pathToString<segments extends string[], delimiter extends string = "/"> = segments extends [] ? "/" : join<segments, delimiter>;
export declare const join: <segments extends array<string>, delimiter extends string>(segments: segments, delimiter: delimiter) => join<segments, delimiter>;
export type join<segments extends array<string>, delimiter extends string, result extends string = ""> = segments extends (readonly [infer head extends string, ...infer tail extends string[]]) ? join<tail, delimiter, result extends "" ? head : `${result}${delimiter}${head}`> : result;
export declare const getPath: (root: unknown, path: string[]) => unknown;
export declare const intersectUniqueLists: <item>(l: readonly item[], r: readonly item[]) => item[];
export type filter<t extends array, constraint, result extends unknown[] = []> = t extends readonly [infer head, ...infer tail] ? filter<tail, constraint, head extends constraint ? [...result, head] : result> : result;
export type array<t = unknown> = readonly t[];
export declare namespace array {
type multiply<t extends array, count extends number> = _multiply<t, [
], count, [
]>;
type _multiply<base extends array, result extends array, count extends number, i extends 1[]> = i["length"] extends count ? result : _multiply<base, [...result, ...base], count, [...i, 1]>;
type repeat<element, count extends number> = buildFromSegments<element, [
], exponentials.max<count>, count>;
type buildFromSegments<element, result extends 1[], segments extends 1[][], count extends number, next extends 1[] = [...result, ...segments[0]]> = next["length"] extends count ? {
[i in keyof next]: element;
} : `${count}` extends keyof next ? buildFromSegments<element, result, nextSegments<segments>, count> : buildFromSegments<element, next, nextSegments<segments>, count>;
type nextSegments<segments extends 1[][]> = segments extends [unknown, ...infer nextSegments extends 1[][]] ? nextSegments : never;
type minLength<element, minLength extends number> = readonly [
...multiply<[element], minLength>,
...element[]
];
}
export type listable<t> = t | readonly t[];
export type flattenListable<t> = t extends array<infer element> ? element : t;
export type longerThan<t extends array, n extends number> = `${n}` extends keyof t ? true : false;
export type CollapsingList<t = unknown> = readonly [] | t | readonly [t, t, ...t[]];
export type headOf<t extends array> = t[0];
export type tailOf<t extends array> = t extends readonly [unknown, ...infer tail] ? tail : never;
export type lastIndexOf<t extends array> = tailOf<t>["length"];
export type lastOf<t extends array> = t[lastIndexOf<t>];
export type initOf<t extends array> = t extends readonly [...infer init, unknown] ? init : never;
export type numericStringKeyOf<t extends array> = Extract<keyof t, `${number}`>;
export type arrayIndexOf<a extends array> = keyof a extends infer k ? parseNonNegativeInteger<k & string> : never;
export type liftArray<t> = t extends array ? [
t
] extends [anyOrNever] ? t[] : t : t[];
export declare const liftArray: <t>(data: t) => liftArray<t>;
/**
* Splits an array into two arrays based on the result of a predicate
*
* @param predicate - The guard function used to determine which items to include.
* @returns A tuple containing two arrays:
* - the first includes items for which `predicate` returns true
* - the second includes items for which `predicate` returns false
*
* @example
* const list = [1, "2", "3", 4, 5];
* const [numbers, strings] = spliterate(list, (x) => typeof x === "number");
* // Type: number[]
* // Output: [1, 4, 5]
* console.log(evens);
* // Type: string[]
* // Output: ["2", "3"]
* console.log(odds);
*/
export declare const spliterate: <item, included extends item>(arr: readonly item[], predicate: GuardablePredicate<item, included>) => [included: included[], excluded: [item] extends [included] ? item[] : Exclude<item, included>[]];
export declare const ReadonlyArray: new <T>(...args: ConstructorParameters<typeof Array<T>>) => ReadonlyArray<T>;
export declare const includes: <a extends array>(array: a, element: unknown) => element is a[number];
export declare const range: (length: number, offset?: number) => number[];
export type AppendOptions = {
/** If true, adds the element to the beginning of the array instead of the end */
prepend?: boolean;
};
/**
* Adds a value or array to an array, returning the concatenated result
*/
export declare const append: <to extends unknown[] | undefined, value extends appendableValue<to>>(to: to, value: value, opts?: AppendOptions) => to & {};
export type appendableValue<to extends array | undefined> = to extends array<infer element> ? element extends array ? array<element> : listable<element> : never;
/**
* Concatenates an element or list with a readonly list
*/
export declare const conflatenate: <element>(to: readonly element[] | undefined | null, elementOrList: appendableValue<readonly element[]> | undefined | null) => readonly element[];
/**
* Concatenates a variadic list of elements or lists with a readonly list
*/
export declare const conflatenateAll: <element>(...elementsOrLists: (listable<element> | undefined | null)[]) => readonly element[];
export interface ComparisonOptions<t = unknown> {
isEqual?: (l: t, r: t) => boolean;
}
/**
* Appends a value or concatenates an array to an array if it is not already included, returning the array
*/
export declare const appendUnique: <to extends unknown[]>(to: to | undefined, value: NoInfer<Readonly<to> | to[number]>, opts?: ComparisonOptions<to[number]>) => to;
export type groupableKeyOf<o> = keyof o extends infer k ? k extends keyof o ? o[k] extends PropertyKey ? k : never : never : never;
export type groupBy<element, discriminant extends groupableKeyOf<element>> = {
[k in element[discriminant] & PropertyKey]?: (element extends unknown ? isDisjoint<element[discriminant], k> extends true ? never : element : never)[];
} & unknown;
export declare const groupBy: <element, discriminant extends groupableKeyOf<element>>(array: readonly element[], discriminant: discriminant) => groupBy<element, discriminant>;
export declare const arrayEquals: <element>(l: array<element>, r: array<element>, opts?: ComparisonOptions<element>) => boolean;
export type validateExhaustiveKeys<keys extends readonly PropertyKey[], expectedKey extends PropertyKey> = keys extends readonly [infer head, ...infer tail extends PropertyKey[]] ? readonly [
conform<head, expectedKey>,
...validateExhaustiveKeys<tail, Exclude<expectedKey, head>>
] : [expectedKey] extends [never] ? [] : [expectedKey];
export type applyElementLabels<t extends readonly unknown[], labels extends readonly unknown[]> = labels extends [unknown, ...infer labelsTail] ? t extends readonly [infer head, ...infer tail] ? readonly [
...labelElement<head, labels>,
...applyElementLabels<tail, labelsTail>
] : applyOptionalElementLabels<Required<t>, labels> : t;
type applyOptionalElementLabels<t extends readonly unknown[], labels extends readonly unknown[]> = labels extends readonly [unknown, ...infer labelsTail] ? t extends readonly [infer head, ...infer tail] ? [
...labelOptionalElement<head, labels>,
...applyOptionalElementLabels<tail, labelsTail>
] : applyRestElementLabels<t, labels> : t;
type applyRestElementLabels<t extends readonly unknown[], labels extends readonly unknown[]> = t extends readonly [] ? [] : labels extends readonly [unknown, ...infer tail] ? [
...labelOptionalElement<t[0], labels>,
...applyRestElementLabels<t, tail>
] : t;
type labelElement<element, labels extends readonly unknown[]> = labels extends readonly [unknown] ? {
[K in keyof labels]: element;
} : labels extends readonly [...infer head, unknown] ? labelElement<element, head> : [_: element];
type labelOptionalElement<element, label extends readonly unknown[]> = label extends readonly [unknown] ? {
[K in keyof label]?: element;
} : label extends readonly [...infer head, unknown] ? labelOptionalElement<element, head> : [_?: element];
export type setIndex<arr extends readonly unknown[], i extends number, to extends arr[number]> = arr extends arr[number][] ? _setIndex<arr, i, to, []> : Readonly<_setIndex<arr, i, to, []>>;
type _setIndex<arr extends readonly unknown[], i extends number, to extends arr[number], result extends arr[number][]> = arr extends readonly [infer head, ...infer tail] ? _setIndex<tail, i, to, [...result, result["length"] extends i ? to : head]> : result;
type zero = [];
type one = [1];
type two = [1, 1];
type three = [...two, ...two];
type four = [...three, ...three];
type five = [...four, ...four];
type six = [...five, ...five];
type seven = [...six, ...six];
type eight = [...seven, ...seven];
type nine = [...eight, ...eight];
type ten = [...nine, ...nine];
type eleven = [...ten, ...ten];
type twelve = [...eleven, ...eleven];
type thirteen = [...twelve, ...twelve];
type fourteen = [...thirteen, ...thirteen];
type exponentials = [
fourteen,
thirteen,
twelve,
eleven,
ten,
nine,
eight,
seven,
six,
five,
four,
three,
two,
one,
zero
];
declare namespace exponentials {
type max<n extends number> = _max<n, exponentials>;
type _max<n extends number, filtered extends unknown[]> = `${n}` extends keyof filtered[0] ? _max<n, tailOf<filtered>> : filtered;
}
export {};

147
frontend/node_modules/@ark/util/out/arrays.js generated vendored Normal file
View File

@@ -0,0 +1,147 @@
/**
* Extracts duplicated elements and their indices from an array, returning them.
*
* Note that given `a === b && b === c`, then `c === a` must be `true` for this to give accurate results.
*
* @param arr The array to extract duplicate elements from.
*/ export const getDuplicatesOf = (arr, opts) => {
const isEqual = opts?.isEqual ?? ((l, r) => l === r);
const elementFirstSeenIndx = new Map();
const duplicates = [];
for (const [indx, element] of arr.entries()) {
const duplicatesIndx = duplicates.findIndex(duplicate => isEqual(duplicate.element, element));
if (duplicatesIndx !== -1) {
// This is at least the third occurrence of an item equal to `element`,
// so add this index to the list of indices where the element is duplicated.
duplicates[duplicatesIndx].indices.push(indx);
continue;
}
// At this point, we know this is either the first
// or second occurrence of an item equal to `element`...
let found = false;
for (const [existingElement, firstSeenIndx] of elementFirstSeenIndx) {
if (isEqual(element, existingElement)) {
// This is the second occurrence of an item equal to `element`,
// so store it as a duplicate.
found = true;
duplicates.push({
element: existingElement,
indices: [firstSeenIndx, indx]
});
}
}
if (!found) {
// We haven't seen this element before,
// so just store the index it was first seen
elementFirstSeenIndx.set(element, indx);
}
}
return duplicates;
};
export const join = (segments, delimiter) => segments.join(delimiter);
export const getPath = (root, path) => {
let result = root;
for (const segment of path) {
if (typeof result !== "object" || result === null)
return undefined;
result = result[segment];
}
return result;
};
export const intersectUniqueLists = (l, r) => {
const intersection = [...l];
for (const item of r)
if (!l.includes(item))
intersection.push(item);
return intersection;
};
export const liftArray = (data) => (Array.isArray(data) ? data : [data]);
/**
* Splits an array into two arrays based on the result of a predicate
*
* @param predicate - The guard function used to determine which items to include.
* @returns A tuple containing two arrays:
* - the first includes items for which `predicate` returns true
* - the second includes items for which `predicate` returns false
*
* @example
* const list = [1, "2", "3", 4, 5];
* const [numbers, strings] = spliterate(list, (x) => typeof x === "number");
* // Type: number[]
* // Output: [1, 4, 5]
* console.log(evens);
* // Type: string[]
* // Output: ["2", "3"]
* console.log(odds);
*/
export const spliterate = (arr, predicate) => {
const result = [[], []];
for (const item of arr) {
if (predicate(item))
result[0].push(item);
else
result[1].push(item);
}
return result;
};
export const ReadonlyArray = Array;
export const includes = (array, element) => array.includes(element);
export const range = (length, offset = 0) => [...new Array(length)].map((_, i) => i + offset);
/**
* Adds a value or array to an array, returning the concatenated result
*/
export const append = (to, value, opts) => {
if (to === undefined) {
return (value === undefined ? []
: Array.isArray(value) ? value
: [value]);
}
if (opts?.prepend) {
if (Array.isArray(value))
to.unshift(...value);
else
to.unshift(value);
}
else {
if (Array.isArray(value))
to.push(...value);
else
to.push(value);
}
return to;
};
/**
* Concatenates an element or list with a readonly list
*/
export const conflatenate = (to, elementOrList) => {
if (elementOrList === undefined || elementOrList === null)
return to ?? [];
if (to === undefined || to === null)
return liftArray(elementOrList);
return to.concat(elementOrList);
};
/**
* Concatenates a variadic list of elements or lists with a readonly list
*/
export const conflatenateAll = (...elementsOrLists) => elementsOrLists.reduce(conflatenate, []);
/**
* Appends a value or concatenates an array to an array if it is not already included, returning the array
*/
export const appendUnique = (to, value, opts) => {
if (to === undefined)
return Array.isArray(value) ? value : [value];
const isEqual = opts?.isEqual ?? ((l, r) => l === r);
for (const v of liftArray(value))
if (!to.some(existing => isEqual(existing, v)))
to.push(v);
return to;
};
export const groupBy = (array, discriminant) => array.reduce((result, item) => {
const key = item[discriminant];
result[key] = append(result[key], item);
return result;
}, {});
export const arrayEquals = (l, r, opts) => l.length === r.length &&
l.every(opts?.isEqual ?
(lItem, i) => opts.isEqual(lItem, r[i])
: (lItem, i) => lItem === r[i]);

4
frontend/node_modules/@ark/util/out/clone.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
/** Shallowly copy the properties of the object. */
export declare const shallowClone: <input extends object>(input: input) => input;
/** Deeply copy the properties of the a non-subclassed Object, Array or Date.*/
export declare const deepClone: <input extends object>(input: input) => input;

33
frontend/node_modules/@ark/util/out/clone.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
import { getBuiltinNameOfConstructor } from "./objectKinds.js";
/** Shallowly copy the properties of the object. */
export const shallowClone = input => _clone(input, null);
/** Deeply copy the properties of the a non-subclassed Object, Array or Date.*/
export const deepClone = (input) => _clone(input, new Map());
const _clone = (input, seen) => {
if (typeof input !== "object" || input === null)
return input;
if (seen?.has(input))
return seen.get(input);
const builtinConstructorName = getBuiltinNameOfConstructor(input.constructor);
if (builtinConstructorName === "Date")
return new Date(input.getTime());
// we don't try and clone other prototypes here since this we can't guarantee arrow functions attached to the object
// are rebound in case they reference `this` (see https://x.com/colinhacks/status/1818422039210049985)
if (builtinConstructorName && builtinConstructorName !== "Array")
return input;
const cloned = Array.isArray(input) ?
input.slice()
: Object.create(Object.getPrototypeOf(input));
const propertyDescriptors = Object.getOwnPropertyDescriptors(input);
if (seen) {
seen.set(input, cloned);
for (const k in propertyDescriptors) {
const desc = propertyDescriptors[k];
if ("get" in desc || "set" in desc)
continue;
desc.value = _clone(desc.value, seen);
}
}
Object.defineProperties(cloned, propertyDescriptors);
return cloned;
};

25
frontend/node_modules/@ark/util/out/describe.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import type { array } from "./arrays.ts";
import type { describeDomainOf, domainOf, inferDomain } from "./domain.ts";
import type { anyOrNever, satisfy, Stringifiable } from "./generics.ts";
import type { describeObject } from "./objectKinds.ts";
import type { stringifyUnion } from "./unionToTuple.ts";
export type DescribeOptions = {
includeArticles?: boolean;
branchDelimiter?: string;
};
export type typeToString<t, opts extends DescribeOptions = {}> = stringifyUnion<[
t
] extends [anyOrNever] ? unknown extends t ? "any" : "never" : unknown extends t ? "unknown" : boolean extends t ? "boolean" | ([t] extends [boolean] ? never : typeToString<Exclude<t, boolean>, opts>) : t extends array ? arrayTypeToString<t, opts> : t extends object ? describeObject<t, opts> : t extends Stringifiable ? stringifiableToString<t, opts> : describeDomainOf<t, opts>, opts["branchDelimiter"] extends string ? opts["branchDelimiter"] : describeDefaults["branchDelimiter"]>;
type stringifiableToString<t extends Stringifiable, opts extends DescribeOptions> = inferDomain<domainOf<t>> extends t ? describeDomainOf<t, opts> : `${t}`;
export type describe<t> = typeToString<t, {
includeArticles: true;
branchDelimiter: " or ";
}>;
type arrayTypeToString<t extends array, opts extends DescribeOptions> = typeToString<t[number], opts> extends infer element extends string ? opts["includeArticles"] extends true ? describeArrayOf<element> : includesDelimiter<element, opts> extends true ? `(${element})[]` : `${element}[]` : never;
type describeArrayOf<element extends string> = element extends "unknown" ? "an array" : `an array of ${element}`;
type includesDelimiter<s extends string, opts extends DescribeOptions> = s extends (`${string}${opts["branchDelimiter"] extends string ? opts["branchDelimiter"] : describeDefaults["branchDelimiter"]}${string}`) ? true : false;
export type describeDefaults = satisfy<Required<DescribeOptions>, {
includeArticles: false;
branchDelimiter: " | ";
}>;
export {};

1
frontend/node_modules/@ark/util/out/describe.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

48
frontend/node_modules/@ark/util/out/domain.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
import type { describeDefaults, DescribeOptions } from "./describe.ts";
import type { show } from "./generics.ts";
import type { stringifyUnion } from "./unionToTuple.ts";
export type JsTypeOf = "object" | "function" | "number" | "bigint" | "boolean" | "string" | "symbol" | "undefined" | "null";
export declare const hasDomain: <data, domain extends Domain>(data: data, kind: domain) => data is data & inferDomain<domain>;
type TypesByDomain = {
bigint: bigint;
boolean: boolean;
number: number;
object: object;
string: string;
symbol: symbol;
undefined: undefined;
null: null;
};
export type inferDomain<kind extends Domain> = Domain extends kind ? unknown : TypesByDomain[kind];
export type Domain = show<keyof TypesByDomain>;
export type NullishDomain = "undefined" | "null";
export type NonNullishDomain = Exclude<Domain, NullishDomain>;
export type PrimitiveDomain = Exclude<Domain, "object">;
export type Primitive = inferDomain<PrimitiveDomain>;
export type domainOf<data> = unknown extends data ? Domain : data extends object ? "object" : data extends string ? "string" : data extends number ? "number" : data extends boolean ? "boolean" : data extends undefined ? "undefined" : data extends null ? "null" : data extends bigint ? "bigint" : data extends symbol ? "symbol" : never;
export declare const domainOf: <data>(data: data) => domainOf<data>;
/** Each domain's completion for the phrase "must be _____" */
export declare const domainDescriptions: {
readonly boolean: "boolean";
readonly null: "null";
readonly undefined: "undefined";
readonly bigint: "a bigint";
readonly number: "a number";
readonly object: "an object";
readonly string: "a string";
readonly symbol: "a symbol";
};
export declare const jsTypeOfDescriptions: {
readonly function: "a function";
readonly boolean: "boolean";
readonly null: "null";
readonly undefined: "undefined";
readonly bigint: "a bigint";
readonly number: "a number";
readonly object: "an object";
readonly string: "a string";
readonly symbol: "a symbol";
};
export type domainDescriptions = typeof domainDescriptions;
export type describeDomainOf<t, opts extends DescribeOptions = {}> = stringifyUnion<opts["includeArticles"] extends true ? domainDescriptions[domainOf<t>] : domainOf<t>, opts["branchDelimiter"] extends string ? opts["branchDelimiter"] : describeDefaults["branchDelimiter"]>;
export {};

25
frontend/node_modules/@ark/util/out/domain.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
export const hasDomain = (data, kind) => domainOf(data) === kind;
export const domainOf = (data) => {
const builtinType = typeof data;
return (builtinType === "object" ?
data === null ?
"null"
: "object"
: builtinType === "function" ? "object"
: builtinType);
};
/** Each domain's completion for the phrase "must be _____" */
export const domainDescriptions = {
boolean: "boolean",
null: "null",
undefined: "undefined",
bigint: "a bigint",
number: "a number",
object: "an object",
string: "a string",
symbol: "a symbol"
};
export const jsTypeOfDescriptions = {
...domainDescriptions,
function: "a function"
};

29
frontend/node_modules/@ark/util/out/errors.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import type { brand } from "./generics.ts";
import type { CastableBase } from "./records.ts";
export declare class InternalArktypeError extends Error {
}
export declare const throwInternalError: (message: string) => never;
export declare const throwError: (message: string, ctor?: new (message: string) => Error) => never;
export declare class ParseError extends Error {
readonly name = "ParseError";
}
export declare const throwParseError: (message: string) => never;
/**
* TypeScript won't suggest strings beginning with a space as properties.
* Useful for symbol-like string properties.
*/
export declare const noSuggest: <s extends string>(s: s) => noSuggest<s>;
/**
* TypeScript won't suggest strings beginning with a space as properties.
* Useful for symbol-like string properties.
*/
export type noSuggest<s extends string = string> = ` ${s}`;
/** Unrendered character (U+200B) used to mark a string type */
export declare const ZeroWidthSpace = "\u200B";
/** Unrendered character (U+200B) used to mark a string type */
export type ZeroWidthSpace = typeof ZeroWidthSpace;
export type ErrorMessage<message extends string = string> = `${message}${ZeroWidthSpace}`;
export interface ErrorType<ctx extends {} = {}> extends CastableBase<ctx> {
[brand]: "ErrorType";
}
export type Completion<text extends string = string> = `${text}${ZeroWidthSpace}${ZeroWidthSpace}`;

17
frontend/node_modules/@ark/util/out/errors.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
export class InternalArktypeError extends Error {
}
export const throwInternalError = message => throwError(message, InternalArktypeError);
export const throwError = (message, ctor = Error) => {
throw new ctor(message);
};
export class ParseError extends Error {
name = "ParseError";
}
export const throwParseError = message => throwError(message, ParseError);
/**
* TypeScript won't suggest strings beginning with a space as properties.
* Useful for symbol-like string properties.
*/
export const noSuggest = (s) => ` ${s}`;
/** Unrendered character (U+200B) used to mark a string type */
export const ZeroWidthSpace = "\u{200B}";

41
frontend/node_modules/@ark/util/out/flatMorph.d.ts generated vendored Normal file
View File

@@ -0,0 +1,41 @@
import { type array, type listable } from "./arrays.ts";
import type { conform, show } from "./generics.ts";
import type { Key } from "./keys.ts";
import type { Entry, entryOf } from "./records.ts";
import type { intersectUnion } from "./unionToTuple.ts";
type objectFromListableEntries<transformed extends readonly GroupableEntry[]> = show<intersectUnion<fromGroupableEntries<transformed>>>;
type fromGroupableEntries<entries extends readonly GroupableEntry[]> = {
[entry in entries[number] as entry extends GroupedEntry ? entry[0]["group"] : conform<entry[0], PropertyKey>]: entry extends GroupedEntry ? entry[1][] : entry[1];
};
type arrayFromListableEntries<transformed extends Entry> = Entry<number, never> extends transformed ? transformed[1][] : _arrayFromListableEntries<transformed, []>;
type _arrayFromListableEntries<transformed extends Entry, result extends unknown[]> = [
transformed
] extends [never] ? result : Extract<transformed, Entry<result["length"]>> extends (infer next extends Entry) ? Exclude<transformed, next> extends infer remaining extends Entry ? [
transformed
] extends [remaining] ? [
...result,
...transformed[1][]
] : _arrayFromListableEntries<remaining, [...result, next[1]]> : never : [...result, ...transformed[1][]];
type extractEntrySets<e extends listable<GroupableEntry>> = e extends readonly GroupableEntry[] ? e : [e];
type extractEntries<e extends listable<Entry>> = e extends readonly Entry[] ? e[number] : e;
type entryArgsWithIndex<o> = {
[k in keyof o]-?: [k: k, v: Exclude<o[k], undefined>, i: number];
}[keyof o];
type numericArrayEntry<a extends array> = number extends a["length"] ? [number, a[number]] : {
[i in keyof a]: i extends `${infer n extends number}` ? [n, a[i]] : never;
}[number];
export type GroupedEntry = readonly [key: {
group: Key;
}, value: unknown];
export type GroupableEntry = Entry<Key> | Entry<number> | GroupedEntry;
export type ListableEntry = listable<GroupableEntry>;
export type fromMappedEntries<transformed extends ListableEntry> = [
transformed
] extends [listable<Entry<number>>] ? arrayFromListableEntries<extractEntries<transformed>> : objectFromListableEntries<extractEntrySets<transformed>>;
export type FlatMorph = {
<const o extends array, transformed extends ListableEntry>(o: o, flatMapEntry: (...args: numericArrayEntry<o>) => transformed): fromMappedEntries<transformed>;
<const o extends object, transformed extends ListableEntry>(o: o, flatMapEntry: (...args: entryOf<o>) => transformed): fromMappedEntries<transformed>;
<const o extends object, transformed extends ListableEntry>(o: o, flatMapEntry: (...args: entryArgsWithIndex<o>) => transformed): fromMappedEntries<transformed>;
};
export declare const flatMorph: FlatMorph;
export {};

24
frontend/node_modules/@ark/util/out/flatMorph.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import { append } from "./arrays.js";
export const flatMorph = (o, flatMapEntry) => {
const result = {};
const inputIsArray = Array.isArray(o);
let outputShouldBeArray = false;
for (const [i, entry] of Object.entries(o).entries()) {
const mapped = inputIsArray ? flatMapEntry(i, entry[1]) : flatMapEntry(...entry, i);
outputShouldBeArray ||= typeof mapped[0] === "number";
const flattenedEntries = Array.isArray(mapped[0]) || mapped.length === 0 ?
// if we have an empty array (for filtering) or an array with
// another array as its first element, treat it as a list
mapped
// otherwise, it should be a single entry, so nest it in a tuple
// so it doesn't get spread when the result is flattened
: [mapped];
for (const [k, v] of flattenedEntries) {
if (typeof k === "object")
result[k.group] = append(result[k.group], v);
else
result[k] = v;
}
}
return outputShouldBeArray ? Object.values(result) : result;
};

33
frontend/node_modules/@ark/util/out/functions.d.ts generated vendored Normal file
View File

@@ -0,0 +1,33 @@
export type Fn<args extends readonly any[] = readonly any[], returns = unknown> = (...args: args) => returns;
export declare const cached: <t>(thunk: () => t) => (() => t);
export declare const isThunk: <value>(value: value) => value is Extract<value, Thunk> extends never ? value & Thunk : Extract<value, Thunk>;
export type Thunk<ret = unknown> = () => ret;
export type thunkable<t> = t | Thunk<t>;
export declare const tryCatch: <returns, onError = never>(fn: () => returns, onError?: (e: unknown) => onError) => returns | onError;
export declare const DynamicFunction: DynamicFunction;
export type DynamicFunction = new <fn extends Fn>(...args: ConstructorParameters<typeof Function>) => fn & {
apply(thisArg: null, args: Parameters<fn>): ReturnType<fn>;
call(thisArg: null, ...args: Parameters<fn>): ReturnType<fn>;
};
export type CallableOptions<attachments extends object> = {
attach?: attachments;
bind?: object;
};
/** @ts-ignore required to cast function type */
export interface Callable<fn extends Fn, attachments extends object> extends fn, attachments {
}
export declare class Callable<fn extends Fn, attachments extends object = {}> {
constructor(fn: fn, ...[opts]: {} extends attachments ? [opts?: CallableOptions<attachments>] : [opts: CallableOptions<attachments>]);
}
export type GuardablePredicate<input = unknown, narrowed extends input = input> = ((In: input) => In is narrowed) | ((In: input) => boolean);
export type TypeGuard<input = unknown, narrowed extends input = input> = (In: input) => In is narrowed;
/**
* Checks if the environment has Content Security Policy (CSP) enabled,
* preventing JIT-optimized code from being compiled via new Function().
*
* @returns `true` if a function created using new Function() can be
* successfully invoked in the environment, `false` otherwise.
*
* The result is cached for subsequent invocations.
*/
export declare const envHasCsp: () => boolean;

53
frontend/node_modules/@ark/util/out/functions.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
import { throwInternalError } from "./errors.js";
import { unset } from "./records.js";
export const cached = (thunk) => {
let result = unset;
return () => (result === unset ? (result = thunk()) : result);
};
export const isThunk = (value) => typeof value === "function" && value.length === 0;
export const tryCatch = (fn, onError) => {
try {
return fn();
}
catch (e) {
return onError?.(e);
}
};
export const DynamicFunction = class extends Function {
constructor(...args) {
const params = args.slice(0, -1);
const body = args[args.length - 1];
try {
super(...params, body);
}
catch (e) {
return throwInternalError(`Encountered an unexpected error while compiling your definition:
Message: ${e}
Source: (${args.slice(0, -1)}) => {
${args[args.length - 1]}
}`);
}
}
};
export class Callable {
constructor(fn, ...[opts]) {
return Object.assign(Object.setPrototypeOf(fn.bind(opts?.bind ?? this), this.constructor.prototype), opts?.attach);
}
}
/**
* Checks if the environment has Content Security Policy (CSP) enabled,
* preventing JIT-optimized code from being compiled via new Function().
*
* @returns `true` if a function created using new Function() can be
* successfully invoked in the environment, `false` otherwise.
*
* The result is cached for subsequent invocations.
*/
export const envHasCsp = cached(() => {
try {
return new Function("return false")();
}
catch {
return true;
}
});

59
frontend/node_modules/@ark/util/out/generics.d.ts generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import type { Primitive } from "./domain.ts";
import { type ErrorMessage } from "./errors.ts";
import type { unionToTuple } from "./unionToTuple.ts";
export type Stringifiable = string | boolean | number | bigint | null | undefined;
/** Force an operation like `{ a: 0 } & { b: 1 }` to be computed so that it displays `{ a: 0; b: 1 }`. */
export type show<t> = {
[k in keyof t]: t[k];
} & unknown;
/** @deprecated use "show" instead */
export type evaluate<t> = {
[k in keyof t]: t[k];
} & unknown;
export type get<t, k extends PropertyKey> = t[k & keyof t];
export type exact<t extends object, u extends object> = {
[k in keyof t]: k extends keyof u ? conform<t[k], u[k]> : never;
};
export type exactMessageOnError<t extends object, u extends object> = {
[k in keyof t]: k extends keyof u ? conform<t[k], u[k]> : ErrorMessage<`'${k & string}' is not a valid key`>;
} & u;
export type promisable<t> = t | Promise<t>;
export type leftIfEqual<l, r> = [l, r] extends [r, l] ? l : r;
export type UnknownUnion = string | number | symbol | bigint | boolean | object | null | undefined;
/**
* Interesection (`&`) that avoids evaluating `unknown` to `{}`
*/
export type andPreserveUnknown<l, r> = unknown extends l & r ? unknown : show<l & r>;
/** Can be used to test for the universal subtypes, `any` and `never`, e.g.:
*
* ```ts
* type isAnyOrNever<t> = [t] extends [anyOrNever] ? true : false
* ```
*
* The actual value is a string literal, but the only realistic subtypes
* of that literal are `any` and `never`.
*/
export type anyOrNever = " anyOrNever";
export type conform<t, base> = t extends base ? t : base;
export type equals<l, r> = [l, r] extends [r, l] ? true : false;
export type exactEquals<l, r> = (<_>() => _ extends l ? 1 : 2) extends <_>() => _ extends r ? 1 : 2 ? true : false;
export declare const brand: " brand";
export type Brand<t = unknown, id = unknown> = t & {
readonly [brand]: [t, id];
};
export type unbrand<t> = t extends Brand<infer base, string> ? base : never;
export type satisfy<base, t extends base> = t;
export type defined<t> = t & ({} | null);
export type autocomplete<suggestions extends string> = suggestions | (string & {});
export type widen<t, supertypes> = collectWidenedType<t, unionToTuple<supertypes>>;
type collectWidenedType<t, remaining extends unknown[], result = never> = remaining extends [infer head, ...infer tail] ? collectWidenedType<t, tail, t extends head ? result | head : result> : result;
type narrowTuple<t extends readonly unknown[]> = t extends readonly [infer head, ...infer tail] ? readonly [head, ...narrowTuple<tail>] : [];
export type narrow<t> = t extends Primitive ? t : t extends readonly unknown[] ? narrowTuple<t> : {
[k in keyof t]: narrow<t[k]>;
};
export declare const narrow: <t>(t: narrow<t>) => t;
/** primitive key used to represent an inferred type at compile-time */
export declare const inferred: " arkInferred";
/** primitive key used to represent an inferred type at compile-time */
export type inferred = typeof inferred;
export {};

5
frontend/node_modules/@ark/util/out/generics.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { noSuggest } from "./errors.js";
export const brand = noSuggest("brand");
export const narrow = (t) => t;
/** primitive key used to represent an inferred type at compile-time */
export const inferred = noSuggest("arkInferred");

9
frontend/node_modules/@ark/util/out/get.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import type { conform } from "./generics.ts";
import type { keyOf } from "./records.ts";
type getKey<o, k> = k extends keyof o ? o[k] : k extends `${infer n extends number & keyof o}` ? o[n] : never;
type getPath<o, path extends string> = path extends `${infer head}.${infer tail}` ? getPath<getKey<o, head>, tail> : getKey<o, path>;
type validatePath<o, path extends string, prefix extends string = ""> = path extends `${infer head}.${infer tail}` ? head extends keyOf<o> ? validatePath<getKey<o, head>, tail, `${prefix}${head}.`> : `Key '${head}' is not valid following '${prefix}'` : {
[k in keyOf<o>]: k extends `${path}${string}` ? `${prefix}${k}` : never;
}[keyOf<o>];
export declare const get: <const o extends object, path extends string>(data: o, pathStr: conform<path, string & validatePath<o, path>>) => getPath<o, path>;
export {};

7
frontend/node_modules/@ark/util/out/get.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export const get = (data, pathStr) => {
let target = data;
const path = pathStr.split(".");
while (path.length)
target = target[path.shift()];
return target;
};

27
frontend/node_modules/@ark/util/out/hkt.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
declare const args: " args";
type args = typeof args;
export declare abstract class Hkt<constraints extends unknown[] = any> {
[args]: unknown[];
constraints: constraints;
args: this[args] extends infer args extends unknown[] ? args : never;
0: this[args] extends [infer arg, ...any] ? arg : never;
1: this[args] extends [any, infer arg, ...any] ? arg : never;
2: this[args] extends [any, any, infer arg, ...any] ? arg : never;
3: this[args] extends [any, any, any, infer arg, ...any] ? arg : never;
abstract body: unknown;
description?: string;
constructor();
}
/** A small set of HKT utility types based on https://github.com/gvergnaud/hotscript
* See https://github.com/gvergnaud/hotscript/blob/main/src/internals/core/Core.ts
*/
export declare namespace Hkt {
type constructor<constraints extends unknown[] = any> = new () => Hkt<constraints>;
type args = typeof args;
type apply<hkt extends Hkt, args extends {
[i in keyof args]: hkt["constraints"][i];
}> = (hkt & {
[args]: args;
})["body"];
}
export {};

5
frontend/node_modules/@ark/util/out/hkt.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { noSuggest } from "./errors.js";
const args = noSuggest("args");
export class Hkt {
constructor() { }
}

24
frontend/node_modules/@ark/util/out/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
export * from "./arrays.ts";
export * from "./clone.ts";
export * from "./describe.ts";
export * from "./domain.ts";
export * from "./errors.ts";
export * from "./flatMorph.ts";
export * from "./functions.ts";
export * from "./generics.ts";
export * from "./hkt.ts";
export * from "./intersections.ts";
export * from "./isomorphic.ts";
export * from "./keys.ts";
export * from "./lazily.ts";
export * from "./numbers.ts";
export * from "./objectKinds.ts";
export * from "./path.ts";
export * from "./primitive.ts";
export * from "./records.ts";
export * from "./registry.ts";
export * from "./scanner.ts";
export * from "./serialize.ts";
export * from "./strings.ts";
export * from "./traits.ts";
export * from "./unionToTuple.ts";

24
frontend/node_modules/@ark/util/out/index.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
export * from "./arrays.js";
export * from "./clone.js";
export * from "./describe.js";
export * from "./domain.js";
export * from "./errors.js";
export * from "./flatMorph.js";
export * from "./functions.js";
export * from "./generics.js";
export * from "./hkt.js";
export * from "./intersections.js";
export * from "./isomorphic.js";
export * from "./keys.js";
export * from "./lazily.js";
export * from "./numbers.js";
export * from "./objectKinds.js";
export * from "./path.js";
export * from "./primitive.js";
export * from "./records.js";
export * from "./registry.js";
export * from "./scanner.js";
export * from "./serialize.js";
export * from "./strings.js";
export * from "./traits.js";
export * from "./unionToTuple.js";

50
frontend/node_modules/@ark/util/out/intersections.d.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import type { array } from "./arrays.ts";
import type { domainOf } from "./domain.ts";
import type { andPreserveUnknown } from "./generics.ts";
import type { Hkt } from "./hkt.ts";
import type { propValueOf, requiredKeyOf } from "./records.ts";
export interface AndPreserveUnknown extends Hkt<[unknown, unknown]> {
body: andPreserveUnknown<this[0], this[1]>;
}
type SequenceIntersectionKind = "array" | "parameters";
export type intersectArrays<l extends array, r extends array, operator extends Hkt = AndPreserveUnknown> = intersectSequences<l, r, [], [], operator, "array">;
export type intersectParameters<l extends array, r extends array, operator extends Hkt = AndPreserveUnknown> = intersectSequences<l, r, [], [], operator, "parameters">;
type intersectSequences<l extends array, r extends array, acc extends array, postfix extends array, operation extends Hkt, kind extends SequenceIntersectionKind> = l extends readonly [] ? kind extends "array" ? [
] extends r ? [
...acc,
...postfix
] : never : [...acc, ...r, ...postfix] : r extends readonly [] ? kind extends "array" ? [
] extends l ? [
...acc,
...postfix
] : never : [...acc, ...l, ...postfix] : [
l,
r
] extends ([
readonly [(infer lHead)?, ...infer lTail],
readonly [(infer rHead)?, ...infer rTail]
]) ? [
"0",
lHead,
rHead
] extends [keyof l | keyof r, l[0], r[0]] ? intersectSequences<lTail, rTail, [
[],
[]
] extends [l, r] ? [
...acc,
Hkt.apply<operation, [lHead, rHead]>?
] : [...acc, Hkt.apply<operation, [lHead, rHead]>], postfix, operation, kind> : l extends readonly [...infer lInit, infer lLast] ? r extends readonly [...infer rInit, infer rLast] ? intersectSequences<lInit, rInit, acc, [
Hkt.apply<operation, [lLast, rLast]>,
...postfix
], operation, kind> : intersectSequences<lInit, r, acc, [
Hkt.apply<operation, [lLast, r[number]]>,
...postfix
], operation, kind> : r extends readonly [...infer rInit, infer rLast] ? intersectSequences<l, rInit, acc, [
Hkt.apply<operation, [l[number], rLast]>,
...postfix
], operation, kind> : [...acc, ...Hkt.apply<operation, [lHead, rHead]>[], ...postfix] : never;
export type isDisjoint<l, r> = overlaps<l, r> extends true ? false : true;
export type overlaps<l, r> = l & r extends never ? false : domainOf<l> & domainOf<r> extends never ? false : [l, r] extends [object, object] ? false extends (propValueOf<{
[k in Extract<keyof l & keyof r, requiredKeyOf<l> | requiredKeyOf<r>>]: overlaps<l[k], r[k]>;
}>) ? false : true : true;
export {};

1
frontend/node_modules/@ark/util/out/intersections.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

5
frontend/node_modules/@ark/util/out/isomorphic.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import type { autocomplete } from "./generics.ts";
export declare const isomorphic: {
fileName: () => string;
env: Record<autocomplete<"ARK_DEBUG">, string | undefined>;
};

19
frontend/node_modules/@ark/util/out/isomorphic.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
// based on the util of the same name in @ark/fs
// isolated here for use with registry
/** get a CJS/ESM compatible string representing the current file */
const fileName = () => {
try {
const error = new Error();
const stackLine = error.stack?.split("\n")[2]?.trim() || ""; // [1]=this func, [2]=caller
const filePath = stackLine.match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1] || "unknown";
return filePath.replace(/^file:\/\//, "");
}
catch {
return "unknown";
}
};
const env = globalThis.process?.env ?? {};
export const isomorphic = {
fileName,
env
};

18
frontend/node_modules/@ark/util/out/keys.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import type { array, join } from "./arrays.ts";
import type { NonNegativeIntegerLiteral } from "./numbers.ts";
export type Key = string | symbol;
export type toArkKey<o, k extends keyof o> = k extends number ? [
o,
number
] extends [array, k] ? NonNegativeIntegerLiteral : `${k}` : k;
export type arkIndexableOf<o> = arkKeyOf<o> extends infer k ? k extends `${infer index extends number}` ? index | k : k : never;
export type arkKeyOf<o> = [
o
] extends [object] ? [
o
] extends [array] ? arkArrayKeyOf<o> : arkObjectLiteralKeyOf<o> : never;
type arkArrayKeyOf<a extends array> = number extends a["length"] ? NonNegativeIntegerLiteral : keyof a extends infer i ? i extends `${number}` ? i : never : never;
type arkObjectLiteralKeyOf<o extends object> = keyof o extends infer k ? k extends number ? `${k}` : k : never;
export type arkGet<o, k extends arkIndexableOf<o>> = o[k extends keyof o ? k : NonNegativeIntegerLiteral extends k ? number & keyof o : k extends number ? `${k}` & keyof o : never];
export type writeInvalidKeysMessage<o extends string, keys extends array<string>> = `Key${keys["length"] extends 1 ? "" : "s"} ${join<keys, ", ">} ${keys["length"] extends 1 ? "does" : "do"} not exist on ${o}`;
export {};

1
frontend/node_modules/@ark/util/out/keys.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

1
frontend/node_modules/@ark/util/out/lazily.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare const lazily: <t extends object>(thunk: () => t) => t;

16
frontend/node_modules/@ark/util/out/lazily.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
export const lazily = (thunk) => {
let cached;
return new Proxy({}, {
get: (_, prop) => {
if (!cached)
cached = thunk();
return cached[prop];
},
set: (_, prop, value) => {
if (!cached)
cached = thunk();
cached[prop] = value;
return true;
}
});
};

72
frontend/node_modules/@ark/util/out/numbers.d.ts generated vendored Normal file
View File

@@ -0,0 +1,72 @@
export type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
export type NumberLiteral<n extends number = number> = `${n}`;
export type BigintLiteral<n extends bigint = bigint> = `${n}n`;
export type IntegerLiteral<n extends bigint = bigint> = `${n}`;
export type NonNegativeIntegerLiteral<n extends bigint = bigint> = `${Digit}` | (`${Exclude<Digit, 0>}${string}` & `${n}`);
/**
* Matches a well-formatted numeric expression according to the following rules:
* 1. Must include an integer portion (i.e. '.321' must be written as '0.321')
* 2. The first digit of the value must not be 0, unless the entire integer portion is 0
* 3. If the value includes a decimal, its last digit may not be 0
* 4. The value may not be "-0"
*/
export declare const wellFormedNumberMatcher: RegExp;
export declare const isWellFormedNumber: RegExp["test"];
/**
* Similar to wellFormedNumber but more permissive in the following ways:
*
* - Allows numbers without an integer portion like ".5" (well-formed equivalent is "0.5")
* - Allows decimals with trailing zeroes like "0.10" (well-formed equivalent is "0.1")
*/
export declare const numericStringMatcher: RegExp;
export declare const isNumericString: (string: string) => boolean;
export declare const numberLikeMatcher: RegExp;
/**
* Matches a well-formatted integer according to the following rules:
* 1. must begin with an integer, the first digit of which cannot be 0 unless the entire value is 0
* 2. The value may not be "-0"
*/
export declare const wellFormedIntegerMatcher: RegExp;
export declare const isWellFormedInteger: RegExp["test"];
export declare const integerLikeMatcher: RegExp;
type NumericLiteralKind = "number" | "bigint" | "integer";
declare const numericLiteralDescriptions: {
readonly number: "a number";
readonly bigint: "a bigint";
readonly integer: "an integer";
};
type numericLiteralDescriptions = typeof numericLiteralDescriptions;
export type writeMalformedNumericLiteralMessage<def extends string, kind extends NumericLiteralKind> = `'${def}' was parsed as ${numericLiteralDescriptions[kind]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`;
export declare const writeMalformedNumericLiteralMessage: <def extends string, kind extends NumericLiteralKind>(def: def, kind: kind) => writeMalformedNumericLiteralMessage<def, kind>;
export declare const tryParseNumber: <errorOnFail extends boolean | string>(token: string, options?: NumericParseOptions<errorOnFail>) => errorOnFail extends true | string ? number : number | undefined;
export declare const tryParseWellFormedNumber: typeof tryParseNumber;
export type tryParseNumber<token extends string, messageOnFail extends string> = token extends `${infer n extends number}` ? number extends n ? writeMalformedNumericLiteralMessage<token, "number"> : n : messageOnFail;
export type parseNumber<token extends string> = token extends `${infer n extends number}` ? n : never;
export declare const tryParseInteger: <errorOnFail extends boolean | string>(token: string, options?: NumericParseOptions<errorOnFail>) => errorOnFail extends true | string ? number : number | undefined;
export type tryParseInteger<token extends string, messageOnFail extends string> = token extends `${infer b extends bigint}` ? bigint extends b ? writeMalformedNumericLiteralMessage<token, "integer"> : token extends `${infer n extends number}` ? n : never : messageOnFail;
export type parseInteger<token extends string> = token extends `${bigint}` ? token extends `${infer n extends number}` ? n : never : never;
export type parseNonNegativeInteger<token extends string> = token extends `-${string}` ? never : parseInteger<token>;
export type NumericParseOptions<errorOnFail extends boolean | string> = {
errorOnFail?: errorOnFail;
strict?: boolean;
};
export declare const tryParseWellFormedBigint: (def: string) => bigint | undefined;
/**
* Returns the next or previous representable floating-point number after the given input.
*
* @param {"+" | "-"} [direction="+"] - The direction to find the nearest float. "+" for the next float, "-" for the previous float.
* @throws {Error} If the input is not a finite number.
*
* @example
* console.log(nearestFloat(0)); // Smallest positive number
* console.log(nearestFloat(2)); // 2.0000000000000004
* console.log(nearestFloat(2.1)); // 2.1000000000000005
* console.log(nearestFloat(2, "-")); // 1.9999999999999998
* console.log(nearestFloat(2.1, "-")); // 2.0999999999999996
* // as size of input increases, the increments become larger to stay within what
* // JS can represent in a numeric value
* console.log(nearestFloat(5555555555555555)); // 5555555555555556
* console.log(nearestFloat(5555555555555555, "-")); // 5555555555555554
*/
export declare const nearestFloat: (n: number, direction?: "+" | "-") => number;
export {};

138
frontend/node_modules/@ark/util/out/numbers.js generated vendored Normal file
View File

@@ -0,0 +1,138 @@
import { throwParseError } from "./errors.js";
import { anchoredRegex, RegexPatterns } from "./strings.js";
/*
* The goal of the number literal and bigint literal regular expressions is to:
*
* 1. Ensure definitions form a bijection with the values they represent.
* 2. Attempt to mirror TypeScript's own format for stringification of numeric
* values such that the regex should match a given definition if any only if
* a precise literal type will be inferred (in TS4.8+).
*/
const anchoredNegativeZeroPattern = /^-0\.?0*$/.source;
const positiveIntegerPattern = /[1-9]\d*/.source;
const looseDecimalPattern = /\.\d+/.source;
const strictDecimalPattern = /\.\d*[1-9]/.source;
const createNumberMatcher = (opts) => anchoredRegex(RegexPatterns.negativeLookahead(anchoredNegativeZeroPattern) +
RegexPatterns.nonCapturingGroup("-?" +
RegexPatterns.nonCapturingGroup(RegexPatterns.nonCapturingGroup("0|" + positiveIntegerPattern) +
RegexPatterns.nonCapturingGroup(opts.decimalPattern) +
"?") +
(opts.allowDecimalOnly ? "|" + opts.decimalPattern : "") +
"?"));
/**
* Matches a well-formatted numeric expression according to the following rules:
* 1. Must include an integer portion (i.e. '.321' must be written as '0.321')
* 2. The first digit of the value must not be 0, unless the entire integer portion is 0
* 3. If the value includes a decimal, its last digit may not be 0
* 4. The value may not be "-0"
*/
export const wellFormedNumberMatcher = createNumberMatcher({
decimalPattern: strictDecimalPattern,
allowDecimalOnly: false
});
export const isWellFormedNumber = wellFormedNumberMatcher.test.bind(wellFormedNumberMatcher);
/**
* Similar to wellFormedNumber but more permissive in the following ways:
*
* - Allows numbers without an integer portion like ".5" (well-formed equivalent is "0.5")
* - Allows decimals with trailing zeroes like "0.10" (well-formed equivalent is "0.1")
*/
export const numericStringMatcher = createNumberMatcher({
decimalPattern: looseDecimalPattern,
allowDecimalOnly: true
});
export const isNumericString = numericStringMatcher.test.bind(numericStringMatcher);
export const numberLikeMatcher = /^-?\d*\.?\d*$/;
const isNumberLike = (s) => s.length !== 0 && numberLikeMatcher.test(s);
/**
* Matches a well-formatted integer according to the following rules:
* 1. must begin with an integer, the first digit of which cannot be 0 unless the entire value is 0
* 2. The value may not be "-0"
*/
export const wellFormedIntegerMatcher = anchoredRegex(RegexPatterns.negativeLookahead("^-0$") +
"-?" +
RegexPatterns.nonCapturingGroup(RegexPatterns.nonCapturingGroup("0|" + positiveIntegerPattern)));
export const isWellFormedInteger = wellFormedIntegerMatcher.test.bind(wellFormedIntegerMatcher);
export const integerLikeMatcher = /^-?\d+$/;
const isIntegerLike = integerLikeMatcher.test.bind(integerLikeMatcher);
const numericLiteralDescriptions = {
number: "a number",
bigint: "a bigint",
integer: "an integer"
};
export const writeMalformedNumericLiteralMessage = (def, kind) => `'${def}' was parsed as ${numericLiteralDescriptions[kind]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`;
const isWellFormed = (def, kind) => kind === "number" ? isWellFormedNumber(def) : isWellFormedInteger(def);
const parseKind = (def, kind) => kind === "number" ? Number(def) : Number.parseInt(def);
const isKindLike = (def, kind) => kind === "number" ? isNumberLike(def) : isIntegerLike(def);
export const tryParseNumber = (token, options) => parseNumeric(token, "number", options);
export const tryParseWellFormedNumber = (token, options) => parseNumeric(token, "number", { ...options, strict: true });
export const tryParseInteger = (token, options) => parseNumeric(token, "integer", options);
const parseNumeric = (token, kind, options) => {
const value = parseKind(token, kind);
if (!Number.isNaN(value)) {
if (isKindLike(token, kind)) {
if (options?.strict) {
return isWellFormed(token, kind) ? value : (throwParseError(writeMalformedNumericLiteralMessage(token, kind)));
}
return value;
}
}
return (options?.errorOnFail ?
throwParseError(options?.errorOnFail === true ?
`Failed to parse ${numericLiteralDescriptions[kind]} from '${token}'`
: options?.errorOnFail)
: undefined);
};
export const tryParseWellFormedBigint = (def) => {
if (def[def.length - 1] !== "n")
return;
const maybeIntegerLiteral = def.slice(0, -1);
let value;
try {
value = BigInt(maybeIntegerLiteral);
}
catch {
return;
}
if (wellFormedIntegerMatcher.test(maybeIntegerLiteral))
return value;
if (integerLikeMatcher.test(maybeIntegerLiteral)) {
// If the definition looks like a bigint but is
// not well-formed, throw.
return throwParseError(writeMalformedNumericLiteralMessage(def, "bigint"));
}
};
/**
* Returns the next or previous representable floating-point number after the given input.
*
* @param {"+" | "-"} [direction="+"] - The direction to find the nearest float. "+" for the next float, "-" for the previous float.
* @throws {Error} If the input is not a finite number.
*
* @example
* console.log(nearestFloat(0)); // Smallest positive number
* console.log(nearestFloat(2)); // 2.0000000000000004
* console.log(nearestFloat(2.1)); // 2.1000000000000005
* console.log(nearestFloat(2, "-")); // 1.9999999999999998
* console.log(nearestFloat(2.1, "-")); // 2.0999999999999996
* // as size of input increases, the increments become larger to stay within what
* // JS can represent in a numeric value
* console.log(nearestFloat(5555555555555555)); // 5555555555555556
* console.log(nearestFloat(5555555555555555, "-")); // 5555555555555554
*/
export const nearestFloat = (n, direction = "+") => {
const buffer = new ArrayBuffer(8);
const f64 = new Float64Array(buffer);
const u32 = new Uint32Array(buffer);
f64[0] = n;
if (n === 0) {
u32[0] = 1;
u32[1] = direction === "-" ? 1 << 31 : 0;
}
else if ((n > 0 && direction === "+") || (n < 0 && direction === "-")) {
if (u32[0]++ === 0xffffffff)
u32[1]++;
}
else if (u32[0]-- === 0)
u32[1]--;
return f64[0];
};

205
frontend/node_modules/@ark/util/out/objectKinds.d.ts generated vendored Normal file
View File

@@ -0,0 +1,205 @@
import type { DescribeOptions } from "./describe.ts";
import { type domainDescriptions, domainOf } from "./domain.ts";
import type { Fn } from "./functions.ts";
import type { satisfy } from "./generics.ts";
export declare const ecmascriptConstructors: {
Array: ArrayConstructor;
Boolean: BooleanConstructor;
Date: DateConstructor;
Error: ErrorConstructor;
Function: FunctionConstructor;
Map: MapConstructor;
Number: NumberConstructor;
Promise: PromiseConstructor;
RegExp: RegExpConstructor;
Set: SetConstructor;
String: StringConstructor;
WeakMap: WeakMapConstructor;
WeakSet: WeakSetConstructor;
};
export type ecmascriptConstructors = typeof ecmascriptConstructors;
export type EcmascriptObjects = satisfy<instantiateConstructors<keyof ecmascriptConstructors>, {
Array: Array<unknown>;
Boolean: Boolean;
Date: Date;
Error: Error;
Function: Function;
Map: Map<unknown, unknown>;
Number: Number;
RegExp: RegExp;
Set: Set<unknown>;
String: String;
WeakMap: WeakMap<object, unknown>;
WeakSet: WeakSet<object>;
Promise: Promise<unknown>;
}>;
/** Node18 */
export declare const FileConstructor: typeof import("buffer").File;
export type platformConstructors = {
ArrayBuffer: ArrayBufferConstructor;
Blob: typeof Blob;
File: typeof File;
FormData: typeof FormData;
Headers: typeof Headers;
Request: typeof Request;
Response: typeof Response;
URL: typeof URL;
};
export declare const platformConstructors: platformConstructors;
export type PlatformObjects = instantiateConstructors<keyof platformConstructors>;
export declare const typedArrayConstructors: {
Int8Array: Int8ArrayConstructor;
Uint8Array: Uint8ArrayConstructor;
Uint8ClampedArray: Uint8ClampedArrayConstructor;
Int16Array: Int16ArrayConstructor;
Uint16Array: Uint16ArrayConstructor;
Int32Array: Int32ArrayConstructor;
Uint32Array: Uint32ArrayConstructor;
Float32Array: Float32ArrayConstructor;
Float64Array: Float64ArrayConstructor;
BigInt64Array: BigInt64ArrayConstructor;
BigUint64Array: BigUint64ArrayConstructor;
};
export type typedArrayConstructors = typeof typedArrayConstructors;
export type TypedArrayObjects = instantiateConstructors<keyof typedArrayConstructors>;
export declare const builtinConstructors: {
String: StringConstructor;
Number: NumberConstructor;
Boolean: BooleanConstructor;
Int8Array: Int8ArrayConstructor;
Uint8Array: Uint8ArrayConstructor;
Uint8ClampedArray: Uint8ClampedArrayConstructor;
Int16Array: Int16ArrayConstructor;
Uint16Array: Uint16ArrayConstructor;
Int32Array: Int32ArrayConstructor;
Uint32Array: Uint32ArrayConstructor;
Float32Array: Float32ArrayConstructor;
Float64Array: Float64ArrayConstructor;
BigInt64Array: BigInt64ArrayConstructor;
BigUint64Array: BigUint64ArrayConstructor;
ArrayBuffer: ArrayBufferConstructor;
Blob: typeof Blob;
File: typeof File;
FormData: typeof FormData;
Headers: typeof Headers;
Request: typeof Request;
Response: typeof Response;
URL: typeof URL;
Array: ArrayConstructor;
Date: DateConstructor;
Error: ErrorConstructor;
Function: FunctionConstructor;
Map: MapConstructor;
Promise: PromiseConstructor;
RegExp: RegExpConstructor;
Set: SetConstructor;
WeakMap: WeakMapConstructor;
WeakSet: WeakSetConstructor;
};
export type builtinConstructors = typeof builtinConstructors;
export type BuiltinObjectKind = keyof builtinConstructors;
export type GlobalName = keyof typeof globalThis;
type instantiateConstructors<kind extends BuiltinObjectKind> = {
[k in kind]: k extends GlobalName ? InstanceType<(typeof globalThis)[k]> : `${k}Constructor` extends GlobalName ? InstanceType<(typeof globalThis)[`${k}Constructor`]> : never;
};
export type BuiltinObjects = instantiateConstructors<BuiltinObjectKind>;
export type objectKindOf<data extends object> = object extends data ? keyof builtinConstructors | undefined : data extends Fn ? "Function" : instantiableObjectKind<data> extends never ? undefined : instantiableObjectKind<data>;
export type describeObject<o extends object, opts extends DescribeOptions = {}> = objectKindOf<o> extends string ? [
opts["includeArticles"]
] extends [true] ? objectKindDescriptions[objectKindOf<o>] : objectKindOf<o> : [opts["includeArticles"]] extends [true] ? domainDescriptions["object"] : "object";
type instantiableObjectKind<data extends object> = {
[kind in keyof builtinConstructors]: data extends (InstanceType<builtinConstructors[kind]>) ? kind : never;
}[keyof builtinConstructors];
export declare const objectKindOf: <data extends object>(data: data) => objectKindOf<data> | undefined;
export declare const objectKindOrDomainOf: <data>(data: data) => (objectKindOf<data & object> & {}) | domainOf<data>;
export type objectKindOrDomainOf<data> = data extends object ? objectKindOf<data> extends undefined ? "object" : objectKindOf<data> : domainOf<data>;
export declare const hasObjectKind: <kind extends keyof builtinConstructors>(data: object, kind: kind) => data is InstanceType<builtinConstructors[kind]>;
export declare const isArray: (data: unknown) => data is readonly unknown[];
export declare const ecmascriptDescriptions: {
readonly Array: "an array";
readonly Function: "a function";
readonly Date: "a Date";
readonly RegExp: "a RegExp";
readonly Error: "an Error";
readonly Map: "a Map";
readonly Set: "a Set";
readonly String: "a String object";
readonly Number: "a Number object";
readonly Boolean: "a Boolean object";
readonly Promise: "a Promise";
readonly WeakMap: "a WeakMap";
readonly WeakSet: "a WeakSet";
};
export declare const platformDescriptions: {
ArrayBuffer: string;
Blob: string;
File: string;
FormData: string;
Headers: string;
Request: string;
Response: string;
URL: string;
};
export declare const typedArrayDescriptions: {
readonly Int8Array: "an Int8Array";
readonly Uint8Array: "a Uint8Array";
readonly Uint8ClampedArray: "a Uint8ClampedArray";
readonly Int16Array: "an Int16Array";
readonly Uint16Array: "a Uint16Array";
readonly Int32Array: "an Int32Array";
readonly Uint32Array: "a Uint32Array";
readonly Float32Array: "a Float32Array";
readonly Float64Array: "a Float64Array";
readonly BigInt64Array: "a BigInt64Array";
readonly BigUint64Array: "a BigUint64Array";
};
/** Each defaultObjectKind's completion for the phrase "must be _____" */
export declare const objectKindDescriptions: {
readonly Int8Array: "an Int8Array";
readonly Uint8Array: "a Uint8Array";
readonly Uint8ClampedArray: "a Uint8ClampedArray";
readonly Int16Array: "an Int16Array";
readonly Uint16Array: "a Uint16Array";
readonly Int32Array: "an Int32Array";
readonly Uint32Array: "a Uint32Array";
readonly Float32Array: "a Float32Array";
readonly Float64Array: "a Float64Array";
readonly BigInt64Array: "a BigInt64Array";
readonly BigUint64Array: "a BigUint64Array";
readonly ArrayBuffer: string;
readonly Blob: string;
readonly File: string;
readonly FormData: string;
readonly Headers: string;
readonly Request: string;
readonly Response: string;
readonly URL: string;
readonly Array: "an array";
readonly Function: "a function";
readonly Date: "a Date";
readonly RegExp: "a RegExp";
readonly Error: "an Error";
readonly Map: "a Map";
readonly Set: "a Set";
readonly String: "a String object";
readonly Number: "a Number object";
readonly Boolean: "a Boolean object";
readonly Promise: "a Promise";
readonly WeakMap: "a WeakMap";
readonly WeakSet: "a WeakSet";
};
export type objectKindDescriptions = typeof objectKindDescriptions;
/**
* this will only return an object kind if it's the root constructor
* example TypeError would return null not 'Error'
**/
export declare const getBuiltinNameOfConstructor: (ctor: Function) => BuiltinObjectKind | null;
export type Constructor<instance = {}> = abstract new (...args: never[]) => instance;
export type instanceOf<constructor> = constructor extends Constructor<infer instance> ? instance : never;
/**
* Returns an array of constructors for all ancestors (i.e., prototypes) of a given object.
*/
export declare const ancestorsOf: (o: object) => Function[];
export type normalizedKeyOf<t> = keyof t extends infer k ? k extends number ? `${k}` : k : never;
export declare const constructorExtends: (ctor: Constructor, base: Constructor) => boolean;
export {};

150
frontend/node_modules/@ark/util/out/objectKinds.js generated vendored Normal file
View File

@@ -0,0 +1,150 @@
import { domainOf } from "./domain.js";
import { isKeyOf } from "./records.js";
// ECMAScript Objects
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
export const ecmascriptConstructors = {
Array,
Boolean,
Date,
Error,
Function,
Map,
Number,
Promise,
RegExp,
Set,
String,
WeakMap,
WeakSet
};
/** Node18 */
export const FileConstructor = globalThis.File ?? Blob;
// Platform APIs
// See https://developer.mozilla.org/en-US/docs/Web/API
// Must be implemented in Node etc. as well as the browser to include here
export const platformConstructors = {
ArrayBuffer,
Blob,
File: FileConstructor,
FormData,
Headers,
Request,
Response,
URL
};
export const typedArrayConstructors = {
Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array,
BigInt64Array,
BigUint64Array
};
// Built-in object constructors based on a subset of:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
export const builtinConstructors = {
...ecmascriptConstructors,
...platformConstructors,
...typedArrayConstructors,
String,
Number,
Boolean
};
export const objectKindOf = (data) => {
let prototype = Object.getPrototypeOf(data);
while (prototype?.constructor &&
(!isKeyOf(prototype.constructor.name, builtinConstructors) ||
!(data instanceof builtinConstructors[prototype.constructor.name])))
prototype = Object.getPrototypeOf(prototype);
const name = prototype?.constructor?.name;
if (name === undefined || name === "Object")
return undefined;
return name;
};
export const objectKindOrDomainOf = (data) => (typeof data === "object" && data !== null ?
(objectKindOf(data) ?? "object")
: domainOf(data));
export const hasObjectKind = (data, kind) => objectKindOf(data) === kind;
export const isArray = Array.isArray;
export const ecmascriptDescriptions = {
Array: "an array",
Function: "a function",
Date: "a Date",
RegExp: "a RegExp",
Error: "an Error",
Map: "a Map",
Set: "a Set",
String: "a String object",
Number: "a Number object",
Boolean: "a Boolean object",
Promise: "a Promise",
WeakMap: "a WeakMap",
WeakSet: "a WeakSet"
};
export const platformDescriptions = {
ArrayBuffer: "an ArrayBuffer instance",
Blob: "a Blob instance",
File: "a File instance",
FormData: "a FormData instance",
Headers: "a Headers instance",
Request: "a Request instance",
Response: "a Response instance",
URL: "a URL instance"
};
export const typedArrayDescriptions = {
Int8Array: "an Int8Array",
Uint8Array: "a Uint8Array",
Uint8ClampedArray: "a Uint8ClampedArray",
Int16Array: "an Int16Array",
Uint16Array: "a Uint16Array",
Int32Array: "an Int32Array",
Uint32Array: "a Uint32Array",
Float32Array: "a Float32Array",
Float64Array: "a Float64Array",
BigInt64Array: "a BigInt64Array",
BigUint64Array: "a BigUint64Array"
};
/** Each defaultObjectKind's completion for the phrase "must be _____" */
export const objectKindDescriptions = {
...ecmascriptDescriptions,
...platformDescriptions,
...typedArrayDescriptions
};
/**
* this will only return an object kind if it's the root constructor
* example TypeError would return null not 'Error'
**/
export const getBuiltinNameOfConstructor = (ctor) => {
const constructorName = Object(ctor).name ?? null;
return (constructorName &&
isKeyOf(constructorName, builtinConstructors) &&
builtinConstructors[constructorName] === ctor) ?
constructorName
: null;
};
/**
* Returns an array of constructors for all ancestors (i.e., prototypes) of a given object.
*/
export const ancestorsOf = (o) => {
let proto = Object.getPrototypeOf(o);
const result = [];
while (proto !== null) {
result.push(proto.constructor);
proto = Object.getPrototypeOf(proto);
}
return result;
};
export const constructorExtends = (ctor, base) => {
let current = ctor.prototype;
while (current !== null) {
if (current === base.prototype)
return true;
current = Object.getPrototypeOf(current);
}
return false;
};

22
frontend/node_modules/@ark/util/out/path.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import { ReadonlyArray, type array } from "./arrays.ts";
import type { requireKeys } from "./records.ts";
import { type JsonArray } from "./serialize.ts";
export type StringifyPathOptions<stringifiable = PropertyKey> = requireKeys<{
stringifySymbol?: (s: symbol) => string;
stringifyNonKey?: (o: Exclude<stringifiable, PropertyKey>) => string;
}, stringifiable extends PropertyKey ? never : "stringifyNonKey">;
export type StringifyPathFn = <stringifiable>(path: array<stringifiable>, ...[opts]: [stringifiable] extends [PropertyKey] ? [
opts?: StringifyPathOptions
] : NoInfer<[opts: StringifyPathOptions<stringifiable>]>) => string;
export type AppendStringifiedKeyFn = <stringifiable>(path: string, prop: stringifiable, ...[opts]: [stringifiable] extends [PropertyKey] ? [
opts?: StringifyPathOptions
] : NoInfer<[opts: StringifyPathOptions<stringifiable>]>) => string;
export declare const appendStringifiedKey: AppendStringifiedKeyFn;
export declare const stringifyPath: StringifyPathFn;
export declare class ReadonlyPath extends ReadonlyArray<PropertyKey> {
private cache;
constructor(...items: array<PropertyKey>);
toJSON(): JsonArray;
stringify(): string;
stringifyAncestors(): readonly string[];
}

65
frontend/node_modules/@ark/util/out/path.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
import { ReadonlyArray } from "./arrays.js";
import { throwParseError } from "./errors.js";
import { isDotAccessible } from "./registry.js";
import { printable } from "./serialize.js";
export const appendStringifiedKey = (path, prop, ...[opts]) => {
const stringifySymbol = opts?.stringifySymbol ?? printable;
let propAccessChain = path;
switch (typeof prop) {
case "string":
propAccessChain =
isDotAccessible(prop) ?
path === "" ?
prop
: `${path}.${prop}`
: `${path}[${JSON.stringify(prop)}]`;
break;
case "number":
propAccessChain = `${path}[${prop}]`;
break;
case "symbol":
propAccessChain = `${path}[${stringifySymbol(prop)}]`;
break;
default:
if (opts?.stringifyNonKey)
propAccessChain = `${path}[${opts.stringifyNonKey(prop)}]`;
else {
throwParseError(`${printable(prop)} must be a PropertyKey or stringifyNonKey must be passed to options`);
}
}
return propAccessChain;
};
export const stringifyPath = (path, ...opts) => path.reduce((s, k) => appendStringifiedKey(s, k, ...opts), "");
export class ReadonlyPath extends ReadonlyArray {
// alternate strategy for caching since the base object is frozen
cache = {};
constructor(...items) {
super();
this.push(...items);
}
toJSON() {
if (this.cache.json)
return this.cache.json;
this.cache.json = [];
for (let i = 0; i < this.length; i++) {
this.cache.json.push(typeof this[i] === "symbol" ? printable(this[i]) : this[i]);
}
return this.cache.json;
}
stringify() {
if (this.cache.stringify)
return this.cache.stringify;
return (this.cache.stringify = stringifyPath(this));
}
stringifyAncestors() {
if (this.cache.stringifyAncestors)
return this.cache.stringifyAncestors;
let propString = "";
const result = [propString];
for (const path of this) {
propString = appendStringifiedKey(propString, path);
result.push(propString);
}
return (this.cache.stringifyAncestors = result);
}
}

16
frontend/node_modules/@ark/util/out/primitive.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import type { inferDomain } from "./domain.ts";
import type { BigintLiteral } from "./numbers.ts";
type SerializedString<value extends string = string> = `"${value}"`;
export type SerializedPrimitives = {
string: SerializedString;
number: `${number}`;
bigint: BigintLiteral;
boolean: "true" | "false";
null: "null";
undefined: "undefined";
};
export type SerializedPrimitive = SerializedPrimitives[keyof SerializedPrimitives];
export type SerializablePrimitive = inferDomain<keyof SerializedPrimitives>;
export declare const serializePrimitive: <value extends SerializablePrimitive>(value: value) => serializePrimitive<value>;
export type serializePrimitive<value extends SerializablePrimitive> = value extends string ? `"${value}"` : value extends bigint ? `${value}n` : `${value}`;
export {};

3
frontend/node_modules/@ark/util/out/primitive.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export const serializePrimitive = (value) => (typeof value === "string" ? JSON.stringify(value)
: typeof value === "bigint" ? `${value}n`
: `${value}`);

183
frontend/node_modules/@ark/util/out/records.d.ts generated vendored Normal file
View File

@@ -0,0 +1,183 @@
import type { array } from "./arrays.ts";
import type { Primitive } from "./domain.ts";
import type { Fn } from "./functions.ts";
import type { defined, show } from "./generics.ts";
import type { Key } from "./keys.ts";
import type { intersectUnion } from "./unionToTuple.ts";
export type Dict<k extends string = string, v = unknown> = {
readonly [_ in k]: v;
};
export type dict<v = unknown, k extends string = string> = {
[_ in k]: v;
};
/** Either:
* A, with all properties of B undefined
* OR
* B, with all properties of A undefined
**/
export type propwiseXor<a, b> = show<a & {
[k in keyof b]?: undefined;
}> | show<b & {
[k in keyof a]?: undefined;
}>;
export type unionToPropwiseXor<props extends object, branchKey extends PropertyKey = keyof intersectUnion<props>> = props extends infer distributed ? show<distributed & {
[k in branchKey]?: k extends keyof distributed ? unknown : undefined;
}> : never;
export type requireKeys<o, key extends keyof o> = o & {
[requiredKey in key]-?: defined<o[requiredKey]>;
};
export type require<o, maxDepth extends number = 1> = _require<o, [], maxDepth>;
type _require<o, depth extends 1[], maxDepth extends number> = depth["length"] extends maxDepth ? o : o extends object ? o extends Fn ? o : {
[k in keyof o]-?: _require<o[k], [...depth, 1], maxDepth>;
} : o;
export type PartialRecord<k extends PropertyKey = PropertyKey, v = unknown> = {
[_ in k]?: v;
};
/** Returns true if a type can be homomorphically mapped without losing information.
* Useful for avoiding e.g. classes with private properties while mapping.
*/
export type isSafelyMappable<t> = {
[k in keyof t]: t[k];
} extends t ? true : false;
export type KeySet<key extends string = string> = {
readonly [_ in key]?: 1;
};
export type keySetOf<o extends object> = KeySet<Extract<keyof o, string>>;
export type mutable<o, maxDepth extends number = 1> = _mutable<o, [], maxDepth>;
type _mutable<o, depth extends 1[], maxDepth extends number> = depth["length"] extends maxDepth ? o : o extends Primitive ? o : o extends Fn ? o : {
-readonly [k in keyof o]: _mutable<o[k], [...depth, 1], maxDepth>;
};
/**
* extracts entries mimicking Object.entries, accounting for whether the
* object is an array
**/
export type entryOf<o> = {
[k in keyof o]-?: [k, o[k] & ({} | null)];
}[o extends readonly unknown[] ? keyof o & number : keyof o] & unknown;
export type entriesOf<o extends object> = entryOf<o>[];
/**
* Object.entries wrapper providing narrowed types for objects with known sets
* of keys, e.g. those defined internally as configs
*/
export declare const entriesOf: <o extends object>(o: o) => entryOf<o>[];
export type Entry<key extends PropertyKey = PropertyKey, value = unknown> = readonly [key: key, value: value];
export type fromEntries<entries extends readonly Entry[]> = show<{
[entry in entries[number] as entry[0]]: entry[1];
}>;
export declare const fromEntries: <const entries extends readonly Entry[]>(entries: entries) => fromEntries<entries>;
/** Mimics the result of Object.keys(...) */
export type keyOf<o> = o extends array ? number extends o["length"] ? `${number}` : keyof o & `${number}` : keyof o extends infer k ? k extends string ? k : k extends number ? `${k}` : never : never;
export declare const keysOf: <o extends object>(o: o) => keyOf<o>[];
export declare const isKeyOf: <k extends string | number | symbol, o extends object>(k: k, o: o) => k is Extract<keyof o, k>;
/** Coalesce keys that exist on one or more branches of a union */
export type unionKeyOf<t> = t extends unknown ? keyof t : never;
export type extractKeyed<o extends object, k extends unionKeyOf<o>> = Extract<o, {
[_ in k]?: unknown;
}>;
export declare const hasKey: <o extends object, k extends unionKeyOf<o>>(o: o, k: k) => o is extractKeyed<o, k>;
export type extractDefinedKey<o extends object, k extends unionKeyOf<o>> = show<extractKeyed<o, k> & {
[_ in k]: {} | null;
}>;
export declare const hasDefinedKey: <o extends object, k extends unionKeyOf<o>>(o: o, k: k) => o is extractDefinedKey<o, k>;
export type requiredKeyOf<o> = keyof o extends infer k ? k extends keyof o ? o extends {
[_ in k]-?: o[k];
} ? k : never : never : never;
export type optionalKeyOf<o> = Exclude<keyof o, requiredKeyOf<o>>;
export type merge<base, props> = base extends unknown ? props extends unknown ? keyof base & keyof props extends never ? show<base & props> : show<omit<base, keyof props & keyof base> & props> : never : never;
export type override<base, merged extends {
[k in keyof base]?: unknown;
}> = merge<base, merged>;
export type propValueOf<o> = o[keyof o];
export declare const InnerDynamicBase: new <t extends object>(base: t) => t;
export declare class Covariant<t> {
/**
* Patterns of the form `interface Example<T> extends T {}` don't count as using `T`.
* From tsc's point of view when calculating variance it may as well look like `interface Example<T> {}`.
* Fundamentally this ordinarily means `Example<T>` will always be assignable to `Example<U>` and
* vice versa.
*
* Obviously this is a problem, so `Covariant` exists to add an unobtrusive covariant usage of the type
* parameter, making `Example<T>` assignable to `Example<U>` only if `T` is a subtype of `U`.
*/
private " covariant"?;
}
/** @ts-ignore (needed to extend `t`) **/
export interface DynamicBase<t extends object> extends t, Covariant<t> {
}
export declare class DynamicBase<t extends object> {
constructor(properties: t);
}
export declare const NoopBase: new <t extends object>() => t;
/** @ts-ignore (needed to extend `t`) **/
export declare class CastableBase<t extends object> extends NoopBase<t> {
private " covariant"?;
}
export declare const splitByKeys: <o extends object, leftKeys extends keySetOf<o>>(o: o, leftKeys: leftKeys) => [show<Pick<o, keyof leftKeys & keyof o>>, show<Omit<o, keyof leftKeys & keyof o>>];
/** Homomorphic implementation of the builtin Pick.
*
* Gives different results for certain union expressions like the following:
*
* @example
* // flattens result to { a?: 1 | 2; b?: 1 | 2 }
* type PickResult = Pick<{ a: 1; b?: 1 } | { a?: 2; b: 2 }, "a" | "b">
*
* @example
* // preserves original type w/ modifier groupings
* type pickResult = pick<{ a: 1; b?: 1 } | { a?: 2; b: 2 }, "a" | "b">
*/
export type pick<o, key extends keyof o> = o extends unknown ? {
[k in keyof o as k extends key ? k : never]: o[k];
} : never;
export declare const pick: <o extends object, keys extends keySetOf<o>>(o: o, keys: keys) => pick<o, keyof keys & keyof o>;
/** Homomorphic implementation of the builtin Omit.
*
* Gives different results for many union expressions like the following:
*
* @example
* // {}
* type OmitResult = Omit<{ a: 1 } | { b: 2 }, never>
*
* @example
* // preserves original type w/ modifier groupings
* type omitResult = omit<{ a: 1 } | { b: 2 }, never>
*/
export type omit<o, key extends keyof o> = {
[k in keyof o as k extends key ? never : k]: o[k];
};
export declare const omit: <o extends object, keys extends keySetOf<o>>(o: o, keys: keys) => omit<o, keyof keys & keyof o>;
/** Returns onTrue if the type is exactly `{}` and onFalse otherwise*/
export type ifEmptyObjectLiteral<t, onTrue = true, onFalse = false> = [
unknown,
t & (null | undefined)
] extends [t | null | undefined, never] ? onTrue : onFalse;
export type EmptyObject = Record<PropertyKey, never>;
export declare const isEmptyObject: (o: object) => o is EmptyObject;
export declare const stringAndSymbolicEntriesOf: (o: object) => Entry<Key>[];
/** Like Object.assign, but it will preserve getters instead of evaluating them. */
export declare const defineProperties: <base extends object, merged extends object>(base: base, merged: merged) => merge<base, merged>;
/** Copies enumerable keys of o to a new object in alphabetical order */
export declare const withAlphabetizedKeys: <o extends object>(o: o) => o;
export type invert<t extends Record<PropertyKey, PropertyKey>> = {
[k in t[keyof t]]: {
[k2 in keyof t]: t[k2] extends k ? k2 : never;
}[keyof t];
} & unknown;
export declare const invert: <t extends Record<PropertyKey, PropertyKey>>(t: t) => invert<t>;
export declare const unset: " unset";
export type unset = typeof unset;
/**
* For each keyof o that also exists on jsDocSource, add associated JsDoc annotations to o.
* Does not preserve modifiers on o like optionality.
*/
export type withJsDoc<o, jsDocSource> = show<keyof o extends keyof jsDocSource ? keyof jsDocSource extends keyof o ? _withJsDoc<o, jsDocSource> : Pick<_withJsDoc<o, jsDocSource>, keyof o & keyof jsDocSource> : Pick<_withJsDoc<o, jsDocSource>, keyof o & keyof jsDocSource> & {
[k in Exclude<keyof o, keyof jsDocSource>]: o[k];
}>;
type _withJsDoc<o, jsDocSource> = {
[k in keyof jsDocSource]-?: o[k & keyof o];
};
export type propertyDescriptorsOf<o extends object> = {
[k in keyof o]: TypedPropertyDescriptor<o[k]>;
};
export type keyWithValue<t, constraint> = keyof t extends infer k ? k extends keyof t ? t[k] extends constraint ? k : never : never : never;
export declare const enumValues: <tsEnum extends object>(tsEnum: tsEnum) => tsEnum[keyof tsEnum][];
export {};

63
frontend/node_modules/@ark/util/out/records.js generated vendored Normal file
View File

@@ -0,0 +1,63 @@
import { noSuggest, ZeroWidthSpace } from "./errors.js";
import { flatMorph } from "./flatMorph.js";
/**
* Object.entries wrapper providing narrowed types for objects with known sets
* of keys, e.g. those defined internally as configs
*/
export const entriesOf = Object.entries;
export const fromEntries = (entries) => Object.fromEntries(entries);
export const keysOf = (o) => Object.keys(o);
export const isKeyOf = (k, o) => k in o;
export const hasKey = (o, k) => k in o;
// must be defined this way to avoid https://github.com/microsoft/TypeScript/issues/55049
export const hasDefinedKey = (o, k) => o[k] !== undefined;
export const InnerDynamicBase = class {
};
export class DynamicBase {
constructor(properties) {
Object.assign(this, properties);
}
}
export const NoopBase = class {
};
/** @ts-ignore (needed to extend `t`) **/
export class CastableBase extends NoopBase {
}
export const splitByKeys = (o, leftKeys) => {
const l = {};
const r = {};
let k;
for (k in o) {
if (k in leftKeys)
l[k] = o[k];
else
r[k] = o[k];
}
return [l, r];
};
export const pick = (o, keys) => splitByKeys(o, keys)[0];
export const omit = (o, keys) => splitByKeys(o, keys)[1];
export const isEmptyObject = (o) => Object.keys(o).length === 0;
export const stringAndSymbolicEntriesOf = (o) => [
...Object.entries(o),
...Object.getOwnPropertySymbols(o).map(k => [k, o[k]])
];
/** Like Object.assign, but it will preserve getters instead of evaluating them. */
export const defineProperties = (base, merged) =>
// declared like this to avoid https://github.com/microsoft/TypeScript/issues/55049
Object.defineProperties(base, Object.getOwnPropertyDescriptors(merged));
/** Copies enumerable keys of o to a new object in alphabetical order */
export const withAlphabetizedKeys = (o) => {
const keys = Object.keys(o).sort();
const result = {};
for (let i = 0; i < keys.length; i++)
result[keys[i]] = o[keys[i]];
return result;
};
export const invert = (t) => flatMorph(t, (k, v) => [v, k]);
export const unset = noSuggest(`unset${ZeroWidthSpace}`);
export const enumValues = (tsEnum) => Object.values(tsEnum).filter(v => {
if (typeof v === "number")
return true;
return typeof tsEnum[v] !== "number";
});

21
frontend/node_modules/@ark/util/out/registry.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
export declare const arkUtilVersion = "0.56.0";
export declare const initialRegistryContents: {
version: string;
filename: string;
FileConstructor: typeof import("buffer").File;
};
export type InitialRegistryContents = typeof initialRegistryContents;
export interface ArkRegistry extends InitialRegistryContents {
[k: string]: unknown;
}
export declare const registry: ArkRegistry;
declare global {
export interface ArkEnv {
prototypes(): never;
}
export namespace ArkEnv {
type prototypes = ReturnType<ArkEnv["prototypes"]>;
}
}
export declare const register: (value: object | symbol) => string;
export declare const isDotAccessible: (keyName: string) => boolean;

49
frontend/node_modules/@ark/util/out/registry.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
import { domainOf } from "./domain.js";
import { throwInternalError } from "./errors.js";
import { isomorphic } from "./isomorphic.js";
import { FileConstructor, objectKindOf } from "./objectKinds.js";
// Eventually we can just import from package.json in the source itself
// but for now, import assertions are too unstable and it wouldn't support
// recent node versions (https://nodejs.org/api/esm.html#json-modules).
// For now, we assert this matches the package.json version via a unit test.
export const arkUtilVersion = "0.56.0";
export const initialRegistryContents = {
version: arkUtilVersion,
filename: isomorphic.fileName(),
FileConstructor
};
export const registry = initialRegistryContents;
const namesByResolution = new Map();
const nameCounts = Object.create(null);
export const register = (value) => {
const existingName = namesByResolution.get(value);
if (existingName)
return existingName;
let name = baseNameFor(value);
if (nameCounts[name])
name = `${name}${nameCounts[name]++}`;
else
nameCounts[name] = 1;
registry[name] = value;
namesByResolution.set(value, name);
return name;
};
export const isDotAccessible = (keyName) => /^[$A-Z_a-z][\w$]*$/.test(keyName);
const baseNameFor = (value) => {
switch (typeof value) {
case "object": {
if (value === null)
break;
const prefix = objectKindOf(value) ?? "object";
// convert to camelCase
return prefix[0].toLowerCase() + prefix.slice(1);
}
case "function":
return isDotAccessible(value.name) ? value.name : "fn";
case "symbol":
return value.description && isDotAccessible(value.description) ?
value.description
: "symbol";
}
return throwInternalError(`Unexpected attempt to register serializable value of type ${domainOf(value)}`);
};

44
frontend/node_modules/@ark/util/out/scanner.d.ts generated vendored Normal file
View File

@@ -0,0 +1,44 @@
import type { KeySet } from "./records.ts";
import { Backslash, type WhitespaceChar } from "./strings.ts";
export declare class Scanner<lookahead extends string = string> {
chars: string[];
i: number;
def: string;
constructor(def: string);
/** Get lookahead and advance scanner by one */
shift(): this["lookahead"];
get lookahead(): lookahead;
get nextLookahead(): string;
get length(): number;
shiftUntil(condition: Scanner.UntilCondition): string;
shiftUntilEscapable(condition: Scanner.UntilCondition): string;
shiftUntilLookahead(charOrSet: string | KeySet): string;
shiftUntilNonWhitespace(): string;
jumpToIndex(i: number): void;
jumpForward(count: number): void;
get location(): number;
get unscanned(): string;
get scanned(): string;
sliceChars(start: number, end?: number): string;
lookaheadIs<char extends lookahead>(char: char): this is Scanner<char>;
lookaheadIsIn<keySet extends KeySet>(tokens: keySet): this is Scanner<Extract<keyof keySet, string>>;
}
export declare namespace Scanner {
type UntilCondition = (scanner: Scanner, shifted: string) => boolean;
type shift<lookahead extends string, unscanned extends string> = `${lookahead}${unscanned}`;
type shiftUntil<unscanned extends string, terminator extends string, appendTo extends string = ""> = unscanned extends shift<infer lookahead, infer nextUnscanned> ? lookahead extends terminator ? [
appendTo,
unscanned
] : shiftUntil<nextUnscanned, terminator, `${appendTo}${lookahead}`> : [appendTo, ""];
type shiftUntilEscapable<unscanned extends string, terminator extends string, escapeEscape extends Backslash | "", appendTo extends string = ""> = unscanned extends shift<infer lookahead, infer nextUnscanned> ? lookahead extends terminator ? [appendTo, unscanned] : lookahead extends Backslash ? nextUnscanned extends (shift<infer nextLookahead, infer postEscapedUnscanned>) ? shiftUntilEscapable<postEscapedUnscanned, terminator, escapeEscape, `${appendTo}${nextLookahead extends terminator ? "" : nextLookahead extends Backslash ? escapeEscape : Backslash}${nextLookahead}`> : [`${appendTo}${Backslash}`, ""] : shiftUntilEscapable<nextUnscanned, terminator, escapeEscape, `${appendTo}${lookahead}`> : [appendTo, ""];
type shiftUntilNot<unscanned extends string, nonTerminator extends string, appendTo extends string = ""> = unscanned extends shift<infer lookahead, infer nextUnscanned> ? lookahead extends nonTerminator ? shiftUntilNot<nextUnscanned, nonTerminator, `${appendTo}${lookahead}`> : [appendTo, unscanned] : [appendTo, ""];
type skipWhitespace<unscanned extends string> = shiftUntilNot<unscanned, WhitespaceChar>[1];
type shiftResult<scanned extends string, unscanned extends string> = [
scanned,
unscanned
];
}
export declare const writeUnmatchedGroupCloseMessage: <char extends string, unscanned extends string>(char: char, unscanned: unscanned) => writeUnmatchedGroupCloseMessage<char, unscanned>;
export type writeUnmatchedGroupCloseMessage<char extends string, unscanned extends string> = `Unmatched ${char}${unscanned extends "" ? "" : ` before ${unscanned}`}`;
export declare const writeUnclosedGroupMessage: <missingChar extends string>(missingChar: missingChar) => writeUnclosedGroupMessage<missingChar>;
export type writeUnclosedGroupMessage<missingChar extends string> = `Missing ${missingChar}`;

87
frontend/node_modules/@ark/util/out/scanner.js generated vendored Normal file
View File

@@ -0,0 +1,87 @@
import { Backslash, whitespaceChars } from "./strings.js";
export class Scanner {
chars;
i;
def;
constructor(def) {
this.def = def;
this.chars = [...def];
this.i = 0;
}
/** Get lookahead and advance scanner by one */
shift() {
return (this.chars[this.i++] ?? "");
}
get lookahead() {
return (this.chars[this.i] ?? "");
}
get nextLookahead() {
return this.chars[this.i + 1] ?? "";
}
get length() {
return this.chars.length;
}
shiftUntil(condition) {
let shifted = "";
while (this.lookahead) {
if (condition(this, shifted))
break;
else
shifted += this.shift();
}
return shifted;
}
shiftUntilEscapable(condition) {
let shifted = "";
while (this.lookahead) {
if (this.lookahead === Backslash) {
this.shift();
if (condition(this, shifted))
shifted += this.shift();
else if (this.lookahead === Backslash)
shifted += this.shift();
else
shifted += `${Backslash}${this.shift()}`;
}
else if (condition(this, shifted))
break;
else
shifted += this.shift();
}
return shifted;
}
shiftUntilLookahead(charOrSet) {
return typeof charOrSet === "string" ?
this.shiftUntil(s => s.lookahead === charOrSet)
: this.shiftUntil(s => s.lookahead in charOrSet);
}
shiftUntilNonWhitespace() {
return this.shiftUntil(() => !(this.lookahead in whitespaceChars));
}
jumpToIndex(i) {
this.i = i < 0 ? this.length + i : i;
}
jumpForward(count) {
this.i += count;
}
get location() {
return this.i;
}
get unscanned() {
return this.chars.slice(this.i, this.length).join("");
}
get scanned() {
return this.chars.slice(0, this.i).join("");
}
sliceChars(start, end) {
return this.chars.slice(start, end).join("");
}
lookaheadIs(char) {
return this.lookahead === char;
}
lookaheadIsIn(tokens) {
return this.lookahead in tokens;
}
}
export const writeUnmatchedGroupCloseMessage = (char, unscanned) => `Unmatched ${char}${(unscanned === "" ? "" : ` before ${unscanned}`)}`;
export const writeUnclosedGroupMessage = (missingChar) => `Missing ${missingChar}`;

34
frontend/node_modules/@ark/util/out/serialize.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import type { array } from "./arrays.ts";
import { type Primitive } from "./domain.ts";
export type SerializationOptions = {
onCycle?: (value: object) => string;
onSymbol?: (value: symbol) => string;
onFunction?: (value: Function) => string;
onUndefined?: string;
onBigInt?: (value: bigint) => string;
};
export type JsonStructure = JsonObject | JsonArray;
export interface JsonObject {
[k: string]: Json;
}
export type JsonArray = Json[];
export type JsonPrimitive = string | boolean | number | null;
export type Json = JsonStructure | JsonPrimitive;
export declare const snapshot: <t>(data: t, opts?: SerializationOptions) => snapshot<t>;
export type snapshot<t, depth extends 1[] = []> = unknown extends t ? unknown : t extends Primitive ? snapshotPrimitive<t> : t extends {
toJSON: () => infer serialized;
} ? serialized : t extends Function ? `Function(${string})` : t extends Date ? string : depth["length"] extends 10 ? unknown : t extends array<infer item> ? array<snapshot<item, [...depth, 1]>> : {
[k in keyof t as snapshotPrimitive<k>]: snapshot<t[k], [...depth, 1]>;
};
type snapshotPrimitive<t> = t extends symbol ? `Symbol(${string})` : t;
export type PrintableOptions = {
indent?: number;
quoteKeys?: boolean;
};
export declare const print: (data: unknown, opts?: PrintableOptions) => void;
export declare const printable: (data: unknown, opts?: PrintableOptions) => string;
/**
* Converts a Date instance to a human-readable description relative to its precision
*/
export declare const describeCollapsibleDate: (date: Date) => string;
export {};

150
frontend/node_modules/@ark/util/out/serialize.js generated vendored Normal file
View File

@@ -0,0 +1,150 @@
import { domainOf } from "./domain.js";
import { serializePrimitive } from "./primitive.js";
import { stringAndSymbolicEntriesOf } from "./records.js";
import { isDotAccessible, register } from "./registry.js";
export const snapshot = (data, opts = {}) => _serialize(data, {
onUndefined: `$ark.undefined`,
onBigInt: n => `$ark.bigint-${n}`,
...opts
}, []);
export const print = (data, opts) => console.log(printable(data, opts));
export const printable = (data, opts) => {
switch (domainOf(data)) {
case "object":
const o = data;
const ctorName = o.constructor?.name ?? "Object";
return (ctorName === "Object" || ctorName === "Array" ?
opts?.quoteKeys === false ?
stringifyUnquoted(o, opts?.indent ?? 0, "")
: JSON.stringify(_serialize(o, printableOpts, []), null, opts?.indent)
: stringifyUnquoted(o, opts?.indent ?? 0, ""));
case "symbol":
return printableOpts.onSymbol(data);
default:
return serializePrimitive(data);
}
};
const stringifyUnquoted = (value, indent, currentIndent) => {
if (typeof value === "function")
return printableOpts.onFunction(value);
if (typeof value !== "object" || value === null)
return serializePrimitive(value);
const nextIndent = currentIndent + " ".repeat(indent);
if (Array.isArray(value)) {
if (value.length === 0)
return "[]";
const items = value
.map(item => stringifyUnquoted(item, indent, nextIndent))
.join(",\n" + nextIndent);
return indent ? `[\n${nextIndent}${items}\n${currentIndent}]` : `[${items}]`;
}
const ctorName = value.constructor?.name ?? "Object";
if (ctorName === "Object") {
const keyValues = stringAndSymbolicEntriesOf(value).map(([key, val]) => {
const stringifiedKey = typeof key === "symbol" ? printableOpts.onSymbol(key)
: isDotAccessible(key) ? key
: JSON.stringify(key);
const stringifiedValue = stringifyUnquoted(val, indent, nextIndent);
return `${nextIndent}${stringifiedKey}: ${stringifiedValue}`;
});
if (keyValues.length === 0)
return "{}";
return indent ?
`{\n${keyValues.join(",\n")}\n${currentIndent}}`
: `{${keyValues.join(", ")}}`;
}
if (value instanceof Date)
return describeCollapsibleDate(value);
if ("expression" in value && typeof value.expression === "string")
return value.expression;
return ctorName;
};
const printableOpts = {
onCycle: () => "(cycle)",
onSymbol: v => `Symbol(${register(v)})`,
onFunction: v => `Function(${register(v)})`
};
const _serialize = (data, opts, seen) => {
switch (domainOf(data)) {
case "object": {
const o = data;
if ("toJSON" in o && typeof o.toJSON === "function")
return o.toJSON();
if (typeof o === "function")
return printableOpts.onFunction(o);
if (seen.includes(o))
return "(cycle)";
const nextSeen = [...seen, o];
if (Array.isArray(o))
return o.map(item => _serialize(item, opts, nextSeen));
if (o instanceof Date)
return o.toDateString();
const result = {};
for (const k in o)
result[k] = _serialize(o[k], opts, nextSeen);
for (const s of Object.getOwnPropertySymbols(o)) {
result[opts.onSymbol?.(s) ?? s.toString()] = _serialize(o[s], opts, nextSeen);
}
return result;
}
case "symbol":
return printableOpts.onSymbol(data);
case "bigint":
return opts.onBigInt?.(data) ?? `${data}n`;
case "undefined":
return opts.onUndefined ?? "undefined";
case "string":
return data.replace(/\\/g, "\\\\");
default:
return data;
}
};
/**
* Converts a Date instance to a human-readable description relative to its precision
*/
export const describeCollapsibleDate = (date) => {
const year = date.getFullYear();
const month = date.getMonth();
const dayOfMonth = date.getDate();
const hours = date.getHours();
const minutes = date.getMinutes();
const seconds = date.getSeconds();
const milliseconds = date.getMilliseconds();
if (month === 0 &&
dayOfMonth === 1 &&
hours === 0 &&
minutes === 0 &&
seconds === 0 &&
milliseconds === 0)
return `${year}`;
const datePortion = `${months[month]} ${dayOfMonth}, ${year}`;
if (hours === 0 && minutes === 0 && seconds === 0 && milliseconds === 0)
return datePortion;
let timePortion = date.toLocaleTimeString();
const suffix = timePortion.endsWith(" AM") || timePortion.endsWith(" PM") ?
timePortion.slice(-3)
: "";
if (suffix)
timePortion = timePortion.slice(0, -suffix.length);
if (milliseconds)
timePortion += `.${pad(milliseconds, 3)}`;
else if (timeWithUnnecessarySeconds.test(timePortion))
timePortion = timePortion.slice(0, -3);
return `${timePortion + suffix}, ${datePortion}`;
};
const months = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
const timeWithUnnecessarySeconds = /:\d\d:00$/;
const pad = (value, length) => String(value).padStart(length, "0");

33
frontend/node_modules/@ark/util/out/strings.d.ts generated vendored Normal file
View File

@@ -0,0 +1,33 @@
export declare const capitalize: <s extends string>(s: s) => Capitalize<s>;
export declare const uncapitalize: <s extends string>(s: s) => Uncapitalize<s>;
export type firstChar<s extends string> = s extends `${infer head}${string}` ? head : "";
export type charsAfterFirst<s extends string> = s extends `${string}${infer tail}` ? tail : "";
export type lastChar<s extends string> = s extends `${infer head}${infer tail}` ? tail extends "" ? head : lastChar<tail> : s;
export type charsBeforeLast<s extends string> = s extends `${infer head}${infer tail}` ? tail extends "" ? "" : `${head}${charsBeforeLast<tail>}` : "";
export type contains<s extends string, sub extends string> = s extends `${string}${sub}${string}` ? true : false;
export declare const anchoredRegex: (regex: RegExp | string) => RegExp;
export declare const deanchoredRegex: (regex: RegExp | string) => RegExp;
export declare const anchoredSource: (regex: RegExp | string) => string;
export declare const deanchoredSource: (regex: RegExp | string) => string;
export declare const RegexPatterns: {
negativeLookahead: (pattern: string) => `(?!${string})`;
nonCapturingGroup: (pattern: string) => `(?:${string})`;
};
export declare const Backslash = "\\";
export type Backslash = typeof Backslash;
export declare const whitespaceChars: {
readonly " ": 1;
readonly "\n": 1;
readonly "\t": 1;
};
export type WhitespaceChar = keyof typeof whitespaceChars;
export type trim<s extends string> = trimEnd<trimStart<s>>;
export type trimStart<s extends string> = s extends `${WhitespaceChar}${infer tail}` ? trimEnd<tail> : s;
export type trimEnd<s extends string> = s extends `${infer init}${WhitespaceChar}` ? trimEnd<init> : s;
export type isStringLiteral<t> = [
t
] extends [string] ? [
string
] extends [t] ? false : Uppercase<t> extends Uppercase<Lowercase<t>> ? Lowercase<t> extends Lowercase<Uppercase<t>> ? true : false : false : false;
export declare const emojiToUnicode: (emoji: string) => string;
export declare const alphabet: readonly ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];

59
frontend/node_modules/@ark/util/out/strings.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
export const capitalize = (s) => (s[0].toUpperCase() + s.slice(1));
export const uncapitalize = (s) => (s[0].toLowerCase() + s.slice(1));
export const anchoredRegex = (regex) => new RegExp(anchoredSource(regex), typeof regex === "string" ? "" : regex.flags);
export const deanchoredRegex = (regex) => new RegExp(deanchoredSource(regex), typeof regex === "string" ? "" : regex.flags);
export const anchoredSource = (regex) => {
const source = typeof regex === "string" ? regex : regex.source;
return `^(?:${source})$`;
};
export const deanchoredSource = (regex) => {
const source = typeof regex === "string" ? regex : regex.source;
if (source.startsWith("^(?:") && source.endsWith(")$"))
return source.slice(4, -2);
return source.slice(source[0] === "^" ? 1 : 0, source[source.length - 1] === "$" ? -1 : undefined);
};
export const RegexPatterns = {
negativeLookahead: (pattern) => `(?!${pattern})`,
nonCapturingGroup: (pattern) => `(?:${pattern})`
};
export const Backslash = "\\";
export const whitespaceChars = {
" ": 1,
"\n": 1,
"\t": 1
};
export const emojiToUnicode = (emoji) => emoji
.split("")
.map(char => {
const codePoint = char.codePointAt(0);
return codePoint ? `\\u${codePoint.toString(16).padStart(4, "0")}` : "";
})
.join("");
export const alphabet = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z"
];

89
frontend/node_modules/@ark/util/out/traits.d.ts generated vendored Normal file
View File

@@ -0,0 +1,89 @@
import type { array } from "./arrays.ts";
import type { conform, satisfy, show } from "./generics.ts";
import type { intersectParameters } from "./intersections.ts";
import { type Constructor } from "./objectKinds.ts";
import { NoopBase } from "./records.ts";
export type TraitImplementation = <traits extends TraitConstructor[], implementation extends implementationOf<s>, s extends CompositionState = composeTraits<[
...traits,
implementation
], "implementation">, cls extends TraitConstructor = TraitConstructor<s["params"], s["implemented"], s["statics"], s["abstractMethods"], s["abstractProps"], s["abstractStatics"]>>(...args: [...traits, implementation & ThisType<InstanceType<cls>>]) => cls;
export type TraitComposition = <traits extends TraitConstructor[], s extends CompositionState = composeTraits<traits, "abstract">>(...traits: conform<traits, s["validated"]>) => TraitConstructor<s["params"], s["implemented"], s["statics"], s["abstractMethods"], s["abstractProps"], s["abstractStatics"]>;
export declare const hasTrait: (traitClass: Constructor) => (o: unknown) => boolean;
export type TraitDeclaration = {
abstractMethods?: object;
abstractProps?: object;
abstractStatics?: object;
dynamicBase?: object;
};
/** @ts-ignore required to extend NoopBase */
export declare abstract class Trait<d extends TraitDeclaration = {}, abstractMethods extends object = d["abstractMethods"] & {}, abstractProps extends object = d["abstractProps"] & {}, abstractStatics extends object = d["abstractStatics"] & {}, dynamicBase extends object = d["dynamicBase"] & {}> extends NoopBase<abstractMethods & abstractProps & dynamicBase> {
abstractMethods: abstractMethods;
abstractProps: abstractProps;
abstractStatic: abstractStatics;
static get [Symbol.hasInstance](): (o: unknown) => boolean;
traitsOf(): readonly TraitConstructor[];
}
export declare const compose: TraitComposition;
export declare const implement: TraitImplementation;
export type TraitConstructor<params extends array = any[], instance extends object = {}, statics = {}, abstractMethods extends object = {}, abstractProps extends object = {}, abstractStatics extends object = {}> = statics & (new (...args: params) => Trait<{
abstractMethods: abstractMethods;
abstractProps: abstractProps;
abstractStatics: abstractStatics;
}> & instance);
type CompositionState = {
validated: array;
remaining: array;
params: array;
kind: TraitCompositionKind;
implemented: object;
abstractMethods: object;
abstractProps: object;
abstractStatics: object;
statics: object;
};
export type TraitCompositionKind = "abstract" | "implementation";
export type composeTraits<traits extends array, kind extends TraitCompositionKind> = _compose<{
validated: [];
remaining: traits;
kind: kind;
params: [];
implemented: {};
abstractMethods: {};
abstractProps: {};
abstractStatics: {};
statics: {};
}>;
type intersectImplementations<l, r> = {
[k in keyof l]: k extends keyof r ? l[k] extends (...args: infer lArgs) => infer lReturn ? r[k] extends (...args: infer rArgs) => infer rReturn ? (...args: intersectParameters<lArgs, rArgs>) => lReturn & rReturn : l[k] & r[k] : l[k] & r[k] : l[k];
} & Omit<r, keyof l>;
type _compose<s extends CompositionState> = s["remaining"] extends (readonly [
TraitConstructor<infer params, infer instance, infer statics, infer abstractMethods, infer abstractProps, infer abstractStatics>,
...infer tail
]) ? _compose<{
validated: [...s["validated"], s["remaining"][0]];
remaining: tail;
kind: s["kind"];
params: intersectParameters<s["params"], params>;
implemented: intersectImplementations<s["implemented"], Omit<instance, keyof abstractMethods | keyof abstractProps>>;
statics: intersectImplementations<s["statics"], Omit<statics, keyof abstractStatics>>;
abstractMethods: intersectImplementations<s["abstractMethods"], abstractMethods>;
abstractProps: intersectImplementations<s["abstractProps"], abstractProps>;
abstractStatics: intersectImplementations<s["abstractStatics"], abstractStatics>;
}> : finalizeState<s>;
type finalizeState<s extends CompositionState> = satisfy<CompositionState, {
params: s["params"];
validated: s["validated"];
remaining: s["remaining"];
kind: s["kind"];
implemented: show<s["implemented"]>;
statics: show<Omit<s["statics"], keyof typeof Trait>>;
abstractMethods: show<Omit<s["abstractMethods"], keyof s["implemented"]>>;
abstractProps: show<Omit<s["abstractProps"], keyof s["implemented"]>>;
abstractStatics: show<Omit<s["abstractStatics"], keyof s["statics"]>>;
}>;
export type implementationOf<s extends CompositionState> = s["abstractMethods"] & ({} extends s["abstractProps"] ? {} : {
construct: (...args: s["params"]) => s["abstractProps"];
}) & ({} extends s["abstractStatics"] ? {} : {
statics: s["abstractStatics"];
});
export {};

75
frontend/node_modules/@ark/util/out/traits.js generated vendored Normal file
View File

@@ -0,0 +1,75 @@
import { hasDomain } from "./domain.js";
import { noSuggest } from "./errors.js";
import { ancestorsOf } from "./objectKinds.js";
import { NoopBase } from "./records.js";
// even though the value we attach will be identical, we use this so classes
// won't be treated as instanceof a Trait
const implementedTraits = noSuggest("implementedTraits");
export const hasTrait = (traitClass) => (o) => {
if (!hasDomain(o, "object"))
return false;
if (implementedTraits in o.constructor &&
o.constructor[implementedTraits].includes(traitClass))
return true;
// emulate standard instanceof behavior
return ancestorsOf(o).includes(traitClass);
};
/** @ts-ignore required to extend NoopBase */
export class Trait extends NoopBase {
static get [Symbol.hasInstance]() {
return hasTrait(this);
}
traitsOf() {
return implementedTraits in this.constructor ?
this.constructor[implementedTraits]
: [];
}
}
const collectPrototypeDescriptors = (trait) => {
let proto = trait.prototype;
let result = {};
do {
// ensure prototypes are sorted from lowest to highest precedence
result = Object.assign(Object.getOwnPropertyDescriptors(proto), result);
proto = Object.getPrototypeOf(proto);
} while (proto !== Object.prototype && proto !== null);
return result;
};
export const compose = ((...traits) => {
const base = function (...args) {
for (const trait of traits) {
const instance = Reflect.construct(trait, args, this.constructor);
Object.assign(this, instance);
}
};
const flatImplementedTraits = [];
for (const trait of traits) {
// copy static properties
Object.assign(base, trait);
// flatten and copy prototype
Object.defineProperties(base.prototype, collectPrototypeDescriptors(trait));
if (implementedTraits in trait) {
// add any ancestor traits from which the current trait was composed
for (const innerTrait of trait[implementedTraits]) {
if (!flatImplementedTraits.includes(innerTrait))
flatImplementedTraits.push(innerTrait);
}
}
if (!flatImplementedTraits.includes(trait))
flatImplementedTraits.push(trait);
}
Object.defineProperty(base, implementedTraits, {
value: flatImplementedTraits,
enumerable: false
});
return base;
});
export const implement = (...args) => {
if (args[args.length - 1] instanceof Trait)
return compose(...args);
const implementation = args[args.length - 1];
const base = compose(...args.slice(0, -1));
// copy implementation last since it overrides traits
Object.defineProperties(base.prototype, Object.getOwnPropertyDescriptors(implementation));
return base;
};

14
frontend/node_modules/@ark/util/out/unionToTuple.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import type { array, join } from "./arrays.ts";
import type { Fn } from "./functions.ts";
import type { conform } from "./generics.ts";
export type stringifyUnion<t extends string, delimiter extends string = ", "> = join<unionToTuple<t>, delimiter>;
export type unionToTuple<t> = _unionToTuple<t, []> extends infer result ? conform<result, t[]> : never;
type _unionToTuple<t, result extends unknown[]> = getLastBranch<t> extends infer current ? [
t
] extends [never] ? result : _unionToTuple<Exclude<t, current>, [current, ...result]> : never;
type getLastBranch<t> = intersectUnion<t extends unknown ? (x: t) => void : never> extends ((x: infer branch) => void) ? branch : never;
export type intersectUnion<t> = (t extends unknown ? (_: t) => void : never) extends ((_: infer intersection) => void) ? intersection : never;
export type intersectOverloadReturns<fn extends Fn> = intersectUnion<ReturnType<overloadOf<fn>>>;
export type overloadOf<fn extends Fn, givenArgs extends array = array> = Exclude<collectSignatures<(() => never) & fn, givenArgs, unknown>, fn extends () => never ? never : () => never>;
type collectSignatures<fn, givenArgs extends array, result> = result & fn extends (...args: infer args) => infer returns ? result extends fn ? never : collectSignatures<fn, givenArgs, Pick<fn, keyof fn> & result & ((...args: args) => returns)> | (args extends givenArgs ? (...args: args) => returns : never) : never;
export {};

1
frontend/node_modules/@ark/util/out/unionToTuple.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

39
frontend/node_modules/@ark/util/package.json generated vendored Normal file
View File

@@ -0,0 +1,39 @@
{
"name": "@ark/util",
"version": "0.56.0",
"license": "MIT",
"author": {
"name": "David Blass",
"email": "david@arktype.io",
"url": "https://arktype.io"
},
"type": "module",
"main": "./out/index.js",
"types": "./out/index.d.ts",
"exports": {
".": {
"ark-ts": "./index.ts",
"default": "./out/index.js"
},
"./tsconfig.base.json": "./tsconfig.base.json",
"./internal/*.ts": {
"ark-ts": "./*.ts",
"default": "./out/*.js"
},
"./internal/*.js": {
"ark-ts": "./*.ts",
"default": "./out/*.js"
}
},
"files": [
"out",
"tsconfig.base.json"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "ts ../repo/build.ts",
"test": "ts ../repo/testPackage.ts"
}
}

18
frontend/node_modules/@ark/util/tsconfig.base.json generated vendored Normal file
View File

@@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "NodeNext",
"target": "ES2023",
"moduleResolution": "NodeNext",
"lib": ["ESNext"],
"noEmit": true,
"skipLibCheck": true,
"strict": true,
"noUncheckedSideEffectImports": true,
"declaration": true,
"verbatimModuleSyntax": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true
}
}