(function_: AnyFunction, options: WrapOptions): AnyFunction;
+type CreateWrapKeyOptions = {
+ keyPrefix?: string;
+ serialize?: (object: any) => string;
+};
+declare function createWrapKey(function_: AnyFunction, arguments_: any[], options?: CreateWrapKeyOptions): string;
+//#endregion
+//#region src/run-if-fn.d.ts
+type Function_ = (...arguments_: P[]) => T;
+declare function runIfFn(valueOrFunction: T | Function_, ...arguments_: P[]): T;
+//#endregion
+//#region src/sleep.d.ts
+declare const sleep: (ms: number) => Promise;
+//#endregion
+//#region src/stats.d.ts
+/**
+ * A counter field that can be incremented or decremented via the unified
+ * {@link Stats.increment} / {@link Stats.decrement} API or an event map.
+ */
+type StatField = "hits" | "misses" | "gets" | "sets" | "deletes" | "clears" | "count";
+/**
+ * A duck-typed event emitter. This intentionally matches both `Hookified`
+ * (used by `cacheable`, `node-cache`, `memory`, `flat-cache`) and Node's
+ * built-in `EventEmitter` (used by `cache-manager`, `cacheable-request`)
+ * without adding a hard dependency on either.
+ */
+type StatsEmitter = {
+ on(event: string, listener: (...args: any[]) => void): unknown;
+ off?(event: string, listener: (...args: any[]) => void): unknown;
+ removeListener?(event: string, listener: (...args: any[]) => void): unknown;
+};
+/**
+ * A custom handler invoked when a subscribed event fires. It receives the
+ * {@link Stats} instance and the raw event arguments (which may be positional,
+ * e.g. node-cache emits `(key, value)`).
+ */
+type StatsEventHandler = (stats: Stats, ...args: any[]) => void;
+/**
+ * Maps an event name to the stat update it should perform: a single field to
+ * increment, an array of fields to increment, or a custom handler.
+ */
+type StatsEventMap = Record;
+/**
+ * A counter field that can be recorded per key via {@link Stats.recordKey}.
+ * This is the subset of {@link StatField} that makes sense for a single key
+ * (`clears` and `count` are cache-wide).
+ */
+type KeyStatField = "hits" | "misses" | "gets" | "sets" | "deletes";
+/**
+ * Per-key statistics returned by {@link Stats.mostUsedKeys},
+ * {@link Stats.leastUsedKeys}, and {@link Stats.keyStats}.
+ */
+type StatsKeyEntry = {
+ key: string; /** Total recorded operations for this key (sum of all fields). */
+ count: number;
+ hits: number;
+ misses: number;
+ gets: number;
+ sets: number;
+ deletes: number; /** `hits / (hits + misses)` for this key, or `0` when there have been no lookups. */
+ hitRate: number;
+};
+/**
+ * A plain-object snapshot of a {@link Stats} instance, suitable for logging,
+ * metrics, or serialization. Returned by {@link Stats.toJSON}.
+ */
+type StatsSnapshot = {
+ enabled: boolean;
+ hits: number;
+ misses: number;
+ gets: number;
+ sets: number;
+ deletes: number;
+ clears: number;
+ vsize: number;
+ ksize: number;
+ count: number;
+ hitRate: number;
+ missRate: number; /** Number of unique keys currently tracked (0 when key tracking is off). */
+ trackedKeys: number;
+ lastUpdated?: number;
+ lastReset?: number;
+};
+type StatsOptions = {
+ /** Whether the stats are enabled. Defaults to `false`. */enabled?: boolean; /** Optionally subscribe to an emitter immediately on construction. */
+ emitter?: StatsEmitter; /** The event map to use. Required when `emitter` is provided. */
+ eventMap?: StatsEventMap; /** Track per-key statistics via {@link Stats.recordKey}. Defaults to `false`. */
+ trackKeys?: boolean;
+ /**
+ * Safety cap on the number of unique keys tracked. When exceeded, the
+ * lowest-count keys are pruned, which keeps {@link Stats.mostUsedKeys}
+ * approximately accurate but makes {@link Stats.leastUsedKeys} unreliable.
+ * Unbounded when unset.
+ */
+ maxTrackedKeys?: number;
+};
+/**
+ * Event map for `@cacheable/node-cache` instances. node-cache emits with
+ * positional arguments (e.g. `set(key, value)`), and emits each lifecycle
+ * event exactly once, so the counts map cleanly. `flush` clears the cache data
+ * and `flush_stats` resets the stats counters, mirroring node-cache's
+ * `flushAll()` / `flushStats()` lifecycle.
+ *
+ * Presets for `cacheable` and `cache-manager` are intentionally not provided:
+ * their event streams emit per-store probes (and, for cache-manager, do not
+ * emit an event on a normal miss), so a simple map cannot faithfully reproduce
+ * their imperative stats. Wire those up with a custom map or imperative calls.
+ */
+declare const nodeCacheStatsEventMap: StatsEventMap;
+/**
+ * Raw per-key counters stored in {@link Stats.trackedKeys}: the
+ * `hits`/`misses`/`gets`/`sets`/`deletes` totals for a single cache key.
+ */
+type KeyCounters = Record;
+declare class Stats {
+ private _counters;
+ private _vsize;
+ private _ksize;
+ private _enabled;
+ private _lastUpdated;
+ private _lastReset;
+ private _subscriptions;
+ /** Backing store for the public {@link trackedKeys} read-only view. */
+ private _trackedKeys;
+ private _trackKeys;
+ private _maxTrackedKeys;
+ constructor(options?: StatsOptions);
+ /**
+ * @returns {boolean} - Whether the stats are enabled
+ */
+ get enabled(): boolean;
+ /**
+ * @param {boolean} enabled - Whether to enable the stats
+ */
+ set enabled(enabled: boolean);
+ /**
+ * @returns {boolean} - Whether per-key statistics are tracked
+ */
+ get trackKeys(): boolean;
+ /**
+ * @param {boolean} trackKeys - Whether to track per-key statistics
+ */
+ set trackKeys(trackKeys: boolean);
+ /**
+ * @returns {number | undefined} - The cap on unique keys tracked, or
+ * `undefined` when unbounded
+ */
+ get maxTrackedKeys(): number | undefined;
+ /**
+ * @param {number | undefined} maxTrackedKeys - The cap on unique keys
+ * tracked. Set `undefined` for unbounded.
+ */
+ set maxTrackedKeys(maxTrackedKeys: number | undefined);
+ /**
+ * Per-key statistics, keyed by cache key, holding each key's raw
+ * `hits`/`misses`/`gets`/`sets`/`deletes` counters. Populated by
+ * {@link recordKey} when {@link trackKeys} is enabled; read `trackedKeys.size`
+ * for the number of unique keys currently tracked. The returned map is a
+ * read-only view — mutate per-key stats via {@link recordKey} /
+ * {@link clearKeys} / {@link reset}.
+ * @returns {ReadonlyMap>}
+ * @readonly
+ */
+ get trackedKeys(): ReadonlyMap>;
+ /**
+ * @returns {number} - The number of hits
+ * @readonly
+ */
+ get hits(): number;
+ /**
+ * @returns {number} - The number of misses
+ * @readonly
+ */
+ get misses(): number;
+ /**
+ * @returns {number} - The number of gets
+ * @readonly
+ */
+ get gets(): number;
+ /**
+ * @returns {number} - The number of sets
+ * @readonly
+ */
+ get sets(): number;
+ /**
+ * @returns {number} - The number of deletes
+ * @readonly
+ */
+ get deletes(): number;
+ /**
+ * @returns {number} - The number of clears
+ * @readonly
+ */
+ get clears(): number;
+ /**
+ * @returns {number} - The vsize (value size) of the cache instance
+ * @readonly
+ */
+ get vsize(): number;
+ /**
+ * @returns {number} - The ksize (key size) of the cache instance
+ * @readonly
+ */
+ get ksize(): number;
+ /**
+ * @returns {number} - The count of the cache instance
+ * @readonly
+ */
+ get count(): number;
+ /**
+ * The ratio of hits to total lookups (hits + misses). Returns `0` when there
+ * have been no lookups.
+ * @returns {number} - A value between 0 and 1
+ * @readonly
+ */
+ get hitRate(): number;
+ /**
+ * The ratio of misses to total lookups (hits + misses). Returns `0` when
+ * there have been no lookups.
+ * @returns {number} - A value between 0 and 1
+ * @readonly
+ */
+ get missRate(): number;
+ /**
+ * The timestamp (ms since epoch) of the last mutation while enabled, or
+ * `undefined` if there have been none since the last reset.
+ * @returns {number | undefined}
+ * @readonly
+ */
+ get lastUpdated(): number | undefined;
+ /**
+ * The timestamp (ms since epoch) of the last {@link reset}/{@link clear}, or
+ * `undefined` if it has never been reset.
+ * @returns {number | undefined}
+ * @readonly
+ */
+ get lastReset(): number | undefined;
+ /**
+ * Increment a counter field by `amount` (default `1`). No-op when disabled.
+ * @param {StatField} field - The counter to increment
+ * @param {number} amount - The amount to add (default 1)
+ */
+ increment(field: StatField, amount?: number): void;
+ /**
+ * Decrement a counter field by `amount` (default `1`). No-op when disabled.
+ * @param {StatField} field - The counter to decrement
+ * @param {number} amount - The amount to subtract (default 1)
+ */
+ decrement(field: StatField, amount?: number): void;
+ incrementHits(amount?: number): void;
+ incrementMisses(amount?: number): void;
+ incrementGets(amount?: number): void;
+ incrementSets(amount?: number): void;
+ incrementDeletes(amount?: number): void;
+ incrementClears(amount?: number): void;
+ incrementVSize(value: any): void;
+ decreaseVSize(value: any): void;
+ incrementKSize(key: string): void;
+ decreaseKSize(key: string): void;
+ incrementCount(amount?: number): void;
+ decreaseCount(amount?: number): void;
+ setCount(count: number): void;
+ roughSizeOfString(value: string): number;
+ roughSizeOfObject(object: any): number;
+ /**
+ * Enable stat tracking. Equivalent to setting {@link enabled} to `true`.
+ */
+ enable(): void;
+ /**
+ * Disable stat tracking. Equivalent to setting {@link enabled} to `false`.
+ */
+ disable(): void;
+ /**
+ * Reset all counters to zero and record the reset timestamp. Alias of
+ * {@link reset}.
+ */
+ clear(): void;
+ reset(): void;
+ resetStoreValues(): void;
+ /**
+ * @returns {StatsSnapshot} - A plain-object snapshot of the current stats,
+ * including computed `hitRate`/`missRate` and timestamps.
+ */
+ toJSON(): StatsSnapshot;
+ /**
+ * @returns {StatsSnapshot} - A plain-object snapshot of the current stats.
+ * Alias of {@link toJSON}.
+ */
+ snapshot(): StatsSnapshot;
+ /**
+ * Record an operation against a specific key for per-key statistics. No-op
+ * unless both {@link enabled} and {@link trackKeys} are `true`.
+ * @param {string} key - The cache key the operation touched
+ * @param {KeyStatField} field - The per-key counter to increment
+ * @param {number} amount - The amount to add (default 1)
+ */
+ recordKey(key: string, field: KeyStatField, amount?: number): void;
+ /**
+ * The most-used keys, sorted descending. Sorts by total recorded operations,
+ * or by a single field when `field` is provided. Ties order by key.
+ * @param {number} limit - Maximum entries to return (default 100)
+ * @param {KeyStatField} [field] - Optionally rank by one counter (e.g. "hits")
+ * @returns {StatsKeyEntry[]}
+ */
+ mostUsedKeys(limit?: number, field?: KeyStatField): StatsKeyEntry[];
+ /**
+ * The least-used keys, sorted ascending. Sorts by total recorded operations,
+ * or by a single field when `field` is provided. Ties order by key. Note:
+ * only keys that have been recorded at least once can be ranked, and when
+ * {@link maxTrackedKeys} pruning has occurred the true least-used keys may
+ * have been evicted.
+ * @param {number} limit - Maximum entries to return (default 100)
+ * @param {KeyStatField} [field] - Optionally rank by one counter (e.g. "gets")
+ * @returns {StatsKeyEntry[]}
+ */
+ leastUsedKeys(limit?: number, field?: KeyStatField): StatsKeyEntry[];
+ /**
+ * @param {string} key - The key to look up
+ * @returns {StatsKeyEntry | undefined} - The per-key statistics, or
+ * `undefined` if the key has not been recorded
+ */
+ keyStats(key: string): StatsKeyEntry | undefined;
+ /**
+ * Clear all per-key statistics without touching the aggregate counters.
+ */
+ clearKeys(): void;
+ private totalOf;
+ private toKeyEntry;
+ private sortedKeyEntries;
+ /**
+ * When over {@link maxTrackedKeys}, prune the lowest-count keys down to 90%
+ * of the cap (batched so the sort cost amortizes across inserts). The key
+ * that was just recorded is never pruned.
+ */
+ private pruneTrackedKeys;
+ /**
+ * Subscribe to an emitter so that matching events automatically update the
+ * stats. Counting is gated by {@link enabled}, so you may subscribe first and
+ * toggle enablement later. Call {@link unsubscribe} to detach.
+ * @param {StatsEmitter} emitter - The emitter to listen on
+ * @param {StatsEventMap} eventMap - The event-to-stat mapping (e.g.
+ * {@link nodeCacheStatsEventMap} or a custom map)
+ */
+ subscribe(emitter: StatsEmitter, eventMap: StatsEventMap): void;
+ /**
+ * Detach listeners previously attached via {@link subscribe}. When `emitter`
+ * is provided, only that emitter's listeners are removed; otherwise all are.
+ * @param {StatsEmitter} [emitter] - The emitter to detach from
+ */
+ unsubscribe(emitter?: StatsEmitter): void;
+ private applyEvent;
+ private touch;
+}
+//#endregion
+export { type AnyFunction, type CacheInstance, type CacheSyncInstance, CacheTags, type CacheTagsOptions, type CacheableItem, type CacheableStoreItem, type CreateWrapKey, type CreateWrapKeyOptions, type GetOrSetFunctionOptions, type GetOrSetKey, type GetOrSetOptions, type GetOrSetSyncKey, type GetOrSetSyncOptions, HashAlgorithm, type HashOptions, type HashToNumberOptions, type KeyCounters, type KeyStatField, type KeyTagEntry, type PerStoreTtl, type RemoveKeysOptions, type SetKeyTagsOptions, type StatField, Stats, type StatsEmitter, type StatsEventHandler, type StatsEventMap, type StatsKeyEntry, type StatsOptions, type StatsSnapshot, type WrapFunctionOptions, type WrapOptions, type WrapSyncOptions, calculateTtlFromExpiration, coalesceAsync, createWrapKey, getCascadingTtl, getOrSet, getOrSetSync, getTtlFromExpires, hash, hashSync, hashToNumber, hashToNumberSync, isKeyvInstance, isObject, lessThan, nodeCacheStatsEventMap, resolvePerStoreTtl, runIfFn, shorthandToMilliseconds, shorthandToTime, sleep, wrap, wrapSync };
\ No newline at end of file
diff --git a/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/@cacheable/utils/dist/index.d.mts b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/@cacheable/utils/dist/index.d.mts
new file mode 100644
index 00000000..afe18e12
--- /dev/null
+++ b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/@cacheable/utils/dist/index.d.mts
@@ -0,0 +1,903 @@
+import { Keyv } from "keyv";
+
+//#region src/shorthand-time.d.ts
+/**
+ * Converts a shorthand time string or number into milliseconds.
+ * The shorthand can be a string like '1s', '2m', '3h', '4d', or a number representing milliseconds.
+ * If the input is undefined, it returns undefined.
+ * If the input is a string that does not match the expected format, it throws an error.
+ * @param shorthand - A shorthand time string or number representing milliseconds.
+ * @returns The equivalent time in milliseconds or undefined.
+ */
+declare const shorthandToMilliseconds: (shorthand?: string | number) => number | undefined;
+/**
+ * Converts a shorthand time string or number into a timestamp.
+ * If the shorthand is undefined, it returns the current date's timestamp.
+ * If the shorthand is a valid time format, it adds that duration to the current date's timestamp.
+ * @param shorthand - A shorthand time string or number representing milliseconds.
+ * @param fromDate - An optional Date object to calculate from. Defaults to the current date if not provided.
+ * @returns The timestamp in milliseconds since epoch.
+ */
+declare const shorthandToTime: (shorthand?: string | number, fromDate?: Date) => number;
+//#endregion
+//#region src/cache-tags.d.ts
+/**
+ * Options for constructing a {@link CacheTags}.
+ * @typedef {Object} CacheTagsOptions
+ * @property {Keyv} store - The Keyv store used to persist tag versions and key snapshots.
+ * @property {string} [namespace] - An optional namespace that isolates this service's tags
+ * and keys from others sharing the same store. Defaults to `"default"`.
+ * @property {boolean} [enabled] - Whether the service is enabled. While disabled, every method
+ * is a no-op: read methods return their neutral value ({@link CacheTags.isKeyFresh} returns
+ * `true`, {@link CacheTags.isKeyStale} returns `false`, etc.) and writes are skipped. The
+ * service must be explicitly enabled to use tags. Defaults to `true`.
+ * @property {(error: unknown) => void} [onError] - Invoked with errors from non-blocking
+ * (fire-and-forget) operations, which cannot be thrown to the caller. Defaults to ignoring them.
+ */
+type CacheTagsOptions = {
+ store: Keyv;
+ namespace?: string;
+ enabled?: boolean;
+ onError?: (error: unknown) => void;
+};
+/**
+ * Options for {@link CacheTags.setKeyTags}.
+ * @typedef {Object} SetKeyTagsOptions
+ * @property {number} [ttl] - Time-to-live in milliseconds for the key's tag snapshot. Should
+ * match the TTL of the cached value it tracks so the snapshot expires alongside it. If omitted,
+ * the snapshot does not expire.
+ * @property {boolean} [nonBlocking] - When `true`, the snapshot write is fire-and-forget:
+ * the call resolves immediately and failures are reported via the `onError` option.
+ */
+type SetKeyTagsOptions = {
+ ttl?: number;
+ nonBlocking?: boolean;
+};
+/**
+ * Options for {@link CacheTags.removeKey} and {@link CacheTags.removeKeys}.
+ * @typedef {Object} RemoveKeysOptions
+ * @property {boolean} [nonBlocking] - When `true`, the removal is fire-and-forget:
+ * the call resolves immediately and failures are reported via the `onError` option.
+ */
+type RemoveKeysOptions = {
+ nonBlocking?: boolean;
+};
+/**
+ * The metadata stored for a tagged key. It records the version of each tag at the moment the key
+ * was written, allowing {@link CacheTags.isKeyFresh} to detect later invalidations.
+ * @typedef {Object} KeyTagEntry
+ * @property {Record} tags - A snapshot mapping each tag name to its version at set time.
+ */
+type KeyTagEntry = {
+ tags: Record;
+};
+/**
+ * Provides tag-based cache invalidation on top of any {@link Keyv} store. It is store-agnostic and
+ * requires no adapter changes.
+ *
+ * The service uses a lazy invalidation model rather than scanning and deleting keys. Each tag has a
+ * monotonically increasing version counter; {@link CacheTags.invalidateTag} simply increments
+ * it. When a key is tagged via {@link CacheTags.setKeyTags}, a snapshot of its tags' current
+ * versions is stored alongside it. {@link CacheTags.isKeyFresh} compares that snapshot against
+ * the live versions — if any tag has been incremented since, the key is considered stale. Stale
+ * entries are not deleted explicitly; they are expected to fall out of the cache via their TTL.
+ *
+ * This keeps invalidation constant-time regardless of how many keys reference a tag, at the cost of
+ * one additional `isKeyFresh` read per cache lookup.
+ *
+ * The service can be disabled via the `enabled` option or property so integrations pay no cost for
+ * untagged workloads: while disabled, every method is a no-op — reads return their neutral value
+ * and writes are skipped. The service must be explicitly enabled to use tags; it never enables
+ * itself, which keeps behavior consistent across distributed instances sharing a store.
+ *
+ * All metadata is written under a reserved prefix so it cannot collide with user keys:
+ * - `--cacheable--tags--::tag:` → integer version counter (stored without TTL).
+ * - `--cacheable--tags--::key:` → the {@link KeyTagEntry} snapshot.
+ *
+ * Note: the read-version-then-write-snapshot sequence in `setKeyTags` is not atomic across
+ * processes. A concurrent `invalidateTag` running between the read and the write can leave a freshly
+ * written key referencing a stale version.
+ *
+ * @example
+ * ```typescript
+ * const cacheTags = new CacheTags({ store: new Keyv(), namespace: 'app' });
+ * await cacheTags.setKeyTags('user:42', ['users', 'org:7'], { ttl: 3600000 });
+ * await cacheTags.isKeyFresh('user:42'); // true
+ * await cacheTags.invalidateTag('users');
+ * await cacheTags.isKeyFresh('user:42'); // false
+ * ```
+ */
+declare class CacheTags {
+ private readonly _store;
+ private readonly _namespace;
+ private _enabled;
+ private readonly _onError?;
+ /**
+ * Creates a new tag service.
+ * @param {CacheTagsOptions} options - The store, optional namespace, enabled state, and
+ * non-blocking error handler to use.
+ */
+ constructor(options: CacheTagsOptions);
+ /**
+ * The Keyv store backing this service.
+ * @returns {Keyv} The store provided to the constructor.
+ */
+ get store(): Keyv;
+ /**
+ * The namespace isolating this service's tags and keys within the store.
+ * @returns {string} The configured namespace, or `"default"` if none was provided.
+ */
+ get namespace(): string;
+ /**
+ * Whether the service is enabled. While disabled, every method is a no-op — read methods
+ * return their neutral value and writes are skipped — so integrations pay no extra store
+ * reads for untagged workloads. The service must be explicitly enabled to use tags; it never
+ * enables itself.
+ * @returns {boolean} Whether the service is enabled.
+ */
+ get enabled(): boolean;
+ /**
+ * Sets whether the service is enabled.
+ * @param {boolean} enabled Whether the service is enabled.
+ */
+ set enabled(enabled: boolean);
+ /**
+ * Builds the reserved store key under which a tag's version counter is stored.
+ * @param tag - The tag name.
+ * @returns {string} The namespaced store key for the tag's version.
+ */
+ private tagKey;
+ /**
+ * Builds the reserved store key under which a cache key's tag snapshot is stored.
+ * @param key - The cache key being tagged.
+ * @returns {string} The namespaced store key for the key's snapshot.
+ */
+ private keyEntryKey;
+ /**
+ * Builds the common prefix shared by every key-snapshot entry in this namespace. Used to filter
+ * key entries when iterating the store.
+ * @returns {string} The namespaced key-entry prefix.
+ */
+ private keyPrefix;
+ /**
+ * Reads the current version of a single tag.
+ * @param tag - The tag name.
+ * @returns {Promise} The tag's version, or `0` if it has never been invalidated.
+ */
+ private getTagVersion;
+ /**
+ * Reads the current versions of multiple tags in a single batched store read.
+ * @param tags - The tag names to look up.
+ * @returns {Promise} The versions in the same order as `tags`; entries that have never
+ * been invalidated resolve to `0`. Returns an empty array when `tags` is empty.
+ */
+ private getTagVersions;
+ /**
+ * Reports a fire-and-forget failure to the `onError` handler, if one was provided.
+ * @param error - The error raised by the non-blocking operation.
+ */
+ private handleNonBlockingError;
+ /**
+ * Reads the version snapshot of each tag and writes the key's tag snapshot to the store.
+ * @param key - The cache key to tag.
+ * @param tags - The tags to associate with the key.
+ * @param ttl - Time-to-live in milliseconds for the snapshot.
+ * @returns {Promise} Resolves once the snapshot has been written.
+ */
+ private writeKeyTags;
+ /**
+ * Associates a cache key with a set of tags by recording a snapshot of each tag's current
+ * version. Call this whenever you write a fresh value to the cache. Duplicate tags are ignored.
+ * No-op while the service is disabled.
+ * @param key - The cache key to tag.
+ * @param tags - The tags to associate with the key.
+ * @param {SetKeyTagsOptions} [options] - Optional settings, such as a `ttl` for the snapshot or
+ * `nonBlocking` to fire-and-forget the write.
+ * @returns {Promise} Resolves once the snapshot has been written, or immediately when
+ * `nonBlocking` is set.
+ */
+ setKeyTags(key: string, tags: string[], options?: SetKeyTagsOptions): Promise;
+ /**
+ * Removes a key's tag snapshot. After this, {@link CacheTags.isKeyFresh} returns `false`
+ * for the key. Use when the cached value itself is deleted. No-op while the service is
+ * disabled.
+ * @param key - The cache key whose snapshot should be removed.
+ * @param {RemoveKeysOptions} [options] - Optional settings, such as `nonBlocking` to
+ * fire-and-forget the removal.
+ * @returns {Promise} Resolves once the snapshot has been deleted, or immediately when
+ * `nonBlocking` is set.
+ */
+ removeKey(key: string, options?: RemoveKeysOptions): Promise;
+ /**
+ * Removes multiple keys' tag snapshots in a single batched store delete. After this,
+ * {@link CacheTags.isKeyFresh} returns `false` for each key. An empty list is a no-op, as is
+ * the entire call while the service is disabled.
+ * @param keys - The cache keys whose snapshots should be removed.
+ * @param {RemoveKeysOptions} [options] - Optional settings, such as `nonBlocking` to
+ * fire-and-forget the removal.
+ * @returns {Promise} Resolves once the snapshots have been deleted, or immediately when
+ * `nonBlocking` is set.
+ */
+ removeKeys(keys: string[], options?: RemoveKeysOptions): Promise;
+ /**
+ * Determines whether a key's cached value can still be trusted. A key is fresh only when a
+ * snapshot exists for it and every tag in that snapshot still has the version it had at set time.
+ * A key with no tags is trivially fresh. Call this before returning a value from your cache.
+ * Always returns `true` while the service is disabled.
+ * @param key - The cache key to check.
+ * @returns {Promise} `true` if the key is still fresh; `false` if it is unknown or any of
+ * its tags has been invalidated since the snapshot was taken.
+ */
+ isKeyFresh(key: string): Promise;
+ /**
+ * Determines whether a key's cached value is known to be stale due to tag invalidation. This is
+ * the complement of {@link CacheTags.isKeyFresh} for tagged keys, but treats keys without a
+ * snapshot as not stale — making it safe to call for every cache lookup, including keys that were
+ * never tagged. Always returns `false` while the service is disabled.
+ * @param key - The cache key to check.
+ * @returns {Promise} `true` only when a snapshot exists for the key and at least one of
+ * its tags has been invalidated since the snapshot was taken; `false` otherwise (including when
+ * the key has no snapshot).
+ */
+ isKeyStale(key: string): Promise;
+ /**
+ * Determines which of the given keys are known to be stale due to tag invalidation, using two
+ * batched store reads regardless of how many keys are checked: one for the snapshots and one for
+ * the union of their tag versions. Keys without a snapshot are not considered stale. Returns an
+ * empty array while the service is disabled.
+ * @param keys - The cache keys to check.
+ * @returns {Promise} The subset of `keys` whose snapshot references at least one tag
+ * that has been invalidated since the snapshot was taken.
+ */
+ getStaleKeys(keys: string[]): Promise;
+ /**
+ * Returns the tags currently associated with a key. Returns `undefined` while the service is
+ * disabled.
+ * @param key - The cache key to look up.
+ * @returns {Promise} The tag names from the key's snapshot, or `undefined`
+ * if the key has no snapshot.
+ */
+ getTags(key: string): Promise;
+ /**
+ * Returns all cache keys whose snapshot references the given tag. This scans every key entry in
+ * the namespace via the Keyv iterator, making it an `O(N)` operation intended for debugging and
+ * tests rather than hot paths. Returns an empty array if the underlying store exposes no iterator
+ * or while the service is disabled.
+ * @param tag - The tag to search for.
+ * @returns {Promise} The cache keys (with the reserved prefix stripped) referencing the tag.
+ */
+ getKeysByTag(tag: string): Promise;
+ /**
+ * Invalidates a single tag by incrementing its version counter. Every key whose snapshot
+ * references this tag becomes stale immediately. Runs in constant time regardless of how many
+ * keys reference the tag. No-op while the service is disabled.
+ * @param tag - The tag to invalidate.
+ * @returns {Promise} A single-element array containing the invalidated tag, or an
+ * empty array while the service is disabled.
+ */
+ invalidateTag(tag: string): Promise;
+ /**
+ * Invalidates multiple tags by incrementing each of their version counters in a single batched
+ * store write. Duplicate tags are bumped once. An empty list is a no-op, as is the entire call
+ * while the service is disabled.
+ * @param tags - The tags to invalidate.
+ * @returns {Promise} The `tags` argument as provided (including any duplicates), or
+ * an empty array while the service is disabled.
+ */
+ invalidateTags(tags: string[]): Promise;
+}
+//#endregion
+//#region src/cacheable-item-types.d.ts
+/**
+ * CacheableItem
+ * @typedef {Object} CacheableItem
+ * @property {string} key - The key of the cacheable item
+ * @property {any} value - The value of the cacheable item
+ * @property {number|string} [ttl] - Time to Live - If you set a number it is miliseconds, if you set a string it is a human-readable
+ * format such as `1s` for 1 second or `1h` for 1 hour. Setting undefined means that it will use the default time-to-live. If both are
+ * undefined then it will not have a time-to-live.
+ */
+type CacheableItem = {
+ key: string;
+ value: any;
+ ttl?: number | string;
+};
+/**
+ * CacheableStoreItem
+ * @typedef {Object} CacheableStoreItem
+ * @property {string} key - The key of the cacheable store item
+ * @property {any} value - The value of the cacheable store item
+ * @property {number} [expires] - The expiration time in milliseconds since epoch. If not set, the item does not expire.
+ */
+type CacheableStoreItem = {
+ key: string;
+ value: any;
+ expires?: number;
+};
+//#endregion
+//#region src/coalesce-async.d.ts
+/**
+ * Enqueue a promise for the group identified by `key`.
+ *
+ * All requests received for the same key while a request for that key
+ * is already being executed will wait. Once the running request settles
+ * then all the waiting requests in the group will settle, too.
+ * This minimizes how many times the function itself runs at the same time.
+ * This function resolves or rejects according to the given function argument.
+ *
+ * @url https://github.com/douglascayers/promise-coalesce
+ */
+declare function coalesceAsync(
+/**
+ * Any identifier to group requests together.
+ */
+
+key: string,
+/**
+ * The function to run.
+ */
+
+fnc: () => T | PromiseLike): Promise;
+//#endregion
+//#region src/hash.d.ts
+declare enum HashAlgorithm {
+ SHA256 = "SHA-256",
+ SHA384 = "SHA-384",
+ SHA512 = "SHA-512",
+ DJB2 = "djb2",
+ FNV1 = "fnv1",
+ MURMER = "murmer",
+ CRC32 = "crc32"
+}
+type HashOptions = {
+ algorithm?: HashAlgorithm;
+ serialize?: (object: any) => string;
+};
+type HashToNumberOptions = HashOptions & {
+ min?: number;
+ max?: number;
+ hashLength?: number;
+};
+/**
+ * Hashes an object asynchronously using the specified cryptographic algorithm.
+ * This method should be used for cryptographic algorithms (SHA-256, SHA-384, SHA-512).
+ * For non-cryptographic algorithms, use hashSync() for better performance.
+ * @param object The object to hash
+ * @param options The hash options to use
+ * @returns {Promise} The hash of the object
+ */
+declare function hash(object: any, options?: HashOptions): Promise;
+/**
+ * Hashes an object synchronously using the specified non-cryptographic algorithm.
+ * This method should be used for non-cryptographic algorithms (DJB2, FNV1, MURMER, CRC32).
+ * For cryptographic algorithms, use hash() instead.
+ * @param object The object to hash
+ * @param options The hash options to use
+ * @returns {string} The hash of the object
+ */
+declare function hashSync(object: any, options?: HashOptions): string;
+/**
+ * Hashes an object asynchronously and converts it to a number within a specified range.
+ * This method should be used for cryptographic algorithms (SHA-256, SHA-384, SHA-512).
+ * For non-cryptographic algorithms, use hashToNumberSync() for better performance.
+ * @param object The object to hash
+ * @param options The hash options to use including min/max range
+ * @returns {Promise} A number within the specified range
+ */
+declare function hashToNumber(object: any, options?: HashToNumberOptions): Promise;
+/**
+ * Hashes an object synchronously and converts it to a number within a specified range.
+ * This method should be used for non-cryptographic algorithms (DJB2, FNV1, MURMER, CRC32).
+ * For cryptographic algorithms, use hashToNumber() instead.
+ * @param object The object to hash
+ * @param options The hash options to use including min/max range
+ * @returns {number} A number within the specified range
+ */
+declare function hashToNumberSync(object: any, options?: HashToNumberOptions): number;
+//#endregion
+//#region src/is-keyv-instance.d.ts
+declare function isKeyvInstance(keyv: any): boolean;
+//#endregion
+//#region src/is-object.d.ts
+declare function isObject>(value: unknown): value is T;
+//#endregion
+//#region src/less-than.d.ts
+declare function lessThan(number1?: number, number2?: number): boolean;
+//#endregion
+//#region src/ttl.d.ts
+/**
+ * A per-store time-to-live override. Each field is a normal TTL (a number in milliseconds or a
+ * human-readable shorthand such as `1s`, `1m`, `1h`, `1d`) applied to that specific store. Fields
+ * left undefined fall back to that store's own default TTL resolution.
+ */
+type PerStoreTtl = {
+ /**
+ * The time-to-live to use for the primary store.
+ */
+ primary?: number | string;
+ /**
+ * The time-to-live to use for the secondary store.
+ */
+ secondary?: number | string;
+};
+/**
+ * Normalizes a TTL input into per-store milliseconds. When given an object it resolves the
+ * `primary` and `secondary` fields independently; when given a number or shorthand string it
+ * applies the same value to both stores. Undefined fields (or undefined input) resolve to
+ * `undefined` so the caller can fall back to its own default TTL.
+ * @param ttl - The TTL input: a number (ms), a shorthand string, or a {@link PerStoreTtl} object.
+ * @returns {{ primary?: number; secondary?: number }} The resolved per-store TTLs in milliseconds.
+ */
+declare function resolvePerStoreTtl(ttl?: number | string | PerStoreTtl): {
+ primary?: number;
+ secondary?: number;
+};
+/**
+ * Converts a exspires value to a TTL value.
+ * @param expires - The expires value to convert.
+ * @returns {number | undefined} The TTL value in milliseconds, or undefined if the expires value is not valid.
+ */
+declare function getTtlFromExpires(expires: number | undefined): number | undefined;
+/**
+ * Get the TTL value from the cacheableTtl, primaryTtl, and secondaryTtl values.
+ * @param cacheableTtl - The cacheableTtl value to use.
+ * @param primaryTtl - The primaryTtl value to use.
+ * @param secondaryTtl - The secondaryTtl value to use.
+ * @returns {number | undefined} The TTL value in milliseconds, or undefined if all values are undefined.
+ */
+declare function getCascadingTtl(cacheableTtl?: number | string, primaryTtl?: number, secondaryTtl?: number): number | undefined;
+/**
+ * Calculate the TTL value from the expires value. If the ttl is undefined, it will be set to the expires value. If the
+ * expires value is undefined, it will be set to the ttl value. If both values are defined, the smaller of the two will be used.
+ * @param ttl
+ * @param expires
+ * @returns
+ */
+declare function calculateTtlFromExpiration(ttl: number | undefined, expires: number | undefined): number | undefined;
+//#endregion
+//#region src/memoize.d.ts
+type CacheInstance = {
+ get: (key: string) => Promise;
+ has: (key: string) => Promise;
+ set: (key: string, value: any, ttl?: number | string | PerStoreTtl) => Promise;
+ on: (event: string, listener: (...args: any[]) => void) => void;
+ emit: (event: string, ...args: any[]) => boolean;
+};
+type CacheSyncInstance = {
+ get: (key: string) => any | undefined;
+ has: (key: string) => boolean;
+ set: (key: string, value: any, ttl?: number | string) => void;
+ on: (event: string, listener: (...args: any[]) => void) => void;
+ emit: (event: string, ...args: any[]) => boolean;
+};
+type GetOrSetKey = string | ((options?: GetOrSetOptions) => string);
+type GetOrSetThrowErrorsContext = "function" | "store";
+type GetOrSetFunctionOptions = {
+ ttl?: number | string;
+ cacheErrors?: boolean;
+ /** Whether or not to throw errors:
+ * - `false` (default) - do not throw any errors
+ * - `true` - throw any error
+ * - `"function"` - only throw errors that occur in the provided function / setter
+ * - `"store"` - only throw errors that occur when getting/setting the cache
+ */
+ throwErrors?: boolean | GetOrSetThrowErrorsContext;
+ /**
+ * If set, this will bypass the instances nonBlocking setting for the get call.
+ * @type {boolean}
+ */
+ nonBlocking?: boolean;
+};
+type GetOrSetOptions = Omit & {
+ ttl?: number | string | PerStoreTtl;
+ cacheId?: string;
+ cache: CacheInstance;
+};
+/**
+ * Options for {@link getOrSetSync}, the synchronous counterpart to {@link GetOrSetOptions}. It
+ * targets a {@link CacheSyncInstance} and its `ttl` is always a single value (a number in
+ * milliseconds or a shorthand string), never a per-store object. The inherited `nonBlocking`
+ * option has no effect on a single, synchronous store.
+ */
+type GetOrSetSyncOptions = GetOrSetFunctionOptions & {
+ cache: CacheSyncInstance;
+};
+/**
+ * A cache key for {@link getOrSetSync}: either a string or a function that derives the key from the
+ * resolved {@link GetOrSetSyncOptions}.
+ */
+type GetOrSetSyncKey = string | ((options?: GetOrSetSyncOptions) => string);
+type CreateWrapKey = (function_: AnyFunction, arguments_: any[], options?: WrapFunctionOptions) => string;
+type WrapFunctionOptions = {
+ ttl?: number | string;
+ keyPrefix?: string;
+ createKey?: CreateWrapKey;
+ cacheErrors?: boolean;
+ cacheId?: string;
+ serialize?: (object: any) => string;
+};
+type WrapOptions = Omit & {
+ ttl?: number | string | PerStoreTtl;
+ cache: CacheInstance;
+ serialize?: (object: any) => string;
+};
+type WrapSyncOptions = WrapFunctionOptions & {
+ cache: CacheSyncInstance;
+ serialize?: (object: any) => string;
+};
+type AnyFunction = (...arguments_: any[]) => any;
+declare function wrapSync(function_: AnyFunction, options: WrapSyncOptions): AnyFunction;
+declare function getOrSet(key: GetOrSetKey, function_: () => Promise, options: GetOrSetOptions): Promise;
+/**
+ * Synchronous counterpart to {@link getOrSet}. Reads `key` from the cache and, on a miss, computes
+ * the value with `function_`, stores it, and returns it.
+ *
+ * Unlike {@link getOrSet} there is no request coalescing: synchronous code runs to completion
+ * without interleaving, so concurrent callers cannot stampede the setter the way they can with an
+ * async cache.
+ *
+ * Error handling mirrors {@link getOrSet}: errors are emitted on the cache's `error` event, can be
+ * cached when `cacheErrors` is set, and can be rethrown selectively via `throwErrors` (`true` for
+ * any error, `"function"` for setter errors, `"store"` for cache read/write errors).
+ *
+ * @param key - The cache key, or a function that derives it from the resolved options.
+ * @param function_ - The setter invoked on a cache miss to compute the value.
+ * @param options - The {@link GetOrSetSyncOptions} including the target synchronous cache.
+ * @returns The cached or freshly computed value, or `undefined`.
+ */
+declare function getOrSetSync(key: GetOrSetSyncKey, function_: () => T, options: GetOrSetSyncOptions): T | undefined;
+declare function wrap(function_: AnyFunction, options: WrapOptions): AnyFunction;
+type CreateWrapKeyOptions = {
+ keyPrefix?: string;
+ serialize?: (object: any) => string;
+};
+declare function createWrapKey(function_: AnyFunction, arguments_: any[], options?: CreateWrapKeyOptions): string;
+//#endregion
+//#region src/run-if-fn.d.ts
+type Function_ = (...arguments_: P[]) => T;
+declare function runIfFn(valueOrFunction: T | Function_, ...arguments_: P[]): T;
+//#endregion
+//#region src/sleep.d.ts
+declare const sleep: (ms: number) => Promise;
+//#endregion
+//#region src/stats.d.ts
+/**
+ * A counter field that can be incremented or decremented via the unified
+ * {@link Stats.increment} / {@link Stats.decrement} API or an event map.
+ */
+type StatField = "hits" | "misses" | "gets" | "sets" | "deletes" | "clears" | "count";
+/**
+ * A duck-typed event emitter. This intentionally matches both `Hookified`
+ * (used by `cacheable`, `node-cache`, `memory`, `flat-cache`) and Node's
+ * built-in `EventEmitter` (used by `cache-manager`, `cacheable-request`)
+ * without adding a hard dependency on either.
+ */
+type StatsEmitter = {
+ on(event: string, listener: (...args: any[]) => void): unknown;
+ off?(event: string, listener: (...args: any[]) => void): unknown;
+ removeListener?(event: string, listener: (...args: any[]) => void): unknown;
+};
+/**
+ * A custom handler invoked when a subscribed event fires. It receives the
+ * {@link Stats} instance and the raw event arguments (which may be positional,
+ * e.g. node-cache emits `(key, value)`).
+ */
+type StatsEventHandler = (stats: Stats, ...args: any[]) => void;
+/**
+ * Maps an event name to the stat update it should perform: a single field to
+ * increment, an array of fields to increment, or a custom handler.
+ */
+type StatsEventMap = Record;
+/**
+ * A counter field that can be recorded per key via {@link Stats.recordKey}.
+ * This is the subset of {@link StatField} that makes sense for a single key
+ * (`clears` and `count` are cache-wide).
+ */
+type KeyStatField = "hits" | "misses" | "gets" | "sets" | "deletes";
+/**
+ * Per-key statistics returned by {@link Stats.mostUsedKeys},
+ * {@link Stats.leastUsedKeys}, and {@link Stats.keyStats}.
+ */
+type StatsKeyEntry = {
+ key: string; /** Total recorded operations for this key (sum of all fields). */
+ count: number;
+ hits: number;
+ misses: number;
+ gets: number;
+ sets: number;
+ deletes: number; /** `hits / (hits + misses)` for this key, or `0` when there have been no lookups. */
+ hitRate: number;
+};
+/**
+ * A plain-object snapshot of a {@link Stats} instance, suitable for logging,
+ * metrics, or serialization. Returned by {@link Stats.toJSON}.
+ */
+type StatsSnapshot = {
+ enabled: boolean;
+ hits: number;
+ misses: number;
+ gets: number;
+ sets: number;
+ deletes: number;
+ clears: number;
+ vsize: number;
+ ksize: number;
+ count: number;
+ hitRate: number;
+ missRate: number; /** Number of unique keys currently tracked (0 when key tracking is off). */
+ trackedKeys: number;
+ lastUpdated?: number;
+ lastReset?: number;
+};
+type StatsOptions = {
+ /** Whether the stats are enabled. Defaults to `false`. */enabled?: boolean; /** Optionally subscribe to an emitter immediately on construction. */
+ emitter?: StatsEmitter; /** The event map to use. Required when `emitter` is provided. */
+ eventMap?: StatsEventMap; /** Track per-key statistics via {@link Stats.recordKey}. Defaults to `false`. */
+ trackKeys?: boolean;
+ /**
+ * Safety cap on the number of unique keys tracked. When exceeded, the
+ * lowest-count keys are pruned, which keeps {@link Stats.mostUsedKeys}
+ * approximately accurate but makes {@link Stats.leastUsedKeys} unreliable.
+ * Unbounded when unset.
+ */
+ maxTrackedKeys?: number;
+};
+/**
+ * Event map for `@cacheable/node-cache` instances. node-cache emits with
+ * positional arguments (e.g. `set(key, value)`), and emits each lifecycle
+ * event exactly once, so the counts map cleanly. `flush` clears the cache data
+ * and `flush_stats` resets the stats counters, mirroring node-cache's
+ * `flushAll()` / `flushStats()` lifecycle.
+ *
+ * Presets for `cacheable` and `cache-manager` are intentionally not provided:
+ * their event streams emit per-store probes (and, for cache-manager, do not
+ * emit an event on a normal miss), so a simple map cannot faithfully reproduce
+ * their imperative stats. Wire those up with a custom map or imperative calls.
+ */
+declare const nodeCacheStatsEventMap: StatsEventMap;
+/**
+ * Raw per-key counters stored in {@link Stats.trackedKeys}: the
+ * `hits`/`misses`/`gets`/`sets`/`deletes` totals for a single cache key.
+ */
+type KeyCounters = Record;
+declare class Stats {
+ private _counters;
+ private _vsize;
+ private _ksize;
+ private _enabled;
+ private _lastUpdated;
+ private _lastReset;
+ private _subscriptions;
+ /** Backing store for the public {@link trackedKeys} read-only view. */
+ private _trackedKeys;
+ private _trackKeys;
+ private _maxTrackedKeys;
+ constructor(options?: StatsOptions);
+ /**
+ * @returns {boolean} - Whether the stats are enabled
+ */
+ get enabled(): boolean;
+ /**
+ * @param {boolean} enabled - Whether to enable the stats
+ */
+ set enabled(enabled: boolean);
+ /**
+ * @returns {boolean} - Whether per-key statistics are tracked
+ */
+ get trackKeys(): boolean;
+ /**
+ * @param {boolean} trackKeys - Whether to track per-key statistics
+ */
+ set trackKeys(trackKeys: boolean);
+ /**
+ * @returns {number | undefined} - The cap on unique keys tracked, or
+ * `undefined` when unbounded
+ */
+ get maxTrackedKeys(): number | undefined;
+ /**
+ * @param {number | undefined} maxTrackedKeys - The cap on unique keys
+ * tracked. Set `undefined` for unbounded.
+ */
+ set maxTrackedKeys(maxTrackedKeys: number | undefined);
+ /**
+ * Per-key statistics, keyed by cache key, holding each key's raw
+ * `hits`/`misses`/`gets`/`sets`/`deletes` counters. Populated by
+ * {@link recordKey} when {@link trackKeys} is enabled; read `trackedKeys.size`
+ * for the number of unique keys currently tracked. The returned map is a
+ * read-only view — mutate per-key stats via {@link recordKey} /
+ * {@link clearKeys} / {@link reset}.
+ * @returns {ReadonlyMap>}
+ * @readonly
+ */
+ get trackedKeys(): ReadonlyMap>;
+ /**
+ * @returns {number} - The number of hits
+ * @readonly
+ */
+ get hits(): number;
+ /**
+ * @returns {number} - The number of misses
+ * @readonly
+ */
+ get misses(): number;
+ /**
+ * @returns {number} - The number of gets
+ * @readonly
+ */
+ get gets(): number;
+ /**
+ * @returns {number} - The number of sets
+ * @readonly
+ */
+ get sets(): number;
+ /**
+ * @returns {number} - The number of deletes
+ * @readonly
+ */
+ get deletes(): number;
+ /**
+ * @returns {number} - The number of clears
+ * @readonly
+ */
+ get clears(): number;
+ /**
+ * @returns {number} - The vsize (value size) of the cache instance
+ * @readonly
+ */
+ get vsize(): number;
+ /**
+ * @returns {number} - The ksize (key size) of the cache instance
+ * @readonly
+ */
+ get ksize(): number;
+ /**
+ * @returns {number} - The count of the cache instance
+ * @readonly
+ */
+ get count(): number;
+ /**
+ * The ratio of hits to total lookups (hits + misses). Returns `0` when there
+ * have been no lookups.
+ * @returns {number} - A value between 0 and 1
+ * @readonly
+ */
+ get hitRate(): number;
+ /**
+ * The ratio of misses to total lookups (hits + misses). Returns `0` when
+ * there have been no lookups.
+ * @returns {number} - A value between 0 and 1
+ * @readonly
+ */
+ get missRate(): number;
+ /**
+ * The timestamp (ms since epoch) of the last mutation while enabled, or
+ * `undefined` if there have been none since the last reset.
+ * @returns {number | undefined}
+ * @readonly
+ */
+ get lastUpdated(): number | undefined;
+ /**
+ * The timestamp (ms since epoch) of the last {@link reset}/{@link clear}, or
+ * `undefined` if it has never been reset.
+ * @returns {number | undefined}
+ * @readonly
+ */
+ get lastReset(): number | undefined;
+ /**
+ * Increment a counter field by `amount` (default `1`). No-op when disabled.
+ * @param {StatField} field - The counter to increment
+ * @param {number} amount - The amount to add (default 1)
+ */
+ increment(field: StatField, amount?: number): void;
+ /**
+ * Decrement a counter field by `amount` (default `1`). No-op when disabled.
+ * @param {StatField} field - The counter to decrement
+ * @param {number} amount - The amount to subtract (default 1)
+ */
+ decrement(field: StatField, amount?: number): void;
+ incrementHits(amount?: number): void;
+ incrementMisses(amount?: number): void;
+ incrementGets(amount?: number): void;
+ incrementSets(amount?: number): void;
+ incrementDeletes(amount?: number): void;
+ incrementClears(amount?: number): void;
+ incrementVSize(value: any): void;
+ decreaseVSize(value: any): void;
+ incrementKSize(key: string): void;
+ decreaseKSize(key: string): void;
+ incrementCount(amount?: number): void;
+ decreaseCount(amount?: number): void;
+ setCount(count: number): void;
+ roughSizeOfString(value: string): number;
+ roughSizeOfObject(object: any): number;
+ /**
+ * Enable stat tracking. Equivalent to setting {@link enabled} to `true`.
+ */
+ enable(): void;
+ /**
+ * Disable stat tracking. Equivalent to setting {@link enabled} to `false`.
+ */
+ disable(): void;
+ /**
+ * Reset all counters to zero and record the reset timestamp. Alias of
+ * {@link reset}.
+ */
+ clear(): void;
+ reset(): void;
+ resetStoreValues(): void;
+ /**
+ * @returns {StatsSnapshot} - A plain-object snapshot of the current stats,
+ * including computed `hitRate`/`missRate` and timestamps.
+ */
+ toJSON(): StatsSnapshot;
+ /**
+ * @returns {StatsSnapshot} - A plain-object snapshot of the current stats.
+ * Alias of {@link toJSON}.
+ */
+ snapshot(): StatsSnapshot;
+ /**
+ * Record an operation against a specific key for per-key statistics. No-op
+ * unless both {@link enabled} and {@link trackKeys} are `true`.
+ * @param {string} key - The cache key the operation touched
+ * @param {KeyStatField} field - The per-key counter to increment
+ * @param {number} amount - The amount to add (default 1)
+ */
+ recordKey(key: string, field: KeyStatField, amount?: number): void;
+ /**
+ * The most-used keys, sorted descending. Sorts by total recorded operations,
+ * or by a single field when `field` is provided. Ties order by key.
+ * @param {number} limit - Maximum entries to return (default 100)
+ * @param {KeyStatField} [field] - Optionally rank by one counter (e.g. "hits")
+ * @returns {StatsKeyEntry[]}
+ */
+ mostUsedKeys(limit?: number, field?: KeyStatField): StatsKeyEntry[];
+ /**
+ * The least-used keys, sorted ascending. Sorts by total recorded operations,
+ * or by a single field when `field` is provided. Ties order by key. Note:
+ * only keys that have been recorded at least once can be ranked, and when
+ * {@link maxTrackedKeys} pruning has occurred the true least-used keys may
+ * have been evicted.
+ * @param {number} limit - Maximum entries to return (default 100)
+ * @param {KeyStatField} [field] - Optionally rank by one counter (e.g. "gets")
+ * @returns {StatsKeyEntry[]}
+ */
+ leastUsedKeys(limit?: number, field?: KeyStatField): StatsKeyEntry[];
+ /**
+ * @param {string} key - The key to look up
+ * @returns {StatsKeyEntry | undefined} - The per-key statistics, or
+ * `undefined` if the key has not been recorded
+ */
+ keyStats(key: string): StatsKeyEntry | undefined;
+ /**
+ * Clear all per-key statistics without touching the aggregate counters.
+ */
+ clearKeys(): void;
+ private totalOf;
+ private toKeyEntry;
+ private sortedKeyEntries;
+ /**
+ * When over {@link maxTrackedKeys}, prune the lowest-count keys down to 90%
+ * of the cap (batched so the sort cost amortizes across inserts). The key
+ * that was just recorded is never pruned.
+ */
+ private pruneTrackedKeys;
+ /**
+ * Subscribe to an emitter so that matching events automatically update the
+ * stats. Counting is gated by {@link enabled}, so you may subscribe first and
+ * toggle enablement later. Call {@link unsubscribe} to detach.
+ * @param {StatsEmitter} emitter - The emitter to listen on
+ * @param {StatsEventMap} eventMap - The event-to-stat mapping (e.g.
+ * {@link nodeCacheStatsEventMap} or a custom map)
+ */
+ subscribe(emitter: StatsEmitter, eventMap: StatsEventMap): void;
+ /**
+ * Detach listeners previously attached via {@link subscribe}. When `emitter`
+ * is provided, only that emitter's listeners are removed; otherwise all are.
+ * @param {StatsEmitter} [emitter] - The emitter to detach from
+ */
+ unsubscribe(emitter?: StatsEmitter): void;
+ private applyEvent;
+ private touch;
+}
+//#endregion
+export { type AnyFunction, type CacheInstance, type CacheSyncInstance, CacheTags, type CacheTagsOptions, type CacheableItem, type CacheableStoreItem, type CreateWrapKey, type CreateWrapKeyOptions, type GetOrSetFunctionOptions, type GetOrSetKey, type GetOrSetOptions, type GetOrSetSyncKey, type GetOrSetSyncOptions, HashAlgorithm, type HashOptions, type HashToNumberOptions, type KeyCounters, type KeyStatField, type KeyTagEntry, type PerStoreTtl, type RemoveKeysOptions, type SetKeyTagsOptions, type StatField, Stats, type StatsEmitter, type StatsEventHandler, type StatsEventMap, type StatsKeyEntry, type StatsOptions, type StatsSnapshot, type WrapFunctionOptions, type WrapOptions, type WrapSyncOptions, calculateTtlFromExpiration, coalesceAsync, createWrapKey, getCascadingTtl, getOrSet, getOrSetSync, getTtlFromExpires, hash, hashSync, hashToNumber, hashToNumberSync, isKeyvInstance, isObject, lessThan, nodeCacheStatsEventMap, resolvePerStoreTtl, runIfFn, shorthandToMilliseconds, shorthandToTime, sleep, wrap, wrapSync };
\ No newline at end of file
diff --git a/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/@cacheable/utils/dist/index.mjs b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/@cacheable/utils/dist/index.mjs
new file mode 100644
index 00000000..ed97de3c
--- /dev/null
+++ b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/@cacheable/utils/dist/index.mjs
@@ -0,0 +1,1355 @@
+import { Hashery } from "hashery";
+import { Keyv } from "keyv";
+//#region src/shorthand-time.ts
+/**
+* Converts a shorthand time string or number into milliseconds.
+* The shorthand can be a string like '1s', '2m', '3h', '4d', or a number representing milliseconds.
+* If the input is undefined, it returns undefined.
+* If the input is a string that does not match the expected format, it throws an error.
+* @param shorthand - A shorthand time string or number representing milliseconds.
+* @returns The equivalent time in milliseconds or undefined.
+*/
+const shorthandToMilliseconds = (shorthand) => {
+ let milliseconds;
+ if (shorthand === void 0) return;
+ if (typeof shorthand === "number") milliseconds = shorthand;
+ else {
+ if (typeof shorthand !== "string") return;
+ shorthand = shorthand.trim();
+ if (Number.isNaN(Number(shorthand))) {
+ const match = /^([\d.]+)\s*(ms|s|m|h|hr|d)$/i.exec(shorthand);
+ if (!match) throw new Error(`Unsupported time format: "${shorthand}". Use 'ms', 's', 'm', 'h', 'hr', or 'd'.`);
+ const [, value, unit] = match;
+ const numericValue = Number.parseFloat(value);
+ switch (unit.toLowerCase()) {
+ case "ms":
+ milliseconds = numericValue;
+ break;
+ case "s":
+ milliseconds = numericValue * 1e3;
+ break;
+ case "m":
+ milliseconds = numericValue * 1e3 * 60;
+ break;
+ case "h":
+ milliseconds = numericValue * 1e3 * 60 * 60;
+ break;
+ case "hr":
+ milliseconds = numericValue * 1e3 * 60 * 60;
+ break;
+ case "d":
+ milliseconds = numericValue * 1e3 * 60 * 60 * 24;
+ break;
+ /* v8 ignore next -- @preserve */
+ default: milliseconds = Number(shorthand);
+ }
+ } else milliseconds = Number(shorthand);
+ }
+ return milliseconds;
+};
+/**
+* Converts a shorthand time string or number into a timestamp.
+* If the shorthand is undefined, it returns the current date's timestamp.
+* If the shorthand is a valid time format, it adds that duration to the current date's timestamp.
+* @param shorthand - A shorthand time string or number representing milliseconds.
+* @param fromDate - An optional Date object to calculate from. Defaults to the current date if not provided.
+* @returns The timestamp in milliseconds since epoch.
+*/
+const shorthandToTime = (shorthand, fromDate) => {
+ fromDate ??= /* @__PURE__ */ new Date();
+ const milliseconds = shorthandToMilliseconds(shorthand);
+ if (milliseconds === void 0) return fromDate.getTime();
+ return fromDate.getTime() + milliseconds;
+};
+//#endregion
+//#region src/cache-tags.ts
+/**
+* Prefix applied to every store key written by the service so its metadata cannot collide with
+* user-supplied cache keys.
+*/
+const RESERVED_PREFIX = "--cacheable--tags--";
+/** Namespace used when none is supplied to the constructor. */
+const DEFAULT_NAMESPACE = "default";
+/**
+* Provides tag-based cache invalidation on top of any {@link Keyv} store. It is store-agnostic and
+* requires no adapter changes.
+*
+* The service uses a lazy invalidation model rather than scanning and deleting keys. Each tag has a
+* monotonically increasing version counter; {@link CacheTags.invalidateTag} simply increments
+* it. When a key is tagged via {@link CacheTags.setKeyTags}, a snapshot of its tags' current
+* versions is stored alongside it. {@link CacheTags.isKeyFresh} compares that snapshot against
+* the live versions — if any tag has been incremented since, the key is considered stale. Stale
+* entries are not deleted explicitly; they are expected to fall out of the cache via their TTL.
+*
+* This keeps invalidation constant-time regardless of how many keys reference a tag, at the cost of
+* one additional `isKeyFresh` read per cache lookup.
+*
+* The service can be disabled via the `enabled` option or property so integrations pay no cost for
+* untagged workloads: while disabled, every method is a no-op — reads return their neutral value
+* and writes are skipped. The service must be explicitly enabled to use tags; it never enables
+* itself, which keeps behavior consistent across distributed instances sharing a store.
+*
+* All metadata is written under a reserved prefix so it cannot collide with user keys:
+* - `--cacheable--tags--::tag:` → integer version counter (stored without TTL).
+* - `--cacheable--tags--::key:` → the {@link KeyTagEntry} snapshot.
+*
+* Note: the read-version-then-write-snapshot sequence in `setKeyTags` is not atomic across
+* processes. A concurrent `invalidateTag` running between the read and the write can leave a freshly
+* written key referencing a stale version.
+*
+* @example
+* ```typescript
+* const cacheTags = new CacheTags({ store: new Keyv(), namespace: 'app' });
+* await cacheTags.setKeyTags('user:42', ['users', 'org:7'], { ttl: 3600000 });
+* await cacheTags.isKeyFresh('user:42'); // true
+* await cacheTags.invalidateTag('users');
+* await cacheTags.isKeyFresh('user:42'); // false
+* ```
+*/
+var CacheTags = class {
+ _store;
+ _namespace;
+ _enabled;
+ _onError;
+ /**
+ * Creates a new tag service.
+ * @param {CacheTagsOptions} options - The store, optional namespace, enabled state, and
+ * non-blocking error handler to use.
+ */
+ constructor(options) {
+ this._store = options.store;
+ this._namespace = options.namespace ?? DEFAULT_NAMESPACE;
+ this._enabled = options.enabled ?? true;
+ this._onError = options.onError;
+ }
+ /**
+ * The Keyv store backing this service.
+ * @returns {Keyv} The store provided to the constructor.
+ */
+ get store() {
+ return this._store;
+ }
+ /**
+ * The namespace isolating this service's tags and keys within the store.
+ * @returns {string} The configured namespace, or `"default"` if none was provided.
+ */
+ get namespace() {
+ return this._namespace;
+ }
+ /**
+ * Whether the service is enabled. While disabled, every method is a no-op — read methods
+ * return their neutral value and writes are skipped — so integrations pay no extra store
+ * reads for untagged workloads. The service must be explicitly enabled to use tags; it never
+ * enables itself.
+ * @returns {boolean} Whether the service is enabled.
+ */
+ get enabled() {
+ return this._enabled;
+ }
+ /**
+ * Sets whether the service is enabled.
+ * @param {boolean} enabled Whether the service is enabled.
+ */
+ set enabled(enabled) {
+ this._enabled = enabled;
+ }
+ /**
+ * Builds the reserved store key under which a tag's version counter is stored.
+ * @param tag - The tag name.
+ * @returns {string} The namespaced store key for the tag's version.
+ */
+ tagKey(tag) {
+ return `${RESERVED_PREFIX}:${this._namespace}:tag:${tag}`;
+ }
+ /**
+ * Builds the reserved store key under which a cache key's tag snapshot is stored.
+ * @param key - The cache key being tagged.
+ * @returns {string} The namespaced store key for the key's snapshot.
+ */
+ keyEntryKey(key) {
+ return `${RESERVED_PREFIX}:${this._namespace}:key:${key}`;
+ }
+ /**
+ * Builds the common prefix shared by every key-snapshot entry in this namespace. Used to filter
+ * key entries when iterating the store.
+ * @returns {string} The namespaced key-entry prefix.
+ */
+ keyPrefix() {
+ return `${RESERVED_PREFIX}:${this._namespace}:key:`;
+ }
+ /**
+ * Reads the current version of a single tag.
+ * @param tag - The tag name.
+ * @returns {Promise} The tag's version, or `0` if it has never been invalidated.
+ */
+ async getTagVersion(tag) {
+ const version = await this._store.get(this.tagKey(tag));
+ return typeof version === "number" ? version : 0;
+ }
+ /**
+ * Reads the current versions of multiple tags in a single batched store read.
+ * @param tags - The tag names to look up.
+ * @returns {Promise} The versions in the same order as `tags`; entries that have never
+ * been invalidated resolve to `0`. Returns an empty array when `tags` is empty.
+ */
+ async getTagVersions(tags) {
+ if (tags.length === 0) return [];
+ const tagKeys = tags.map((tag) => this.tagKey(tag));
+ const raw = await this._store.get(tagKeys);
+ return tags.map((_, i) => {
+ const value = raw?.[i];
+ return typeof value === "number" ? value : 0;
+ });
+ }
+ /**
+ * Reports a fire-and-forget failure to the `onError` handler, if one was provided.
+ * @param error - The error raised by the non-blocking operation.
+ */
+ handleNonBlockingError(error) {
+ this._onError?.(error);
+ }
+ /**
+ * Reads the version snapshot of each tag and writes the key's tag snapshot to the store.
+ * @param key - The cache key to tag.
+ * @param tags - The tags to associate with the key.
+ * @param ttl - Time-to-live in milliseconds for the snapshot.
+ * @returns {Promise} Resolves once the snapshot has been written.
+ */
+ async writeKeyTags(key, tags, ttl) {
+ const uniqueTags = [...new Set(tags)];
+ const versions = await this.getTagVersions(uniqueTags);
+ const snapshot = {};
+ for (let i = 0; i < uniqueTags.length; i++) snapshot[uniqueTags[i]] = versions[i];
+ const entry = { tags: snapshot };
+ await this._store.set(this.keyEntryKey(key), entry, ttl);
+ }
+ /**
+ * Associates a cache key with a set of tags by recording a snapshot of each tag's current
+ * version. Call this whenever you write a fresh value to the cache. Duplicate tags are ignored.
+ * No-op while the service is disabled.
+ * @param key - The cache key to tag.
+ * @param tags - The tags to associate with the key.
+ * @param {SetKeyTagsOptions} [options] - Optional settings, such as a `ttl` for the snapshot or
+ * `nonBlocking` to fire-and-forget the write.
+ * @returns {Promise} Resolves once the snapshot has been written, or immediately when
+ * `nonBlocking` is set.
+ */
+ async setKeyTags(key, tags, options) {
+ if (!this._enabled) return;
+ const work = this.writeKeyTags(key, tags, options?.ttl);
+ if (options?.nonBlocking) {
+ work.catch((error) => {
+ this.handleNonBlockingError(error);
+ });
+ return;
+ }
+ await work;
+ }
+ /**
+ * Removes a key's tag snapshot. After this, {@link CacheTags.isKeyFresh} returns `false`
+ * for the key. Use when the cached value itself is deleted. No-op while the service is
+ * disabled.
+ * @param key - The cache key whose snapshot should be removed.
+ * @param {RemoveKeysOptions} [options] - Optional settings, such as `nonBlocking` to
+ * fire-and-forget the removal.
+ * @returns {Promise} Resolves once the snapshot has been deleted, or immediately when
+ * `nonBlocking` is set.
+ */
+ async removeKey(key, options) {
+ await this.removeKeys([key], options);
+ }
+ /**
+ * Removes multiple keys' tag snapshots in a single batched store delete. After this,
+ * {@link CacheTags.isKeyFresh} returns `false` for each key. An empty list is a no-op, as is
+ * the entire call while the service is disabled.
+ * @param keys - The cache keys whose snapshots should be removed.
+ * @param {RemoveKeysOptions} [options] - Optional settings, such as `nonBlocking` to
+ * fire-and-forget the removal.
+ * @returns {Promise} Resolves once the snapshots have been deleted, or immediately when
+ * `nonBlocking` is set.
+ */
+ async removeKeys(keys, options) {
+ if (!this._enabled || keys.length === 0) return;
+ const entryKeys = keys.map((key) => this.keyEntryKey(key));
+ const work = this._store.deleteMany(entryKeys);
+ if (options?.nonBlocking) {
+ work.catch((error) => {
+ this.handleNonBlockingError(error);
+ });
+ return;
+ }
+ await work;
+ }
+ /**
+ * Determines whether a key's cached value can still be trusted. A key is fresh only when a
+ * snapshot exists for it and every tag in that snapshot still has the version it had at set time.
+ * A key with no tags is trivially fresh. Call this before returning a value from your cache.
+ * Always returns `true` while the service is disabled.
+ * @param key - The cache key to check.
+ * @returns {Promise} `true` if the key is still fresh; `false` if it is unknown or any of
+ * its tags has been invalidated since the snapshot was taken.
+ */
+ async isKeyFresh(key) {
+ if (!this._enabled) return true;
+ const entry = await this._store.get(this.keyEntryKey(key));
+ if (!entry?.tags) return false;
+ const tags = Object.keys(entry.tags);
+ const currentVersions = await this.getTagVersions(tags);
+ for (let i = 0; i < tags.length; i++) if (currentVersions[i] !== entry.tags[tags[i]]) return false;
+ return true;
+ }
+ /**
+ * Determines whether a key's cached value is known to be stale due to tag invalidation. This is
+ * the complement of {@link CacheTags.isKeyFresh} for tagged keys, but treats keys without a
+ * snapshot as not stale — making it safe to call for every cache lookup, including keys that were
+ * never tagged. Always returns `false` while the service is disabled.
+ * @param key - The cache key to check.
+ * @returns {Promise} `true` only when a snapshot exists for the key and at least one of
+ * its tags has been invalidated since the snapshot was taken; `false` otherwise (including when
+ * the key has no snapshot).
+ */
+ async isKeyStale(key) {
+ if (!this._enabled) return false;
+ return (await this.getStaleKeys([key])).length > 0;
+ }
+ /**
+ * Determines which of the given keys are known to be stale due to tag invalidation, using two
+ * batched store reads regardless of how many keys are checked: one for the snapshots and one for
+ * the union of their tag versions. Keys without a snapshot are not considered stale. Returns an
+ * empty array while the service is disabled.
+ * @param keys - The cache keys to check.
+ * @returns {Promise} The subset of `keys` whose snapshot references at least one tag
+ * that has been invalidated since the snapshot was taken.
+ */
+ async getStaleKeys(keys) {
+ if (!this._enabled || keys.length === 0) return [];
+ const entryKeys = keys.map((key) => this.keyEntryKey(key));
+ const entries = await this._store.get(entryKeys);
+ const tagSet = /* @__PURE__ */ new Set();
+ for (const entry of entries) if (entry?.tags) for (const tag of Object.keys(entry.tags)) tagSet.add(tag);
+ const tags = [...tagSet];
+ const versions = await this.getTagVersions(tags);
+ const currentVersions = /* @__PURE__ */ new Map();
+ for (let i = 0; i < tags.length; i++) currentVersions.set(tags[i], versions[i]);
+ const staleKeys = [];
+ for (const [i, entry] of entries.entries()) {
+ if (!entry?.tags) continue;
+ for (const [tag, version] of Object.entries(entry.tags)) if (currentVersions.get(tag) !== version) {
+ staleKeys.push(keys[i]);
+ break;
+ }
+ }
+ return staleKeys;
+ }
+ /**
+ * Returns the tags currently associated with a key. Returns `undefined` while the service is
+ * disabled.
+ * @param key - The cache key to look up.
+ * @returns {Promise} The tag names from the key's snapshot, or `undefined`
+ * if the key has no snapshot.
+ */
+ async getTags(key) {
+ if (!this._enabled) return;
+ const entry = await this._store.get(this.keyEntryKey(key));
+ if (!entry?.tags) return;
+ return Object.keys(entry.tags);
+ }
+ /**
+ * Returns all cache keys whose snapshot references the given tag. This scans every key entry in
+ * the namespace via the Keyv iterator, making it an `O(N)` operation intended for debugging and
+ * tests rather than hot paths. Returns an empty array if the underlying store exposes no iterator
+ * or while the service is disabled.
+ * @param tag - The tag to search for.
+ * @returns {Promise} The cache keys (with the reserved prefix stripped) referencing the tag.
+ */
+ async getKeysByTag(tag) {
+ const result = [];
+ if (!this._enabled) return result;
+ const prefix = this.keyPrefix();
+ const iterator = this._store.iterator?.(this._store.namespace);
+ if (!iterator) return result;
+ for await (const [storedKey, value] of iterator) {
+ if (typeof storedKey !== "string" || !storedKey.startsWith(prefix)) continue;
+ const entry = value;
+ if (entry?.tags && Object.hasOwn(entry.tags, tag)) result.push(storedKey.slice(prefix.length));
+ }
+ return result;
+ }
+ /**
+ * Invalidates a single tag by incrementing its version counter. Every key whose snapshot
+ * references this tag becomes stale immediately. Runs in constant time regardless of how many
+ * keys reference the tag. No-op while the service is disabled.
+ * @param tag - The tag to invalidate.
+ * @returns {Promise} A single-element array containing the invalidated tag, or an
+ * empty array while the service is disabled.
+ */
+ async invalidateTag(tag) {
+ if (!this._enabled) return [];
+ const current = await this.getTagVersion(tag);
+ await this._store.set(this.tagKey(tag), current + 1);
+ return [tag];
+ }
+ /**
+ * Invalidates multiple tags by incrementing each of their version counters in a single batched
+ * store write. Duplicate tags are bumped once. An empty list is a no-op, as is the entire call
+ * while the service is disabled.
+ * @param tags - The tags to invalidate.
+ * @returns {Promise} The `tags` argument as provided (including any duplicates), or
+ * an empty array while the service is disabled.
+ */
+ async invalidateTags(tags) {
+ if (!this._enabled) return [];
+ const uniqueTags = [...new Set(tags)];
+ if (uniqueTags.length === 0) return tags;
+ const versions = await this.getTagVersions(uniqueTags);
+ const kvPairs = [];
+ for (let i = 0; i < uniqueTags.length; i++) kvPairs.push({
+ key: this.tagKey(uniqueTags[i]),
+ value: versions[i] + 1
+ });
+ await this._store.setMany(kvPairs);
+ return tags;
+ }
+};
+//#endregion
+//#region src/coalesce-async.ts
+const callbacks = /* @__PURE__ */ new Map();
+function hasKey(key) {
+ return callbacks.has(key);
+}
+function addKey(key) {
+ callbacks.set(key, []);
+}
+function removeKey(key) {
+ callbacks.delete(key);
+}
+function addCallbackToKey(key, callback) {
+ const stash = getCallbacksByKey(key);
+ stash.push(callback);
+ callbacks.set(key, stash);
+}
+function getCallbacksByKey(key) {
+ /* v8 ignore next -- @preserve */
+ return callbacks.get(key) ?? [];
+}
+async function enqueue(key) {
+ return new Promise((resolve, reject) => {
+ addCallbackToKey(key, {
+ resolve,
+ reject
+ });
+ });
+}
+function dequeue(key) {
+ const stash = getCallbacksByKey(key);
+ removeKey(key);
+ return stash;
+}
+function coalesce(options) {
+ const { key, error, result } = options;
+ for (const callback of dequeue(key))
+ /* c8 ignore next 1 */
+ if (error)
+ /* c8 ignore next 3 */
+ callback.reject(error);
+ else callback.resolve(result);
+}
+/**
+* Enqueue a promise for the group identified by `key`.
+*
+* All requests received for the same key while a request for that key
+* is already being executed will wait. Once the running request settles
+* then all the waiting requests in the group will settle, too.
+* This minimizes how many times the function itself runs at the same time.
+* This function resolves or rejects according to the given function argument.
+*
+* @url https://github.com/douglascayers/promise-coalesce
+*/
+async function coalesceAsync(key, fnc) {
+ if (!hasKey(key)) {
+ addKey(key);
+ try {
+ const result = await Promise.resolve(fnc());
+ coalesce({
+ key,
+ result
+ });
+ return result;
+ } catch (error) {
+ /* c8 ignore next 5 */
+ coalesce({
+ key,
+ error
+ });
+ throw error;
+ }
+ }
+ return enqueue(key);
+}
+//#endregion
+//#region src/hash.ts
+let HashAlgorithm = /* @__PURE__ */ function(HashAlgorithm) {
+ HashAlgorithm["SHA256"] = "SHA-256";
+ HashAlgorithm["SHA384"] = "SHA-384";
+ HashAlgorithm["SHA512"] = "SHA-512";
+ HashAlgorithm["DJB2"] = "djb2";
+ HashAlgorithm["FNV1"] = "fnv1";
+ HashAlgorithm["MURMER"] = "murmer";
+ HashAlgorithm["CRC32"] = "crc32";
+ return HashAlgorithm;
+}({});
+/**
+* Hashes an object asynchronously using the specified cryptographic algorithm.
+* This method should be used for cryptographic algorithms (SHA-256, SHA-384, SHA-512).
+* For non-cryptographic algorithms, use hashSync() for better performance.
+* @param object The object to hash
+* @param options The hash options to use
+* @returns {Promise} The hash of the object
+*/
+async function hash(object, options = {
+ algorithm: "SHA-256",
+ serialize: JSON.stringify
+}) {
+ const algorithm = options?.algorithm ?? "SHA-256";
+ const objectString = (options?.serialize ?? JSON.stringify)(object);
+ return new Hashery().toHash(objectString, { algorithm });
+}
+/**
+* Hashes an object synchronously using the specified non-cryptographic algorithm.
+* This method should be used for non-cryptographic algorithms (DJB2, FNV1, MURMER, CRC32).
+* For cryptographic algorithms, use hash() instead.
+* @param object The object to hash
+* @param options The hash options to use
+* @returns {string} The hash of the object
+*/
+function hashSync(object, options = {
+ algorithm: "djb2",
+ serialize: JSON.stringify
+}) {
+ const algorithm = options?.algorithm ?? "djb2";
+ const objectString = (options?.serialize ?? JSON.stringify)(object);
+ return new Hashery().toHashSync(objectString, { algorithm });
+}
+/**
+* Hashes an object asynchronously and converts it to a number within a specified range.
+* This method should be used for cryptographic algorithms (SHA-256, SHA-384, SHA-512).
+* For non-cryptographic algorithms, use hashToNumberSync() for better performance.
+* @param object The object to hash
+* @param options The hash options to use including min/max range
+* @returns {Promise} A number within the specified range
+*/
+async function hashToNumber(object, options = {
+ min: 0,
+ max: 10,
+ algorithm: "SHA-256",
+ serialize: JSON.stringify
+}) {
+ const min = options?.min ?? 0;
+ const max = options?.max ?? 10;
+ const algorithm = options?.algorithm ?? "SHA-256";
+ const serialize = options?.serialize ?? JSON.stringify;
+ const hashLength = options?.hashLength ?? 16;
+ if (min >= max) throw new Error(`Invalid range: min (${min}) must be less than max (${max})`);
+ const objectString = serialize(object);
+ return new Hashery().toNumber(objectString, {
+ algorithm,
+ min,
+ max,
+ hashLength
+ });
+}
+/**
+* Hashes an object synchronously and converts it to a number within a specified range.
+* This method should be used for non-cryptographic algorithms (DJB2, FNV1, MURMER, CRC32).
+* For cryptographic algorithms, use hashToNumber() instead.
+* @param object The object to hash
+* @param options The hash options to use including min/max range
+* @returns {number} A number within the specified range
+*/
+function hashToNumberSync(object, options = {
+ min: 0,
+ max: 10,
+ algorithm: "djb2",
+ serialize: JSON.stringify
+}) {
+ const min = options?.min ?? 0;
+ const max = options?.max ?? 10;
+ const algorithm = options?.algorithm ?? "djb2";
+ const serialize = options?.serialize ?? JSON.stringify;
+ const hashLength = options?.hashLength ?? 16;
+ if (min >= max) throw new Error(`Invalid range: min (${min}) must be less than max (${max})`);
+ const objectString = serialize(object);
+ return new Hashery().toNumberSync(objectString, {
+ algorithm,
+ min,
+ max,
+ hashLength
+ });
+}
+//#endregion
+//#region src/is-keyv-instance.ts
+function isKeyvInstance(keyv) {
+ if (keyv === null || keyv === void 0) return false;
+ if (keyv instanceof Keyv) return true;
+ return [
+ "generateIterator",
+ "get",
+ "getMany",
+ "set",
+ "setMany",
+ "delete",
+ "deleteMany",
+ "has",
+ "hasMany",
+ "clear",
+ "disconnect",
+ "serialize",
+ "deserialize"
+ ].every((method) => typeof keyv[method] === "function");
+}
+//#endregion
+//#region src/is-object.ts
+function isObject(value) {
+ return value !== null && typeof value === "object" && !Array.isArray(value);
+}
+//#endregion
+//#region src/less-than.ts
+function lessThan(number1, number2) {
+ return typeof number1 === "number" && typeof number2 === "number" ? number1 < number2 : false;
+}
+//#endregion
+//#region src/memoize.ts
+function wrapSync(function_, options) {
+ const { ttl, keyPrefix, cache, serialize } = options;
+ return (...arguments_) => {
+ let cacheKey = createWrapKey(function_, arguments_, {
+ keyPrefix,
+ serialize
+ });
+ if (options.createKey) cacheKey = options.createKey(function_, arguments_, options);
+ let value = cache.get(cacheKey);
+ if (value === void 0) try {
+ value = function_(...arguments_);
+ cache.set(cacheKey, value, ttl);
+ } catch (error) {
+ cache.emit("error", error);
+ if (options.cacheErrors) cache.set(cacheKey, error, ttl);
+ }
+ return value;
+ };
+}
+async function getOrSet(key, function_, options) {
+ const keyString = typeof key === "function" ? key(options) : key;
+ let value;
+ try {
+ value = await options.cache.get(keyString);
+ } catch (error) {
+ options.cache.emit("error", error);
+ if (options.throwErrors === true || options.throwErrors === "store") throw error;
+ }
+ if (value === void 0) value = await coalesceAsync(`${options.cacheId ?? "default"}::${keyString}`, async () => {
+ let result;
+ try {
+ try {
+ result = await function_();
+ } catch (error) {
+ throw new ErrorEnvelope(error, "function");
+ }
+ try {
+ await options.cache.set(keyString, result, options.ttl);
+ } catch (error) {
+ throw new ErrorEnvelope(error, "store");
+ }
+ return result;
+ } catch (caught) {
+ const errorType = caught instanceof ErrorEnvelope ? caught.context : void 0;
+ const error = caught instanceof ErrorEnvelope ? caught.error : caught;
+ options.cache.emit("error", error);
+ if (options.cacheErrors && errorType === "function") try {
+ await options.cache.set(keyString, error, options.ttl);
+ } catch (storeError) {
+ options.cache.emit("error", storeError);
+ }
+ if (options.throwErrors === true || options.throwErrors === errorType) throw error;
+ }
+ return result;
+ });
+ return value;
+}
+/**
+* Synchronous counterpart to {@link getOrSet}. Reads `key` from the cache and, on a miss, computes
+* the value with `function_`, stores it, and returns it.
+*
+* Unlike {@link getOrSet} there is no request coalescing: synchronous code runs to completion
+* without interleaving, so concurrent callers cannot stampede the setter the way they can with an
+* async cache.
+*
+* Error handling mirrors {@link getOrSet}: errors are emitted on the cache's `error` event, can be
+* cached when `cacheErrors` is set, and can be rethrown selectively via `throwErrors` (`true` for
+* any error, `"function"` for setter errors, `"store"` for cache read/write errors).
+*
+* @param key - The cache key, or a function that derives it from the resolved options.
+* @param function_ - The setter invoked on a cache miss to compute the value.
+* @param options - The {@link GetOrSetSyncOptions} including the target synchronous cache.
+* @returns The cached or freshly computed value, or `undefined`.
+*/
+function getOrSetSync(key, function_, options) {
+ const keyString = typeof key === "function" ? key(options) : key;
+ let value;
+ try {
+ value = options.cache.get(keyString);
+ } catch (error) {
+ options.cache.emit("error", error);
+ if (options.throwErrors === true || options.throwErrors === "store") throw error;
+ }
+ if (value === void 0) try {
+ try {
+ value = function_();
+ } catch (error) {
+ throw new ErrorEnvelope(error, "function");
+ }
+ try {
+ options.cache.set(keyString, value, options.ttl);
+ } catch (error) {
+ throw new ErrorEnvelope(error, "store");
+ }
+ } catch (caught) {
+ const errorType = caught instanceof ErrorEnvelope ? caught.context : void 0;
+ const error = caught instanceof ErrorEnvelope ? caught.error : caught;
+ options.cache.emit("error", error);
+ if (options.cacheErrors && errorType === "function") try {
+ options.cache.set(keyString, error, options.ttl);
+ } catch (storeError) {
+ options.cache.emit("error", storeError);
+ }
+ if (options.throwErrors === true || options.throwErrors === errorType) throw error;
+ }
+ return value;
+}
+function wrap(function_, options) {
+ const { keyPrefix, serialize } = options;
+ return async (...arguments_) => {
+ let cacheKey = createWrapKey(function_, arguments_, {
+ keyPrefix,
+ serialize
+ });
+ if (options.createKey) cacheKey = options.createKey(function_, arguments_, options);
+ return getOrSet(cacheKey, async () => function_(...arguments_), options);
+ };
+}
+function createWrapKey(function_, arguments_, options) {
+ const { keyPrefix, serialize } = options || {};
+ if (!keyPrefix) return `${function_.name}::${hashSync(arguments_, { serialize })}`;
+ return `${keyPrefix}::${function_.name}::${hashSync(arguments_, { serialize })}`;
+}
+var ErrorEnvelope = class {
+ error;
+ context;
+ constructor(error, context) {
+ this.error = error;
+ this.context = context;
+ }
+};
+//#endregion
+//#region src/run-if-fn.ts
+function runIfFn(valueOrFunction, ...arguments_) {
+ return typeof valueOrFunction === "function" ? valueOrFunction(...arguments_) : valueOrFunction;
+}
+//#endregion
+//#region src/sleep.ts
+const sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms));
+//#endregion
+//#region src/stats.ts
+/**
+* Event map for `@cacheable/node-cache` instances. node-cache emits with
+* positional arguments (e.g. `set(key, value)`), and emits each lifecycle
+* event exactly once, so the counts map cleanly. `flush` clears the cache data
+* and `flush_stats` resets the stats counters, mirroring node-cache's
+* `flushAll()` / `flushStats()` lifecycle.
+*
+* Presets for `cacheable` and `cache-manager` are intentionally not provided:
+* their event streams emit per-store probes (and, for cache-manager, do not
+* emit an event on a normal miss), so a simple map cannot faithfully reproduce
+* their imperative stats. Wire those up with a custom map or imperative calls.
+*/
+const nodeCacheStatsEventMap = {
+ set: (stats, key) => {
+ stats.increment("sets");
+ if (typeof key === "string" || typeof key === "number") stats.recordKey(String(key), "sets");
+ },
+ del: (stats, key) => {
+ stats.increment("deletes");
+ if (typeof key === "string" || typeof key === "number") stats.recordKey(String(key), "deletes");
+ },
+ flush: "clears",
+ flush_stats: (stats) => {
+ stats.reset();
+ }
+};
+var Stats = class {
+ _counters = {
+ hits: 0,
+ misses: 0,
+ gets: 0,
+ sets: 0,
+ deletes: 0,
+ clears: 0,
+ count: 0
+ };
+ _vsize = 0;
+ _ksize = 0;
+ _enabled = false;
+ _lastUpdated;
+ _lastReset;
+ _subscriptions = [];
+ /** Backing store for the public {@link trackedKeys} read-only view. */
+ _trackedKeys = /* @__PURE__ */ new Map();
+ _trackKeys = false;
+ _maxTrackedKeys;
+ constructor(options) {
+ if (options?.enabled) this._enabled = options.enabled;
+ if (options?.trackKeys) this._trackKeys = options.trackKeys;
+ if (options?.maxTrackedKeys !== void 0) this._maxTrackedKeys = options.maxTrackedKeys;
+ if (options?.emitter && options?.eventMap) this.subscribe(options.emitter, options.eventMap);
+ }
+ /**
+ * @returns {boolean} - Whether the stats are enabled
+ */
+ get enabled() {
+ return this._enabled;
+ }
+ /**
+ * @param {boolean} enabled - Whether to enable the stats
+ */
+ set enabled(enabled) {
+ this._enabled = enabled;
+ }
+ /**
+ * @returns {boolean} - Whether per-key statistics are tracked
+ */
+ get trackKeys() {
+ return this._trackKeys;
+ }
+ /**
+ * @param {boolean} trackKeys - Whether to track per-key statistics
+ */
+ set trackKeys(trackKeys) {
+ this._trackKeys = trackKeys;
+ }
+ /**
+ * @returns {number | undefined} - The cap on unique keys tracked, or
+ * `undefined` when unbounded
+ */
+ get maxTrackedKeys() {
+ return this._maxTrackedKeys;
+ }
+ /**
+ * @param {number | undefined} maxTrackedKeys - The cap on unique keys
+ * tracked. Set `undefined` for unbounded.
+ */
+ set maxTrackedKeys(maxTrackedKeys) {
+ this._maxTrackedKeys = maxTrackedKeys;
+ }
+ /**
+ * Per-key statistics, keyed by cache key, holding each key's raw
+ * `hits`/`misses`/`gets`/`sets`/`deletes` counters. Populated by
+ * {@link recordKey} when {@link trackKeys} is enabled; read `trackedKeys.size`
+ * for the number of unique keys currently tracked. The returned map is a
+ * read-only view — mutate per-key stats via {@link recordKey} /
+ * {@link clearKeys} / {@link reset}.
+ * @returns {ReadonlyMap>}
+ * @readonly
+ */
+ get trackedKeys() {
+ return this._trackedKeys;
+ }
+ /**
+ * @returns {number} - The number of hits
+ * @readonly
+ */
+ get hits() {
+ return this._counters.hits;
+ }
+ /**
+ * @returns {number} - The number of misses
+ * @readonly
+ */
+ get misses() {
+ return this._counters.misses;
+ }
+ /**
+ * @returns {number} - The number of gets
+ * @readonly
+ */
+ get gets() {
+ return this._counters.gets;
+ }
+ /**
+ * @returns {number} - The number of sets
+ * @readonly
+ */
+ get sets() {
+ return this._counters.sets;
+ }
+ /**
+ * @returns {number} - The number of deletes
+ * @readonly
+ */
+ get deletes() {
+ return this._counters.deletes;
+ }
+ /**
+ * @returns {number} - The number of clears
+ * @readonly
+ */
+ get clears() {
+ return this._counters.clears;
+ }
+ /**
+ * @returns {number} - The vsize (value size) of the cache instance
+ * @readonly
+ */
+ get vsize() {
+ return this._vsize;
+ }
+ /**
+ * @returns {number} - The ksize (key size) of the cache instance
+ * @readonly
+ */
+ get ksize() {
+ return this._ksize;
+ }
+ /**
+ * @returns {number} - The count of the cache instance
+ * @readonly
+ */
+ get count() {
+ return this._counters.count;
+ }
+ /**
+ * The ratio of hits to total lookups (hits + misses). Returns `0` when there
+ * have been no lookups.
+ * @returns {number} - A value between 0 and 1
+ * @readonly
+ */
+ get hitRate() {
+ const total = this._counters.hits + this._counters.misses;
+ return total === 0 ? 0 : this._counters.hits / total;
+ }
+ /**
+ * The ratio of misses to total lookups (hits + misses). Returns `0` when
+ * there have been no lookups.
+ * @returns {number} - A value between 0 and 1
+ * @readonly
+ */
+ get missRate() {
+ const total = this._counters.hits + this._counters.misses;
+ return total === 0 ? 0 : this._counters.misses / total;
+ }
+ /**
+ * The timestamp (ms since epoch) of the last mutation while enabled, or
+ * `undefined` if there have been none since the last reset.
+ * @returns {number | undefined}
+ * @readonly
+ */
+ get lastUpdated() {
+ return this._lastUpdated;
+ }
+ /**
+ * The timestamp (ms since epoch) of the last {@link reset}/{@link clear}, or
+ * `undefined` if it has never been reset.
+ * @returns {number | undefined}
+ * @readonly
+ */
+ get lastReset() {
+ return this._lastReset;
+ }
+ /**
+ * Increment a counter field by `amount` (default `1`). No-op when disabled.
+ * @param {StatField} field - The counter to increment
+ * @param {number} amount - The amount to add (default 1)
+ */
+ increment(field, amount = 1) {
+ if (!this._enabled) return;
+ this._counters[field] += amount;
+ this.touch();
+ }
+ /**
+ * Decrement a counter field by `amount` (default `1`). No-op when disabled.
+ * @param {StatField} field - The counter to decrement
+ * @param {number} amount - The amount to subtract (default 1)
+ */
+ decrement(field, amount = 1) {
+ if (!this._enabled) return;
+ this._counters[field] -= amount;
+ this.touch();
+ }
+ incrementHits(amount = 1) {
+ this.increment("hits", amount);
+ }
+ incrementMisses(amount = 1) {
+ this.increment("misses", amount);
+ }
+ incrementGets(amount = 1) {
+ this.increment("gets", amount);
+ }
+ incrementSets(amount = 1) {
+ this.increment("sets", amount);
+ }
+ incrementDeletes(amount = 1) {
+ this.increment("deletes", amount);
+ }
+ incrementClears(amount = 1) {
+ this.increment("clears", amount);
+ }
+ incrementVSize(value) {
+ if (!this._enabled) return;
+ this._vsize += this.roughSizeOfObject(value);
+ this.touch();
+ }
+ decreaseVSize(value) {
+ if (!this._enabled) return;
+ this._vsize = Math.max(0, this._vsize - this.roughSizeOfObject(value));
+ this.touch();
+ }
+ incrementKSize(key) {
+ if (!this._enabled) return;
+ this._ksize += this.roughSizeOfString(key);
+ this.touch();
+ }
+ decreaseKSize(key) {
+ if (!this._enabled) return;
+ this._ksize = Math.max(0, this._ksize - this.roughSizeOfString(key));
+ this.touch();
+ }
+ incrementCount(amount = 1) {
+ this.increment("count", amount);
+ }
+ decreaseCount(amount = 1) {
+ if (!this._enabled) return;
+ this._counters.count = Math.max(0, this._counters.count - amount);
+ this.touch();
+ }
+ setCount(count) {
+ if (!this._enabled) return;
+ this._counters.count = count;
+ this.touch();
+ }
+ roughSizeOfString(value) {
+ return value.length * 2;
+ }
+ roughSizeOfObject(object) {
+ const objectList = [];
+ const stack = [object];
+ let bytes = 0;
+ while (stack.length > 0) {
+ const value = stack.pop();
+ if (typeof value === "boolean") bytes += 4;
+ else if (typeof value === "string") bytes += value.length * 2;
+ else if (typeof value === "number") bytes += 8;
+ else {
+ if (value === null || value === void 0) {
+ bytes += 4;
+ continue;
+ }
+ if (objectList.includes(value)) continue;
+ objectList.push(value);
+ for (const key in value) {
+ bytes += key.length * 2;
+ stack.push(value[key]);
+ }
+ }
+ }
+ return bytes;
+ }
+ /**
+ * Enable stat tracking. Equivalent to setting {@link enabled} to `true`.
+ */
+ enable() {
+ this._enabled = true;
+ }
+ /**
+ * Disable stat tracking. Equivalent to setting {@link enabled} to `false`.
+ */
+ disable() {
+ this._enabled = false;
+ }
+ /**
+ * Reset all counters to zero and record the reset timestamp. Alias of
+ * {@link reset}.
+ */
+ clear() {
+ this.reset();
+ }
+ reset() {
+ this._counters = {
+ hits: 0,
+ misses: 0,
+ gets: 0,
+ sets: 0,
+ deletes: 0,
+ clears: 0,
+ count: 0
+ };
+ this._vsize = 0;
+ this._ksize = 0;
+ this._trackedKeys.clear();
+ this._lastReset = Date.now();
+ this._lastUpdated = void 0;
+ }
+ resetStoreValues() {
+ this._vsize = 0;
+ this._ksize = 0;
+ this._counters.count = 0;
+ }
+ /**
+ * @returns {StatsSnapshot} - A plain-object snapshot of the current stats,
+ * including computed `hitRate`/`missRate` and timestamps.
+ */
+ toJSON() {
+ return {
+ enabled: this._enabled,
+ hits: this._counters.hits,
+ misses: this._counters.misses,
+ gets: this._counters.gets,
+ sets: this._counters.sets,
+ deletes: this._counters.deletes,
+ clears: this._counters.clears,
+ vsize: this._vsize,
+ ksize: this._ksize,
+ count: this._counters.count,
+ hitRate: this.hitRate,
+ missRate: this.missRate,
+ trackedKeys: this._trackedKeys.size,
+ lastUpdated: this._lastUpdated,
+ lastReset: this._lastReset
+ };
+ }
+ /**
+ * @returns {StatsSnapshot} - A plain-object snapshot of the current stats.
+ * Alias of {@link toJSON}.
+ */
+ snapshot() {
+ return this.toJSON();
+ }
+ /**
+ * Record an operation against a specific key for per-key statistics. No-op
+ * unless both {@link enabled} and {@link trackKeys} are `true`.
+ * @param {string} key - The cache key the operation touched
+ * @param {KeyStatField} field - The per-key counter to increment
+ * @param {number} amount - The amount to add (default 1)
+ */
+ recordKey(key, field, amount = 1) {
+ if (!this._enabled || !this._trackKeys) return;
+ let counters = this._trackedKeys.get(key);
+ if (!counters) {
+ counters = {
+ hits: 0,
+ misses: 0,
+ gets: 0,
+ sets: 0,
+ deletes: 0
+ };
+ this._trackedKeys.set(key, counters);
+ this.pruneTrackedKeys(key);
+ }
+ counters[field] += amount;
+ this.touch();
+ }
+ /**
+ * The most-used keys, sorted descending. Sorts by total recorded operations,
+ * or by a single field when `field` is provided. Ties order by key.
+ * @param {number} limit - Maximum entries to return (default 100)
+ * @param {KeyStatField} [field] - Optionally rank by one counter (e.g. "hits")
+ * @returns {StatsKeyEntry[]}
+ */
+ mostUsedKeys(limit = 100, field) {
+ return this.sortedKeyEntries(field, "desc").slice(0, limit);
+ }
+ /**
+ * The least-used keys, sorted ascending. Sorts by total recorded operations,
+ * or by a single field when `field` is provided. Ties order by key. Note:
+ * only keys that have been recorded at least once can be ranked, and when
+ * {@link maxTrackedKeys} pruning has occurred the true least-used keys may
+ * have been evicted.
+ * @param {number} limit - Maximum entries to return (default 100)
+ * @param {KeyStatField} [field] - Optionally rank by one counter (e.g. "gets")
+ * @returns {StatsKeyEntry[]}
+ */
+ leastUsedKeys(limit = 100, field) {
+ return this.sortedKeyEntries(field, "asc").slice(0, limit);
+ }
+ /**
+ * @param {string} key - The key to look up
+ * @returns {StatsKeyEntry | undefined} - The per-key statistics, or
+ * `undefined` if the key has not been recorded
+ */
+ keyStats(key) {
+ const counters = this._trackedKeys.get(key);
+ return counters ? this.toKeyEntry(key, counters) : void 0;
+ }
+ /**
+ * Clear all per-key statistics without touching the aggregate counters.
+ */
+ clearKeys() {
+ this._trackedKeys.clear();
+ }
+ totalOf(counters) {
+ return counters.hits + counters.misses + counters.gets + counters.sets + counters.deletes;
+ }
+ toKeyEntry(key, counters) {
+ const lookups = counters.hits + counters.misses;
+ return {
+ key,
+ count: this.totalOf(counters),
+ hits: counters.hits,
+ misses: counters.misses,
+ gets: counters.gets,
+ sets: counters.sets,
+ deletes: counters.deletes,
+ hitRate: lookups === 0 ? 0 : counters.hits / lookups
+ };
+ }
+ sortedKeyEntries(field, direction) {
+ const entries = [];
+ for (const [key, counters] of this._trackedKeys) entries.push(this.toKeyEntry(key, counters));
+ const sign = direction === "asc" ? 1 : -1;
+ entries.sort((a, b) => {
+ const valueA = field ? a[field] : a.count;
+ const valueB = field ? b[field] : b.count;
+ if (valueA !== valueB) return (valueA - valueB) * sign;
+ return a.key < b.key ? -1 : 1;
+ });
+ return entries;
+ }
+ /**
+ * When over {@link maxTrackedKeys}, prune the lowest-count keys down to 90%
+ * of the cap (batched so the sort cost amortizes across inserts). The key
+ * that was just recorded is never pruned.
+ */
+ pruneTrackedKeys(protectedKey) {
+ if (this._maxTrackedKeys === void 0 || this._trackedKeys.size <= this._maxTrackedKeys) return;
+ const target = Math.max(1, Math.floor(this._maxTrackedKeys * .9));
+ const sorted = [...this._trackedKeys.entries()].sort((a, b) => this.totalOf(a[1]) - this.totalOf(b[1]));
+ for (const [key] of sorted) {
+ if (this._trackedKeys.size <= target) break;
+ if (key === protectedKey) continue;
+ this._trackedKeys.delete(key);
+ }
+ }
+ /**
+ * Subscribe to an emitter so that matching events automatically update the
+ * stats. Counting is gated by {@link enabled}, so you may subscribe first and
+ * toggle enablement later. Call {@link unsubscribe} to detach.
+ * @param {StatsEmitter} emitter - The emitter to listen on
+ * @param {StatsEventMap} eventMap - The event-to-stat mapping (e.g.
+ * {@link nodeCacheStatsEventMap} or a custom map)
+ */
+ subscribe(emitter, eventMap) {
+ for (const [event, action] of Object.entries(eventMap)) {
+ const listener = (...args) => {
+ this.applyEvent(action, args);
+ };
+ emitter.on(event, listener);
+ this._subscriptions.push({
+ emitter,
+ event,
+ listener
+ });
+ }
+ }
+ /**
+ * Detach listeners previously attached via {@link subscribe}. When `emitter`
+ * is provided, only that emitter's listeners are removed; otherwise all are.
+ * @param {StatsEmitter} [emitter] - The emitter to detach from
+ */
+ unsubscribe(emitter) {
+ const remaining = [];
+ for (const sub of this._subscriptions) {
+ if (emitter && sub.emitter !== emitter) {
+ remaining.push(sub);
+ continue;
+ }
+ (sub.emitter.off ?? sub.emitter.removeListener)?.call(sub.emitter, sub.event, sub.listener);
+ }
+ this._subscriptions = remaining;
+ }
+ applyEvent(action, args) {
+ if (!this._enabled) return;
+ if (typeof action === "function") {
+ action(this, ...args);
+ return;
+ }
+ if (Array.isArray(action)) {
+ for (const field of action) this.increment(field);
+ return;
+ }
+ this.increment(action);
+ }
+ touch() {
+ this._lastUpdated = Date.now();
+ }
+};
+//#endregion
+//#region src/ttl.ts
+/**
+* Normalizes a TTL input into per-store milliseconds. When given an object it resolves the
+* `primary` and `secondary` fields independently; when given a number or shorthand string it
+* applies the same value to both stores. Undefined fields (or undefined input) resolve to
+* `undefined` so the caller can fall back to its own default TTL.
+* @param ttl - The TTL input: a number (ms), a shorthand string, or a {@link PerStoreTtl} object.
+* @returns {{ primary?: number; secondary?: number }} The resolved per-store TTLs in milliseconds.
+*/
+function resolvePerStoreTtl(ttl) {
+ if (ttl === void 0 || ttl === null) return {
+ primary: void 0,
+ secondary: void 0
+ };
+ if (typeof ttl === "object") return {
+ primary: shorthandToMilliseconds(ttl.primary),
+ secondary: shorthandToMilliseconds(ttl.secondary)
+ };
+ const milliseconds = shorthandToMilliseconds(ttl);
+ return {
+ primary: milliseconds,
+ secondary: milliseconds
+ };
+}
+/**
+* Converts a exspires value to a TTL value.
+* @param expires - The expires value to convert.
+* @returns {number | undefined} The TTL value in milliseconds, or undefined if the expires value is not valid.
+*/
+function getTtlFromExpires(expires) {
+ if (expires === void 0 || expires === null) return;
+ const now = Date.now();
+ if (expires < now) return;
+ return expires - now;
+}
+/**
+* Get the TTL value from the cacheableTtl, primaryTtl, and secondaryTtl values.
+* @param cacheableTtl - The cacheableTtl value to use.
+* @param primaryTtl - The primaryTtl value to use.
+* @param secondaryTtl - The secondaryTtl value to use.
+* @returns {number | undefined} The TTL value in milliseconds, or undefined if all values are undefined.
+*/
+function getCascadingTtl(cacheableTtl, primaryTtl, secondaryTtl) {
+ return secondaryTtl ?? primaryTtl ?? shorthandToMilliseconds(cacheableTtl);
+}
+/**
+* Calculate the TTL value from the expires value. If the ttl is undefined, it will be set to the expires value. If the
+* expires value is undefined, it will be set to the ttl value. If both values are defined, the smaller of the two will be used.
+* @param ttl
+* @param expires
+* @returns
+*/
+function calculateTtlFromExpiration(ttl, expires) {
+ const ttlFromExpires = getTtlFromExpires(expires);
+ const expiresFromTtl = ttl ? Date.now() + ttl : void 0;
+ if (ttlFromExpires === void 0) return ttl;
+ if (expiresFromTtl === void 0) return ttlFromExpires;
+ if (expires && expires > expiresFromTtl) return ttl;
+ return ttlFromExpires;
+}
+//#endregion
+export { CacheTags, HashAlgorithm, Stats, calculateTtlFromExpiration, coalesceAsync, createWrapKey, getCascadingTtl, getOrSet, getOrSetSync, getTtlFromExpires, hash, hashSync, hashToNumber, hashToNumberSync, isKeyvInstance, isObject, lessThan, nodeCacheStatsEventMap, resolvePerStoreTtl, runIfFn, shorthandToMilliseconds, shorthandToTime, sleep, wrap, wrapSync };
diff --git a/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/@cacheable/utils/package.json b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/@cacheable/utils/package.json
new file mode 100644
index 00000000..c92d3bca
--- /dev/null
+++ b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/@cacheable/utils/package.json
@@ -0,0 +1,56 @@
+{
+ "name": "@cacheable/utils",
+ "version": "2.5.0",
+ "description": "Cacheable Utilities for Caching Libraries",
+ "type": "module",
+ "main": "./dist/index.cjs",
+ "module": "./dist/index.mjs",
+ "types": "./dist/index.d.mts",
+ "exports": {
+ ".": {
+ "import": {
+ "types": "./dist/index.d.mts",
+ "default": "./dist/index.mjs"
+ },
+ "require": {
+ "types": "./dist/index.d.cts",
+ "default": "./dist/index.cjs"
+ }
+ }
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/jaredwray/cacheable.git",
+ "directory": "packages/utils"
+ },
+ "author": "Jared Wray ",
+ "license": "MIT",
+ "private": false,
+ "dependencies": {
+ "hashery": "^1.5.1",
+ "keyv": "^5.6.0"
+ },
+ "devDependencies": {
+ "tsdown": "^0.22.0",
+ "typescript": "^5.9.3"
+ },
+ "keywords": [
+ "cacheable",
+ "caching",
+ "utilities",
+ "hashing",
+ "keyv",
+ "cache utils"
+ ],
+ "files": [
+ "dist",
+ "LICENSE"
+ ],
+ "scripts": {
+ "build": "rimraf ./dist && tsdown src/index.ts --format cjs,esm --dts --clean",
+ "lint": "biome check --write --error-on-warnings",
+ "test": "pnpm lint && vitest run --coverage",
+ "test:ci": "biome check --error-on-warnings && vitest run --coverage",
+ "clean": "rimraf ./dist ./coverage ./node_modules"
+ }
+}
\ No newline at end of file
diff --git a/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/hashery b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/hashery
new file mode 120000
index 00000000..da3bb81a
--- /dev/null
+++ b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/hashery
@@ -0,0 +1 @@
+../../hashery@1.5.1/node_modules/hashery
\ No newline at end of file
diff --git a/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/keyv b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/keyv
new file mode 120000
index 00000000..21cb8167
--- /dev/null
+++ b/backend/node_modules/.pnpm/@cacheable+utils@2.5.0/node_modules/keyv
@@ -0,0 +1 @@
+../../keyv@5.6.0/node_modules/keyv
\ No newline at end of file
diff --git a/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/LICENSE b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/LICENSE
new file mode 100644
index 00000000..261eeb9e
--- /dev/null
+++ b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/README.md b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/README.md
new file mode 100644
index 00000000..156d72a3
--- /dev/null
+++ b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/README.md
@@ -0,0 +1,369 @@
+# Config Array
+
+## Description
+
+A config array is a way of managing configurations that are based on glob pattern matching of filenames. Each config array contains the information needed to determine the correct configuration for any file based on the filename.
+
+**Note:** This is a generic package that can be used outside of ESLint. It contains no ESLint-specific functionality.
+
+## Installation
+
+For Node.js and compatible runtimes:
+
+```shell
+npm install @eslint/config-array
+# or
+yarn add @eslint/config-array
+# or
+pnpm install @eslint/config-array
+# or
+bun add @eslint/config-array
+```
+
+For Deno:
+
+```shell
+deno add @eslint/config-array
+```
+
+## Background
+
+The basic idea is that all configuration, including overrides, can be represented by a single array where each item in the array is a config object. Config objects appearing later in the array override config objects appearing earlier in the array. You can calculate a config for a given file by traversing all config objects in the array to find the ones that match the filename. Matching is done by specifying glob patterns in `files` and `ignores` properties on each config object. Here's an example:
+
+```js
+export default [
+ // match all JSON files
+ {
+ name: "JSON Handler",
+ files: ["**/*.json"],
+ handler: jsonHandler,
+ },
+
+ // match only package.json
+ {
+ name: "package.json Handler",
+ files: ["package.json"],
+ handler: packageJsonHandler,
+ },
+];
+```
+
+In this example, there are two config objects: the first matches all JSON files in all directories and the second matches just `package.json` in the base path directory (all the globs are evaluated as relative to a base path that can be specified). When you retrieve a configuration for `foo.json`, only the first config object matches so `handler` is equal to `jsonHandler`; when you retrieve a configuration for `package.json`, `handler` is equal to `packageJsonHandler` (because both config objects match, the second one wins).
+
+## Usage
+
+First, import the `ConfigArray` constructor:
+
+```js
+import { ConfigArray } from "@eslint/config-array";
+
+// or using CommonJS
+
+const { ConfigArray } = require("@eslint/config-array");
+```
+
+When you create a new instance of `ConfigArray`, you must pass in two arguments: an array of configs and an options object. The array of configs is most likely read in from a configuration file, so here's a typical example:
+
+```js
+import path from "node:path";
+import { pathToFileURL } from "node:url";
+import { ConfigArray } from "@eslint/config-array";
+
+const configFilename = path.resolve(process.cwd(), "my.config.js");
+const { default: rawConfigs } = await import(pathToFileURL(configFilename));
+
+const configs = new ConfigArray(rawConfigs, {
+ // the path to match filenames from
+ basePath: process.cwd(),
+
+ // additional items in each config
+ schema: mySchema,
+});
+```
+
+This example reads in an object or array from `my.config.js` and passes it into the `ConfigArray` constructor as the first argument. The second argument is an object specifying the `basePath` (the directory in which `my.config.js` is found) and a `schema` to define the additional properties of a config object beyond `files`, `ignores`, `basePath`, and `name`.
+
+### Specifying a Schema
+
+The `schema` option is required for you to use additional properties in config objects. The schema is an object that follows the format of an [`ObjectSchema`](https://npmjs.com/package/@eslint/object-schema). The schema specifies both validation and merge rules that the `ConfigArray` instance needs to combine configs when there are multiple matches. Here's an example:
+
+```js
+const configFilename = path.resolve(process.cwd(), "my.config.js");
+const { default: rawConfigs } = await import(pathToFileURL(configFilename));
+
+const mySchema = {
+ // define the handler key in configs
+ handler: {
+ required: true,
+ merge(a, b) {
+ return b ?? a;
+ },
+ validate(value) {
+ if (typeof value !== "function") {
+ throw new TypeError("Function expected.");
+ }
+ },
+ },
+};
+
+const configs = new ConfigArray(rawConfigs, {
+ // the path to match filenames from
+ basePath: process.cwd(),
+
+ // additional item schemas in each config
+ schema: mySchema,
+
+ // additional config types supported (default: [])
+ extraConfigTypes: ["array", "function"],
+});
+```
+
+### Config Arrays
+
+Config arrays can be multidimensional, so it's possible for a config array to contain another config array when `extraConfigTypes` contains `"array"`, such as:
+
+```js
+export default [
+ // JS config
+ {
+ files: ["**/*.js"],
+ handler: jsHandler,
+ },
+
+ // JSON configs
+ [
+ // match all JSON files
+ {
+ name: "JSON Handler",
+ files: ["**/*.json"],
+ handler: jsonHandler,
+ },
+
+ // match only package.json
+ {
+ name: "package.json Handler",
+ files: ["package.json"],
+ handler: packageJsonHandler,
+ },
+ ],
+
+ // filename must match function
+ {
+ files: [filePath => filePath.endsWith(".md")],
+ handler: markdownHandler,
+ },
+
+ // filename must match all patterns in subarray
+ {
+ files: [["*.test.*", "*.js"]],
+ handler: jsTestHandler,
+ },
+
+ // filename must not match patterns beginning with !
+ {
+ name: "Non-JS files",
+ files: ["!*.js"],
+ settings: {
+ js: false,
+ },
+ },
+
+ // specific settings for files inside `src` directory
+ {
+ name: "Source files",
+ basePath: "src",
+ files: ["**/*"],
+ settings: {
+ source: true,
+ },
+ },
+];
+```
+
+In this example, the array contains both config objects and a config array. When a config array is normalized (see details below), it is flattened so only config objects remain. However, the order of evaluation remains the same.
+
+If the `files` array contains a function, then that function is called with the path of the file as it was passed in. The function is expected to return `true` if there is a match and `false` if not. (The `ignores` array can also contain functions.)
+
+If the `files` array contains an item that is an array of strings and functions, then all patterns must match in order for the config to match. In the preceding examples, both `*.test.*` and `*.js` must match in order for the config object to be used.
+
+If a pattern in the files array begins with `!` then it excludes that pattern. In the preceding example, any filename that doesn't end with `.js` will automatically get a `settings.js` property set to `false`.
+
+You can also specify an `ignores` key that will force files matching those patterns to not be included. If the `ignores` key is in a config object without any other keys, then those ignores will always be applied; otherwise those ignores act as exclusions. Here's an example:
+
+```js
+export default [
+ // Always ignored
+ {
+ ignores: ["**/.git/**", "**/node_modules/**"],
+ },
+
+ // .eslintrc.js file is ignored only when .js file matches
+ {
+ files: ["**/*.js"],
+ ignores: [".eslintrc.js"],
+ handler: jsHandler,
+ },
+];
+```
+
+You can use negated patterns in `ignores` to exclude a file that was already ignored, such as:
+
+```js
+export default [
+ // Ignore all JSON files except tsconfig.json
+ {
+ files: ["**/*"],
+ ignores: ["**/*.json", "!tsconfig.json"],
+ },
+];
+```
+
+### Config Functions
+
+Config arrays can also include config functions when `extraConfigTypes` contains `"function"`. A config function accepts a single parameter, `context` (defined by you), and must return either a config object or a config array (it cannot return another function). Config functions allow end users to execute code in the creation of appropriate config objects. Here's an example:
+
+```js
+export default [
+ // JS config
+ {
+ files: ["**/*.js"],
+ handler: jsHandler,
+ },
+
+ // JSON configs
+ function (context) {
+ return [
+ // match all JSON files
+ {
+ name: context.name + " JSON Handler",
+ files: ["**/*.json"],
+ handler: jsonHandler,
+ },
+
+ // match only package.json
+ {
+ name: context.name + " package.json Handler",
+ files: ["package.json"],
+ handler: packageJsonHandler,
+ },
+ ];
+ },
+];
+```
+
+When a config array is normalized, each function is executed and replaced in the config array with the return value.
+
+**Note:** Config functions can also be async.
+
+### Normalizing Config Arrays
+
+Once a config array has been created and loaded with all of the raw config data, it must be normalized before it can be used. The normalization process goes through and flattens the config array as well as executing all config functions to get their final values.
+
+To normalize a config array, call the `normalize()` method and pass in a context object:
+
+```js
+await configs.normalize({
+ name: "MyApp",
+});
+```
+
+The `normalize()` method returns a promise, so be sure to use the `await` operator. The config array instance is normalized in-place, so you don't need to create a new variable.
+
+If you want to disallow async config functions, you can call `normalizeSync()` instead. This method is completely synchronous and does not require using the `await` operator as it does not return a promise:
+
+```js
+configs.normalizeSync({
+ name: "MyApp",
+});
+```
+
+**Important:** Once a `ConfigArray` is normalized, it cannot be changed further. You can, however, create a new `ConfigArray` and pass in the normalized instance to create an unnormalized copy.
+
+### Getting Config for a File
+
+To get the config for a file, use the `getConfig()` method on a normalized config array and pass in the filename to get a config for:
+
+```js
+// pass in filename
+const fileConfig = configs.getConfig(
+ path.resolve(process.cwd(), "package.json"),
+);
+```
+
+The config array always returns an object, even if there are no configs matching the given filename. You can then inspect the returned config object to determine how to proceed.
+
+A few things to keep in mind:
+
+- If a filename is not an absolute path, it will be resolved relative to the base path directory.
+- The returned config object never has `files`, `ignores`, `basePath`, or `name` properties; the only properties on the object will be the other configuration options specified.
+- The config array caches configs, so subsequent calls to `getConfig()` with the same filename will return in a fast lookup rather than another calculation.
+- A config will only be generated if the filename matches an entry in a `files` key. A config will not be generated without matching a `files` key (configs without a `files` key are only applied when another config with a `files` key is applied; configs without `files` are never applied on their own). Any config with a `files` key entry that is `*` or ends with `/**` or `/*` will only be applied if another entry in the same `files` key matches or another config matches.
+
+## Determining Ignored Paths
+
+You can determine if a file is ignored by using the `isFileIgnored()` method and passing in the path of any file, as in this example:
+
+```js
+const ignored = configs.isFileIgnored("/foo/bar/baz.txt");
+```
+
+A file is considered ignored if any of the following is true:
+
+- **Its parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/a.js` is considered ignored.
+- **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/baz/a.js` is considered ignored.
+- **It matches an ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
+- **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
+- **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored.
+
+For directories, use the `isDirectoryIgnored()` method and pass in the path of any directory, as in this example:
+
+```js
+const ignored = configs.isDirectoryIgnored("/foo/bar/");
+```
+
+A directory is considered ignored if any of the following is true:
+
+- **Its parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/baz` is considered ignored.
+- **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/bar/baz/a.js` is considered ignored.
+- **It matches an ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
+- **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
+- **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored.
+
+**Important:** A pattern such as `foo/**` means that `foo` and `foo/` are _not_ ignored whereas `foo/bar` is ignored. If you want to ignore `foo` and all of its subdirectories, use the pattern `foo` or `foo/` in `ignores`.
+
+## Caching Mechanisms
+
+Each `ConfigArray` aggressively caches configuration objects to avoid unnecessary work. This caching occurs in two ways:
+
+1. **File-based Caching.** For each filename that is passed into a method, the resulting config is cached against that filename so you're always guaranteed to get the same object returned from `getConfig()` whenever you pass the same filename in.
+2. **Index-based Caching.** Whenever a config is calculated, the config elements that were used to create the config are also cached. So if a given filename matches elements 1, 5, and 7, the resulting config is cached with a key of `1,5,7`. That way, if another file is passed that matches the same config elements, the result is already known and doesn't have to be recalculated. That means two files that match all the same elements will return the same config from `getConfig()`.
+
+## Acknowledgements
+
+The design of this project was influenced by feedback on the ESLint RFC, and incorporates ideas from:
+
+- Teddy Katz (@not-an-aardvark)
+- Toru Nagashima (@mysticatea)
+- Kai Cataldo (@kaicataldo)
+
+## License
+
+Apache 2.0
+
+
+
+
+## Sponsors
+
+The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
+to get your logo on our READMEs and [website](https://eslint.org/sponsors).
+
+Platinum Sponsors
+
Gold Sponsors
+
Silver Sponsors
+

Bronze Sponsors
+

+Technology Sponsors
+Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
+

+
diff --git a/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/index.cjs b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/index.cjs
new file mode 100644
index 00000000..34dbbc17
--- /dev/null
+++ b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/index.cjs
@@ -0,0 +1,1541 @@
+'use strict';
+
+var posixPath = require('./std__path/posix.cjs');
+var windowsPath = require('./std__path/windows.cjs');
+var minimatch = require('minimatch');
+var createDebug = require('debug');
+var objectSchema = require('@eslint/object-schema');
+
+function _interopNamespaceDefault(e) {
+ var n = Object.create(null);
+ if (e) {
+ Object.keys(e).forEach(function (k) {
+ if (k !== 'default') {
+ var d = Object.getOwnPropertyDescriptor(e, k);
+ Object.defineProperty(n, k, d.get ? d : {
+ enumerable: true,
+ get: function () { return e[k]; }
+ });
+ }
+ });
+ }
+ n.default = e;
+ return Object.freeze(n);
+}
+
+var posixPath__namespace = /*#__PURE__*/_interopNamespaceDefault(posixPath);
+var windowsPath__namespace = /*#__PURE__*/_interopNamespaceDefault(windowsPath);
+
+/**
+ * @fileoverview ConfigSchema
+ * @author Nicholas C. Zakas
+ */
+
+//------------------------------------------------------------------------------
+// Types
+//------------------------------------------------------------------------------
+
+/** @import * as $eslintobjectschema from "@eslint/object-schema"; */
+/** @typedef {$eslintobjectschema.PropertyDefinition} PropertyDefinition */
+/** @typedef {$eslintobjectschema.ObjectDefinition} ObjectDefinition */
+
+//------------------------------------------------------------------------------
+// Helpers
+//------------------------------------------------------------------------------
+
+/**
+ * A strategy that does nothing.
+ * @type {PropertyDefinition}
+ */
+const NOOP_STRATEGY = {
+ required: false,
+ merge() {
+ return undefined;
+ },
+ validate() {},
+};
+
+//------------------------------------------------------------------------------
+// Exports
+//------------------------------------------------------------------------------
+
+/**
+ * The base schema that every ConfigArray uses.
+ * @type {ObjectDefinition}
+ */
+const baseSchema = Object.freeze({
+ name: {
+ required: false,
+ merge() {
+ return undefined;
+ },
+ validate(value) {
+ if (typeof value !== "string") {
+ throw new TypeError("Property must be a string.");
+ }
+ },
+ },
+ basePath: NOOP_STRATEGY,
+ files: NOOP_STRATEGY,
+ ignores: NOOP_STRATEGY,
+});
+
+/**
+ * @fileoverview ConfigSchema
+ * @author Nicholas C. Zakas
+ */
+
+//------------------------------------------------------------------------------
+// Types
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+// Helpers
+//------------------------------------------------------------------------------
+
+/**
+ * Asserts that a given value is an array.
+ * @param {*} value The value to check.
+ * @returns {void}
+ * @throws {TypeError} When the value is not an array.
+ */
+function assertIsArray(value) {
+ if (!Array.isArray(value)) {
+ throw new TypeError("Expected value to be an array.");
+ }
+}
+
+/**
+ * Asserts that a given value is an array containing only strings and functions.
+ * @param {*} value The value to check.
+ * @returns {void}
+ * @throws {TypeError} When the value is not an array of strings and functions.
+ */
+function assertIsArrayOfStringsAndFunctions(value) {
+ assertIsArray(value);
+
+ if (
+ value.some(
+ item => typeof item !== "string" && typeof item !== "function",
+ )
+ ) {
+ throw new TypeError(
+ "Expected array to only contain strings and functions.",
+ );
+ }
+}
+
+/**
+ * Asserts that a given value is a non-empty array.
+ * @param {*} value The value to check.
+ * @returns {void}
+ * @throws {TypeError} When the value is not an array or an empty array.
+ */
+function assertIsNonEmptyArray(value) {
+ if (!Array.isArray(value) || value.length === 0) {
+ throw new TypeError("Expected value to be a non-empty array.");
+ }
+}
+
+//------------------------------------------------------------------------------
+// Exports
+//------------------------------------------------------------------------------
+
+/**
+ * The schema for `files` and `ignores` that every ConfigArray uses.
+ * @type {ObjectDefinition}
+ */
+const filesAndIgnoresSchema = Object.freeze({
+ basePath: {
+ required: false,
+ merge() {
+ return undefined;
+ },
+ validate(value) {
+ if (typeof value !== "string") {
+ throw new TypeError("Expected value to be a string.");
+ }
+ },
+ },
+ files: {
+ required: false,
+ merge() {
+ return undefined;
+ },
+ validate(value) {
+ // first check if it's an array
+ assertIsNonEmptyArray(value);
+
+ // then check each member
+ value.forEach(item => {
+ if (Array.isArray(item)) {
+ assertIsArrayOfStringsAndFunctions(item);
+ } else if (
+ typeof item !== "string" &&
+ typeof item !== "function"
+ ) {
+ throw new TypeError(
+ "Items must be a string, a function, or an array of strings and functions.",
+ );
+ }
+ });
+ },
+ },
+ ignores: {
+ required: false,
+ merge() {
+ return undefined;
+ },
+ validate: assertIsArrayOfStringsAndFunctions,
+ },
+});
+
+/**
+ * @fileoverview ConfigArray
+ * @author Nicholas C. Zakas
+ */
+
+
+//------------------------------------------------------------------------------
+// Types
+//------------------------------------------------------------------------------
+
+/** @import * as $typests from "./types.ts"; */
+/** @typedef {$typests.ConfigObject} ConfigObject */
+/** @typedef {$typests.FileMatcher} FileMatcher */
+/** @typedef {$typests.FilesMatcher} FilesMatcher */
+/** @typedef {$typests.ExtraConfigType} ExtraConfigType */
+/** @import * as $minimatch from "minimatch"; */
+/** @typedef {$minimatch.MinimatchOptions} MinimatchOptions */
+/** @import * as PathImpl from "@jsr/std__path" */
+
+/*
+ * This is a bit of a hack to make TypeScript happy with the Rollup-created
+ * CommonJS file. Rollup doesn't do object destructuring for imported files
+ * and instead imports the default via `require()`. This messes up type checking
+ * for `ObjectSchema`. To work around that, we just import the type manually
+ * and give it a different name to use in the JSDoc comments.
+ */
+/** @typedef {ObjectSchema} ObjectSchemaInstance */
+
+//------------------------------------------------------------------------------
+// Helpers
+//------------------------------------------------------------------------------
+
+const debug = createDebug("@eslint/config-array");
+
+/**
+ * A cache for minimatch instances.
+ * @type {Map}
+ */
+const minimatchCache = new Map();
+
+/**
+ * A cache for negated minimatch instances.
+ * @type {Map}
+ */
+const negatedMinimatchCache = new Map();
+
+/**
+ * Options to use with minimatch.
+ * @type {MinimatchOptions}
+ */
+const MINIMATCH_OPTIONS = {
+ // matchBase: true,
+ dot: true,
+};
+
+/**
+ * The types of config objects that are supported.
+ * @type {Set}
+ */
+const CONFIG_TYPES = new Set(["array", "function"]);
+
+/**
+ * Fields that are considered metadata and not part of the config object.
+ * @type {Set}
+ */
+const META_FIELDS = new Set(["name", "basePath"]);
+
+/**
+ * A schema containing just files and ignores for early validation.
+ * @type {ObjectSchemaInstance}
+ */
+const FILES_AND_IGNORES_SCHEMA = new objectSchema.ObjectSchema(filesAndIgnoresSchema);
+
+// Precomputed constant objects returned by `ConfigArray.getConfigWithStatus`.
+
+const CONFIG_WITH_STATUS_EXTERNAL = Object.freeze({ status: "external" });
+const CONFIG_WITH_STATUS_IGNORED = Object.freeze({ status: "ignored" });
+const CONFIG_WITH_STATUS_UNCONFIGURED = Object.freeze({
+ status: "unconfigured",
+});
+
+// Match two leading dots followed by a slash or the end of input.
+const EXTERNAL_PATH_REGEX = /^\.\.(?:\/|$)/u;
+
+/**
+ * Wrapper error for config validation errors that adds a name to the front of the
+ * error message.
+ */
+class ConfigError extends Error {
+ /**
+ * Creates a new instance.
+ * @param {string} name The config object name causing the error.
+ * @param {number} index The index of the config object in the array.
+ * @param {Object} options The options for the error.
+ * @param {Error} [options.cause] The error that caused this error.
+ * @param {string} [options.message] The message to use for the error.
+ */
+ constructor(name, index, { cause, message }) {
+ const finalMessage = message || cause.message;
+
+ super(`Config ${name}: ${finalMessage}`, { cause });
+
+ // copy over custom properties that aren't represented
+ if (cause) {
+ for (const key of Object.keys(cause)) {
+ if (!(key in this)) {
+ this[key] = cause[key];
+ }
+ }
+ }
+
+ /**
+ * The name of the error.
+ * @type {string}
+ * @readonly
+ */
+ this.name = "ConfigError";
+
+ /**
+ * The index of the config object in the array.
+ * @type {number}
+ * @readonly
+ */
+ this.index = index;
+ }
+}
+
+/**
+ * Gets the name of a config object.
+ * @param {ConfigObject} config The config object to get the name of.
+ * @returns {string} The name of the config object.
+ */
+function getConfigName(config) {
+ if (config && typeof config.name === "string" && config.name) {
+ return `"${config.name}"`;
+ }
+
+ return "(unnamed)";
+}
+
+/**
+ * Rethrows a config error with additional information about the config object.
+ * @param {ConfigObject} config The config object to get the name of.
+ * @param {number} index The index of the config object in the array.
+ * @param {Error} error The error to rethrow.
+ * @throws {ConfigError} When the error is rethrown for a config.
+ */
+function rethrowConfigError(config, index, error) {
+ const configName = getConfigName(config);
+ throw new ConfigError(configName, index, { cause: error });
+}
+
+/**
+ * Shorthand for checking if a value is a string.
+ * @param {any} value The value to check.
+ * @returns {value is string} True if a string, false if not.
+ */
+function isString(value) {
+ return typeof value === "string";
+}
+
+/**
+ * Creates a function that asserts that the config is valid
+ * during normalization. This checks that the config is not nullish
+ * and that files and ignores keys of a config object are valid as per base schema.
+ * @param {Object} config The config object to check.
+ * @param {number} index The index of the config object in the array.
+ * @returns {void}
+ * @throws {ConfigError} If the files and ignores keys of a config object are not valid.
+ */
+function assertValidBaseConfig(config, index) {
+ if (config === null) {
+ throw new ConfigError(getConfigName(config), index, {
+ message: "Unexpected null config.",
+ });
+ }
+
+ if (config === undefined) {
+ throw new ConfigError(getConfigName(config), index, {
+ message: "Unexpected undefined config.",
+ });
+ }
+
+ if (typeof config !== "object") {
+ throw new ConfigError(getConfigName(config), index, {
+ message: "Unexpected non-object config.",
+ });
+ }
+
+ const validateConfig = {};
+
+ if ("basePath" in config) {
+ validateConfig.basePath = config.basePath;
+ }
+
+ if ("files" in config) {
+ validateConfig.files = config.files;
+ }
+
+ if ("ignores" in config) {
+ validateConfig.ignores = config.ignores;
+ }
+
+ try {
+ FILES_AND_IGNORES_SCHEMA.validate(validateConfig);
+ } catch (validationError) {
+ rethrowConfigError(config, index, validationError);
+ }
+}
+
+/**
+ * Wrapper around minimatch that caches minimatch patterns for
+ * faster matching speed over multiple file path evaluations.
+ * @param {string} filepath The file path to match.
+ * @param {string} pattern The glob pattern to match against.
+ * @param {MinimatchOptions} options The minimatch options to use.
+ * @returns {boolean} True if the file path matches, false if not.
+ */
+function doMatch(filepath, pattern, options = {}) {
+ let cache = minimatchCache;
+
+ if (options.flipNegate) {
+ cache = negatedMinimatchCache;
+ }
+
+ let matcher = cache.get(pattern);
+
+ if (!matcher) {
+ matcher = new minimatch.Minimatch(
+ pattern,
+ Object.assign({}, MINIMATCH_OPTIONS, options),
+ );
+ cache.set(pattern, matcher);
+ }
+
+ return matcher.match(filepath);
+}
+
+/**
+ * Normalizes a pattern by removing the leading "./" if present.
+ * @param {FileMatcher} pattern The pattern to normalize.
+ * @returns {FileMatcher} The normalized pattern.
+ */
+function normalizePattern(pattern) {
+ if (isString(pattern)) {
+ if (pattern.startsWith("./")) {
+ return pattern.slice(2);
+ }
+
+ if (pattern.startsWith("!./")) {
+ return `!${pattern.slice(3)}`;
+ }
+ }
+
+ return pattern;
+}
+
+/**
+ * Checks if a given pattern requires normalization.
+ * @param {any} pattern The pattern to check.
+ * @returns {boolean} True if the pattern needs normalization, false otherwise.
+ *
+ */
+function needsPatternNormalization(pattern) {
+ return (
+ isString(pattern) &&
+ (pattern.startsWith("./") || pattern.startsWith("!./"))
+ );
+}
+
+/**
+ * Normalizes `files` and `ignores` patterns in a config by removing "./" prefixes.
+ * @param {Object} config The config object to normalize patterns in.
+ * @param {string} namespacedBasePath The namespaced base path of the directory to which config base path is relative.
+ * @param {PathImpl} path Path-handling implementation.
+ * @returns {Object} The normalized config object.
+ */
+function normalizeConfigPatterns(config, namespacedBasePath, path) {
+ if (!config) {
+ return config;
+ }
+
+ const hasBasePath = typeof config.basePath === "string";
+
+ let needsNormalization = false;
+
+ if (hasBasePath) {
+ needsNormalization = true;
+ }
+
+ if (!needsNormalization && Array.isArray(config.files)) {
+ needsNormalization = config.files.some(pattern => {
+ if (Array.isArray(pattern)) {
+ return pattern.some(needsPatternNormalization);
+ }
+ return needsPatternNormalization(pattern);
+ });
+ }
+
+ if (!needsNormalization && Array.isArray(config.ignores)) {
+ needsNormalization = config.ignores.some(needsPatternNormalization);
+ }
+
+ if (!needsNormalization) {
+ return config;
+ }
+
+ const newConfig = { ...config };
+
+ if (hasBasePath) {
+ if (path.isAbsolute(config.basePath)) {
+ newConfig.basePath = path.toNamespacedPath(config.basePath);
+ } else {
+ newConfig.basePath = path.resolve(
+ namespacedBasePath,
+ config.basePath,
+ );
+ }
+ }
+
+ if (Array.isArray(newConfig.files)) {
+ newConfig.files = newConfig.files.map(pattern => {
+ if (Array.isArray(pattern)) {
+ return pattern.map(normalizePattern);
+ }
+ return normalizePattern(pattern);
+ });
+ }
+
+ if (Array.isArray(newConfig.ignores)) {
+ newConfig.ignores = newConfig.ignores.map(normalizePattern);
+ }
+
+ return newConfig;
+}
+
+/**
+ * Normalizes a `ConfigArray` by flattening it and executing any functions
+ * that are found inside.
+ * @param {Array} items The items in a `ConfigArray`.
+ * @param {Object} context The context object to pass into any function
+ * found.
+ * @param {ReadonlyArray} extraConfigTypes The config types to check.
+ * @param {string} namespacedBasePath The namespaced base path of the directory to which config base paths are relative.
+ * @param {PathImpl} path Path-handling implementation.
+ * @returns {Promise} A flattened array containing only config objects.
+ * @throws {TypeError} When a config function returns a function.
+ */
+async function normalize(
+ items,
+ context,
+ extraConfigTypes,
+ namespacedBasePath,
+ path,
+) {
+ const allowFunctions = extraConfigTypes.includes("function");
+ const allowArrays = extraConfigTypes.includes("array");
+
+ async function* flatTraverse(array) {
+ for (let item of array) {
+ if (typeof item === "function") {
+ if (!allowFunctions) {
+ throw new TypeError("Unexpected function.");
+ }
+
+ item = item(context);
+ if (item.then) {
+ item = await item;
+ }
+ }
+
+ if (Array.isArray(item)) {
+ if (!allowArrays) {
+ throw new TypeError("Unexpected array.");
+ }
+ yield* flatTraverse(item);
+ } else if (typeof item === "function") {
+ throw new TypeError(
+ "A config function can only return an object or array.",
+ );
+ } else {
+ yield item;
+ }
+ }
+ }
+
+ /*
+ * Async iterables cannot be used with the spread operator, so we need to manually
+ * create the array to return.
+ */
+ const asyncIterable = flatTraverse(items);
+ const configs = [];
+
+ for await (const config of asyncIterable) {
+ configs.push(normalizeConfigPatterns(config, namespacedBasePath, path));
+ }
+
+ return configs;
+}
+
+/**
+ * Normalizes a `ConfigArray` by flattening it and executing any functions
+ * that are found inside.
+ * @param {Array} items The items in a `ConfigArray`.
+ * @param {Object} context The context object to pass into any function
+ * found.
+ * @param {ReadonlyArray} extraConfigTypes The config types to check.
+ * @param {string} namespacedBasePath The namespaced base path of the directory to which config base paths are relative.
+ * @param {PathImpl} path Path-handling implementation
+ * @returns {Array} A flattened array containing only config objects.
+ * @throws {TypeError} When a config function returns a function.
+ */
+function normalizeSync(
+ items,
+ context,
+ extraConfigTypes,
+ namespacedBasePath,
+ path,
+) {
+ const allowFunctions = extraConfigTypes.includes("function");
+ const allowArrays = extraConfigTypes.includes("array");
+
+ function* flatTraverse(array) {
+ for (let item of array) {
+ if (typeof item === "function") {
+ if (!allowFunctions) {
+ throw new TypeError("Unexpected function.");
+ }
+
+ item = item(context);
+ if (item.then) {
+ throw new TypeError(
+ "Async config functions are not supported.",
+ );
+ }
+ }
+
+ if (Array.isArray(item)) {
+ if (!allowArrays) {
+ throw new TypeError("Unexpected array.");
+ }
+
+ yield* flatTraverse(item);
+ } else if (typeof item === "function") {
+ throw new TypeError(
+ "A config function can only return an object or array.",
+ );
+ } else {
+ yield item;
+ }
+ }
+ }
+
+ const configs = [];
+
+ for (const config of flatTraverse(items)) {
+ configs.push(normalizeConfigPatterns(config, namespacedBasePath, path));
+ }
+
+ return configs;
+}
+
+/**
+ * Converts a given path to a relative path with all separator characters replaced by forward slashes (`"/"`).
+ * @param {string} fileOrDirPath The unprocessed path to convert.
+ * @param {string} namespacedBasePath The namespaced base path of the directory to which the calculated path shall be relative.
+ * @param {PathImpl} path Path-handling implementations.
+ * @returns {string} A relative path with all separator characters replaced by forward slashes.
+ */
+function toRelativePath(fileOrDirPath, namespacedBasePath, path) {
+ const fullPath = path.resolve(namespacedBasePath, fileOrDirPath);
+ const namespacedFullPath = path.toNamespacedPath(fullPath);
+ const relativePath = path.relative(namespacedBasePath, namespacedFullPath);
+ return relativePath.replaceAll(path.SEPARATOR, "/");
+}
+
+/**
+ * Determines if a given file path should be ignored based on the given
+ * matcher.
+ * @param {Array<{ basePath?: string, ignores: FileMatcher[] }>} configs Configuration objects containing `ignores`.
+ * @param {string} filePath The unprocessed file path to check.
+ * @param {string} relativeFilePath The path of the file to check relative to the base path,
+ * using forward slash (`"/"`) as a separator.
+ * @param {Object} [basePathData] Additional data needed to recalculate paths for configuration objects
+ * that have `basePath` property.
+ * @param {string} [basePathData.basePath] Namespaced path to which `relativeFilePath` is relative.
+ * @param {PathImpl} [basePathData.path] Path-handling implementation.
+ * @returns {boolean} True if the path should be ignored and false if not.
+ */
+function shouldIgnorePath(
+ configs,
+ filePath,
+ relativeFilePath,
+ { basePath, path } = {},
+) {
+ let shouldIgnore = false;
+
+ for (const config of configs) {
+ let relativeFilePathToCheck = relativeFilePath;
+ if (config.basePath) {
+ relativeFilePathToCheck = toRelativePath(
+ path.resolve(basePath, relativeFilePath),
+ config.basePath,
+ path,
+ );
+
+ if (
+ relativeFilePathToCheck === "" ||
+ EXTERNAL_PATH_REGEX.test(relativeFilePathToCheck)
+ ) {
+ continue;
+ }
+
+ if (relativeFilePath.endsWith("/")) {
+ relativeFilePathToCheck += "/";
+ }
+ }
+ shouldIgnore = config.ignores.reduce((ignored, matcher) => {
+ if (!ignored) {
+ if (typeof matcher === "function") {
+ return matcher(filePath);
+ }
+
+ // don't check negated patterns because we're not ignored yet
+ if (!matcher.startsWith("!")) {
+ return doMatch(relativeFilePathToCheck, matcher);
+ }
+
+ // otherwise we're still not ignored
+ return false;
+ }
+
+ // only need to check negated patterns because we're ignored
+ if (typeof matcher === "string" && matcher.startsWith("!")) {
+ return !doMatch(relativeFilePathToCheck, matcher, {
+ flipNegate: true,
+ });
+ }
+
+ return ignored;
+ }, shouldIgnore);
+ }
+
+ return shouldIgnore;
+}
+
+/**
+ * Determines if a given file path is matched by a config. If the config
+ * has no `files` field, then it matches; otherwise, if a `files` field
+ * is present then we match the globs in `files` and exclude any globs in
+ * `ignores`.
+ * @param {string} filePath The unprocessed file path to check.
+ * @param {string} relativeFilePath The path of the file to check relative to the base path,
+ * using forward slash (`"/"`) as a separator.
+ * @param {ConfigObject & { files: FilesMatcher[] }} config The config object to check.
+ * @returns {boolean} True if the file path is matched by the config,
+ * false if not.
+ */
+function pathMatches(filePath, relativeFilePath, config) {
+ // match both strings and functions
+ function match(pattern) {
+ if (isString(pattern)) {
+ return doMatch(relativeFilePath, pattern);
+ }
+
+ if (typeof pattern === "function") {
+ return pattern(filePath);
+ }
+
+ throw new TypeError(`Unexpected matcher type ${pattern}.`);
+ }
+
+ // check for all matches to config.files
+ let filePathMatchesPattern = config.files.some(pattern => {
+ if (Array.isArray(pattern)) {
+ return pattern.every(match);
+ }
+
+ return match(pattern);
+ });
+
+ /*
+ * If the file path matches the config.files patterns, then check to see
+ * if there are any files to ignore.
+ */
+ if (filePathMatchesPattern && config.ignores) {
+ /*
+ * Pass config object without `basePath`, because `relativeFilePath` is already
+ * calculated as relative to it.
+ */
+ filePathMatchesPattern = !shouldIgnorePath(
+ [{ ignores: config.ignores }],
+ filePath,
+ relativeFilePath,
+ );
+ }
+
+ return filePathMatchesPattern;
+}
+
+/**
+ * Ensures that a ConfigArray has been normalized.
+ * @param {ConfigArray} configArray The ConfigArray to check.
+ * @returns {void}
+ * @throws {Error} When the `ConfigArray` is not normalized.
+ */
+function assertNormalized(configArray) {
+ // TODO: Throw more verbose error
+ if (!configArray.isNormalized()) {
+ throw new Error(
+ "ConfigArray must be normalized to perform this operation.",
+ );
+ }
+}
+
+/**
+ * Ensures that config types are valid.
+ * @param {ReadonlyArray} extraConfigTypes The config types to check.
+ * @returns {void}
+ * @throws {TypeError} When the config types array is invalid.
+ */
+function assertExtraConfigTypes(extraConfigTypes) {
+ if (!Array.isArray(extraConfigTypes)) {
+ throw new TypeError("extraConfigTypes must be an array.");
+ }
+
+ if (extraConfigTypes.length > 2) {
+ throw new TypeError("extraConfigTypes must contain at most two items.");
+ }
+
+ for (const configType of extraConfigTypes) {
+ if (!CONFIG_TYPES.has(configType)) {
+ throw new TypeError(
+ `Unexpected config type "${configType}" in extraConfigTypes. Expected one of: "array", "function".`,
+ );
+ }
+ }
+}
+
+/**
+ * Returns path-handling implementations for Unix or Windows, depending on a given absolute path.
+ * @param {string} fileOrDirPath The absolute path to check.
+ * @returns {PathImpl} Path-handling implementations for the specified path.
+ * @throws {Error} An error is thrown if the specified argument is not an absolute path.
+ */
+function getPathImpl(fileOrDirPath) {
+ // Posix absolute paths always start with a slash.
+ if (fileOrDirPath.startsWith("/")) {
+ return posixPath__namespace;
+ }
+
+ // Windows absolute paths start with a letter followed by a colon and at least one backslash,
+ // or with two backslashes in the case of UNC paths.
+ // Forward slashed are automatically normalized to backslashes.
+ if (/^(?:[A-Za-z]:[/\\]|[/\\]{2})/u.test(fileOrDirPath)) {
+ return windowsPath__namespace;
+ }
+
+ throw new Error(
+ `Expected an absolute path but received "${fileOrDirPath}"`,
+ );
+}
+
+//------------------------------------------------------------------------------
+// Public Interface
+//------------------------------------------------------------------------------
+
+const ConfigArraySymbol = {
+ isNormalized: Symbol("isNormalized"),
+ configCache: Symbol("configCache"),
+ schema: Symbol("schema"),
+ finalizeConfig: Symbol("finalizeConfig"),
+ preprocessConfig: Symbol("preprocessConfig"),
+};
+
+// used to store calculate data for faster lookup
+const dataCache = new WeakMap();
+
+/**
+ * Represents an array of config objects and provides method for working with
+ * those config objects.
+ */
+class ConfigArray extends Array {
+ /**
+ * The namespaced path of the config file directory.
+ * @type {string}
+ */
+ #namespacedBasePath;
+
+ /**
+ * Path-handling implementations.
+ * @type {PathImpl}
+ */
+ #path;
+
+ /**
+ * Creates a new instance of ConfigArray.
+ * @param {Iterable|Function|Object} configs An iterable yielding config
+ * objects, or a config function, or a config object.
+ * @param {Object} options The options for the ConfigArray.
+ * @param {string} [options.basePath="/"] The absolute path of the config file directory.
+ * Defaults to `"/"`.
+ * @param {boolean} [options.normalized=false] Flag indicating if the
+ * configs have already been normalized.
+ * @param {ObjectDefinition} [options.schema] The additional schema
+ * definitions to use for the ConfigArray schema.
+ * @param {ReadonlyArray} [options.extraConfigTypes] List of config types supported.
+ * @throws {TypeError} When the `basePath` is not a non-empty string,
+ */
+ constructor(
+ configs,
+ {
+ basePath = "/",
+ normalized = false,
+ schema: customSchema,
+ extraConfigTypes = [],
+ } = {},
+ ) {
+ super();
+
+ /**
+ * Tracks if the array has been normalized.
+ * @property isNormalized
+ * @type {boolean}
+ * @private
+ */
+ this[ConfigArraySymbol.isNormalized] = normalized;
+
+ /**
+ * The schema used for validating and merging configs.
+ * @property schema
+ * @type {ObjectSchemaInstance}
+ * @private
+ */
+ this[ConfigArraySymbol.schema] = new objectSchema.ObjectSchema(
+ Object.assign({}, customSchema, baseSchema),
+ );
+
+ if (!isString(basePath) || !basePath) {
+ throw new TypeError("basePath must be a non-empty string");
+ }
+
+ /**
+ * The path of the config file that this array was loaded from.
+ * This is used to calculate filename matches.
+ * @property basePath
+ * @type {string}
+ */
+ this.basePath = basePath;
+
+ assertExtraConfigTypes(extraConfigTypes);
+
+ /**
+ * The supported config types.
+ * @type {ReadonlyArray}
+ */
+ this.extraConfigTypes = [...extraConfigTypes];
+ Object.freeze(this.extraConfigTypes);
+
+ /**
+ * A cache to store calculated configs for faster repeat lookup.
+ * @property configCache
+ * @type {Map}
+ * @private
+ */
+ this[ConfigArraySymbol.configCache] = new Map();
+
+ // init cache
+ dataCache.set(this, {
+ explicitMatches: new Map(),
+ directoryMatches: new Map(),
+ files: undefined,
+ ignores: undefined,
+ });
+
+ // load the configs into this array
+ if (Array.isArray(configs)) {
+ this.push(...configs);
+ } else {
+ this.push(configs);
+ }
+
+ // select path-handling implementations depending on the base path
+ this.#path = getPathImpl(basePath);
+
+ // On Windows, `path.relative()` returns an absolute path when given two paths on different drives.
+ // The namespaced base path is useful to make sure that calculated relative paths are always relative.
+ // On Unix, it is identical to the base path.
+ this.#namespacedBasePath = this.#path.toNamespacedPath(basePath);
+ }
+
+ /**
+ * Prevent normal array methods from creating a new `ConfigArray` instance.
+ * This is to ensure that methods such as `slice()` won't try to create a
+ * new instance of `ConfigArray` behind the scenes as doing so may throw
+ * an error due to the different constructor signature.
+ * @type {ArrayConstructor} The `Array` constructor.
+ */
+ static get [Symbol.species]() {
+ return Array;
+ }
+
+ /**
+ * Returns the `files` globs from every config object in the array.
+ * This can be used to determine which files will be matched by a
+ * config array or to use as a glob pattern when no patterns are provided
+ * for a command line interface.
+ * @returns {Array} An array of matchers.
+ */
+ get files() {
+ assertNormalized(this);
+
+ // if this data has been cached, retrieve it
+ const cache = dataCache.get(this);
+
+ if (cache.files) {
+ return cache.files;
+ }
+
+ // otherwise calculate it
+
+ const result = [];
+
+ for (const config of this) {
+ if (config.files) {
+ config.files.forEach(filePattern => {
+ result.push(filePattern);
+ });
+ }
+ }
+
+ // store result
+ cache.files = result;
+ dataCache.set(this, cache);
+
+ return result;
+ }
+
+ /**
+ * Returns ignore matchers that should always be ignored regardless of
+ * the matching `files` fields in any configs. This is necessary to mimic
+ * the behavior of things like .gitignore and .eslintignore, allowing a
+ * globbing operation to be faster.
+ * @returns {Array<{ basePath?: string, name?: string, ignores: FileMatcher[] }>} An array of config objects representing global ignores.
+ */
+ get ignores() {
+ assertNormalized(this);
+
+ // if this data has been cached, retrieve it
+ const cache = dataCache.get(this);
+
+ if (cache.ignores) {
+ return cache.ignores;
+ }
+
+ // otherwise calculate it
+
+ const result = [];
+
+ for (const config of this) {
+ /*
+ * We only count ignores if there are no other keys in the object.
+ * In this case, it acts like a globally ignored pattern. If there
+ * are additional keys, then ignores act like exclusions.
+ */
+ if (
+ config.ignores &&
+ Object.keys(config).filter(key => !META_FIELDS.has(key))
+ .length === 1
+ ) {
+ result.push(config);
+ }
+ }
+
+ // store result
+ cache.ignores = result;
+ dataCache.set(this, cache);
+
+ return result;
+ }
+
+ /**
+ * Indicates if the config array has been normalized.
+ * @returns {boolean} True if the config array is normalized, false if not.
+ */
+ isNormalized() {
+ return this[ConfigArraySymbol.isNormalized];
+ }
+
+ /**
+ * Normalizes a config array by flattening embedded arrays and executing
+ * config functions.
+ * @param {Object} [context] The context object for config functions.
+ * @returns {Promise} The current ConfigArray instance.
+ */
+ async normalize(context = {}) {
+ if (!this.isNormalized()) {
+ const normalizedConfigs = await normalize(
+ this,
+ context,
+ this.extraConfigTypes,
+ this.#namespacedBasePath,
+ this.#path,
+ );
+ this.length = 0;
+ this.push(
+ ...normalizedConfigs.map(
+ this[ConfigArraySymbol.preprocessConfig].bind(this),
+ ),
+ );
+ this.forEach(assertValidBaseConfig);
+ this[ConfigArraySymbol.isNormalized] = true;
+
+ // prevent further changes
+ Object.freeze(this);
+ }
+
+ return this;
+ }
+
+ /**
+ * Normalizes a config array by flattening embedded arrays and executing
+ * config functions.
+ * @param {Object} [context] The context object for config functions.
+ * @returns {ConfigArray} The current ConfigArray instance.
+ */
+ normalizeSync(context = {}) {
+ if (!this.isNormalized()) {
+ const normalizedConfigs = normalizeSync(
+ this,
+ context,
+ this.extraConfigTypes,
+ this.#namespacedBasePath,
+ this.#path,
+ );
+ this.length = 0;
+ this.push(
+ ...normalizedConfigs.map(
+ this[ConfigArraySymbol.preprocessConfig].bind(this),
+ ),
+ );
+ this.forEach(assertValidBaseConfig);
+ this[ConfigArraySymbol.isNormalized] = true;
+
+ // prevent further changes
+ Object.freeze(this);
+ }
+
+ return this;
+ }
+
+ /* eslint-disable class-methods-use-this -- Desired as instance methods */
+
+ /**
+ * Finalizes the state of a config before being cached and returned by
+ * `getConfig()`. Does nothing by default but is provided to be
+ * overridden by subclasses as necessary.
+ * @param {Object} config The config to finalize.
+ * @returns {Object} The finalized config.
+ */
+ // Cast key to `never` to prevent TypeScript from adding the signature `[x: symbol]: (config: any) => any` to the type of the class.
+ [/** @type {never} */ (ConfigArraySymbol.finalizeConfig)](config) {
+ return config;
+ }
+
+ /**
+ * Preprocesses a config during the normalization process. This is the
+ * method to override if you want to convert an array item before it is
+ * validated for the first time. For example, if you want to replace a
+ * string with an object, this is the method to override.
+ * @param {Object} config The config to preprocess.
+ * @returns {Object} The config to use in place of the argument.
+ */
+ // Cast key to `never` to prevent TypeScript from adding the signature `[x: symbol]: (config: any) => any` to the type of the class.
+ [/** @type {never} */ (ConfigArraySymbol.preprocessConfig)](config) {
+ return config;
+ }
+
+ /* eslint-enable class-methods-use-this -- Desired as instance methods */
+
+ /**
+ * Returns the config object for a given file path and a status that can be used to determine why a file has no config.
+ * @param {string} filePath The path of a file to get a config for.
+ * @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }}
+ * An object with an optional property `config` and property `status`.
+ * `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig},
+ * `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}.
+ */
+ getConfigWithStatus(filePath) {
+ assertNormalized(this);
+
+ const cache = this[ConfigArraySymbol.configCache];
+
+ // first check the cache for a filename match to avoid duplicate work
+ if (cache.has(filePath)) {
+ return cache.get(filePath);
+ }
+
+ // check to see if the file is outside the base path
+
+ const relativeToBaseFilePath = toRelativePath(
+ filePath,
+ this.#namespacedBasePath,
+ this.#path,
+ );
+
+ if (EXTERNAL_PATH_REGEX.test(relativeToBaseFilePath)) {
+ debug(`No config for file ${filePath} outside of base path`);
+
+ // cache and return result
+ cache.set(filePath, CONFIG_WITH_STATUS_EXTERNAL);
+ return CONFIG_WITH_STATUS_EXTERNAL;
+ }
+
+ // next check to see if the file should be ignored
+
+ // check if this should be ignored due to its directory
+ if (this.isDirectoryIgnored(this.#path.dirname(filePath))) {
+ debug(`Ignoring ${filePath} based on directory pattern`);
+
+ // cache and return result
+ cache.set(filePath, CONFIG_WITH_STATUS_IGNORED);
+ return CONFIG_WITH_STATUS_IGNORED;
+ }
+
+ if (
+ shouldIgnorePath(this.ignores, filePath, relativeToBaseFilePath, {
+ basePath: this.#namespacedBasePath,
+ path: this.#path,
+ })
+ ) {
+ debug(`Ignoring ${filePath} based on file pattern`);
+
+ // cache and return result
+ cache.set(filePath, CONFIG_WITH_STATUS_IGNORED);
+ return CONFIG_WITH_STATUS_IGNORED;
+ }
+
+ // filePath isn't automatically ignored, so try to construct config
+
+ const matchingConfigIndices = [];
+ let matchFound = false;
+ const universalPattern = /^\*$|^!|\/\*{1,2}$/u;
+
+ this.forEach((config, index) => {
+ const relativeFilePath = config.basePath
+ ? toRelativePath(
+ this.#path.resolve(this.#namespacedBasePath, filePath),
+ config.basePath,
+ this.#path,
+ )
+ : relativeToBaseFilePath;
+
+ if (config.basePath && EXTERNAL_PATH_REGEX.test(relativeFilePath)) {
+ debug(
+ `Skipped config found for ${filePath} (based on config's base path: ${config.basePath}`,
+ );
+ return;
+ }
+
+ if (!config.files) {
+ if (!config.ignores) {
+ debug(`Universal config found for ${filePath}`);
+ matchingConfigIndices.push(index);
+ return;
+ }
+
+ if (
+ Object.keys(config).filter(key => !META_FIELDS.has(key))
+ .length === 1
+ ) {
+ debug(
+ `Skipped config found for ${filePath} (global ignores)`,
+ );
+ return;
+ }
+
+ /*
+ * Pass config object without `basePath`, because `relativeFilePath` is already
+ * calculated as relative to it.
+ */
+ if (
+ shouldIgnorePath(
+ [{ ignores: config.ignores }],
+ filePath,
+ relativeFilePath,
+ )
+ ) {
+ debug(
+ `Skipped config found for ${filePath} (based on ignores: ${config.ignores})`,
+ );
+ return;
+ }
+
+ debug(
+ `Matching config found for ${filePath} (based on ignores: ${config.ignores})`,
+ );
+ matchingConfigIndices.push(index);
+ return;
+ }
+
+ /*
+ * If a config has a files pattern * or patterns ending in /** or /*,
+ * and the filePath only matches those patterns, then the config is only
+ * applied if there is another config where the filePath matches
+ * a file with a specific extensions such as *.js.
+ */
+
+ const nonUniversalFiles = [];
+ const universalFiles = config.files.filter(element => {
+ if (Array.isArray(element)) {
+ /*
+ * filePath matches an element that is an array only if it matches
+ * all patterns in it (AND operation). Therefore, if there is at least
+ * one non-universal pattern in the array, and filePath matches the array,
+ * then we know for sure that filePath matches at least one non-universal
+ * pattern, so we can consider the entire array to be non-universal.
+ * In other words, all patterns in the array need to be universal
+ * for it to be considered universal.
+ */
+ if (
+ element.every(pattern => universalPattern.test(pattern))
+ ) {
+ return true;
+ }
+
+ nonUniversalFiles.push(element);
+ return false;
+ }
+
+ // element is a string
+
+ if (universalPattern.test(element)) {
+ return true;
+ }
+
+ nonUniversalFiles.push(element);
+ return false;
+ });
+
+ // universal patterns were found so we need to check the config twice
+ if (universalFiles.length) {
+ debug("Universal files patterns found. Checking carefully.");
+
+ // check that the config matches without the non-universal files first
+ if (
+ nonUniversalFiles.length &&
+ pathMatches(filePath, relativeFilePath, {
+ files: nonUniversalFiles,
+ ignores: config.ignores,
+ })
+ ) {
+ debug(`Matching config found for ${filePath}`);
+ matchingConfigIndices.push(index);
+ matchFound = true;
+ return;
+ }
+
+ // if there wasn't a match then check if it matches with universal files
+ if (
+ universalFiles.length &&
+ pathMatches(filePath, relativeFilePath, {
+ files: universalFiles,
+ ignores: config.ignores,
+ })
+ ) {
+ debug(`Matching config found for ${filePath}`);
+ matchingConfigIndices.push(index);
+ return;
+ }
+
+ // if we make here, then there was no match
+ return;
+ }
+
+ // the normal case
+ if (pathMatches(filePath, relativeFilePath, config)) {
+ debug(`Matching config found for ${filePath}`);
+ matchingConfigIndices.push(index);
+ matchFound = true;
+ }
+ });
+
+ // if matching both files and ignores, there will be no config to create
+ if (!matchFound) {
+ debug(`No matching configs found for ${filePath}`);
+
+ // cache and return result
+ cache.set(filePath, CONFIG_WITH_STATUS_UNCONFIGURED);
+ return CONFIG_WITH_STATUS_UNCONFIGURED;
+ }
+
+ // check to see if there is a config cached by indices
+ const indicesKey = matchingConfigIndices.toString();
+ let configWithStatus = cache.get(indicesKey);
+
+ if (configWithStatus) {
+ // also store for filename for faster lookup next time
+ cache.set(filePath, configWithStatus);
+
+ return configWithStatus;
+ }
+
+ // otherwise construct the config
+
+ // eslint-disable-next-line array-callback-return, consistent-return -- rethrowConfigError always throws an error
+ let finalConfig = matchingConfigIndices.reduce((result, index) => {
+ try {
+ return this[ConfigArraySymbol.schema].merge(
+ result,
+ this[index],
+ );
+ } catch (validationError) {
+ rethrowConfigError(this[index], index, validationError);
+ }
+ }, {});
+
+ finalConfig = this[ConfigArraySymbol.finalizeConfig](finalConfig);
+
+ configWithStatus = Object.freeze({
+ config: finalConfig,
+ status: "matched",
+ });
+ cache.set(filePath, configWithStatus);
+ cache.set(indicesKey, configWithStatus);
+
+ return configWithStatus;
+ }
+
+ /**
+ * Returns the config object for a given file path.
+ * @param {string} filePath The path of a file to get a config for.
+ * @returns {Object|undefined} The config object for this file or `undefined`.
+ */
+ getConfig(filePath) {
+ return this.getConfigWithStatus(filePath).config;
+ }
+
+ /**
+ * Determines whether a file has a config or why it doesn't.
+ * @param {string} filePath The path of the file to check.
+ * @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values:
+ * * `"ignored"`: the file is ignored
+ * * `"external"`: the file is outside the base path
+ * * `"unconfigured"`: the file is not matched by any config
+ * * `"matched"`: the file has a matching config
+ */
+ getConfigStatus(filePath) {
+ return this.getConfigWithStatus(filePath).status;
+ }
+
+ /**
+ * Determines if the given filepath is ignored based on the configs.
+ * @param {string} filePath The path of a file to check.
+ * @returns {boolean} True if the path is ignored, false if not.
+ * @deprecated Use `isFileIgnored` instead.
+ */
+ isIgnored(filePath) {
+ return this.isFileIgnored(filePath);
+ }
+
+ /**
+ * Determines if the given filepath is ignored based on the configs.
+ * @param {string} filePath The path of a file to check.
+ * @returns {boolean} True if the path is ignored, false if not.
+ */
+ isFileIgnored(filePath) {
+ return this.getConfigStatus(filePath) === "ignored";
+ }
+
+ /**
+ * Determines if the given directory is ignored based on the configs.
+ * This checks only default `ignores` that don't have `files` in the
+ * same config. A pattern such as `/foo` be considered to ignore the directory
+ * while a pattern such as `/foo/**` is not considered to ignore the
+ * directory because it is matching files.
+ * @param {string} directoryPath The path of a directory to check.
+ * @returns {boolean} True if the directory is ignored, false if not. Will
+ * return true for any directory that is not inside of `basePath`.
+ * @throws {Error} When the `ConfigArray` is not normalized.
+ */
+ isDirectoryIgnored(directoryPath) {
+ assertNormalized(this);
+
+ const relativeDirectoryPath = toRelativePath(
+ directoryPath,
+ this.#namespacedBasePath,
+ this.#path,
+ );
+
+ // basePath directory can never be ignored
+ if (relativeDirectoryPath === "") {
+ return false;
+ }
+
+ if (EXTERNAL_PATH_REGEX.test(relativeDirectoryPath)) {
+ return true;
+ }
+
+ // first check the cache
+ const cache = dataCache.get(this).directoryMatches;
+
+ if (cache.has(relativeDirectoryPath)) {
+ return cache.get(relativeDirectoryPath);
+ }
+
+ const directoryParts = relativeDirectoryPath.split("/");
+ let relativeDirectoryToCheck = "";
+ let result;
+
+ /*
+ * In order to get the correct gitignore-style ignores, where an
+ * ignored parent directory cannot have any descendants unignored,
+ * we need to check every directory starting at the parent all
+ * the way down to the actual requested directory.
+ *
+ * We aggressively cache all of this info to make sure we don't
+ * have to recalculate everything for every call.
+ */
+ do {
+ relativeDirectoryToCheck += `${directoryParts.shift()}/`;
+
+ result = shouldIgnorePath(
+ this.ignores,
+ this.#path.join(this.basePath, relativeDirectoryToCheck),
+ relativeDirectoryToCheck,
+ {
+ basePath: this.#namespacedBasePath,
+ path: this.#path,
+ },
+ );
+
+ cache.set(relativeDirectoryToCheck, result);
+ } while (!result && directoryParts.length);
+
+ // also cache the result for the requested path
+ cache.set(relativeDirectoryPath, result);
+
+ return result;
+ }
+}
+
+Object.defineProperty(exports, "ObjectSchema", {
+ enumerable: true,
+ get: function () { return objectSchema.ObjectSchema; }
+});
+exports.ConfigArray = ConfigArray;
+exports.ConfigArraySymbol = ConfigArraySymbol;
diff --git a/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/index.d.cts b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/index.d.cts
new file mode 100644
index 00000000..016ed4c6
--- /dev/null
+++ b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/index.d.cts
@@ -0,0 +1,151 @@
+export { ObjectSchema } from "@eslint/object-schema";
+export type PropertyDefinition = $eslintobjectschema.PropertyDefinition;
+export type ObjectDefinition = $eslintobjectschema.ObjectDefinition;
+export type ConfigObject = $typests.ConfigObject;
+export type FileMatcher = $typests.FileMatcher;
+export type FilesMatcher = $typests.FilesMatcher;
+export type ExtraConfigType = $typests.ExtraConfigType;
+export type MinimatchOptions = $minimatch.MinimatchOptions;
+export type ObjectSchemaInstance = ObjectSchema;
+/**
+ * Represents an array of config objects and provides method for working with
+ * those config objects.
+ */
+export class ConfigArray extends Array {
+ /**
+ * Creates a new instance of ConfigArray.
+ * @param {Iterable|Function|Object} configs An iterable yielding config
+ * objects, or a config function, or a config object.
+ * @param {Object} options The options for the ConfigArray.
+ * @param {string} [options.basePath="/"] The absolute path of the config file directory.
+ * Defaults to `"/"`.
+ * @param {boolean} [options.normalized=false] Flag indicating if the
+ * configs have already been normalized.
+ * @param {ObjectDefinition} [options.schema] The additional schema
+ * definitions to use for the ConfigArray schema.
+ * @param {ReadonlyArray} [options.extraConfigTypes] List of config types supported.
+ * @throws {TypeError} When the `basePath` is not a non-empty string,
+ */
+ constructor(configs: Iterable | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: {
+ basePath?: string;
+ normalized?: boolean;
+ schema?: ObjectDefinition;
+ extraConfigTypes?: ReadonlyArray;
+ });
+ /**
+ * The path of the config file that this array was loaded from.
+ * This is used to calculate filename matches.
+ * @property basePath
+ * @type {string}
+ */
+ basePath: string;
+ /**
+ * The supported config types.
+ * @type {ReadonlyArray}
+ */
+ extraConfigTypes: ReadonlyArray;
+ /**
+ * Returns the `files` globs from every config object in the array.
+ * This can be used to determine which files will be matched by a
+ * config array or to use as a glob pattern when no patterns are provided
+ * for a command line interface.
+ * @returns {Array} An array of matchers.
+ */
+ get files(): Array;
+ /**
+ * Returns ignore matchers that should always be ignored regardless of
+ * the matching `files` fields in any configs. This is necessary to mimic
+ * the behavior of things like .gitignore and .eslintignore, allowing a
+ * globbing operation to be faster.
+ * @returns {Array<{ basePath?: string, name?: string, ignores: FileMatcher[] }>} An array of config objects representing global ignores.
+ */
+ get ignores(): Array<{
+ basePath?: string;
+ name?: string;
+ ignores: FileMatcher[];
+ }>;
+ /**
+ * Indicates if the config array has been normalized.
+ * @returns {boolean} True if the config array is normalized, false if not.
+ */
+ isNormalized(): boolean;
+ /**
+ * Normalizes a config array by flattening embedded arrays and executing
+ * config functions.
+ * @param {Object} [context] The context object for config functions.
+ * @returns {Promise} The current ConfigArray instance.
+ */
+ normalize(context?: any): Promise;
+ /**
+ * Normalizes a config array by flattening embedded arrays and executing
+ * config functions.
+ * @param {Object} [context] The context object for config functions.
+ * @returns {ConfigArray} The current ConfigArray instance.
+ */
+ normalizeSync(context?: any): ConfigArray;
+ /**
+ * Returns the config object for a given file path and a status that can be used to determine why a file has no config.
+ * @param {string} filePath The path of a file to get a config for.
+ * @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }}
+ * An object with an optional property `config` and property `status`.
+ * `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig},
+ * `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}.
+ */
+ getConfigWithStatus(filePath: string): {
+ config?: any;
+ status: "ignored" | "external" | "unconfigured" | "matched";
+ };
+ /**
+ * Returns the config object for a given file path.
+ * @param {string} filePath The path of a file to get a config for.
+ * @returns {Object|undefined} The config object for this file or `undefined`.
+ */
+ getConfig(filePath: string): any | undefined;
+ /**
+ * Determines whether a file has a config or why it doesn't.
+ * @param {string} filePath The path of the file to check.
+ * @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values:
+ * * `"ignored"`: the file is ignored
+ * * `"external"`: the file is outside the base path
+ * * `"unconfigured"`: the file is not matched by any config
+ * * `"matched"`: the file has a matching config
+ */
+ getConfigStatus(filePath: string): "ignored" | "external" | "unconfigured" | "matched";
+ /**
+ * Determines if the given filepath is ignored based on the configs.
+ * @param {string} filePath The path of a file to check.
+ * @returns {boolean} True if the path is ignored, false if not.
+ * @deprecated Use `isFileIgnored` instead.
+ */
+ isIgnored(filePath: string): boolean;
+ /**
+ * Determines if the given filepath is ignored based on the configs.
+ * @param {string} filePath The path of a file to check.
+ * @returns {boolean} True if the path is ignored, false if not.
+ */
+ isFileIgnored(filePath: string): boolean;
+ /**
+ * Determines if the given directory is ignored based on the configs.
+ * This checks only default `ignores` that don't have `files` in the
+ * same config. A pattern such as `/foo` be considered to ignore the directory
+ * while a pattern such as `/foo/**` is not considered to ignore the
+ * directory because it is matching files.
+ * @param {string} directoryPath The path of a directory to check.
+ * @returns {boolean} True if the directory is ignored, false if not. Will
+ * return true for any directory that is not inside of `basePath`.
+ * @throws {Error} When the `ConfigArray` is not normalized.
+ */
+ isDirectoryIgnored(directoryPath: string): boolean;
+ #private;
+}
+export namespace ConfigArraySymbol {
+ let isNormalized: symbol;
+ let configCache: symbol;
+ let schema: symbol;
+ let finalizeConfig: symbol;
+ let preprocessConfig: symbol;
+}
+import type * as $eslintobjectschema from "@eslint/object-schema";
+import type * as $typests from "./types.cts";
+import type * as $minimatch from "minimatch";
+import { ObjectSchema } from '@eslint/object-schema';
diff --git a/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs
new file mode 100644
index 00000000..13cc0d3e
--- /dev/null
+++ b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs
@@ -0,0 +1,1336 @@
+// @ts-nocheck
+'use strict';
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+function assertPath(path) {
+ if (typeof path !== "string") {
+ throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`);
+ }
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function stripSuffix(name, suffix) {
+ if (suffix.length >= name.length) {
+ return name;
+ }
+ const lenDiff = name.length - suffix.length;
+ for(let i = suffix.length - 1; i >= 0; --i){
+ if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) {
+ return name;
+ }
+ }
+ return name.slice(0, -suffix.length);
+}
+function lastPathSegment(path, isSep, start = 0) {
+ let matchedNonSeparator = false;
+ let end = path.length;
+ for(let i = path.length - 1; i >= start; --i){
+ if (isSep(path.charCodeAt(i))) {
+ if (matchedNonSeparator) {
+ start = i + 1;
+ break;
+ }
+ } else if (!matchedNonSeparator) {
+ matchedNonSeparator = true;
+ end = i + 1;
+ }
+ }
+ return path.slice(start, end);
+}
+function assertArgs$1(path, suffix) {
+ assertPath(path);
+ if (path.length === 0) return path;
+ if (typeof suffix !== "string") {
+ throw new TypeError(`Suffix must be a string, received "${JSON.stringify(suffix)}"`);
+ }
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function assertArg$3(url) {
+ url = url instanceof URL ? url : new URL(url);
+ if (url.protocol !== "file:") {
+ throw new TypeError(`URL must be a file URL: received "${url.protocol}"`);
+ }
+ return url;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Converts a file URL to a path string.
+ *
+ * @example Usage
+ * ```ts
+ * import { fromFileUrl } from "@std/path/posix/from-file-url";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(fromFileUrl(new URL("file:///home/foo")), "/home/foo");
+ * ```
+ *
+ * @param url The file URL to convert.
+ * @returns The path string.
+ */ function fromFileUrl(url) {
+ url = assertArg$3(url);
+ return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+// Ported from https://github.com/browserify/path-browserify/
+// This module is browser compatible.
+function stripTrailingSeparators(segment, isSep) {
+ if (segment.length <= 1) {
+ return segment;
+ }
+ let end = segment.length;
+ for(let i = segment.length - 1; i > 0; i--){
+ if (isSep(segment.charCodeAt(i))) {
+ end = i;
+ } else {
+ break;
+ }
+ }
+ return segment.slice(0, end);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+// Ported from https://github.com/browserify/path-browserify/
+// This module is browser compatible.
+// Alphabet chars.
+// Non-alphabetic chars.
+const CHAR_DOT = 46; /* . */
+const CHAR_FORWARD_SLASH = 47; /* / */
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+// Ported from https://github.com/browserify/path-browserify/
+// This module is browser compatible.
+function isPosixPathSeparator(code) {
+ return code === CHAR_FORWARD_SLASH;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return the last portion of a `path`.
+ * Trailing directory separators are ignored, and optional suffix is removed.
+ *
+ * @example Usage
+ * ```ts
+ * import { basename } from "@std/path/posix/basename";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(basename("/home/user/Documents/"), "Documents");
+ * assertEquals(basename("/home/user/Documents/image.png"), "image.png");
+ * assertEquals(basename("/home/user/Documents/image.png", ".png"), "image");
+ * assertEquals(basename(new URL("file:///home/user/Documents/image.png")), "image.png");
+ * assertEquals(basename(new URL("file:///home/user/Documents/image.png"), ".png"), "image");
+ * ```
+ *
+ * @example Working with URLs
+ *
+ * Note: This function doesn't automatically strip hash and query parts from
+ * URLs. If your URL contains a hash or query, remove them before passing the
+ * URL to the function. This can be done by passing the URL to `new URL(url)`,
+ * and setting the `hash` and `search` properties to empty strings.
+ *
+ * ```ts
+ * import { basename } from "@std/path/posix/basename";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(basename("https://deno.land/std/path/mod.ts"), "mod.ts");
+ * assertEquals(basename("https://deno.land/std/path/mod.ts", ".ts"), "mod");
+ * assertEquals(basename("https://deno.land/std/path/mod.ts?a=b"), "mod.ts?a=b");
+ * assertEquals(basename("https://deno.land/std/path/mod.ts#header"), "mod.ts#header");
+ * ```
+ *
+ * @param path The path to extract the name from.
+ * @param suffix The suffix to remove from extracted name.
+ * @returns The extracted name.
+ */ function basename(path, suffix = "") {
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ assertArgs$1(path, suffix);
+ const lastSegment = lastPathSegment(path, isPosixPathSeparator);
+ const strippedSegment = stripTrailingSeparators(lastSegment, isPosixPathSeparator);
+ return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * The character used to separate entries in the PATH environment variable.
+ */ const DELIMITER = ":";
+/**
+ * The character used to separate components of a file path.
+ */ const SEPARATOR = "/";
+/**
+ * A regular expression that matches one or more path separators.
+ */ const SEPARATOR_PATTERN = /\/+/;
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function assertArg$2(path) {
+ assertPath(path);
+ if (path.length === 0) return ".";
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return the directory path of a `path`.
+ *
+ * @example Usage
+ * ```ts
+ * import { dirname } from "@std/path/posix/dirname";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(dirname("/home/user/Documents/"), "/home/user");
+ * assertEquals(dirname("/home/user/Documents/image.png"), "/home/user/Documents");
+ * assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path");
+ * assertEquals(dirname(new URL("file:///home/user/Documents/image.png")), "/home/user/Documents");
+ * ```
+ *
+ * @example Working with URLs
+ *
+ * ```ts
+ * import { dirname } from "@std/path/posix/dirname";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path");
+ * assertEquals(dirname("https://deno.land/std/path/mod.ts?a=b"), "https://deno.land/std/path");
+ * assertEquals(dirname("https://deno.land/std/path/mod.ts#header"), "https://deno.land/std/path");
+ * ```
+ *
+ * @param path The path to get the directory from.
+ * @returns The directory path.
+ */ function dirname(path) {
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ assertArg$2(path);
+ let end = -1;
+ let matchedNonSeparator = false;
+ for(let i = path.length - 1; i >= 1; --i){
+ if (isPosixPathSeparator(path.charCodeAt(i))) {
+ if (matchedNonSeparator) {
+ end = i;
+ break;
+ }
+ } else {
+ matchedNonSeparator = true;
+ }
+ }
+ // No matches. Fallback based on provided path:
+ //
+ // - leading slashes paths
+ // "/foo" => "/"
+ // "///foo" => "/"
+ // - no slash path
+ // "foo" => "."
+ if (end === -1) {
+ return isPosixPathSeparator(path.charCodeAt(0)) ? "/" : ".";
+ }
+ return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return the extension of the `path` with leading period.
+ *
+ * @example Usage
+ * ```ts
+ * import { extname } from "@std/path/posix/extname";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(extname("/home/user/Documents/file.ts"), ".ts");
+ * assertEquals(extname("/home/user/Documents/"), "");
+ * assertEquals(extname("/home/user/Documents/image.png"), ".png");
+ * assertEquals(extname(new URL("file:///home/user/Documents/file.ts")), ".ts");
+ * assertEquals(extname(new URL("file:///home/user/Documents/file.ts?a=b")), ".ts");
+ * assertEquals(extname(new URL("file:///home/user/Documents/file.ts#header")), ".ts");
+ * ```
+ *
+ * @example Working with URLs
+ *
+ * Note: This function doesn't automatically strip hash and query parts from
+ * URLs. If your URL contains a hash or query, remove them before passing the
+ * URL to the function. This can be done by passing the URL to `new URL(url)`,
+ * and setting the `hash` and `search` properties to empty strings.
+ *
+ * ```ts
+ * import { extname } from "@std/path/posix/extname";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(extname("https://deno.land/std/path/mod.ts"), ".ts");
+ * assertEquals(extname("https://deno.land/std/path/mod.ts?a=b"), ".ts?a=b");
+ * assertEquals(extname("https://deno.land/std/path/mod.ts#header"), ".ts#header");
+ * ```
+ *
+ * @param path The path to get the extension from.
+ * @returns The extension (ex. for `file.ts` returns `.ts`).
+ */ function extname(path) {
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ assertPath(path);
+ let startDot = -1;
+ let startPart = 0;
+ let end = -1;
+ let matchedSlash = true;
+ // Track the state of characters (if any) we see before our first dot and
+ // after any path separator we find
+ let preDotState = 0;
+ for(let i = path.length - 1; i >= 0; --i){
+ const code = path.charCodeAt(i);
+ if (isPosixPathSeparator(code)) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ startPart = i + 1;
+ break;
+ }
+ continue;
+ }
+ if (end === -1) {
+ // We saw the first non-path separator, mark this as the end of our
+ // extension
+ matchedSlash = false;
+ end = i + 1;
+ }
+ if (code === CHAR_DOT) {
+ // If this is our first dot, mark it as the start of our extension
+ if (startDot === -1) startDot = i;
+ else if (preDotState !== 1) preDotState = 1;
+ } else if (startDot !== -1) {
+ // We saw a non-dot and non-path separator before our dot, so we should
+ // have a good chance at having a non-empty extension
+ preDotState = -1;
+ }
+ }
+ if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
+ preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
+ preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
+ return "";
+ }
+ return path.slice(startDot, end);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function _format(sep, pathObject) {
+ const dir = pathObject.dir || pathObject.root;
+ const base = pathObject.base || (pathObject.name ?? "") + (pathObject.ext ?? "");
+ if (!dir) return base;
+ if (base === sep) return dir;
+ if (dir === pathObject.root) return dir + base;
+ return dir + sep + base;
+}
+function assertArg$1(pathObject) {
+ if (pathObject === null || typeof pathObject !== "object") {
+ throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof pathObject}"`);
+ }
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Generate a path from `ParsedPath` object.
+ *
+ * @example Usage
+ * ```ts
+ * import { format } from "@std/path/posix/format";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const path = format({
+ * root: "/",
+ * dir: "/path/dir",
+ * base: "file.txt",
+ * ext: ".txt",
+ * name: "file"
+ * });
+ * assertEquals(path, "/path/dir/file.txt");
+ * ```
+ *
+ * @param pathObject The path object to format.
+ * @returns The formatted path.
+ */ function format(pathObject) {
+ assertArg$1(pathObject);
+ return _format("/", pathObject);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Verifies whether provided path is absolute.
+ *
+ * @example Usage
+ * ```ts
+ * import { isAbsolute } from "@std/path/posix/is-absolute";
+ * import { assert, assertFalse } from "@std/assert";
+ *
+ * assert(isAbsolute("/home/user/Documents/"));
+ * assertFalse(isAbsolute("home/user/Documents/"));
+ * ```
+ *
+ * @param path The path to verify.
+ * @returns Whether the path is absolute.
+ */ function isAbsolute(path) {
+ assertPath(path);
+ return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0));
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function assertArg(path) {
+ assertPath(path);
+ if (path.length === 0) return ".";
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+// Ported from https://github.com/browserify/path-browserify/
+// This module is browser compatible.
+// Resolves . and .. elements in a path with directory names
+function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
+ let res = "";
+ let lastSegmentLength = 0;
+ let lastSlash = -1;
+ let dots = 0;
+ let code;
+ for(let i = 0; i <= path.length; ++i){
+ if (i < path.length) code = path.charCodeAt(i);
+ else if (isPathSeparator(code)) break;
+ else code = CHAR_FORWARD_SLASH;
+ if (isPathSeparator(code)) {
+ if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) {
+ if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== CHAR_DOT || res.charCodeAt(res.length - 2) !== CHAR_DOT) {
+ if (res.length > 2) {
+ const lastSlashIndex = res.lastIndexOf(separator);
+ if (lastSlashIndex === -1) {
+ res = "";
+ lastSegmentLength = 0;
+ } else {
+ res = res.slice(0, lastSlashIndex);
+ lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);
+ }
+ lastSlash = i;
+ dots = 0;
+ continue;
+ } else if (res.length === 2 || res.length === 1) {
+ res = "";
+ lastSegmentLength = 0;
+ lastSlash = i;
+ dots = 0;
+ continue;
+ }
+ }
+ if (allowAboveRoot) {
+ if (res.length > 0) res += `${separator}..`;
+ else res = "..";
+ lastSegmentLength = 2;
+ }
+ } else {
+ if (res.length > 0) res += separator + path.slice(lastSlash + 1, i);
+ else res = path.slice(lastSlash + 1, i);
+ lastSegmentLength = i - lastSlash - 1;
+ }
+ lastSlash = i;
+ dots = 0;
+ } else if (code === CHAR_DOT && dots !== -1) {
+ ++dots;
+ } else {
+ dots = -1;
+ }
+ }
+ return res;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
+ * Note that resolving these segments does not necessarily mean that all will be eliminated.
+ * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
+ *
+ * @example Usage
+ * ```ts
+ * import { normalize } from "@std/path/posix/normalize";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(normalize("/foo/bar//baz/asdf/quux/.."), "/foo/bar/baz/asdf");
+ * assertEquals(normalize(new URL("file:///foo/bar//baz/asdf/quux/..")), "/foo/bar/baz/asdf/");
+ * ```
+ *
+ * @example Working with URLs
+ *
+ * Note: This function will remove the double slashes from a URL's scheme.
+ * Hence, do not pass a full URL to this function. Instead, pass the pathname of
+ * the URL.
+ *
+ * ```ts
+ * import { normalize } from "@std/path/posix/normalize";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const url = new URL("https://deno.land");
+ * url.pathname = normalize("//std//assert//.//mod.ts");
+ * assertEquals(url.href, "https://deno.land/std/assert/mod.ts");
+ *
+ * url.pathname = normalize("std/assert/../async/retry.ts");
+ * assertEquals(url.href, "https://deno.land/std/async/retry.ts");
+ * ```
+ *
+ * @param path The path to normalize.
+ * @returns The normalized path.
+ */ function normalize(path) {
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ assertArg(path);
+ const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
+ const trailingSeparator = isPosixPathSeparator(path.charCodeAt(path.length - 1));
+ // Normalize the path
+ path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator);
+ if (path.length === 0 && !isAbsolute) path = ".";
+ if (path.length > 0 && trailingSeparator) path += "/";
+ if (isAbsolute) return `/${path}`;
+ return path;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
+ *
+ * @example Usage
+ * ```ts
+ * import { join } from "@std/path/posix/join";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(join("/foo", "bar", "baz/asdf", "quux", ".."), "/foo/bar/baz/asdf");
+ * assertEquals(join(new URL("file:///foo"), "bar", "baz/asdf", "quux", ".."), "/foo/bar/baz/asdf");
+ * ```
+ *
+ * @example Working with URLs
+ * ```ts
+ * import { join } from "@std/path/posix/join";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const url = new URL("https://deno.land");
+ * url.pathname = join("std", "path", "mod.ts");
+ * assertEquals(url.href, "https://deno.land/std/path/mod.ts");
+ *
+ * url.pathname = join("//std", "path/", "/mod.ts");
+ * assertEquals(url.href, "https://deno.land/std/path/mod.ts");
+ * ```
+ *
+ * @param path The path to join. This can be string or file URL.
+ * @param paths The paths to join.
+ * @returns The joined path.
+ */ function join(path, ...paths) {
+ if (path === undefined) return ".";
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ paths = path ? [
+ path,
+ ...paths
+ ] : paths;
+ paths.forEach((path)=>assertPath(path));
+ const joined = paths.filter((path)=>path.length > 0).join("/");
+ return joined === "" ? "." : normalize(joined);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return a `ParsedPath` object of the `path`.
+ *
+ * @example Usage
+ * ```ts
+ * import { parse } from "@std/path/posix/parse";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const path = parse("/home/user/file.txt");
+ * assertEquals(path, {
+ * root: "/",
+ * dir: "/home/user",
+ * base: "file.txt",
+ * ext: ".txt",
+ * name: "file"
+ * });
+ * ```
+ *
+ * @param path The path to parse.
+ * @returns The parsed path object.
+ */ function parse(path) {
+ assertPath(path);
+ const ret = {
+ root: "",
+ dir: "",
+ base: "",
+ ext: "",
+ name: ""
+ };
+ if (path.length === 0) return ret;
+ const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
+ let start;
+ if (isAbsolute) {
+ ret.root = "/";
+ start = 1;
+ } else {
+ start = 0;
+ }
+ let startDot = -1;
+ let startPart = 0;
+ let end = -1;
+ let matchedSlash = true;
+ let i = path.length - 1;
+ // Track the state of characters (if any) we see before our first dot and
+ // after any path separator we find
+ let preDotState = 0;
+ // Get non-dir info
+ for(; i >= start; --i){
+ const code = path.charCodeAt(i);
+ if (isPosixPathSeparator(code)) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ startPart = i + 1;
+ break;
+ }
+ continue;
+ }
+ if (end === -1) {
+ // We saw the first non-path separator, mark this as the end of our
+ // extension
+ matchedSlash = false;
+ end = i + 1;
+ }
+ if (code === CHAR_DOT) {
+ // If this is our first dot, mark it as the start of our extension
+ if (startDot === -1) startDot = i;
+ else if (preDotState !== 1) preDotState = 1;
+ } else if (startDot !== -1) {
+ // We saw a non-dot and non-path separator before our dot, so we should
+ // have a good chance at having a non-empty extension
+ preDotState = -1;
+ }
+ }
+ if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
+ preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
+ preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
+ if (end !== -1) {
+ if (startPart === 0 && isAbsolute) {
+ ret.base = ret.name = path.slice(1, end);
+ } else {
+ ret.base = ret.name = path.slice(startPart, end);
+ }
+ }
+ // Fallback to '/' in case there is no basename
+ ret.base = ret.base || "/";
+ } else {
+ if (startPart === 0 && isAbsolute) {
+ ret.name = path.slice(1, startDot);
+ ret.base = path.slice(1, end);
+ } else {
+ ret.name = path.slice(startPart, startDot);
+ ret.base = path.slice(startPart, end);
+ }
+ ret.ext = path.slice(startDot, end);
+ }
+ if (startPart > 0) {
+ ret.dir = stripTrailingSeparators(path.slice(0, startPart - 1), isPosixPathSeparator);
+ } else if (isAbsolute) ret.dir = "/";
+ return ret;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Resolves path segments into a `path`.
+ *
+ * @example Usage
+ * ```ts
+ * import { resolve } from "@std/path/posix/resolve";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const path = resolve("/foo", "bar", "baz/asdf", "quux", "..");
+ * assertEquals(path, "/foo/bar/baz/asdf");
+ * ```
+ *
+ * @param pathSegments The path segments to resolve.
+ * @returns The resolved path.
+ */ function resolve(...pathSegments) {
+ let resolvedPath = "";
+ let resolvedAbsolute = false;
+ for(let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--){
+ let path;
+ if (i >= 0) path = pathSegments[i];
+ else {
+ // deno-lint-ignore no-explicit-any
+ const { Deno } = globalThis;
+ if (typeof Deno?.cwd !== "function") {
+ throw new TypeError("Resolved a relative path without a current working directory (CWD)");
+ }
+ path = Deno.cwd();
+ }
+ assertPath(path);
+ // Skip empty entries
+ if (path.length === 0) {
+ continue;
+ }
+ resolvedPath = `${path}/${resolvedPath}`;
+ resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0));
+ }
+ // At this point the path should be resolved to a full absolute path, but
+ // handle relative paths to be safe (might happen when Deno.cwd() fails)
+ // Normalize the path
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
+ if (resolvedAbsolute) {
+ if (resolvedPath.length > 0) return `/${resolvedPath}`;
+ else return "/";
+ } else if (resolvedPath.length > 0) return resolvedPath;
+ else return ".";
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function assertArgs(from, to) {
+ assertPath(from);
+ assertPath(to);
+ if (from === to) return "";
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return the relative path from `from` to `to` based on current working directory.
+ *
+ * If `from` and `to` are the same, return an empty string.
+ *
+ * @example Usage
+ * ```ts
+ * import { relative } from "@std/path/posix/relative";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const path = relative("/data/orandea/test/aaa", "/data/orandea/impl/bbb");
+ * assertEquals(path, "../../impl/bbb");
+ * ```
+ *
+ * @param from The path to start from.
+ * @param to The path to reach.
+ * @returns The relative path.
+ */ function relative(from, to) {
+ assertArgs(from, to);
+ from = resolve(from);
+ to = resolve(to);
+ if (from === to) return "";
+ // Trim any leading backslashes
+ let fromStart = 1;
+ const fromEnd = from.length;
+ for(; fromStart < fromEnd; ++fromStart){
+ if (!isPosixPathSeparator(from.charCodeAt(fromStart))) break;
+ }
+ const fromLen = fromEnd - fromStart;
+ // Trim any leading backslashes
+ let toStart = 1;
+ const toEnd = to.length;
+ for(; toStart < toEnd; ++toStart){
+ if (!isPosixPathSeparator(to.charCodeAt(toStart))) break;
+ }
+ const toLen = toEnd - toStart;
+ // Compare paths to find the longest common path from root
+ const length = fromLen < toLen ? fromLen : toLen;
+ let lastCommonSep = -1;
+ let i = 0;
+ for(; i <= length; ++i){
+ if (i === length) {
+ if (toLen > length) {
+ if (isPosixPathSeparator(to.charCodeAt(toStart + i))) {
+ // We get here if `from` is the exact base path for `to`.
+ // For example: from='/foo/bar'; to='/foo/bar/baz'
+ return to.slice(toStart + i + 1);
+ } else if (i === 0) {
+ // We get here if `from` is the root
+ // For example: from='/'; to='/foo'
+ return to.slice(toStart + i);
+ }
+ } else if (fromLen > length) {
+ if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) {
+ // We get here if `to` is the exact base path for `from`.
+ // For example: from='/foo/bar/baz'; to='/foo/bar'
+ lastCommonSep = i;
+ } else if (i === 0) {
+ // We get here if `to` is the root.
+ // For example: from='/foo'; to='/'
+ lastCommonSep = 0;
+ }
+ }
+ break;
+ }
+ const fromCode = from.charCodeAt(fromStart + i);
+ const toCode = to.charCodeAt(toStart + i);
+ if (fromCode !== toCode) break;
+ else if (isPosixPathSeparator(fromCode)) lastCommonSep = i;
+ }
+ let out = "";
+ // Generate the relative path based on the path difference between `to`
+ // and `from`
+ for(i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i){
+ if (i === fromEnd || isPosixPathSeparator(from.charCodeAt(i))) {
+ if (out.length === 0) out += "..";
+ else out += "/..";
+ }
+ }
+ // Lastly, append the rest of the destination (`to`) path that comes after
+ // the common path parts
+ if (out.length > 0) return out + to.slice(toStart + lastCommonSep);
+ else {
+ toStart += lastCommonSep;
+ if (isPosixPathSeparator(to.charCodeAt(toStart))) ++toStart;
+ return to.slice(toStart);
+ }
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+const WHITESPACE_ENCODINGS = {
+ "\u0009": "%09",
+ "\u000A": "%0A",
+ "\u000B": "%0B",
+ "\u000C": "%0C",
+ "\u000D": "%0D",
+ "\u0020": "%20"
+};
+function encodeWhitespace(string) {
+ return string.replaceAll(/[\s]/g, (c)=>{
+ return WHITESPACE_ENCODINGS[c] ?? c;
+ });
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Converts a path string to a file URL.
+ *
+ * @example Usage
+ * ```ts
+ * import { toFileUrl } from "@std/path/posix/to-file-url";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(toFileUrl("/home/foo"), new URL("file:///home/foo"));
+ * assertEquals(toFileUrl("/home/foo bar"), new URL("file:///home/foo%20bar"));
+ * ```
+ *
+ * @param path The path to convert.
+ * @returns The file URL.
+ */ function toFileUrl(path) {
+ if (!isAbsolute(path)) {
+ throw new TypeError(`Path must be absolute: received "${path}"`);
+ }
+ const url = new URL("file:///");
+ url.pathname = encodeWhitespace(path.replace(/%/g, "%25").replace(/\\/g, "%5C"));
+ return url;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Converts a path to a namespaced path. This function returns the path as is on posix.
+ *
+ * @example Usage
+ * ```ts
+ * import { toNamespacedPath } from "@std/path/posix/to-namespaced-path";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(toNamespacedPath("/home/foo"), "/home/foo");
+ * ```
+ *
+ * @param path The path.
+ * @returns The namespaced path.
+ */ function toNamespacedPath(path) {
+ // Non-op on posix systems
+ return path;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function common$1(paths, sep) {
+ const [first = "", ...remaining] = paths;
+ const parts = first.split(sep);
+ let endOfPrefix = parts.length;
+ let append = "";
+ for (const path of remaining){
+ const compare = path.split(sep);
+ if (compare.length <= endOfPrefix) {
+ endOfPrefix = compare.length;
+ append = "";
+ }
+ for(let i = 0; i < endOfPrefix; i++){
+ if (compare[i] !== parts[i]) {
+ endOfPrefix = i;
+ append = i === 0 ? "" : sep;
+ break;
+ }
+ }
+ }
+ return parts.slice(0, endOfPrefix).join(sep) + append;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/** Determines the common path from a set of paths for POSIX systems.
+ *
+ * @example Usage
+ * ```ts
+ * import { common } from "@std/path/posix/common";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const path = common([
+ * "./deno/std/path/mod.ts",
+ * "./deno/std/fs/mod.ts",
+ * ]);
+ * assertEquals(path, "./deno/std/");
+ * ```
+ *
+ * @param paths The paths to compare.
+ * @returns The common path.
+ */ function common(paths) {
+ return common$1(paths, SEPARATOR);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Options for {@linkcode globToRegExp}, {@linkcode joinGlobs},
+ * {@linkcode normalizeGlob} and {@linkcode expandGlob}.
+ */ const REG_EXP_ESCAPE_CHARS = [
+ "!",
+ "$",
+ "(",
+ ")",
+ "*",
+ "+",
+ ".",
+ "=",
+ "?",
+ "[",
+ "\\",
+ "^",
+ "{",
+ "|"
+];
+const RANGE_ESCAPE_CHARS = [
+ "-",
+ "\\",
+ "]"
+];
+function _globToRegExp(c, glob, { extended = true, globstar: globstarOption = true, // os = osType,
+caseInsensitive = false } = {}) {
+ if (glob === "") {
+ return /(?!)/;
+ }
+ // Remove trailing separators.
+ let newLength = glob.length;
+ for(; newLength > 1 && c.seps.includes(glob[newLength - 1]); newLength--);
+ glob = glob.slice(0, newLength);
+ let regExpString = "";
+ // Terminates correctly. Trust that `j` is incremented every iteration.
+ for(let j = 0; j < glob.length;){
+ let segment = "";
+ const groupStack = [];
+ let inRange = false;
+ let inEscape = false;
+ let endsWithSep = false;
+ let i = j;
+ // Terminates with `i` at the non-inclusive end of the current segment.
+ for(; i < glob.length && !(c.seps.includes(glob[i]) && groupStack.length === 0); i++){
+ if (inEscape) {
+ inEscape = false;
+ const escapeChars = inRange ? RANGE_ESCAPE_CHARS : REG_EXP_ESCAPE_CHARS;
+ segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i];
+ continue;
+ }
+ if (glob[i] === c.escapePrefix) {
+ inEscape = true;
+ continue;
+ }
+ if (glob[i] === "[") {
+ if (!inRange) {
+ inRange = true;
+ segment += "[";
+ if (glob[i + 1] === "!") {
+ i++;
+ segment += "^";
+ } else if (glob[i + 1] === "^") {
+ i++;
+ segment += "\\^";
+ }
+ continue;
+ } else if (glob[i + 1] === ":") {
+ let k = i + 1;
+ let value = "";
+ while(glob[k + 1] !== undefined && glob[k + 1] !== ":"){
+ value += glob[k + 1];
+ k++;
+ }
+ if (glob[k + 1] === ":" && glob[k + 2] === "]") {
+ i = k + 2;
+ if (value === "alnum") segment += "\\dA-Za-z";
+ else if (value === "alpha") segment += "A-Za-z";
+ else if (value === "ascii") segment += "\x00-\x7F";
+ else if (value === "blank") segment += "\t ";
+ else if (value === "cntrl") segment += "\x00-\x1F\x7F";
+ else if (value === "digit") segment += "\\d";
+ else if (value === "graph") segment += "\x21-\x7E";
+ else if (value === "lower") segment += "a-z";
+ else if (value === "print") segment += "\x20-\x7E";
+ else if (value === "punct") {
+ segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~";
+ } else if (value === "space") segment += "\\s\v";
+ else if (value === "upper") segment += "A-Z";
+ else if (value === "word") segment += "\\w";
+ else if (value === "xdigit") segment += "\\dA-Fa-f";
+ continue;
+ }
+ }
+ }
+ if (glob[i] === "]" && inRange) {
+ inRange = false;
+ segment += "]";
+ continue;
+ }
+ if (inRange) {
+ segment += glob[i];
+ continue;
+ }
+ if (glob[i] === ")" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") {
+ segment += ")";
+ const type = groupStack.pop();
+ if (type === "!") {
+ segment += c.wildcard;
+ } else if (type !== "@") {
+ segment += type;
+ }
+ continue;
+ }
+ if (glob[i] === "|" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") {
+ segment += "|";
+ continue;
+ }
+ if (glob[i] === "+" && extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("+");
+ segment += "(?:";
+ continue;
+ }
+ if (glob[i] === "@" && extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("@");
+ segment += "(?:";
+ continue;
+ }
+ if (glob[i] === "?") {
+ if (extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("?");
+ segment += "(?:";
+ } else {
+ segment += ".";
+ }
+ continue;
+ }
+ if (glob[i] === "!" && extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("!");
+ segment += "(?!";
+ continue;
+ }
+ if (glob[i] === "{") {
+ groupStack.push("BRACE");
+ segment += "(?:";
+ continue;
+ }
+ if (glob[i] === "}" && groupStack[groupStack.length - 1] === "BRACE") {
+ groupStack.pop();
+ segment += ")";
+ continue;
+ }
+ if (glob[i] === "," && groupStack[groupStack.length - 1] === "BRACE") {
+ segment += "|";
+ continue;
+ }
+ if (glob[i] === "*") {
+ if (extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("*");
+ segment += "(?:";
+ } else {
+ const prevChar = glob[i - 1];
+ let numStars = 1;
+ while(glob[i + 1] === "*"){
+ i++;
+ numStars++;
+ }
+ const nextChar = glob[i + 1];
+ if (globstarOption && numStars === 2 && [
+ ...c.seps,
+ undefined
+ ].includes(prevChar) && [
+ ...c.seps,
+ undefined
+ ].includes(nextChar)) {
+ segment += c.globstar;
+ endsWithSep = true;
+ } else {
+ segment += c.wildcard;
+ }
+ }
+ continue;
+ }
+ segment += REG_EXP_ESCAPE_CHARS.includes(glob[i]) ? `\\${glob[i]}` : glob[i];
+ }
+ // Check for unclosed groups or a dangling backslash.
+ if (groupStack.length > 0 || inRange || inEscape) {
+ // Parse failure. Take all characters from this segment literally.
+ segment = "";
+ for (const c of glob.slice(j, i)){
+ segment += REG_EXP_ESCAPE_CHARS.includes(c) ? `\\${c}` : c;
+ endsWithSep = false;
+ }
+ }
+ regExpString += segment;
+ if (!endsWithSep) {
+ regExpString += i < glob.length ? c.sep : c.sepMaybe;
+ endsWithSep = true;
+ }
+ // Terminates with `i` at the start of the next segment.
+ while(c.seps.includes(glob[i]))i++;
+ j = i;
+ }
+ regExpString = `^${regExpString}$`;
+ return new RegExp(regExpString, caseInsensitive ? "i" : "");
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+const constants = {
+ sep: "/+",
+ sepMaybe: "/*",
+ seps: [
+ "/"
+ ],
+ globstar: "(?:[^/]*(?:/|$)+)*",
+ wildcard: "[^/]*",
+ escapePrefix: "\\"
+};
+/** Convert a glob string to a regular expression.
+ *
+ * Tries to match bash glob expansion as closely as possible.
+ *
+ * Basic glob syntax:
+ * - `*` - Matches everything without leaving the path segment.
+ * - `?` - Matches any single character.
+ * - `{foo,bar}` - Matches `foo` or `bar`.
+ * - `[abcd]` - Matches `a`, `b`, `c` or `d`.
+ * - `[a-d]` - Matches `a`, `b`, `c` or `d`.
+ * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`.
+ * - `[[::]]` - Matches any character belonging to ``.
+ * - `[[:alnum:]]` - Matches any digit or letter.
+ * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`.
+ * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes
+ * for a complete list of supported character classes.
+ * - `\` - Escapes the next character for an `os` other than `"windows"`.
+ * - \` - Escapes the next character for `os` set to `"windows"`.
+ * - `/` - Path separator.
+ * - `\` - Additional path separator only for `os` set to `"windows"`.
+ *
+ * Extended syntax:
+ * - Requires `{ extended: true }`.
+ * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`.
+ * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same.
+ * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`.
+ * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`.
+ * - `!(foo|bar)` - Matches anything other than `{foo,bar}`.
+ * - See https://www.linuxjournal.com/content/bash-extended-globbing.
+ *
+ * Globstar syntax:
+ * - Requires `{ globstar: true }`.
+ * - `**` - Matches any number of any path segments.
+ * - Must comprise its entire path segment in the provided glob.
+ * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option.
+ *
+ * Note the following properties:
+ * - The generated `RegExp` is anchored at both start and end.
+ * - Repeating and trailing separators are tolerated. Trailing separators in the
+ * provided glob have no meaning and are discarded.
+ * - Absolute globs will only match absolute paths, etc.
+ * - Empty globs will match nothing.
+ * - Any special glob syntax must be contained to one path segment. For example,
+ * `?(foo|bar/baz)` is invalid. The separator will take precedence and the
+ * first segment ends with an unclosed group.
+ * - If a path segment ends with unclosed groups or a dangling escape prefix, a
+ * parse error has occurred. Every character for that segment is taken
+ * literally in this event.
+ *
+ * Limitations:
+ * - A negative group like `!(foo|bar)` will wrongly be converted to a negative
+ * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly
+ * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively,
+ * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if
+ * the group occurs not nested at the end of the segment.
+ *
+ * @example Usage
+ * ```ts
+ * import { globToRegExp } from "@std/path/posix/glob-to-regexp";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(globToRegExp("*.js"), /^[^/]*\.js\/*$/);
+ * ```
+ *
+ * @param glob Glob string to convert.
+ * @param options Conversion options.
+ * @returns The regular expression equivalent to the glob.
+ */ function globToRegExp(glob, options = {}) {
+ return _globToRegExp(constants, glob, options);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Test whether the given string is a glob.
+ *
+ * @example Usage
+ * ```ts
+ * import { isGlob } from "@std/path/is-glob";
+ * import { assert } from "@std/assert";
+ *
+ * assert(!isGlob("foo/bar/../baz"));
+ * assert(isGlob("foo/*ar/../baz"));
+ * ```
+ *
+ * @param str String to test.
+ * @returns `true` if the given string is a glob, otherwise `false`
+ */ function isGlob(str) {
+ const chars = {
+ "{": "}",
+ "(": ")",
+ "[": "]"
+ };
+ const regex = /\\(.)|(^!|\*|\?|[\].+)]\?|\[[^[\\\]]+\]|\{[^{\\}]+\}|\(\?[:!=][^\\)]+\)|\([^(|]+\|[^\\)]+\)|@\([^)]+\))/;
+ if (str === "") {
+ return false;
+ }
+ let match;
+ while(match = regex.exec(str)){
+ if (match[2]) return true;
+ let idx = match.index + match[0].length;
+ // if an open bracket/brace/paren is escaped,
+ // set the index to the next closing character
+ const open = match[1];
+ const close = open ? chars[open] : null;
+ if (open && close) {
+ const n = str.indexOf(close, idx);
+ if (n !== -1) {
+ idx = n + 1;
+ }
+ }
+ str = str.slice(idx);
+ }
+ return false;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Like normalize(), but doesn't collapse "**\/.." when `globstar` is true.
+ *
+ * @example Usage
+ * ```ts
+ * import { normalizeGlob } from "@std/path/posix/normalize-glob";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const path = normalizeGlob("foo/bar/../*", { globstar: true });
+ * assertEquals(path, "foo/*");
+ * ```
+ *
+ * @param glob The glob to normalize.
+ * @param options The options to use.
+ * @returns The normalized path.
+ */ function normalizeGlob(glob, options = {}) {
+ const { globstar = false } = options;
+ if (glob.match(/\0/g)) {
+ throw new Error(`Glob contains invalid characters: "${glob}"`);
+ }
+ if (!globstar) {
+ return normalize(glob);
+ }
+ const s = SEPARATOR_PATTERN.source;
+ const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
+ return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Like join(), but doesn't collapse "**\/.." when `globstar` is true.
+ *
+ * @example Usage
+ * ```ts
+ * import { joinGlobs } from "@std/path/posix/join-globs";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const path = joinGlobs(["foo", "bar", "**"], { globstar: true });
+ * assertEquals(path, "foo/bar/**");
+ * ```
+ *
+ * @param globs The globs to join.
+ * @param options The options to use.
+ * @returns The joined path.
+ */ function joinGlobs(globs, options = {}) {
+ const { globstar = false } = options;
+ if (!globstar || globs.length === 0) {
+ return join(...globs);
+ }
+ let joined;
+ for (const glob of globs){
+ const path = glob;
+ if (path.length > 0) {
+ if (!joined) joined = path;
+ else joined += `${SEPARATOR}${path}`;
+ }
+ }
+ if (!joined) return ".";
+ return normalizeGlob(joined, {
+ globstar
+ });
+}
+
+exports.DELIMITER = DELIMITER;
+exports.SEPARATOR = SEPARATOR;
+exports.SEPARATOR_PATTERN = SEPARATOR_PATTERN;
+exports.basename = basename;
+exports.common = common;
+exports.dirname = dirname;
+exports.extname = extname;
+exports.format = format;
+exports.fromFileUrl = fromFileUrl;
+exports.globToRegExp = globToRegExp;
+exports.isAbsolute = isAbsolute;
+exports.isGlob = isGlob;
+exports.join = join;
+exports.joinGlobs = joinGlobs;
+exports.normalize = normalize;
+exports.normalizeGlob = normalizeGlob;
+exports.parse = parse;
+exports.relative = relative;
+exports.resolve = resolve;
+exports.toFileUrl = toFileUrl;
+exports.toNamespacedPath = toNamespacedPath;
diff --git a/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs
new file mode 100644
index 00000000..1501f940
--- /dev/null
+++ b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs
@@ -0,0 +1,1678 @@
+// @ts-nocheck
+'use strict';
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+function assertPath(path) {
+ if (typeof path !== "string") {
+ throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`);
+ }
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function stripSuffix(name, suffix) {
+ if (suffix.length >= name.length) {
+ return name;
+ }
+ const lenDiff = name.length - suffix.length;
+ for(let i = suffix.length - 1; i >= 0; --i){
+ if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) {
+ return name;
+ }
+ }
+ return name.slice(0, -suffix.length);
+}
+function lastPathSegment(path, isSep, start = 0) {
+ let matchedNonSeparator = false;
+ let end = path.length;
+ for(let i = path.length - 1; i >= start; --i){
+ if (isSep(path.charCodeAt(i))) {
+ if (matchedNonSeparator) {
+ start = i + 1;
+ break;
+ }
+ } else if (!matchedNonSeparator) {
+ matchedNonSeparator = true;
+ end = i + 1;
+ }
+ }
+ return path.slice(start, end);
+}
+function assertArgs$1(path, suffix) {
+ assertPath(path);
+ if (path.length === 0) return path;
+ if (typeof suffix !== "string") {
+ throw new TypeError(`Suffix must be a string, received "${JSON.stringify(suffix)}"`);
+ }
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+// Ported from https://github.com/browserify/path-browserify/
+// This module is browser compatible.
+// Alphabet chars.
+const CHAR_UPPERCASE_A = 65; /* A */
+const CHAR_LOWERCASE_A = 97; /* a */
+const CHAR_UPPERCASE_Z = 90; /* Z */
+const CHAR_LOWERCASE_Z = 122; /* z */
+// Non-alphabetic chars.
+const CHAR_DOT = 46; /* . */
+const CHAR_FORWARD_SLASH = 47; /* / */
+const CHAR_BACKWARD_SLASH = 92; /* \ */
+const CHAR_COLON = 58; /* : */
+const CHAR_QUESTION_MARK = 63; /* ? */
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+// Ported from https://github.com/browserify/path-browserify/
+// This module is browser compatible.
+function stripTrailingSeparators(segment, isSep) {
+ if (segment.length <= 1) {
+ return segment;
+ }
+ let end = segment.length;
+ for(let i = segment.length - 1; i > 0; i--){
+ if (isSep(segment.charCodeAt(i))) {
+ end = i;
+ } else {
+ break;
+ }
+ }
+ return segment.slice(0, end);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+// Ported from https://github.com/browserify/path-browserify/
+// This module is browser compatible.
+function isPosixPathSeparator(code) {
+ return code === CHAR_FORWARD_SLASH;
+}
+function isPathSeparator(code) {
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
+}
+function isWindowsDeviceRoot(code) {
+ return code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z || code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function assertArg$3(url) {
+ url = url instanceof URL ? url : new URL(url);
+ if (url.protocol !== "file:") {
+ throw new TypeError(`URL must be a file URL: received "${url.protocol}"`);
+ }
+ return url;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Converts a file URL to a path string.
+ *
+ * @example Usage
+ * ```ts
+ * import { fromFileUrl } from "@std/path/windows/from-file-url";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(fromFileUrl("file:///home/foo"), "\\home\\foo");
+ * assertEquals(fromFileUrl("file:///C:/Users/foo"), "C:\\Users\\foo");
+ * assertEquals(fromFileUrl("file://localhost/home/foo"), "\\home\\foo");
+ * ```
+ *
+ * @param url The file URL to convert.
+ * @returns The path string.
+ */ function fromFileUrl(url) {
+ url = assertArg$3(url);
+ let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
+ if (url.hostname !== "") {
+ // Note: The `URL` implementation guarantees that the drive letter and
+ // hostname are mutually exclusive. Otherwise it would not have been valid
+ // to append the hostname and path like this.
+ path = `\\\\${url.hostname}${path}`;
+ }
+ return path;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return the last portion of a `path`.
+ * Trailing directory separators are ignored, and optional suffix is removed.
+ *
+ * @example Usage
+ * ```ts
+ * import { basename } from "@std/path/windows/basename";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(basename("C:\\user\\Documents\\"), "Documents");
+ * assertEquals(basename("C:\\user\\Documents\\image.png"), "image.png");
+ * assertEquals(basename("C:\\user\\Documents\\image.png", ".png"), "image");
+ * assertEquals(basename(new URL("file:///C:/user/Documents/image.png")), "image.png");
+ * assertEquals(basename(new URL("file:///C:/user/Documents/image.png"), ".png"), "image");
+ * ```
+ *
+ * @param path The path to extract the name from.
+ * @param suffix The suffix to remove from extracted name.
+ * @returns The extracted name.
+ */ function basename(path, suffix = "") {
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ assertArgs$1(path, suffix);
+ // Check for a drive letter prefix so as not to mistake the following
+ // path separator as an extra separator at the end of the path that can be
+ // disregarded
+ let start = 0;
+ if (path.length >= 2) {
+ const drive = path.charCodeAt(0);
+ if (isWindowsDeviceRoot(drive)) {
+ if (path.charCodeAt(1) === CHAR_COLON) start = 2;
+ }
+ }
+ const lastSegment = lastPathSegment(path, isPathSeparator, start);
+ const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator);
+ return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * The character used to separate entries in the PATH environment variable.
+ */ const DELIMITER = ";";
+/**
+ * The character used to separate components of a file path.
+ */ const SEPARATOR = "\\";
+/**
+ * A regular expression that matches one or more path separators.
+ */ const SEPARATOR_PATTERN = /[\\/]+/;
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function assertArg$2(path) {
+ assertPath(path);
+ if (path.length === 0) return ".";
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return the directory path of a `path`.
+ *
+ * @example Usage
+ * ```ts
+ * import { dirname } from "@std/path/windows/dirname";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(dirname("C:\\foo\\bar\\baz.ext"), "C:\\foo\\bar");
+ * assertEquals(dirname(new URL("file:///C:/foo/bar/baz.ext")), "C:\\foo\\bar");
+ * ```
+ *
+ * @param path The path to get the directory from.
+ * @returns The directory path.
+ */ function dirname(path) {
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ assertArg$2(path);
+ const len = path.length;
+ let rootEnd = -1;
+ let end = -1;
+ let matchedSlash = true;
+ let offset = 0;
+ const code = path.charCodeAt(0);
+ // Try to match a root
+ if (len > 1) {
+ if (isPathSeparator(code)) {
+ // Possible UNC root
+ rootEnd = offset = 1;
+ if (isPathSeparator(path.charCodeAt(1))) {
+ // Matched double path separator at beginning
+ let j = 2;
+ let last = j;
+ // Match 1 or more non-path separators
+ for(; j < len; ++j){
+ if (isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j < len && j !== last) {
+ // Matched!
+ last = j;
+ // Match 1 or more path separators
+ for(; j < len; ++j){
+ if (!isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j < len && j !== last) {
+ // Matched!
+ last = j;
+ // Match 1 or more non-path separators
+ for(; j < len; ++j){
+ if (isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j === len) {
+ // We matched a UNC root only
+ return path;
+ }
+ if (j !== last) {
+ // We matched a UNC root with leftovers
+ // Offset by 1 to include the separator after the UNC root to
+ // treat it as a "normal root" on top of a (UNC) root
+ rootEnd = offset = j + 1;
+ }
+ }
+ }
+ }
+ } else if (isWindowsDeviceRoot(code)) {
+ // Possible device root
+ if (path.charCodeAt(1) === CHAR_COLON) {
+ rootEnd = offset = 2;
+ if (len > 2) {
+ if (isPathSeparator(path.charCodeAt(2))) rootEnd = offset = 3;
+ }
+ }
+ }
+ } else if (isPathSeparator(code)) {
+ // `path` contains just a path separator, exit early to avoid
+ // unnecessary work
+ return path;
+ }
+ for(let i = len - 1; i >= offset; --i){
+ if (isPathSeparator(path.charCodeAt(i))) {
+ if (!matchedSlash) {
+ end = i;
+ break;
+ }
+ } else {
+ // We saw the first non-path separator
+ matchedSlash = false;
+ }
+ }
+ if (end === -1) {
+ if (rootEnd === -1) return ".";
+ else end = rootEnd;
+ }
+ return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return the extension of the `path` with leading period.
+ *
+ * @example Usage
+ * ```ts
+ * import { extname } from "@std/path/windows/extname";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(extname("file.ts"), ".ts");
+ * assertEquals(extname(new URL("file:///C:/foo/bar/baz.ext")), ".ext");
+ * ```
+ *
+ * @param path The path to get the extension from.
+ * @returns The extension of the `path`.
+ */ function extname(path) {
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ assertPath(path);
+ let start = 0;
+ let startDot = -1;
+ let startPart = 0;
+ let end = -1;
+ let matchedSlash = true;
+ // Track the state of characters (if any) we see before our first dot and
+ // after any path separator we find
+ let preDotState = 0;
+ // Check for a drive letter prefix so as not to mistake the following
+ // path separator as an extra separator at the end of the path that can be
+ // disregarded
+ if (path.length >= 2 && path.charCodeAt(1) === CHAR_COLON && isWindowsDeviceRoot(path.charCodeAt(0))) {
+ start = startPart = 2;
+ }
+ for(let i = path.length - 1; i >= start; --i){
+ const code = path.charCodeAt(i);
+ if (isPathSeparator(code)) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ startPart = i + 1;
+ break;
+ }
+ continue;
+ }
+ if (end === -1) {
+ // We saw the first non-path separator, mark this as the end of our
+ // extension
+ matchedSlash = false;
+ end = i + 1;
+ }
+ if (code === CHAR_DOT) {
+ // If this is our first dot, mark it as the start of our extension
+ if (startDot === -1) startDot = i;
+ else if (preDotState !== 1) preDotState = 1;
+ } else if (startDot !== -1) {
+ // We saw a non-dot and non-path separator before our dot, so we should
+ // have a good chance at having a non-empty extension
+ preDotState = -1;
+ }
+ }
+ if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
+ preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
+ preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
+ return "";
+ }
+ return path.slice(startDot, end);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function _format(sep, pathObject) {
+ const dir = pathObject.dir || pathObject.root;
+ const base = pathObject.base || (pathObject.name ?? "") + (pathObject.ext ?? "");
+ if (!dir) return base;
+ if (base === sep) return dir;
+ if (dir === pathObject.root) return dir + base;
+ return dir + sep + base;
+}
+function assertArg$1(pathObject) {
+ if (pathObject === null || typeof pathObject !== "object") {
+ throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof pathObject}"`);
+ }
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Generate a path from `ParsedPath` object.
+ *
+ * @example Usage
+ * ```ts
+ * import { format } from "@std/path/windows/format";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const path = format({
+ * root: "C:\\",
+ * dir: "C:\\path\\dir",
+ * base: "file.txt",
+ * ext: ".txt",
+ * name: "file"
+ * });
+ * assertEquals(path, "C:\\path\\dir\\file.txt");
+ * ```
+ *
+ * @param pathObject The path object to format.
+ * @returns The formatted path.
+ */ function format(pathObject) {
+ assertArg$1(pathObject);
+ return _format("\\", pathObject);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Verifies whether provided path is absolute.
+ *
+ * @example Usage
+ * ```ts
+ * import { isAbsolute } from "@std/path/windows/is-absolute";
+ * import { assert, assertFalse } from "@std/assert";
+ *
+ * assert(isAbsolute("C:\\foo\\bar"));
+ * assertFalse(isAbsolute("..\\baz"));
+ * ```
+ *
+ * @param path The path to verify.
+ * @returns `true` if the path is absolute, `false` otherwise.
+ */ function isAbsolute(path) {
+ assertPath(path);
+ const len = path.length;
+ if (len === 0) return false;
+ const code = path.charCodeAt(0);
+ if (isPathSeparator(code)) {
+ return true;
+ } else if (isWindowsDeviceRoot(code)) {
+ // Possible device root
+ if (len > 2 && path.charCodeAt(1) === CHAR_COLON) {
+ if (isPathSeparator(path.charCodeAt(2))) return true;
+ }
+ }
+ return false;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function assertArg(path) {
+ assertPath(path);
+ if (path.length === 0) return ".";
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// Copyright the Browserify authors. MIT License.
+// Ported from https://github.com/browserify/path-browserify/
+// This module is browser compatible.
+// Resolves . and .. elements in a path with directory names
+function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
+ let res = "";
+ let lastSegmentLength = 0;
+ let lastSlash = -1;
+ let dots = 0;
+ let code;
+ for(let i = 0; i <= path.length; ++i){
+ if (i < path.length) code = path.charCodeAt(i);
+ else if (isPathSeparator(code)) break;
+ else code = CHAR_FORWARD_SLASH;
+ if (isPathSeparator(code)) {
+ if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) {
+ if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== CHAR_DOT || res.charCodeAt(res.length - 2) !== CHAR_DOT) {
+ if (res.length > 2) {
+ const lastSlashIndex = res.lastIndexOf(separator);
+ if (lastSlashIndex === -1) {
+ res = "";
+ lastSegmentLength = 0;
+ } else {
+ res = res.slice(0, lastSlashIndex);
+ lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);
+ }
+ lastSlash = i;
+ dots = 0;
+ continue;
+ } else if (res.length === 2 || res.length === 1) {
+ res = "";
+ lastSegmentLength = 0;
+ lastSlash = i;
+ dots = 0;
+ continue;
+ }
+ }
+ if (allowAboveRoot) {
+ if (res.length > 0) res += `${separator}..`;
+ else res = "..";
+ lastSegmentLength = 2;
+ }
+ } else {
+ if (res.length > 0) res += separator + path.slice(lastSlash + 1, i);
+ else res = path.slice(lastSlash + 1, i);
+ lastSegmentLength = i - lastSlash - 1;
+ }
+ lastSlash = i;
+ dots = 0;
+ } else if (code === CHAR_DOT && dots !== -1) {
+ ++dots;
+ } else {
+ dots = -1;
+ }
+ }
+ return res;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
+ * Note that resolving these segments does not necessarily mean that all will be eliminated.
+ * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
+ *
+ * @example Usage
+ * ```ts
+ * import { normalize } from "@std/path/windows/normalize";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(normalize("C:\\foo\\..\\bar"), "C:\\bar");
+ * assertEquals(normalize(new URL("file:///C:/foo/../bar")), "C:\\bar");
+ * ```
+ *
+ * @param path The path to normalize
+ * @returns The normalized path
+ */ function normalize(path) {
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ assertArg(path);
+ const len = path.length;
+ let rootEnd = 0;
+ let device;
+ let isAbsolute = false;
+ const code = path.charCodeAt(0);
+ // Try to match a root
+ if (len > 1) {
+ if (isPathSeparator(code)) {
+ // Possible UNC root
+ // If we started with a separator, we know we at least have an absolute
+ // path of some kind (UNC or otherwise)
+ isAbsolute = true;
+ if (isPathSeparator(path.charCodeAt(1))) {
+ // Matched double path separator at beginning
+ let j = 2;
+ let last = j;
+ // Match 1 or more non-path separators
+ for(; j < len; ++j){
+ if (isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j < len && j !== last) {
+ const firstPart = path.slice(last, j);
+ // Matched!
+ last = j;
+ // Match 1 or more path separators
+ for(; j < len; ++j){
+ if (!isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j < len && j !== last) {
+ // Matched!
+ last = j;
+ // Match 1 or more non-path separators
+ for(; j < len; ++j){
+ if (isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j === len) {
+ // We matched a UNC root only
+ // Return the normalized version of the UNC root since there
+ // is nothing left to process
+ return `\\\\${firstPart}\\${path.slice(last)}\\`;
+ } else if (j !== last) {
+ // We matched a UNC root with leftovers
+ device = `\\\\${firstPart}\\${path.slice(last, j)}`;
+ rootEnd = j;
+ }
+ }
+ }
+ } else {
+ rootEnd = 1;
+ }
+ } else if (isWindowsDeviceRoot(code)) {
+ // Possible device root
+ if (path.charCodeAt(1) === CHAR_COLON) {
+ device = path.slice(0, 2);
+ rootEnd = 2;
+ if (len > 2) {
+ if (isPathSeparator(path.charCodeAt(2))) {
+ // Treat separator following drive name as an absolute path
+ // indicator
+ isAbsolute = true;
+ rootEnd = 3;
+ }
+ }
+ }
+ }
+ } else if (isPathSeparator(code)) {
+ // `path` contains just a path separator, exit early to avoid unnecessary
+ // work
+ return "\\";
+ }
+ let tail;
+ if (rootEnd < len) {
+ tail = normalizeString(path.slice(rootEnd), !isAbsolute, "\\", isPathSeparator);
+ } else {
+ tail = "";
+ }
+ if (tail.length === 0 && !isAbsolute) tail = ".";
+ if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {
+ tail += "\\";
+ }
+ if (device === undefined) {
+ if (isAbsolute) {
+ if (tail.length > 0) return `\\${tail}`;
+ else return "\\";
+ }
+ return tail;
+ } else if (isAbsolute) {
+ if (tail.length > 0) return `${device}\\${tail}`;
+ else return `${device}\\`;
+ }
+ return device + tail;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
+ *
+ * @example Usage
+ * ```ts
+ * import { join } from "@std/path/windows/join";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(join("C:\\foo", "bar", "baz\\.."), "C:\\foo\\bar");
+ * assertEquals(join(new URL("file:///C:/foo"), "bar", "baz\\.."), "C:\\foo\\bar");
+ * ```
+ *
+ * @param path The path to join. This can be string or file URL.
+ * @param paths The paths to join.
+ * @returns The joined path.
+ */ function join(path, ...paths) {
+ if (path instanceof URL) {
+ path = fromFileUrl(path);
+ }
+ paths = path ? [
+ path,
+ ...paths
+ ] : paths;
+ paths.forEach((path)=>assertPath(path));
+ paths = paths.filter((path)=>path.length > 0);
+ if (paths.length === 0) return ".";
+ // Make sure that the joined path doesn't start with two slashes, because
+ // normalize() will mistake it for an UNC path then.
+ //
+ // This step is skipped when it is very clear that the user actually
+ // intended to point at an UNC path. This is assumed when the first
+ // non-empty string arguments starts with exactly two slashes followed by
+ // at least one more non-slash character.
+ //
+ // Note that for normalize() to treat a path as an UNC path it needs to
+ // have at least 2 components, so we don't filter for that here.
+ // This means that the user can use join to construct UNC paths from
+ // a server name and a share name; for example:
+ // path.join('//server', 'share') -> '\\\\server\\share\\'
+ let needsReplace = true;
+ let slashCount = 0;
+ const firstPart = paths[0];
+ if (isPathSeparator(firstPart.charCodeAt(0))) {
+ ++slashCount;
+ const firstLen = firstPart.length;
+ if (firstLen > 1) {
+ if (isPathSeparator(firstPart.charCodeAt(1))) {
+ ++slashCount;
+ if (firstLen > 2) {
+ if (isPathSeparator(firstPart.charCodeAt(2))) ++slashCount;
+ else {
+ // We matched a UNC path in the first part
+ needsReplace = false;
+ }
+ }
+ }
+ }
+ }
+ let joined = paths.join("\\");
+ if (needsReplace) {
+ // Find any more consecutive slashes we need to replace
+ for(; slashCount < joined.length; ++slashCount){
+ if (!isPathSeparator(joined.charCodeAt(slashCount))) break;
+ }
+ // Replace the slashes if needed
+ if (slashCount >= 2) joined = `\\${joined.slice(slashCount)}`;
+ }
+ return normalize(joined);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return a `ParsedPath` object of the `path`.
+ *
+ * @example Usage
+ * ```ts
+ * import { parse } from "@std/path/windows/parse";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const parsed = parse("C:\\foo\\bar\\baz.ext");
+ * assertEquals(parsed, {
+ * root: "C:\\",
+ * dir: "C:\\foo\\bar",
+ * base: "baz.ext",
+ * ext: ".ext",
+ * name: "baz",
+ * });
+ * ```
+ *
+ * @param path The path to parse.
+ * @returns The `ParsedPath` object.
+ */ function parse(path) {
+ assertPath(path);
+ const ret = {
+ root: "",
+ dir: "",
+ base: "",
+ ext: "",
+ name: ""
+ };
+ const len = path.length;
+ if (len === 0) return ret;
+ let rootEnd = 0;
+ let code = path.charCodeAt(0);
+ // Try to match a root
+ if (len > 1) {
+ if (isPathSeparator(code)) {
+ // Possible UNC root
+ rootEnd = 1;
+ if (isPathSeparator(path.charCodeAt(1))) {
+ // Matched double path separator at beginning
+ let j = 2;
+ let last = j;
+ // Match 1 or more non-path separators
+ for(; j < len; ++j){
+ if (isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j < len && j !== last) {
+ // Matched!
+ last = j;
+ // Match 1 or more path separators
+ for(; j < len; ++j){
+ if (!isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j < len && j !== last) {
+ // Matched!
+ last = j;
+ // Match 1 or more non-path separators
+ for(; j < len; ++j){
+ if (isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j === len) {
+ // We matched a UNC root only
+ rootEnd = j;
+ } else if (j !== last) {
+ // We matched a UNC root with leftovers
+ rootEnd = j + 1;
+ }
+ }
+ }
+ }
+ } else if (isWindowsDeviceRoot(code)) {
+ // Possible device root
+ if (path.charCodeAt(1) === CHAR_COLON) {
+ rootEnd = 2;
+ if (len > 2) {
+ if (isPathSeparator(path.charCodeAt(2))) {
+ if (len === 3) {
+ // `path` contains just a drive root, exit early to avoid
+ // unnecessary work
+ ret.root = ret.dir = path;
+ ret.base = "\\";
+ return ret;
+ }
+ rootEnd = 3;
+ }
+ } else {
+ // `path` contains just a relative drive root, exit early to avoid
+ // unnecessary work
+ ret.root = ret.dir = path;
+ return ret;
+ }
+ }
+ }
+ } else if (isPathSeparator(code)) {
+ // `path` contains just a path separator, exit early to avoid
+ // unnecessary work
+ ret.root = ret.dir = path;
+ ret.base = "\\";
+ return ret;
+ }
+ if (rootEnd > 0) ret.root = path.slice(0, rootEnd);
+ let startDot = -1;
+ let startPart = rootEnd;
+ let end = -1;
+ let matchedSlash = true;
+ let i = path.length - 1;
+ // Track the state of characters (if any) we see before our first dot and
+ // after any path separator we find
+ let preDotState = 0;
+ // Get non-dir info
+ for(; i >= rootEnd; --i){
+ code = path.charCodeAt(i);
+ if (isPathSeparator(code)) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ startPart = i + 1;
+ break;
+ }
+ continue;
+ }
+ if (end === -1) {
+ // We saw the first non-path separator, mark this as the end of our
+ // extension
+ matchedSlash = false;
+ end = i + 1;
+ }
+ if (code === CHAR_DOT) {
+ // If this is our first dot, mark it as the start of our extension
+ if (startDot === -1) startDot = i;
+ else if (preDotState !== 1) preDotState = 1;
+ } else if (startDot !== -1) {
+ // We saw a non-dot and non-path separator before our dot, so we should
+ // have a good chance at having a non-empty extension
+ preDotState = -1;
+ }
+ }
+ if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
+ preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
+ preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
+ if (end !== -1) {
+ ret.base = ret.name = path.slice(startPart, end);
+ }
+ } else {
+ ret.name = path.slice(startPart, startDot);
+ ret.base = path.slice(startPart, end);
+ ret.ext = path.slice(startDot, end);
+ }
+ // Fallback to '\' in case there is no basename
+ ret.base = ret.base || "\\";
+ // If the directory is the root, use the entire root as the `dir` including
+ // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
+ // trailing slash (`C:\abc\def` -> `C:\abc`).
+ if (startPart > 0 && startPart !== rootEnd) {
+ ret.dir = path.slice(0, startPart - 1);
+ } else ret.dir = ret.root;
+ return ret;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Resolves path segments into a `path`.
+ *
+ * @example Usage
+ * ```ts
+ * import { resolve } from "@std/path/windows/resolve";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const resolved = resolve("C:\\foo\\bar", "..\\baz");
+ * assertEquals(resolved, "C:\\foo\\baz");
+ * ```
+ *
+ * @param pathSegments The path segments to process to path
+ * @returns The resolved path
+ */ function resolve(...pathSegments) {
+ let resolvedDevice = "";
+ let resolvedTail = "";
+ let resolvedAbsolute = false;
+ for(let i = pathSegments.length - 1; i >= -1; i--){
+ let path;
+ // deno-lint-ignore no-explicit-any
+ const { Deno } = globalThis;
+ if (i >= 0) {
+ path = pathSegments[i];
+ } else if (!resolvedDevice) {
+ if (typeof Deno?.cwd !== "function") {
+ throw new TypeError("Resolved a drive-letter-less path without a current working directory (CWD)");
+ }
+ path = Deno.cwd();
+ } else {
+ if (typeof Deno?.env?.get !== "function" || typeof Deno?.cwd !== "function") {
+ throw new TypeError("Resolved a relative path without a current working directory (CWD)");
+ }
+ path = Deno.cwd();
+ // Verify that a cwd was found and that it actually points
+ // to our drive. If not, default to the drive's root.
+ if (path === undefined || path.slice(0, 3).toLowerCase() !== `${resolvedDevice.toLowerCase()}\\`) {
+ path = `${resolvedDevice}\\`;
+ }
+ }
+ assertPath(path);
+ const len = path.length;
+ // Skip empty entries
+ if (len === 0) continue;
+ let rootEnd = 0;
+ let device = "";
+ let isAbsolute = false;
+ const code = path.charCodeAt(0);
+ // Try to match a root
+ if (len > 1) {
+ if (isPathSeparator(code)) {
+ // Possible UNC root
+ // If we started with a separator, we know we at least have an
+ // absolute path of some kind (UNC or otherwise)
+ isAbsolute = true;
+ if (isPathSeparator(path.charCodeAt(1))) {
+ // Matched double path separator at beginning
+ let j = 2;
+ let last = j;
+ // Match 1 or more non-path separators
+ for(; j < len; ++j){
+ if (isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j < len && j !== last) {
+ const firstPart = path.slice(last, j);
+ // Matched!
+ last = j;
+ // Match 1 or more path separators
+ for(; j < len; ++j){
+ if (!isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j < len && j !== last) {
+ // Matched!
+ last = j;
+ // Match 1 or more non-path separators
+ for(; j < len; ++j){
+ if (isPathSeparator(path.charCodeAt(j))) break;
+ }
+ if (j === len) {
+ // We matched a UNC root only
+ device = `\\\\${firstPart}\\${path.slice(last)}`;
+ rootEnd = j;
+ } else if (j !== last) {
+ // We matched a UNC root with leftovers
+ device = `\\\\${firstPart}\\${path.slice(last, j)}`;
+ rootEnd = j;
+ }
+ }
+ }
+ } else {
+ rootEnd = 1;
+ }
+ } else if (isWindowsDeviceRoot(code)) {
+ // Possible device root
+ if (path.charCodeAt(1) === CHAR_COLON) {
+ device = path.slice(0, 2);
+ rootEnd = 2;
+ if (len > 2) {
+ if (isPathSeparator(path.charCodeAt(2))) {
+ // Treat separator following drive name as an absolute path
+ // indicator
+ isAbsolute = true;
+ rootEnd = 3;
+ }
+ }
+ }
+ }
+ } else if (isPathSeparator(code)) {
+ // `path` contains just a path separator
+ rootEnd = 1;
+ isAbsolute = true;
+ }
+ if (device.length > 0 && resolvedDevice.length > 0 && device.toLowerCase() !== resolvedDevice.toLowerCase()) {
+ continue;
+ }
+ if (resolvedDevice.length === 0 && device.length > 0) {
+ resolvedDevice = device;
+ }
+ if (!resolvedAbsolute) {
+ resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`;
+ resolvedAbsolute = isAbsolute;
+ }
+ if (resolvedAbsolute && resolvedDevice.length > 0) break;
+ }
+ // At this point the path should be resolved to a full absolute path,
+ // but handle relative paths to be safe (might happen when Deno.cwd()
+ // fails)
+ // Normalize the tail path
+ resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, "\\", isPathSeparator);
+ return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || ".";
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function assertArgs(from, to) {
+ assertPath(from);
+ assertPath(to);
+ if (from === to) return "";
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Return the relative path from `from` to `to` based on current working directory.
+ *
+ * An example in windows, for instance:
+ * from = 'C:\\orandea\\test\\aaa'
+ * to = 'C:\\orandea\\impl\\bbb'
+ * The output of the function should be: '..\\..\\impl\\bbb'
+ *
+ * @example Usage
+ * ```ts
+ * import { relative } from "@std/path/windows/relative";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const relativePath = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb");
+ * assertEquals(relativePath, "..\\..\\impl\\bbb");
+ * ```
+ *
+ * @param from The path from which to calculate the relative path
+ * @param to The path to which to calculate the relative path
+ * @returns The relative path from `from` to `to`
+ */ function relative(from, to) {
+ assertArgs(from, to);
+ const fromOrig = resolve(from);
+ const toOrig = resolve(to);
+ if (fromOrig === toOrig) return "";
+ from = fromOrig.toLowerCase();
+ to = toOrig.toLowerCase();
+ if (from === to) return "";
+ // Trim any leading backslashes
+ let fromStart = 0;
+ let fromEnd = from.length;
+ for(; fromStart < fromEnd; ++fromStart){
+ if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH) break;
+ }
+ // Trim trailing backslashes (applicable to UNC paths only)
+ for(; fromEnd - 1 > fromStart; --fromEnd){
+ if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH) break;
+ }
+ const fromLen = fromEnd - fromStart;
+ // Trim any leading backslashes
+ let toStart = 0;
+ let toEnd = to.length;
+ for(; toStart < toEnd; ++toStart){
+ if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH) break;
+ }
+ // Trim trailing backslashes (applicable to UNC paths only)
+ for(; toEnd - 1 > toStart; --toEnd){
+ if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH) break;
+ }
+ const toLen = toEnd - toStart;
+ // Compare paths to find the longest common path from root
+ const length = fromLen < toLen ? fromLen : toLen;
+ let lastCommonSep = -1;
+ let i = 0;
+ for(; i <= length; ++i){
+ if (i === length) {
+ if (toLen > length) {
+ if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {
+ // We get here if `from` is the exact base path for `to`.
+ // For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz'
+ return toOrig.slice(toStart + i + 1);
+ } else if (i === 2) {
+ // We get here if `from` is the device root.
+ // For example: from='C:\\'; to='C:\\foo'
+ return toOrig.slice(toStart + i);
+ }
+ }
+ if (fromLen > length) {
+ if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {
+ // We get here if `to` is the exact base path for `from`.
+ // For example: from='C:\\foo\\bar'; to='C:\\foo'
+ lastCommonSep = i;
+ } else if (i === 2) {
+ // We get here if `to` is the device root.
+ // For example: from='C:\\foo\\bar'; to='C:\\'
+ lastCommonSep = 3;
+ }
+ }
+ break;
+ }
+ const fromCode = from.charCodeAt(fromStart + i);
+ const toCode = to.charCodeAt(toStart + i);
+ if (fromCode !== toCode) break;
+ else if (fromCode === CHAR_BACKWARD_SLASH) lastCommonSep = i;
+ }
+ // We found a mismatch before the first common path separator was seen, so
+ // return the original `to`.
+ if (i !== length && lastCommonSep === -1) {
+ return toOrig;
+ }
+ let out = "";
+ if (lastCommonSep === -1) lastCommonSep = 0;
+ // Generate the relative path based on the path difference between `to` and
+ // `from`
+ for(i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i){
+ if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {
+ if (out.length === 0) out += "..";
+ else out += "\\..";
+ }
+ }
+ // Lastly, append the rest of the destination (`to`) path that comes after
+ // the common path parts
+ if (out.length > 0) {
+ return out + toOrig.slice(toStart + lastCommonSep, toEnd);
+ } else {
+ toStart += lastCommonSep;
+ if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) ++toStart;
+ return toOrig.slice(toStart, toEnd);
+ }
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+const WHITESPACE_ENCODINGS = {
+ "\u0009": "%09",
+ "\u000A": "%0A",
+ "\u000B": "%0B",
+ "\u000C": "%0C",
+ "\u000D": "%0D",
+ "\u0020": "%20"
+};
+function encodeWhitespace(string) {
+ return string.replaceAll(/[\s]/g, (c)=>{
+ return WHITESPACE_ENCODINGS[c] ?? c;
+ });
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Converts a path string to a file URL.
+ *
+ * @example Usage
+ * ```ts
+ * import { toFileUrl } from "@std/path/windows/to-file-url";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(toFileUrl("\\home\\foo"), new URL("file:///home/foo"));
+ * assertEquals(toFileUrl("C:\\Users\\foo"), new URL("file:///C:/Users/foo"));
+ * assertEquals(toFileUrl("\\\\127.0.0.1\\home\\foo"), new URL("file://127.0.0.1/home/foo"));
+ * ```
+ * @param path The path to convert.
+ * @returns The file URL.
+ */ function toFileUrl(path) {
+ if (!isAbsolute(path)) {
+ throw new TypeError(`Path must be absolute: received "${path}"`);
+ }
+ const [, hostname, pathname] = path.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/);
+ const url = new URL("file:///");
+ url.pathname = encodeWhitespace(pathname.replace(/%/g, "%25"));
+ if (hostname !== undefined && hostname !== "localhost") {
+ url.hostname = hostname;
+ if (!url.hostname) {
+ throw new TypeError(`Invalid hostname: "${url.hostname}"`);
+ }
+ }
+ return url;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Resolves path to a namespace path
+ *
+ * @example Usage
+ * ```ts
+ * import { toNamespacedPath } from "@std/path/windows/to-namespaced-path";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const namespaced = toNamespacedPath("C:\\foo\\bar");
+ * assertEquals(namespaced, "\\\\?\\C:\\foo\\bar");
+ * ```
+ *
+ * @param path The path to resolve to namespaced path
+ * @returns The resolved namespaced path
+ */ function toNamespacedPath(path) {
+ // Note: this will *probably* throw somewhere.
+ if (typeof path !== "string") return path;
+ if (path.length === 0) return "";
+ const resolvedPath = resolve(path);
+ if (resolvedPath.length >= 3) {
+ if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {
+ // Possible UNC root
+ if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {
+ const code = resolvedPath.charCodeAt(2);
+ if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
+ // Matched non-long UNC root, convert the path to a long UNC path
+ return `\\\\?\\UNC\\${resolvedPath.slice(2)}`;
+ }
+ }
+ } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) {
+ // Possible device root
+ if (resolvedPath.charCodeAt(1) === CHAR_COLON && resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {
+ // Matched device root, convert the path to a long UNC path
+ return `\\\\?\\${resolvedPath}`;
+ }
+ }
+ }
+ return path;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+function common$1(paths, sep) {
+ const [first = "", ...remaining] = paths;
+ const parts = first.split(sep);
+ let endOfPrefix = parts.length;
+ let append = "";
+ for (const path of remaining){
+ const compare = path.split(sep);
+ if (compare.length <= endOfPrefix) {
+ endOfPrefix = compare.length;
+ append = "";
+ }
+ for(let i = 0; i < endOfPrefix; i++){
+ if (compare[i] !== parts[i]) {
+ endOfPrefix = i;
+ append = i === 0 ? "" : sep;
+ break;
+ }
+ }
+ }
+ return parts.slice(0, endOfPrefix).join(sep) + append;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Determines the common path from a set of paths for Windows systems.
+ *
+ * @example Usage
+ * ```ts
+ * import { common } from "@std/path/windows/common";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const path = common([
+ * "C:\\foo\\bar",
+ * "C:\\foo\\baz",
+ * ]);
+ * assertEquals(path, "C:\\foo\\");
+ * ```
+ *
+ * @param paths The paths to compare.
+ * @returns The common path.
+ */ function common(paths) {
+ return common$1(paths, SEPARATOR);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Options for {@linkcode globToRegExp}, {@linkcode joinGlobs},
+ * {@linkcode normalizeGlob} and {@linkcode expandGlob}.
+ */ const REG_EXP_ESCAPE_CHARS = [
+ "!",
+ "$",
+ "(",
+ ")",
+ "*",
+ "+",
+ ".",
+ "=",
+ "?",
+ "[",
+ "\\",
+ "^",
+ "{",
+ "|"
+];
+const RANGE_ESCAPE_CHARS = [
+ "-",
+ "\\",
+ "]"
+];
+function _globToRegExp(c, glob, { extended = true, globstar: globstarOption = true, // os = osType,
+caseInsensitive = false } = {}) {
+ if (glob === "") {
+ return /(?!)/;
+ }
+ // Remove trailing separators.
+ let newLength = glob.length;
+ for(; newLength > 1 && c.seps.includes(glob[newLength - 1]); newLength--);
+ glob = glob.slice(0, newLength);
+ let regExpString = "";
+ // Terminates correctly. Trust that `j` is incremented every iteration.
+ for(let j = 0; j < glob.length;){
+ let segment = "";
+ const groupStack = [];
+ let inRange = false;
+ let inEscape = false;
+ let endsWithSep = false;
+ let i = j;
+ // Terminates with `i` at the non-inclusive end of the current segment.
+ for(; i < glob.length && !(c.seps.includes(glob[i]) && groupStack.length === 0); i++){
+ if (inEscape) {
+ inEscape = false;
+ const escapeChars = inRange ? RANGE_ESCAPE_CHARS : REG_EXP_ESCAPE_CHARS;
+ segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i];
+ continue;
+ }
+ if (glob[i] === c.escapePrefix) {
+ inEscape = true;
+ continue;
+ }
+ if (glob[i] === "[") {
+ if (!inRange) {
+ inRange = true;
+ segment += "[";
+ if (glob[i + 1] === "!") {
+ i++;
+ segment += "^";
+ } else if (glob[i + 1] === "^") {
+ i++;
+ segment += "\\^";
+ }
+ continue;
+ } else if (glob[i + 1] === ":") {
+ let k = i + 1;
+ let value = "";
+ while(glob[k + 1] !== undefined && glob[k + 1] !== ":"){
+ value += glob[k + 1];
+ k++;
+ }
+ if (glob[k + 1] === ":" && glob[k + 2] === "]") {
+ i = k + 2;
+ if (value === "alnum") segment += "\\dA-Za-z";
+ else if (value === "alpha") segment += "A-Za-z";
+ else if (value === "ascii") segment += "\x00-\x7F";
+ else if (value === "blank") segment += "\t ";
+ else if (value === "cntrl") segment += "\x00-\x1F\x7F";
+ else if (value === "digit") segment += "\\d";
+ else if (value === "graph") segment += "\x21-\x7E";
+ else if (value === "lower") segment += "a-z";
+ else if (value === "print") segment += "\x20-\x7E";
+ else if (value === "punct") {
+ segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~";
+ } else if (value === "space") segment += "\\s\v";
+ else if (value === "upper") segment += "A-Z";
+ else if (value === "word") segment += "\\w";
+ else if (value === "xdigit") segment += "\\dA-Fa-f";
+ continue;
+ }
+ }
+ }
+ if (glob[i] === "]" && inRange) {
+ inRange = false;
+ segment += "]";
+ continue;
+ }
+ if (inRange) {
+ segment += glob[i];
+ continue;
+ }
+ if (glob[i] === ")" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") {
+ segment += ")";
+ const type = groupStack.pop();
+ if (type === "!") {
+ segment += c.wildcard;
+ } else if (type !== "@") {
+ segment += type;
+ }
+ continue;
+ }
+ if (glob[i] === "|" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") {
+ segment += "|";
+ continue;
+ }
+ if (glob[i] === "+" && extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("+");
+ segment += "(?:";
+ continue;
+ }
+ if (glob[i] === "@" && extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("@");
+ segment += "(?:";
+ continue;
+ }
+ if (glob[i] === "?") {
+ if (extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("?");
+ segment += "(?:";
+ } else {
+ segment += ".";
+ }
+ continue;
+ }
+ if (glob[i] === "!" && extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("!");
+ segment += "(?!";
+ continue;
+ }
+ if (glob[i] === "{") {
+ groupStack.push("BRACE");
+ segment += "(?:";
+ continue;
+ }
+ if (glob[i] === "}" && groupStack[groupStack.length - 1] === "BRACE") {
+ groupStack.pop();
+ segment += ")";
+ continue;
+ }
+ if (glob[i] === "," && groupStack[groupStack.length - 1] === "BRACE") {
+ segment += "|";
+ continue;
+ }
+ if (glob[i] === "*") {
+ if (extended && glob[i + 1] === "(") {
+ i++;
+ groupStack.push("*");
+ segment += "(?:";
+ } else {
+ const prevChar = glob[i - 1];
+ let numStars = 1;
+ while(glob[i + 1] === "*"){
+ i++;
+ numStars++;
+ }
+ const nextChar = glob[i + 1];
+ if (globstarOption && numStars === 2 && [
+ ...c.seps,
+ undefined
+ ].includes(prevChar) && [
+ ...c.seps,
+ undefined
+ ].includes(nextChar)) {
+ segment += c.globstar;
+ endsWithSep = true;
+ } else {
+ segment += c.wildcard;
+ }
+ }
+ continue;
+ }
+ segment += REG_EXP_ESCAPE_CHARS.includes(glob[i]) ? `\\${glob[i]}` : glob[i];
+ }
+ // Check for unclosed groups or a dangling backslash.
+ if (groupStack.length > 0 || inRange || inEscape) {
+ // Parse failure. Take all characters from this segment literally.
+ segment = "";
+ for (const c of glob.slice(j, i)){
+ segment += REG_EXP_ESCAPE_CHARS.includes(c) ? `\\${c}` : c;
+ endsWithSep = false;
+ }
+ }
+ regExpString += segment;
+ if (!endsWithSep) {
+ regExpString += i < glob.length ? c.sep : c.sepMaybe;
+ endsWithSep = true;
+ }
+ // Terminates with `i` at the start of the next segment.
+ while(c.seps.includes(glob[i]))i++;
+ j = i;
+ }
+ regExpString = `^${regExpString}$`;
+ return new RegExp(regExpString, caseInsensitive ? "i" : "");
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+const constants = {
+ sep: "(?:\\\\|/)+",
+ sepMaybe: "(?:\\\\|/)*",
+ seps: [
+ "\\",
+ "/"
+ ],
+ globstar: "(?:[^\\\\/]*(?:\\\\|/|$)+)*",
+ wildcard: "[^\\\\/]*",
+ escapePrefix: "`"
+};
+/** Convert a glob string to a regular expression.
+ *
+ * Tries to match bash glob expansion as closely as possible.
+ *
+ * Basic glob syntax:
+ * - `*` - Matches everything without leaving the path segment.
+ * - `?` - Matches any single character.
+ * - `{foo,bar}` - Matches `foo` or `bar`.
+ * - `[abcd]` - Matches `a`, `b`, `c` or `d`.
+ * - `[a-d]` - Matches `a`, `b`, `c` or `d`.
+ * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`.
+ * - `[[::]]` - Matches any character belonging to ``.
+ * - `[[:alnum:]]` - Matches any digit or letter.
+ * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`.
+ * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes
+ * for a complete list of supported character classes.
+ * - `\` - Escapes the next character for an `os` other than `"windows"`.
+ * - \` - Escapes the next character for `os` set to `"windows"`.
+ * - `/` - Path separator.
+ * - `\` - Additional path separator only for `os` set to `"windows"`.
+ *
+ * Extended syntax:
+ * - Requires `{ extended: true }`.
+ * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`.
+ * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same.
+ * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`.
+ * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`.
+ * - `!(foo|bar)` - Matches anything other than `{foo,bar}`.
+ * - See https://www.linuxjournal.com/content/bash-extended-globbing.
+ *
+ * Globstar syntax:
+ * - Requires `{ globstar: true }`.
+ * - `**` - Matches any number of any path segments.
+ * - Must comprise its entire path segment in the provided glob.
+ * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option.
+ *
+ * Note the following properties:
+ * - The generated `RegExp` is anchored at both start and end.
+ * - Repeating and trailing separators are tolerated. Trailing separators in the
+ * provided glob have no meaning and are discarded.
+ * - Absolute globs will only match absolute paths, etc.
+ * - Empty globs will match nothing.
+ * - Any special glob syntax must be contained to one path segment. For example,
+ * `?(foo|bar/baz)` is invalid. The separator will take precedence and the
+ * first segment ends with an unclosed group.
+ * - If a path segment ends with unclosed groups or a dangling escape prefix, a
+ * parse error has occurred. Every character for that segment is taken
+ * literally in this event.
+ *
+ * Limitations:
+ * - A negative group like `!(foo|bar)` will wrongly be converted to a negative
+ * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly
+ * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively,
+ * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if
+ * the group occurs not nested at the end of the segment.
+ *
+ * @example Usage
+ * ```ts
+ * import { globToRegExp } from "@std/path/windows/glob-to-regexp";
+ * import { assertEquals } from "@std/assert";
+ *
+ * assertEquals(globToRegExp("*.js"), /^[^\\/]*\.js(?:\\|\/)*$/);
+ * ```
+ *
+ * @param glob Glob string to convert.
+ * @param options Conversion options.
+ * @returns The regular expression equivalent to the glob.
+ */ function globToRegExp(glob, options = {}) {
+ return _globToRegExp(constants, glob, options);
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Test whether the given string is a glob.
+ *
+ * @example Usage
+ * ```ts
+ * import { isGlob } from "@std/path/is-glob";
+ * import { assert } from "@std/assert";
+ *
+ * assert(!isGlob("foo/bar/../baz"));
+ * assert(isGlob("foo/*ar/../baz"));
+ * ```
+ *
+ * @param str String to test.
+ * @returns `true` if the given string is a glob, otherwise `false`
+ */ function isGlob(str) {
+ const chars = {
+ "{": "}",
+ "(": ")",
+ "[": "]"
+ };
+ const regex = /\\(.)|(^!|\*|\?|[\].+)]\?|\[[^[\\\]]+\]|\{[^{\\}]+\}|\(\?[:!=][^\\)]+\)|\([^(|]+\|[^\\)]+\)|@\([^)]+\))/;
+ if (str === "") {
+ return false;
+ }
+ let match;
+ while(match = regex.exec(str)){
+ if (match[2]) return true;
+ let idx = match.index + match[0].length;
+ // if an open bracket/brace/paren is escaped,
+ // set the index to the next closing character
+ const open = match[1];
+ const close = open ? chars[open] : null;
+ if (open && close) {
+ const n = str.indexOf(close, idx);
+ if (n !== -1) {
+ idx = n + 1;
+ }
+ }
+ str = str.slice(idx);
+ }
+ return false;
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Like normalize(), but doesn't collapse "**\/.." when `globstar` is true.
+ *
+ * @example Usage
+ * ```ts
+ * import { normalizeGlob } from "@std/path/windows/normalize-glob";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const normalized = normalizeGlob("**\\foo\\..\\bar", { globstar: true });
+ * assertEquals(normalized, "**\\bar");
+ * ```
+ *
+ * @param glob The glob pattern to normalize.
+ * @param options The options for glob pattern.
+ * @returns The normalized glob pattern.
+ */ function normalizeGlob(glob, options = {}) {
+ const { globstar = false } = options;
+ if (glob.match(/\0/g)) {
+ throw new Error(`Glob contains invalid characters: "${glob}"`);
+ }
+ if (!globstar) {
+ return normalize(glob);
+ }
+ const s = SEPARATOR_PATTERN.source;
+ const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
+ return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
+}
+
+// Copyright 2018-2025 the Deno authors. MIT license.
+// This module is browser compatible.
+/**
+ * Like join(), but doesn't collapse "**\/.." when `globstar` is true.
+ *
+ * @example Usage
+ *
+ * ```ts
+ * import { joinGlobs } from "@std/path/windows/join-globs";
+ * import { assertEquals } from "@std/assert";
+ *
+ * const joined = joinGlobs(["foo", "**", "bar"], { globstar: true });
+ * assertEquals(joined, "foo\\**\\bar");
+ * ```
+ *
+ * @param globs The globs to join.
+ * @param options The options for glob pattern.
+ * @returns The joined glob pattern.
+ */ function joinGlobs(globs, options = {}) {
+ const { globstar = false } = options;
+ if (!globstar || globs.length === 0) {
+ return join(...globs);
+ }
+ let joined;
+ for (const glob of globs){
+ const path = glob;
+ if (path.length > 0) {
+ if (!joined) joined = path;
+ else joined += `${SEPARATOR}${path}`;
+ }
+ }
+ if (!joined) return ".";
+ return normalizeGlob(joined, {
+ globstar
+ });
+}
+
+exports.DELIMITER = DELIMITER;
+exports.SEPARATOR = SEPARATOR;
+exports.SEPARATOR_PATTERN = SEPARATOR_PATTERN;
+exports.basename = basename;
+exports.common = common;
+exports.dirname = dirname;
+exports.extname = extname;
+exports.format = format;
+exports.fromFileUrl = fromFileUrl;
+exports.globToRegExp = globToRegExp;
+exports.isAbsolute = isAbsolute;
+exports.isGlob = isGlob;
+exports.join = join;
+exports.joinGlobs = joinGlobs;
+exports.normalize = normalize;
+exports.normalizeGlob = normalizeGlob;
+exports.parse = parse;
+exports.relative = relative;
+exports.resolve = resolve;
+exports.toFileUrl = toFileUrl;
+exports.toNamespacedPath = toNamespacedPath;
diff --git a/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/types.cts b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/types.cts
new file mode 100644
index 00000000..54ff2179
--- /dev/null
+++ b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/cjs/types.cts
@@ -0,0 +1,46 @@
+/**
+ * @fileoverview Types for the config-array package.
+ * @author Nicholas C. Zakas
+ */
+
+/**
+ * A file matcher used in `files` and `ignores`.
+ */
+export type FileMatcher = string | ((filePath: string) => boolean);
+
+/**
+ * An entry in a config's `files` array.
+ *
+ * A subarray means all matchers must match.
+ */
+export type FilesMatcher = FileMatcher | FileMatcher[];
+
+/**
+ * The config types allowed in the `extraConfigTypes` option.
+ */
+export type ExtraConfigType = "array" | "function";
+
+export interface ConfigObject {
+ /**
+ * The base path for files and ignores.
+ */
+ basePath?: string;
+
+ /**
+ * The files to include.
+ */
+ files?: FilesMatcher[];
+
+ /**
+ * The files to exclude.
+ */
+ ignores?: FileMatcher[];
+
+ /**
+ * The name of the config object.
+ */
+ name?: string;
+
+ // may also have any number of other properties
+ [key: string]: unknown;
+}
diff --git a/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/esm/index.d.ts b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/esm/index.d.ts
new file mode 100644
index 00000000..b31bed5b
--- /dev/null
+++ b/backend/node_modules/.pnpm/@eslint+config-array@0.23.5/node_modules/@eslint/config-array/dist/esm/index.d.ts
@@ -0,0 +1,151 @@
+export { ObjectSchema } from "@eslint/object-schema";
+export type PropertyDefinition = $eslintobjectschema.PropertyDefinition;
+export type ObjectDefinition = $eslintobjectschema.ObjectDefinition;
+export type ConfigObject = $typests.ConfigObject;
+export type FileMatcher = $typests.FileMatcher;
+export type FilesMatcher = $typests.FilesMatcher;
+export type ExtraConfigType = $typests.ExtraConfigType;
+export type MinimatchOptions = $minimatch.MinimatchOptions;
+export type ObjectSchemaInstance = ObjectSchema;
+/**
+ * Represents an array of config objects and provides method for working with
+ * those config objects.
+ */
+export class ConfigArray extends Array {
+ /**
+ * Creates a new instance of ConfigArray.
+ * @param {Iterable|Function|Object} configs An iterable yielding config
+ * objects, or a config function, or a config object.
+ * @param {Object} options The options for the ConfigArray.
+ * @param {string} [options.basePath="/"] The absolute path of the config file directory.
+ * Defaults to `"/"`.
+ * @param {boolean} [options.normalized=false] Flag indicating if the
+ * configs have already been normalized.
+ * @param {ObjectDefinition} [options.schema] The additional schema
+ * definitions to use for the ConfigArray schema.
+ * @param {ReadonlyArray} [options.extraConfigTypes] List of config types supported.
+ * @throws {TypeError} When the `basePath` is not a non-empty string,
+ */
+ constructor(configs: Iterable | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: {
+ basePath?: string;
+ normalized?: boolean;
+ schema?: ObjectDefinition;
+ extraConfigTypes?: ReadonlyArray;
+ });
+ /**
+ * The path of the config file that this array was loaded from.
+ * This is used to calculate filename matches.
+ * @property basePath
+ * @type {string}
+ */
+ basePath: string;
+ /**
+ * The supported config types.
+ * @type {ReadonlyArray}
+ */
+ extraConfigTypes: ReadonlyArray;
+ /**
+ * Returns the `files` globs from every config object in the array.
+ * This can be used to determine which files will be matched by a
+ * config array or to use as a glob pattern when no patterns are provided
+ * for a command line interface.
+ * @returns {Array